EEL6 Control Theory CT: PID Controller Design. Objectives (i) To design proportional-integral-derivative (PID) controller for closed loop control. (ii) To evaluate the performance of different controllers based on maximum overshoot, rise time, settling time and steady-state error.. Introduction In this lab, you will learn the characteristics of the each of the proportional (P), integral (I) and derivative (D) control terms, and how to use these terms to obtain a desired response. Consider the following unity feedback system: Figure Plant: A system to be controlled Controller: Provides the excitation for the plant; designed to control the overall system behaviour The three-term PID controller The transfer function of the PID controller is K I KDs + KPs + K I GC ( KP + + KDs s s where KP proportional constant; KI integral constant; and KD derivative constant. The P term, I term and D term are given by P term: KP K I I term: s D term: KDs r e Controller u y Plant + - First, let's take a look at how the PID controller works in a closed loop system using Figure. The variable e (r y) represents the tracking error, which is the difference between the desired input value r and the actual output y. This error signal e will be sent to the PID controller, and the controller computes both the derivative and the integral of this error signal. The control signal u
produced by the controller is given by u K p e + K I e dt + K The signal u will form the input to the plant, producing the output y. The output y will be fed back (via a sensor) to allow the error signal e to be recalculated. The controller takes this new error signal and computes its derivative and its integral again. This process is continuous and goes on and on. The objective is to minimise e. In the ideal case, e 0 and y r. The characteristics of P, I and D terms A proportional controller will have the effect of reducing the rise time and will reduce, but never eliminate, the steady-state error. An integral controller will have the effect of eliminating the steady-state error, but it may make the transient response worse. A derivative controller will have the effect of increasing the stability of the system, reducing the overshoot, and improving the transient response. The general effects of increasing each of KP, KI and KD on a closed loop system are summarised in Table. CLOSED LOOP RESPONSE Table D de dt OVERSHOOT RISE TIME SETTLING TIME STEADY- STATE ERROR KP Increase Decrease Small Change Decrease KI Increase Decrease Increase Eliminate KD Decrease Small Change Decrease Small Change Note that these correlations may not be exactly accurate, because the effects of KP, KI and KD are dependent on one another. Changing one of these variables can change the effects of the other two. For this reason, Table should only be used as a reference when you are determining the values for KP, KI and KD. Time domain performance measures Maximum overshoot: Let ymax denote the maximum value of y(t) and yss be the steady-state value of y(t) and ymax yss. The maximum overshoot of y(t) is defined as Maximum overshoot ymax - yss Rise time: The rise time is defined as the time required for the step response to rise from 0% to 90% of its final value. Settling time: The settling time is defined as the time required for the step response to reach and stay within a specified percentage (5%) of its final value.
3. Example system Suppose we have a simple mass, spring, and damper system as in Figure. b x M F k Figure The physical equation of this system is M x + b x + kx F Taking the Laplace transform and assuming zero initial conditions, Ms X ( + bsx ( + kx ( F( The transfer function between the displacement X( and the input F( then becomes X ( F( Ms + bs + k Let M kg b 0 N.s/m k 0 N/m Substituting these values into the above transfer function gives X ( F( s + 0s + 0 The objective of this example is to tune KP, KI and KD to obtain a good step response with Fast rise time and settling time Minimum overshoot Zero steady-state error 3
4. Procedures 4. Open loop system (i) To view the open loop unit step response, first create a new SCE-file by clicking Editor (the icon with a picture of a pencil and paper) in the SCILAB command window. A SCILAB editor/debugger window known as SciNotes will pop up. (ii) In this window, type the following codes and save the file. s%s; num ;den (*s^ + 0*s + 0); tlinspace(0,,00); tf num/den; rsys syslin('c',tf); steprespcsim('step',t,rsy; plotd(t,stepresp); xgrid();xlabel("time (");ylabel("amplitude (m)"); Here, num denotes the numerator polynomial and den denotes the denominator polynomial. linspace, syslin, csim, plotd, xgrid, xlabel and ylabel are SCILAB functions. To find out more about these functions, type help function_name at the SCILAB command prompt. (iii) Run the SCE-file by clicking Execute Save and Execute in the SCILAB editor/debugger window. You should get the plot shown in Figure 3. Figure 3 4
If you wish to save your graph, you can click File Save and save it as an.scg file. (To open a previously saved.scg file, type figure in the command window. In the graphic window, click File Load. You are advised not to keep too many figures open at the same time.) If you wish to export it into Word, then you should click File Export To and save it as a.jpg file. You can insert this graph from Word by clicking Insert Picture and then selecting the file. (iv) Check the final value using Final Value Theorem. An example is shown in Table. Note that F( /s because the input is a step of magnitude (unit step). (v) From the response obtained, find the maximum overshoot, rise time and settling time. Complete the relevant parts in Table 3. (The steady-state error should be calculated based on Final Value Theorem.) 4. Proportional control (i) The closed loop transfer function of the above system with a proportional controller is X ( K p F( s + 0s + (0 + K ) Show the derivation of the closed loop transfer function in Table. (ii) Let the proportional constant KP equal 300 and change the SCE-file as follows. Replace num ;den (*s^ + 0*s + 0); in the original codes with Kp300;num Kp;den (*s^ + 0*s + (0+Kp)); keeping the rest of the codes unchanged. (iii) Run this SCE-file to obtain the step response plot. The plot should show that the proportional controller reduces the rise time, the settling time and the steady-state error, but increases the overshoot. (iv) Complete the relevant entries in Tables and 3. 4.3 Proportional-Derivative control (i) Derive the closed loop transfer function of the given system with a PD controller and record this in Table. (ii) Let KP equal 300 as before and let KD equal 0. Make the necessary changes to the SCE-file and run the SCE-file. (iii) Complete the relevant entries in Tables and 3. 4.4 Proportional-Integral control (i) Derive the closed loop transfer function of the given system with a PI controller and record this in Table. (ii) Reduce KP to 30, and let KI equal 70. Make the necessary changes to the SCE-file and run the SCE-file. Note that we have reduced the proportional constant because the integral term also reduces the rise time and increases the overshoot as the proportional term does (double effect). (iii) Complete the relevant entries in Tables and 3. 4.5 Proportional-Integral-Derivative control (i) Derive the closed loop transfer function of the given system with a PID controller and record this in Table. 5 p
(ii) There are several methods to choose the parameters KP, KI and KD. One of the methods is by trial and error using Table as a guide. Try at least 4 sets of values for KP, KI and KD and note the closed loop step responses. When choosing the values of KP, KI and KD, try to vary one parameter at a time, in order to see the effects of changing the parameter. Record these in Table 3. (iii) Repeat using KP 350, KI 300 and KD 50. (iv) Complete the relevant entries in Tables and 3. Table 4. Open loop Transfer function: X ( F( s + 0s + 0 lim x( t) lim sx ( t > s > 0 lim s 0 s > s s + 0s + 0 4. P control Closed loop transfer function: 0 No. of finite zeros 0 No. of poles System order No. of finite zeros No. of poles System order 4.3 PD control Closed loop transfer function: No. of finite zeros No. of poles System order 6
4.4 PI control Closed loop transfer function: No. of finite zeros No. of poles System order 4.5 PID control Closed loop transfer function: No. of finite zeros No. of poles System order Table 3 Controller KP KI KD 4. Open loop - - - 4. P 300 - - 4.3 PD 300-0 4.4 PI 30 70-4.5 PID Maximum overshoot Rise time ( Settling time ( Steadystate error 350 300 50 5. Exercises Refer to the on-the-spot assessment sheet. 7
6. Discussion In this lab, you have learned how to design a PID controller for a given system. You have also seen the effects of varying each of the P, I and D terms on the controller performance. In general, when designing a PID controller for a given system, follow the steps shown below to obtain a desired response:. Obtain an open loop response and determine what needs to be improved.. Add a proportional term to improve the rise time. 3. Add a derivative term to improve the overshoot. 4. Add an integral term to eliminate the steady-state error. 5. Adjust each of KP, KI and KD until you obtain a desired overall response. Please keep in mind that you do not need to implement all three terms (proportional, derivative and integral) into a single system. For example, if a PI controller gives a sufficiently good response (like in the above example), then you do not need to implement a derivative term in the system. Keep the controller as simple as possible. 7. Assessment. There will be an on-the-spot assessment for both CT and CT. This will contribute 5% for CT and 5% for CT.. There is no laboratory report required for CT and CT. There will be a separate lab design project which contributes another 5% to your final marks. Please check announcement on MMLS regarding this. 8