8. Modeling and Simulation

Instructions and Problems

1. Physical Device and Testing

The goal of this section is to verify that the device has been built properly and operates as expected.

  1. Demonstrate the you have a safe, working device. Provide proof (photos, screenshots, or a link to a video) that the device has been assembled and has passed each of the 4 tests.

  2. Using the default PID controller gains, plot the device’s response to a step input of 0° along with the drive signal on the same figure. What do you observe about the response and how might it be improved?

Notes: If doing the DIY option, provide proof that the device has been assembled and has passed your own tests to ensure all sensors, actuators, and logging works properly. If doing the DIY option, choose an initial guess of PID gains and plot the device’s response to a baseline reference signal that is analogous to an input of 0° for the T-RECS.

2. Dynamics Modeling

The goal of this section is to derive a mathematical model for the system that can be used to simulate the device’s response and be compared to the actual, physical response.

Notation:

Assumptions:

  • The lever arm’s mass is negligible

  1. Simplify the equation of motion by reducing it to standard form and replacing each term with a single coefficient. (That is, all the state terms on the left-hand side and the input on the right-hand side of the equation)

Note: If doing the DIY option, please provide a free body diagram and the equation(s) of motion specific to your system, if applicable. Provide as much detail as possible. Complete steps (1) and (2) above for your model.

3. Model Approximation

The goal of this section is to experimentally approximate the system’s particular model in order to overcome the nonlinearities and computationally test its response for the controller in the following section.

Note: If doing the DIY option, you must derive the coefficients for your model however you see fit. Please record the test procedure as you will need the procedure and test data for your report. Provide as much detail as possible. Answer all questions for steps (1)-(3).

4. PID Controller Tuning, Testing, and Analysis

The goal of this section is to examine different types of controllers and analyze the importance of feedback control on stabilizing the system.

4.1 Consider a Proportional Controller, or P Controller.

  1. Choose a value for the controller gain and plot the simulated response using MATLAB’s ode45 function to a commanded signal of 0°.

  2. Set the device’s gain to that value (make sure to set the integral and derivative gains to 0). Record the device’s response to a commanded signal of 0°. Plot this response on the same figure as the simulated response.

  3. Repeat Steps 2) and 3) for two different values of the controller gain.

  4. Was the system able to reach the desired signal in any of the three tests, why or why not?

  5. What, if any, differences are there between the simulated response and the actual response? What factors may have caused this?

4.2 Consider a Proportional Derivative Controller, or PD Controller.

  1. Choose a value for each of the controller gains and plot the simulated response using MATLAB’s ode45 function to a commanded signal of 0°. Continue choosing values until the response has a nicely damped response.

  2. Set the device’s gains to those values (make sure to set the integral gain to 0). Record the device’s response to a commanded signal of 0°. Plot this response on the same figure as the simulated response.

  3. Repeat Steps 2) and 3) for two different sets of controller gains, aiming to improve upon the previous responses.

  4. Was the system able to reach the desired signal in any of the three tests, why or why not?

  5. What do you observe about the transient response? (That is, the portion between rest and stabilization).

4.3 Consider a Proportional Integral Derivative Controller, or PID Controller.

  1. Choose a value for each of the controller gains and plot the simulated response using MATLAB’s ode45 function to a commanded signal of 0°. Continue choosing values until the response has a smooth, short transient region and settles with low steady state error.

  2. Choose a value for each of the controller gains and set the device’s gains to the appropriate values. Record the device’s response to a commanded signal of 0°. Plot this response on the same figure as the simulated response.

  3. Repeat Steps 2) and 3) for two different sets of controller gains, aiming to improve upon the previous responses.

  4. Was the system able to reach the desired signal in any of the three tests, why or why not?

  5. Were you able to produce a set of gains that resulted in a response with minimal overshoot, quick rise time, quick settling time, and low steady state error? Why or why not?

4.4 Step Change Test.

  1. Using the set of gains that produced the most satisfactory response, command the device to track a signal of 0°. After the device has stabilized, command it to track a signal of 15°. Record the response starting from when the device was hovering at 0°. (You do not need to plot a simulated response in MATLAB)

  2. How is this response different from that of the previous section? Why is it different?

Note: If doing the DIY option, complete the same steps as above but with a baseline reference signal analogous to the 0° input for the T-RECS. For step 4.4, you should start the system at the baseline then move to another reference signal analogous to the 15° input for the T-RECS. Answer all questions for the steps above. Please provide as much detail as possible to explain how your answers and results for this section were obtained for your system.

5. Optimal Control using LQR

The goal of this section is to expose the students to one method of optimal control theory using a Linear Quadratic Regulator (LQR). Many complex control problems require the use of optimization to determine satisfactory gains and this section serves to introduce these advanced concepts.

5.2: Begin with an identity matrix for each and use MATLAB’s lqr function to compute the optimum PD gains. Using those gains, plot the simulated and actual response to a commanded input of 0°. How did this controller compare to the gains you tested earlier?

5.4: Repeat the same procedure as in 5.2 except using the PID controller. How did this controller compare to the gains you tested earlier? Were you able to safely test the device using the computed PID gains?

Note: If doing the DIY option, complete the same steps as above but with a baseline reference signal analogous to the 0° input for the T-RECS. Answer all questions for the steps above. Please provide as much detail as possible to explain how your answers and results for this section were obtained for your system.

Extra Credit: Online Auto-Tuning of PID Controllers

The goal of this section is to provide the students with an opportunity to explore machine learning in control system applications to earn extra credit on their overall project. Many systems operate in unknown environments so it is crucial for the system to adapt in real time, or “online,” and this learning process can be incorporated into PID control.

  1. Read through the attached paper, “Online Optimal Auto-Tuning of PID Controllers for Tracking in a Special Class of Linear Systems” by M. Miranda and K. Vamvoudakis.

  2. Plan an approach to incorporating the methods introduced in the paper into your device. Briefly describe your approach as to how your device, model, and/or code will apply these methods. (This may include equations, citations from the paper, pseudocode, figures, etc.)

  3. Prepare some evidence of these methods being applied on your device. (This may include plots, tables, videos, pictures, code snippets, etc.). Briefly discuss your results and findings.

Last updated