Digital Control: Summary # 7 Proportional, integral and derivative control where K i is controller parameter (gain). It defines the ratio of the control change to the control error. Note that e(k) 0 u(k) u(k ) (4) This means that when the error is ero, the controller output does not change. It is possible to write the k th value for the controller output as follows u() u(0) + K i e() vu(2) u(0) + K i e(2) u(0) + K i e() + K i e(2). k u(k) u(0) + K i e(j) (5) j The output of the controller is proportional to all past errors. This means that the controller takes the history into account. Fig.. Block diagram of an integral controller The proportional controller discussed previously can be used to control the steady state error and the transient. It can be also used to reduces the steady state error; however, an infinite gain is needed to drive the steady state error to ero. Proportional controller: controller output is proportional to the error. Integral controller: change of the controller output is proportional to the error. In other words, the controller output is proportional to the integral of the error. The integral effort is what drives the error to ero. It is possible to write in the s-domain: U(s) K i E(s) () E(s) s U(s) (2) K i where U(s) is the output of the controller and E(s) is the input of the controller, K i is the controller gain. Integral control law Figure shows the block diagram of the controller where e(k) is the error, i.e., the difference between input and output of the system. The error is the input signal of the controller. u(k) is the output of the controller. The integral control law can be expressed as follows: u(k) u(k ) + K i e(k) (3) Find the -domain transfer function of the proportional controller u(k) u(k ) + K i e(k) (6) U() U() + K i E() (7) U() K i E() (8) K i (9) Steady state error with integral control In order to illustrate the effect of proportional control on steady state error we consider the following example. Consider the following system: G() 0.3 (0) The steady state error to a unit step input and unity feedback (with proportional controller with gain K ) is given by: e( ) lim( ) + 0.3 () + 0.7 (2) 88 (3) Steady state error to unit step with an integral controller e( ) lim( ) + Ki ( )( 0.3) (4)
Digital Controls, spring 208 Summary 7 0.8 Step Response Amplitude 0.6 0.4 0.2 Closed loop step response with unity feedback only 0 0 0. 0.2 0.3 0.4 0.6 0.7 0.8 0.9 (sec).5 Step Response Amplitude First order system with negative a Closed loop response with integral action 0 0 0. 0.2 0.3 0.4 0.6 0.7 0.8 0.9 Time (sec) Fig. 2. Step response for the closed loop system of (0). Clearly the steady state error is ero with the integral controller Fig. 3. Block diagram with integral controller in the presence of disturbance (top) and block diagram of PI controller (bottom) e( ) lim + Ki ( )( 0.3) (5) e( ) lim ( )( 0.3) ( )( 0.3) + K i 0 (6) Thus, with integral controller, for a system of type 0 and a constant input, the steady state error is ero and does not depend on K i. This means that any value of K i that satisfies stability can be used to drive the steady state error to ero. An illustration is shown in figure 2 for system (0), where the closed loop step response with and without integral controller is shown. Steady state error due to disturbance It is possible to consider the steady state error due to a step disturbance as shown in figure 3 top. Recall that the steady state error in the -domain is expressed as E() R() + C()G() D()G() + C()G() G()D() e d ( ) lim( ) + G()C() (7) (8) For a first order system and a unit step disturbance, we can write e d ( ) lim( ) 0.3 + Ki ( 0.3)( ) 0 (9) Therefore, the steady state error to a constant disturbance for any value of K i is 0. This means you can pick any value of K i as long as the system is stable. Proportional + integral Proportional +integral controller combines the advantages of proportional controller and those of integral controller. P control: improves the transient response. I control: ero steady state error. The controller has two terms: u p (k) K p e(k) u i (k) u i (k ) + K i e(k) The PI controller adds these terms together: u(k) u p (k) + u i (k) K p e(k) + u i (k ) + K i e(k) u(k ) u p (k ) + u i (k ) K p e(k ) + u i (k ) u(k) u(k ) K p e(k) K p e(k ) + K i e(k) Thus the final form for the PI controller is or u(k) u(k ) + K p e(k) K p e(k ) + K i e(k) (20) The transfer function of the PI controller is U() E() K p + K i U() E() (K i + K p ) K p (2) (22) Equation (2) emphasies on the components of the controller and equation (22) emphasies on the eros and poles of the controller. Steady state error with PI control: e( ) lim( ) + K p+k i K p 0.3 0 (23) PI controller by pole placement One of the most traditional ways to designing PI controllers is by using pole placement techniques. Consider the 2
Digital Controls, spring 208 Summary 7 block diagram of figure 3 bottom with G() 0.3 The closed loop transfer function is given by G cl () C()G() + C()G() ((K p+k i) K p) ( )( 0.3) ( )( 0.3)+((K p+k i) K p) ( )( 0.3) (K p + K i ) K p 2.3 + 0.3 + (K p + K i ) K p The characteristic polynomial is (24) (25) (26) Q() 2.3 + 0.3 + (K p + K i ) K p (27) The modeled characteristic polynomial is Q() 2 2 cos(ω d T )e ζωnt + e 2ζωnT (28) From the desired specifications, find the desired characteristic polynomial. Solve for K p, K i : equate the coefficients of the desired polynomial and the modeled characteristic polynomial and solve for K p and K i. Verify the results: check that the closed loop poles are inside the unit circle. Let G() 0.3 (29) Design a PI controller so that: T s s, M p % 0%. Take T 0.s. First T s s ζω n 8 (30) and ζ ln(m p) π 2 + ln 2 M p 9 (3) and ω n 3.56rad/s. The desired characteristic polynomial is obtained: from which we get: Finally: Q() 2 0.4 + 0.2 (32) 0.3 K p 0.2 (33) (K p + K i ).3 0.4 (34) K p 0.2 (35) K i.58 (36) In addition to pole placement, other techniques such as graphical tools and empirical methods can be used to design PI controllers. Proportional and derivative controller Integral controllers have the ability to drive the steady state error to ero. While in proportional control, the control action is based on the current error, in integral control, the controller action is based on the previous errors. The derivative term is different where the control action is based on the rate of change of the derivative. The idea in the derivative controller is that the controller should react immediately to any change in the error. The derivative control law has the form: u d (k) K d (e(k) e(k )) (37) where K d is the derivative control gain. It defines the importance given to the rate of change of the error. From equation (37), it is clear that the derivative action cannot react to a constant error. In practice, derivative action is never alone. It is used with proportional control and sometimes with integral control. The transfer function of the derivative action is given by U d () K d (E() E()) (38) U d E () K d (39) where K d is the controller gain. Proportional + derivative The transfer function of proportional + derivative controller is given by U E () K p + K d (K p + K d ) K d (40) Proportional derivative controllers have predictive ability and can be used effectively to reduce overshoot. Proportional + derivative + integral actions Proportional-integral-derivative controllers combine three different actions, three parameters K p, K i, K d are associated each with each action. The output of the controller is u(k) u p (k) + u i (k) + u d (k) (4) k K p e(k) + K i e(i) + K d (e(k) e(k )) i0 The transfer function of a PID controller is given by U() E() K p + K i + K d (42) The block diagram of a PID controller is shown in figure 4. The controller adds two poles to the system: one at the origin and the other one at. The controller transfer function can be written as C() (K p + K i + K d ) 2 (K p + 2K d ) + K d ( ) (43) There exist different methods to design PID controllers: Pole placement methods 3
Digital Controls, spring 208 Summary 7 The closed loop characteristic polynomial is given by Q() 3 3 2 +2+3(K p +K i +K d ) 2 3(K p +2K d )+3K d (50) By equating the two polynomials, we obtain T erm P ID Desired 3 2 3(K p + K d + K i ).3 3(K p + 2K d ) + 2 6 0 3K d 0.078 (5) The table above shows a comparison between the two polynomials in terms of their coefficients. The next step is to equate the coefficients and solve for the gains. Finally, by solving we get: K p 3 K i 0.06 (52) K d 0.026 Fig. 4. Block diagram of a PID control Graphical methods such as root locus Empirical methods (powerful in practice when it is difficult to obtain an algebraic model of the system) PID control using pole placement Pole placement means we chose the poles of the closed loop system. The chosen poles translate the desired characteristics of the system. The method is very similar to the PI design algorithm discussed previously. Consider the open loop transfer function given by G() 3 2 (44) Note that the open loop system is unstable. The desired poles locations are p,2 ± j0. (45) p 3 0.3 (46) The desired characteristic polynomial is given by Q() ( p )( p 2 )( p 3 ) ( + j0.)( j0.)( 0.3)(47) 3.3 2 + 6 0.078 (48) The closed loop transfer function is given by G cl () C()G() + C()G() (49) where C() is the transfer function of the PID controller given by (43). 4
Digital Controls, spring 208 Summary 7 x2 % Initial liquid level yx % Another variable for the liquid level f.75 % Numerical value of the disturbance T. % Sampling time r5 % desired liquid level, i.e., reference Kp2 % Proportionality gain Ki % Integral gain ep0 % previous sample error for time0:t:0 % Proportional u(kp)*(r-y) % The proportional control law only Fig. 5. Tank system yy+t*(u-f) % Open loop transfer function plot(time, y, b+ ) hold on end 5.5 5 4.5 4 Reference Level 3.5 3 2.5 With PI action 2.5 With P action only 0 5 0 5 20 25 30 time(s) Fig. 6. Closed loop system response with P and PI controller This example shows a simple implementation of the P and PI controllers to control the liquid level of figure 5. The closed loop system response is shown in figure 6. Sample code (for P only) can be found below. 5