Time and Frequency-Domain Analysis and Design of Phase-Lead and Phase-Lag controllers (Compensators) In the previous lectures we looked at PID controllers. PID controllers are the simplest form of controllers that make use of the derivative and integration operations in control systems compensation. Root locations and root locus are typically used in the design of controllers, it would make a perfect sense to describe a compensator in terms of the pole and zero locations. A simple passive realizable controller is of the form: Gc ( s) sz s p This controller is easily realized by passive elements (resistors and a capacitor) The controller if of the high-pass filter type (phase –lead) if p > z and is of the lowpass filter type (phase –lag) if p<z Think about this – make sure it makes sense ! Phase-Lead Controller The network realization of a phase-lead controller is shown below The compensator’s transfer function is: Eout ( s ) R2 Gc ( s ) Ein ( s ) R1 R2 1 R1Cs R R 1 1 2 Cs R1 R2 Let a R1 R2 R2 a 1 And T R1R2 C R` R2 Then, the transfer function of the compensator becomes: Gc ( s ) 1 1 aTs a 1 Ts Gc ( s ) s 1 aT s 1 T a 1 (1) a 1 (2) Note: The transfer function of the phase – lead controller network has a real zero at s 1 aT s-plane is: and a real pole at s 1 T and the representation in the S-Plane pole zero 0 1 T 1 aT The zero is always to the right of the pole. This is why the phase –lead controller can improve the relative and absolute stability of a closed loop control system. Phase – Lead: Stabilize the system Increase the PM – thus reduce the overshoot Increase the gain crossover frequency – reduce the rise time. Note: we will work with equation (1) – ignore the 1/a term – it is simply gain and that is taken care of when calculating K for the system to be compensated. - For the compensator in (1): o The gain at high frequencies is approximately = 20log(a) o The gain at low frequencies is = 0dB o The lower cut-off frequency = 1/aT o The upper cut-off frequency = 1/T o The maximum phase shift of the phase lead is: a 1 a 1 max sin 1 The corresponding frequency is: max 1 T a The gain at this frequency is: 1 Gain adB 10 log a 2 The above realities are used in the design. o The Bode plot of a typical Phase –lead controller is: Let the phase lead controller be: Gc ( s) 1 5s 1 s Bode Diagram 15 Magnitude (dB) (discuss the result) 10 5 Phase (deg) 0 60 30 0 -2 10 10 -1 0 10 Frequency (rad/sec) 10 1 10 2 Let us calculate some of the values discussed above: 5 1 o 42 5 1 max sin 1 max 1 0.45 rad / sec 1 5 Design Steps: 1 – Choose the gain, K, to satisfy the steady state error requirement 2- Draw the Bode diagram of KG(s) 3- Determine the new crossover frequency (wg) – the frequency at which the system has the desired phase margin. 4- Construct a table of phase, a, and Gain (for the compensator). In some cases, you may find out that one lead compensator may not be enough. 5- calculate T from the chosen a and the new crossover frequency. 6- implement the compensator design and test the final result. 7- if o.k – done, otherwise, repeat the process. Example: For the sun seeker control system . The seeker is typically mounted on space vehicles. The purpose of the controller is that the seeker tracks the sum with high accuracy. The input is the reference angle of the solar ray r and the output is the angle of the vehicle’s axis o After some block diagram manipulations, the simplified block diagram is shown below: The design specifications are: - the steady state value of e(t) due to a unit ramp input for r (t) should be less than or equal to 0.01 rad /(rad/sec.) of the final steady state output velocity. [ The steady state error due to a unit ramp input should be less than or equal to 1% ess 0.01 due to a unit ramp input] - The peak overshoot should be less than 10% Solution: o G r 1 G E= R – Y = E RR G R 1 1 2 1 G 1 G s 1 2500 K s ( s 25) s ( s 25) s 2 s ( s 25) 2500 K Applying the final value theorem: lim ess (t ) lim sE ( s) t s 0 25 0.01 2500 K K Therefore, for a steady state error to be less than or equal to 1%, K must be greater than or equal to 1. For the worst case, when K =1, The characteristic polynomial is: s 2 25s 2500 0 Which yields the following information: n 2500, 50 rad / sec. 25 0.25 100 Thus the predicted % overshoot is: Max overshoot = e 1 2 100 Let us simulate using Matlab – to verify: = 44.43 % Step Response 1.5 System: Gcl Peak amplitude: 1.44 Overshoot (%): 44.4 At time (sec): 0.0642 Amplitude 1 System: Gcl Rise Time (sec): 0.0254 0.5 0 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.3 0.35 0.4 0.45 Time (sec) Step Response 1.5 Amplitude 1 0.5 0 0 0.05 0.1 0.15 0.2 0.25 Time (sec) Let us plot the %overshoot vs. zeta. clear all;clc Z=[]; OS=[]; for z=0:.01:0.9999 os=100*exp((-z*pi)/(sqrt(1-z^2))); Z=[Z z]; OS=[OS os]; end plot(Z,OS) grid xlabel('zeta') ylabel('% overshoot') title('') 100 90 80 % overshoot 70 60 50 40 30 20 10 0 P.M = 0 0.1 0.2 0.3 0.4 0.5 zeta 0.6 1 2 1 1 tan 2 1 4 2 2 4 1 2 0.7 0.8 0.9 1 Let us plot this relationship of Phase margin vs. damping ratio: clear all Z=[]; PM=[]; for z=0:.01:1 pm=atand(2*z*(1/((4*z^4+1)^0.5-2*z^2))^0.5); Z=[Z z]; PM=[PM pm]; end plot(Z,PM) grid xlabel('zeta') ylabel('PM - degrees') title('Phase lead design') Phase lead design 80 70 PM - degrees 60 50 40 30 20 10 0 0 0.1 0.2 0.3 0.4 0.5 zeta 0.6 0.7 Now. Let us plot the phase margin vs. % overshoot clear all;clc Z=[]; OS=[]; PM=[]; for z=0:.01:0.9999 os=100*exp((-z*pi)/(sqrt(1-z^2))); pm=atand(2*z*(1/((4*z^4+1)^0.5-2*z^2))^0.5); Z=[Z z]; 0.8 0.9 1 OS=[OS os]; PM=[PM pm]; end plot(OS,PM) grid xlabel('%overshoot') ylabel('% Phase Margin') title('') 80 70 % Phase Margin 60 50 40 30 20 10 0 0 10 20 30 40 60 50 %overshoot 70 80 90 100 From the plot, a 10% overshoot corresponds to a phase margin of 58o Let us draw the Bode diagram of the uncompensated system. clear all;close;clc K=1; num=K*[2500]; den=[1 25 0]; G=tf(num,den); bode(G) Bode Diagram 60 Magnitude (dB) 40 20 0 -20 -40 Phase (deg) -60 -90 System: Guncomp Phase Margin (deg): 28 Delay Margin (sec): 0.0104 At frequency (rad/s): 47 Closed loop stable? Yes -135 -180 0 10 1 2 10 10 3 10 Frequency (rad/s) As can be seen, the phase margin for the open loop system is 28 degrees at the wp = 47 rad/sec.. (Check the plot of % OS vs. phase margin – it agrees with our predictions. ) We want the phase margin to be at 60 degrees (according to %os vs. PM). (Add a phase lead) Thus the phase lead controller should add : 60-28 = 32 degrees of phase in the vicinity of the gain –crossover frequency. But, when adding the phase lead controller, the magnitude response will be affected in such a way that the gain crossover frequency will shift higher. Thus, when designing the phase lead, allow for some marginal error to account for the inevitable phase drop off. a 1 a 1 max sin 1 a 1 sin 32 3.25 1 sin 32 Since 20log(a) = 10.25dB (the phase lead will cause a 10.25 shift in the magnitude) Thus the new gain crossover frequency will shift. The problem is now; we want the amount of phase shift correction to occur at the new gain crossover frequency. Choose the geometric mean to locate the new crossover frequency. At the attenuation of -10.25/2 = -5.125dB, the corresponding frequency is: Bode Diagram 60 40 Magnitude (dB) 20 System: Guncomp Frequency (rad/s): 64.6 Magnitude (dB): -5.05 0 -20 -40 -60 -90 -120 Phase (deg) System: Guncomp Phase Margin (deg): 28 Delay Margin (sec): 0.0104 At frequency (rad/s): 47 Closed loop stable? Yes -150 -180 0 1 10 2 10 10 Frequency (rad/s) 65 rad/sec. Now, we can calculate T T= 1 0.0085 w a m Substituting, we get: Gc ( s) 1 1 aTs a 1 Ts The open loop transfer function of the compensated system is: G( s) 1 2500(1 aTs ) a s( s 25)(1 Ts ) = 1 2500(1 0.0277 s) 3.25 s( s 25)(1 0.0085s) 3 10 The Frequency response of the compensated system is: Bode Diagram 40 Magnitude (dB) 20 0 -20 -40 -60 -80 Phase (deg) -100 -90 -120 -150 -180 0 10 System: Gcom Phase Margin (deg): 67.3 Delay Margin (sec): 0.0457 At frequency (rad/sec): 25.7 Closed Loop Stable? Yes 10 1 2 10 Frequency (rad/sec) 10 3 10 4 Plots of uncompensated and compensated are: Bode Diagram Magnitude (dB) 50 0 -50 Phase (deg) -100 -90 -120 -150 -180 0 10 System: Gcom Phase Margin (deg): 67.3 Delay Margin (sec): 0.0457 At frequency (rad/sec): 25.7 Closed Loop Stable? Yes 10 1 System: Gunc Phase Margin (deg): 28 Delay Margin (sec): 0.0104 At frequency (rad/sec): 47 Closed Loop Stable? Yes 2 10 Frequency (rad/sec) 10 3 10 4 a=3.25; T=0.0085; K=1; den1=[1 0]; den2=[1 25]; den3=[T 1]; num1=[K*2500]; num2=(1/a)*[T*a 1]; NUM=conv(num1,num2); DEN=conv(den1,conv(den2,den3)); Gcom=tf(NUM,DEN) bode(Gcom) % GCL=feedback(Gcom,1); % step(GCL) hold DENunc=conv(den1,den2); Gunc=tf(num1,DENunc) bode(Gunc) Let us look at the transient response: Step Response 1.5 System: GCLunc Peak amplitude: 1.44 Overshoot (%): 44.4 At time (sec): 0.0642 System: GCL Peak amplitude: 1.05 Overshoot (%): 4.81 At time (sec): 0.122 System: 1GCLunc Rise Time (sec): 0.0254 Amplitude System: GCL Rise Time (sec): 0.0561 0.5 0 0 0.05 0.1 0.15 0.2 0.25 Time (sec) clear all;clf;close; a=3.25; T=0.0085; 0.3 0.35 0.4 0.45 K=1; den1=[1 0]; den2=[1 25]; den3=[T 1]; num1=[K*2500]; num2=(1/a)*[T*a 1]; NUM=conv(num1,num2); DEN=conv(den1,conv(den2,den3)); Gcom=tf(NUM,DEN) % bode(Gcom) GCL=feedback(Gcom,1); step(GCL) hold DENunc=conv(den1,den2); Gunc=tf(num1,DENunc) % bode(Gunc) GCLunc=feedback(Gunc,1); step(GCLunc) Phase-Lag Controller The network realization of a phase-lag controller is shown below R1 R2 Ein Eout C1 The compensator’s transfer function is: Eout ( s) 1 R 2 C1 s Gc ( s) Ein ( s) 1 ( R1 R2 )C1 s Let a R1 R2 R2 a 1 And T R2 C1 Then, the compensator’s transfer function is: 𝐺𝑐 (𝑠) = 1 + 𝑇𝑠 1 + 𝑎𝑇𝑠 Note, aT > T Observations: 1- The complex plane will have a zero at s = -1/T and a pole at s = -1/aT 2- Thus, the pole is to the right of the zero (opposite to the phase lead compensator.) 3- For the phase lag compensator, the output lags the input in phase angle for all positive frequencies. 4- Also, the magnitude of the output decreases from unity at near 0 rad/sec. to 1/a as ∞ Demonstrate the phase lag network’s frequency response for the case where a = 5, T = 2. Bode Diagram 0 Magnitude (dB) -2 -4 -6 -8 -10 -12 -14 0 -5 Phase (deg) -10 -15 -20 -25 -30 -35 -40 -45 -3 10 10 -2 -1 10 Frequency (rad/sec) 10 0 Notice the phase lag and magnitude attenuation. The lower cutoff frequency is: 1/aT = 0.1 rad/sec. The upper cutoff frequency is 1/T =0.5 rad/sec. Is it obvious why the magnitude plot levels off after the upper cutoff frequency? 10 1 The frequency at which the maximum phase lag occurs, ωm, is found by: 𝜔𝑚 = 1⁄ 𝑇 √𝑎 For this example, ωm = 0.2236 rad/sec. The maximum phase lag is given by: 1−𝑎 ) 1+𝑎 For our example, the maximum phase lag that may be obtained is: 41.8 degrees ( -41.8) 𝜃𝑚𝑎𝑥 = 𝑠𝑖𝑛−1 ( Design steps with a phase lag controller: These steps are demonstrated using an example. The objective of the phase lag controller in the frequency domain is to move the gain crossover frequency where the desired phase margin is realized, while keeping the phase curve relatively unchanged at the new gain crossover frequency. Let us refer to the sun-seeker example used in the phase lead design. The requirements are as follows: 1- the steady state error due to a unit ramp input should be less that 0.01 2- the maximum overshoot of the step response should be less than 5% 3- thr rise time should be less than or equal to 0.5 sec. 4- the settling time should be less than or equal to 0.5 sec. 5- due to noise, the bandwidth of the system should be less than 50 rad/sec. notice, the rise time and settling time requirements have been relaxed. The open loop compensated system is: 𝐺𝑓𝑤𝑑 = 𝐺𝑐 𝐺 = 2500𝐾(1 + 𝑇𝑠) 𝑠(𝑠 + 25)(1 + 𝑎𝑇𝑠) Solution: 1- as was done earlier with phase lead, let K =1 (for worst case) 2- Then the open loop uncompensated system will have a %overshoot of 44.4% and a damping ratio of 0.25. 3- For effective phase –lag control, the pole and zero of the controller function must be placed close together and both are relatively close to the origin. 4- Select a using the equation: 𝒂= 𝐾 𝑡𝑜 𝑟𝑒𝑎𝑙𝑖𝑧𝑒 𝑡ℎ𝑒 𝑠𝑡𝑒𝑎𝑑𝑦 𝑠𝑡𝑎𝑡𝑒 𝑝𝑒𝑟𝑓𝑜𝑟𝑚𝑎𝑛𝑐𝑒 𝐾 𝑡𝑜 𝑟𝑒𝑎𝑙𝑖𝑧𝑒 𝑡ℎ𝑒 𝑑𝑒𝑠𝑖𝑟𝑒𝑑 𝑑𝑎𝑚𝑝𝑖𝑛𝑔 to do this: - draw the root locus of the uncompensated system and determine K to realize the desired damping. Note, from the plot of % overshoot vs. zeta, we obtain a damping ratio of 0.7071 to correspond to % overshoot of 4.32% Root Locus 15 System: Gol Gain: 0.125 Pole: -12.5 + 12.5i Damping: 0.707 Overshoot (%): 4.32 Frequency (rad/sec): 17.7 10 Imaginary Axis 5 0 -5 -10 -15 -30 -25 -20 -15 -10 -5 0 Real Axis Therefore, a = 1/0.125 = 8. 5- if T is sufficiently large, then the pole and zero will be sufficiently close to the origin 6- Let us demonstrate two case of choices of T a. T = 100 b. T = 10 The corresponding Step response of each is shown below: 5 a) T =100 compensated system- Phase lag: T =100, a =8 1.4 System: GCL Peak amplitude: 1.04 Overshoot (%): 4.39 At time (sec): 0.254 1.2 System: GCL Settling Time (sec): 0.34 Amplitude 1 System: GCL Rise Time (sec): 0.122 0.8 0.6 0.4 0.2 0 0 0.05 0.1 0.15 0.2 0.25 Time (sec) 0.3 0.35 0.4 0.45 0.5 Red= uncompensated, Blue = Compensated 40 20 0 -20 -40 -60 -80 0 10 1 10 2 10 and the complete frequency response od the compensated and uncompensated system is: 3 10 Red= uncompensated, Blue = Compensated 40 magnitude dB 20 0 -20 -40 -60 -80 0 10 1 2 10 10 3 10 Frequency rad/sec. Red= uncompensated, Blue = Compensated -80 phae - degrees -100 -120 -140 -160 -180 0 10 1 2 10 10 Frequency rad/sec. pole(GCL) ans = -12.4956 +12.4956i -12.4956 -12.4956i -0.0100 The compensated system has a phase margin of 65 at 11.4 rad/sec. 3 10 b- T = 10; Step Response 1.4 System: GCL Peak amplitude: 1.05 Overshoot (%): 5.04 At time (sec): 0.255 1.2 1 System: GCL Settling Time (sec): 0.362 System: GCL Rise Time (sec): 0.121 Amplitude 0.8 0.6 0.4 0.2 0 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 Time (sec) Red= uncompensated, Blue = Compensated 40 magnitude dB 20 0 -20 -40 -60 -80 0 10 1 2 10 10 3 10 Frequency rad/sec. Red= uncompensated, Blue = Compensated -80 phae - degrees -100 -120 -140 -160 -180 0 10 1 2 10 10 Frequency rad/sec. pole(GCL) 3 10 ans = -12.4559 +12.4561i -12.4559 -12.4561i -0.1007 The compensated system has a phase margin of 65.1 at 11.4 rad/sec. notice – barely any change Notice: The response is basically insensitive to T, therefore, pick a large T and vary a to obtain desired response. No matter what a is (as long as a>1), the steady state error is NOT violated. Fun Let us try a phase –lead –lag controller Using results above, the following phase –lead- lag network is obtained. 𝑠 + 1⁄𝑎 𝑇 𝑠 + 1/𝑇2 1 1 1 𝐺𝑐 (𝑠) = ( )( ) 𝑠 + 1/𝑇1 𝑠 + 1⁄𝑎 𝑇 𝑎 2 2 discuss with class let a1=70, T1 = 0.0004, a2= 5, T2 = 20 a=3.25; T=0.0085; The resulting system’s response is: Step Response 1.4 System: GCL Peak amplitude: 1.05 Overshoot (%): 5.07 At time (sec): 0.156 1.2 System: GCL Time (sec): 0.216 Amplitude: 1.02 Amplitude 1 System: GCL Time (sec): 0.0876 Amplitude: 0.91 0.8 0.6 0.4 0.2 0 0 0.05 0.1 0.15 0.2 Time (sec) controller parameters are: 0.25 0.3 0.35 T1 = 0.00085, a1= 20 T2 = 100, a2 = 2; a2=5; numc1=[1 1/(a1*T1)]; denc1=[1 1/T1]; Gc1=tf(numc1,denc1); numc2=[1 1/T2]; denc2=[1 1/(a2*T2)]*1/a2; Gc2=tf(numc2,denc2); Gc = Gc1*Gc2