WORKSHOP 7 PID TUNING
Overview What you will learn in this section: How to linearize an Adams model and export a state-space (A, B, C, D) representation for Matlab. How to apply a step disturbance, measure the response and calculate approximate controller coefficients. Investigate PID controller weighting effects Hook up controller to full non-linear (Adams) model
Linearize a Model Find static equilibrium Linearize model and generate state-space representation (ABCD) about this operating point. Can specify input vs output quantities (state VARIABLEs) to use in the linearization. c b a
Linear State Space Representation from Adams Optionally create a Bode plot of the response in PostProcessor:
State Space Model in Controls Package Start Matlab in the working directory and import the servomxa, servomxb and all other files generated during creation of linear state matrices using Adams/View. Open the linear_controller.mdl Examine the Servo block. The parameters for A,B,C and D will be directly taken over by Servo block as shown in the next slide.
State Space Model in Controls Package (Cont.) ABCD Linearization in Adams produces A, B, C, D matrix files on disk; can be read into Controls package. Controls packages have a state-space block; can easily reference arrays in the workspace.
State Space Model in Controls Package (Cont.) Run the simulation for 10 sec. Plot the position of servo controller. zoomed
Determine Linear System Response Reference the figure below and approximate the slope (R) and delay (L) from your zoomed plot on the previous page: Determination of parameters a=RL and L from the unit step response Fill in the table: Observed System Response: L = R = a = (R*L) =
Determine PID Coefficients Open the Matlab model named linear_controller_PID.mdl. This new model contains a PID block in a closed loop with the state space block from before. Double-click the (PID Control Block ) to find the K, Ti and Td gain values. Use the table below to determine suitable parameters for a PID-type controller with parameters K, Ti and Td gain values: Regulator Type K Ti Td P 1/a - PI 0.9/a 3L PID 1.2/a 2L 0.5L
P, I, D Effects P – Effects control speed I – Effects steady state errors D – Effects controller damping
Manually Optimize PID Coefficients Modify the PID block in the model and set the recommended values for the k, Ti and Td gain values. The response should look something similar to the following plot: Can you manually adjust the gains to provide a ‘better’ response? For example, try this: K = 528 Ti = 2.1 Td = 0.025
Plant Export from Adams Now apply these gains to the co-simulation model and test the response with the fully non-linear system (the Adams co-simulation). Do this by: Switch back to the Adams/View ‘servo’ model and export the plant. Start ADAMS/View in this working directory and read the model file 'servo.cmd’. Export the controls plant from Controls >> Plant Export menu option using the settings shown in the image. Ensure that the necessary files have been generated in the working directory.
Test Controller with Adams Model Open the Simulink model file ‘cosim_controller_PID.mdl’ and import the co-simulation .m file from the previous step. Build the Adams block using ‘adams_sys’ and put the Adams block into the model:
Test Controller with Adams Model (Cont.) Set an appropriate co-sim sampling rate and run the co-simulation for 10 seconds. Do the co-simulation results look similar to the linear system results?
Observed System Response: Answers Observed System Response: L = 1.11 R = (0.01603-0.002939)/(1.336-1.11) = 0.05792 a = (R*L) = 0.0642