Design Controller
Design Controller
Design Controller
24
Heikki Koivo
25
(2- 1)
If the system is of high order, then the complex conjugate pair of poles, which is closest to the imaginary axis is called dominant poles. In order this to hold the other poles have to be far from the dominant poles or there must be a zero to approximately cancel out the effect of the pole. An example of this is given in Figure 2.1.
x o x x
x Re x
Fig.2.1. Dominant poles. Note that if a pole is close to the dominant poles then a zero has to cancel its effect. The design of a servocontrol system is based on this, but the performance has to be checked by simulation, since we are not quite sure how well the assumption will hold. Let us next collect certain facts about second order systems.
Heikki Koivo
26
M p = (1 + e
1 2
(2- 2)
PO = 100e
/ 1 2
(%) .
(2- 3)
(2- 4)
Use the following MATLAB commands to compute the step response (Fig.2.2): num=[4];den=[1 0.4 4]; gopen=tf(num,den) % transfer function tf- form Transfer function: 4/s^2 + 0.4 s + 4 step(gopen) % % step response calculation
Step Response
PO72%
15 Time (sec.)
20
25
30
Fig.2.2. Typical unit step response of a second order system. Here n = 2 and = 0.2. From the figure percent overshoot PO 72%.
Heikki Koivo
27
100 90 80 70 60 50 40 30 20 10 0 0 0.1 0.2 0.3 0.4 0.5 0.6 Damping ratio tseta 0.7 0.8 0.9 1
Fig.2.3. Percent overshoot (PO) as a function of damping ratio . Another useful relationship in design is between phase margin (PM) and the damping coefficient .
%Overshoot
(2- 5)
Fig.2.4. Phase margin as a function of . Added phase margin vs. percent overshoot is plotted using the above relationships.
Heikki Koivo
28
Exercise: Complete the graphs BANDWIDTH: The bandwidth (BW) of the system is defined to be the frequency at which the overall gain has dropped 3 dB from the level that it was at lower frequencies. For second order systems it is possible to compute the following expression:
BW 2 2 2 2 = (1 2 ) + 2 4 (1 ) n
Similarly for first order systems, it is easy show that
c = 1 c
(2- 6 )
(2- 7)
EXERCISE: One common design specification is settling time ts. This is defined to be the time when the unit step response finally settles to a tolerance of 1% (or 5%). Calculate the exact expression of settling time for a second order system in terms and n. (Answer: Settling time ts 4/n. For higher order systems the predominant time constant is used for the same purpose as n).
Heikki Koivo
29
WLag ( s) =
(3- 1)
= ( a1 ) dB .
(3- 2)
The name of the phase-lag controller follows from the property that phase of the output of Wlag(s) is lagging behind the phase of the input signal. As can be seen from Figure 3.1 the gain decreases at higher frequencies. The gain at higher frequencies is a 1. Since a 1 < 1, this means that W Lag () = ( a1 ) dB is negative, which is clear from Figure
dB
3.1.
Bode Diagrams
10
10
10
Frequency (rad/sec)
Fig.3.1. Bode diagram of a typical phase-lag circuit: WLag ( s) = the behavior at break frequencies 1 rad/s and 10 rad/s.
1 + 0.1s . Observe 1+ s
Heikki Koivo
30
Phase-lag compensator is like a PI controller at high frequencies. Let us draw a PI controller, which roughly corresponds to the phase lag circuit in Figure 3.1.
W PI (s) = (1 + 1 ) 0.1s
(3- 4)
or in MATLAB form num=[0.1 1];den=[1 0]; g=tf(num,den); bode(g) The result is displayed in Figure 3.2.
Bode Diagrams
10
10
10
Frequency (rad/sec)
1 ) . For > 4 rad/s the PI 0.1s controller behaves like the phase-lag compensator of Fig. 3.1.
o sated system has phase (-180 +PM), where PM = desired phase margin. Typically o o o o the required phase margin is 45 -60 for electro-mechanical systems and 25 -30 for processes.
Heikki Koivo
31
STEP 4. Determine how much to decrease the gain in dB at the frequency mentioned in step 3 so that it would become the new cross-over frequency c. This determines a .
1
STEP 5. Gain must be decreased at high frequencies without disturbing it at lower frequencies. This is guaranteed by choosing the upper cut-off frequency u to be one decade below c. STEP 6. Check by simulating the unit step response. STEP 7. If requirements are met, stop. Otherwise go back to STEP 1.
EXAMPLE
Open-loop transfer function of a unity feedback system of Fig.3.3 is given by
G (s) =
1 . s(1 + 0.2s)
(3- 5)
Controller
R(s) + WLAG(s)
System
G(s) = 1 s(1 + 02s) .
Y(s)
Fig.3.3. The block diagram of the overall system. Here WLAG (s) represents the phase-lag controller or compensator and G(s) the open-loop system transfer function. The system has unity feedback, H(s) = 1. Specifications for the system are: Accuracy for a unit ramp input < 2%, i.e. steady-state error < 0.02. Maximum percent overshoot = PO < 20%. Design a phase-lag compensator that satisfies the requirements. HINT: Use MATLAB Help command to familiarize yourself with the following commands, which are useful in design. See APPENDIX for details.
Heikki Koivo
32
1 ) R( s) s 0 1 + G ( s)
(3- 6)
1 K s(1 + 0.2s)
)]
1 =K s2
(3- 7)
Gain is now sufficient. The controller is at this point a P (proportional) controller. STEP 2. From Fig.2.5 percent overshoot PO <20% corresponds to > 48 phase margin, PM. This holds for second order systems and therefore we will make the dominant pole assumption. Draw the Bode diagram of the transfer function KG(s) = 50 /s(1 + 0.2s). REMARK. The numerator now includes gain 50. We will use MATLAB for plotting. Recall that MATLAB requires num/den form so that NUMERATOR: num=[250]; DENOMINATOR: den=[1 5 0]; g=tf(num,den) %Transfer function g Transfer function: 250 --------s^2 + 5 s Next draw the Bode diagram with bode(g).
Heikki Koivo
33
Bode Diagrams
40 20 0 -20
10
-1
10
10
10
Frequency (rad/sec)
Fig.3.4.The open-loop transfer function KG(s). Note that the original open-loop transfer function has been multiplied by K = 50, which is a P controller. The steady-state requirement is now satisfied. Plotting is done with bode command. Phase margin can be read from Figure 3.2. Recall that it is obtained from the Bode diagram by first determining the frequency at which the gain curve crosses the 0 dB level. After that read the phase at the same frequency from the phase curve and subtract it from 180 0. A better and a more accurate answer can be obtained with MARGIN(g) command, which draws the whole Bode diagram and also produces directly gain margin Gm, which is not used in the current design, phase margin Pm and the corresponding frequencies. Gain margin, Gm =Inf, Phase margin, Pm = 17.96 (phase margin 18), at frequency Wcp = 15.42 1/s
Bode Diagrams Gm = Inf, Pm=17.964 deg. (at 15.421 rad/sec)
10
Frequency (rad/sec)
Fig.3.5. MARGIN command margin(g) plots Bode diagram, draws also both the gain and phase margin and the corresponding frequencies and computes the exact numbers into the figure. The open-loop system has been compensated with gain K = 50.
Heikki Koivo
34
Phase margin Pm = 18 is not enough, at least 48 is needed. Phase margin relates to overshoot. It is also easy to check the maximum overshoot by simulation, when the open loop has gain K=50. Note that the simulation must be done for closed -loop system. Compute the closed-loop system transfer function using feedback command. Then apply step command. The closed-loop transfer function is obtained by T=feedback(g,1) Transfer function: 250 --------------s^2 + 5 s + 250 The step response is computed by using step(T) For easier reading a grid is drawn together with labels on x- and y-axis. grid xlabel('time in secs');ylabel('Output'); title('Unit step response of closed loop system') The maximum overshoot can now be read from Fig.3.4. to be about 60 %.
Step Response Unit step response of closed loop system 1.6 1.4 1.2 1 Amplitude Output 0.8 0.6 0.4 0.2 0 0 0.5 1 1.5 time in secs Time (sec.) 2 2.5
Fig.3.6. The unit step response of the closed-loop system, when only pure gain compensator K = 50 (P controller) is used. The maximum overshoot PO = 60% is quite large, but the steady-state error for a step (not for a ramp) is zero, since the system includes an integrator. There is clearly too much overshoot! Additional compensating is needed.
Heikki Koivo
35
At this point it is also useful to draw the Bode diagram of the closed-loop system so that it can be later compared with the compensated one: bode(T)
Fig.3.7. Bode diagram of the closed-loop system when the compensator is K = 50. Bandwidth is read from the figure (use ginput(1)) to be about 25 rad/s STEP 3. In designing phase-lag compensator, the first thing is to determine the frequency, at which the phase margin would be sufficient, if the gain is not changed. Read from the Bode diagram of Fig.3.2 at what frequency there is enough phase margin. A handy way to do it is to use crosshair command ginput(1). ginput(1) ans = 4.1786 18.5074
Fig.3.8. Use of crosshair to determine the new crossover frequency, at which the phase margin is sufficient.
Heikki Koivo
36
Or compute more exactly, which is clumsier but more accurate. (Only part of the table is shown) num=[250];den=[1 5 0]; g=tf(num,den) % define KG(s) w=logspace(-1,2);[mag phase w]=bode(g,w); % compute magnitude and phase phi=180.+phase; magdb = 20*log10(mag); %compute phase margin and mag dB [squeeze(magdb) squeeze(phase) squeeze(phi) w] % table of mag in dB, phase, phase margin, frequency Table 2.1. Original magnitude and phase, the new phase margin (if magnitude is fixed to be 0 dB) and the frequency. MagdB phase phi 23.29 -120.51 59.48 2.9471 21.72 -124.16 55.83 3.3932 20.07 -128.00 51.99 3.9069 18.34 -131.97 48.02 4.4984 16.52 -136.01 43.98 5.1795 At 4 rad/s (3.9069 to be exact) the new phase margin is about 520 (51.99640). Let the new crossover frequency be c = 4rad/s. STEP 4. One further piece of information is read from the table. At 4 rad/s the gain is about 20 dB. This must be taken care by the phase lag compensator. Choose a 1 = - 20 dB or a1 = 0.1. STEP 5. Since the upper cut-off frequency u is one decade below the new crossover frequency , c we have c = 4 rad/s = 10x u = 10/ (a1) or = 20 s. STEP 6. This is sufficient accuracy during first design iteration. The design is now checked by simulation. The transfer function of the open-loop compensated system is obtained either by hand calculation (the computations are simple enough) or by product of transfer functions numw=[0.1 0.05]; denw=[1 0.05]; gw=tf(numw,denw) Compensator * Open loop transfer function = W(s)KG(s) or g1=gw*g Transfer function: 25 s + 12.5 ----------------------s^3 + 5.05 s^2 + 0.25 s
Heikki Koivo
37
Let us draw the open-loop compensated Bode diagram, so as to see how the original Bode diagram has changed. bode(g1)
Bode Diagrams
10
-2
10
-1
10
10
10
Frequency (rad/sec)
Fig.3.9. Bode diagram of the compensated open loop system. For comparison purposes the Bode diagrams of the uncompensated and compensated open-loop system are drawn in the same Figure. Use the following MATLAB commands: % open-loop transfer function to have more data points w=logspace(-3,2);[mag phase w]=bode(g,w); % Compensated open-loop transfer function numw=[0.1 0.05]; denw=[1 0.05]; gw=tf(numw,denw) % compensator g1=gw*g % compensated open-loop transfer function Transfer function: 25 s + 12.5 ----------------------s^3 + 5.05 s^2 + 0.25 s w=logspace(-3,2);[mag1 phase1 w]=bode(g1,w); % plot in the same figure first magnitude in dB w=logspace(-3,2); [mag phase w]=bode(g,w); [mag1 phase1 w]=bode(g1,w); magdb=squeeze(20*log10(mag)); mag1db=squeeze(20*log10(mag1)); semilogx(w,squeeze(magdb),'k',w,squeeze(mag1db),'k --'); grid xlabel('Frequency (rad/s)'); ylabel('Open and closed loop magnitudes in dB')
Heikki Koivo
38
10 10 Frequency (rad/s)
-1
10
10
Fig.3.10. Gain of the uncompensated (solid line, -) and compensated (dashed line, --) open-loop system. Note how the phase-lag compensator decreases the gain at higher frequencies.
Fig.3.11.Phase of the uncompensated (solid line, -) and compensated (dashed line, --) openloop system. Note how the phase-lag compensator decreases the phase at middle frequencies. % Then phase semilogx(w,squeeze(phase),'k',w,squeeze(phase1),'k --'); grid xlabel('w (rad/s)');ylabel('phase, uncompensated (-), compensated(--)') Let us now compute the closed-loop transfer function and then both the Bode diagram and the unit step response. Again in simple cases you could compute the transfer function by hand, but as easily by applying feedback command % closed-loop transfer function T1=feedback(g1,1) Transfer function: 25 s + 12.5 ------------------------------s^3 + 5.05 s^2 + 25.25 s + 12.5
Heikki Koivo
39
Fig.3.12. Bode diagram of the compensated closed-loop system. The bandwidth BW 6.8 rad/s is found using crosshair ginput(1), which is less than the 25 rad/s in Fig.3.7. resulting from gain compensation. This is also seen in the unit step response of Fig.3.15, where the response is slower now than without compensation. For comparison the Bode diagrams of the uncompensated and compensated closedloop systems are drawn in the same Figure. Recall how to compute the closed loop-transfer function (uncompensated) % uncompensated closed-loop system T=feedback(g,1); w=logspace(-1,2); [magcl phascl w]=bode(T,w); semilogx(w,20*log10(squeeze(magcl)),'k') % compensated closed-loop system w=logspace(-1,2);[magcl1 phasecl1 w]=bode(T1,w); % both in the same figure semilogx(w,20*log10(squeeze(magcl)),'k',w,20*log10(squeeze(magcl1)),'k --') xlabel('w (rad/s)');ylabel('closed-loop magnitude, uncompensated (-), compensated(--)') grid
Heikki Koivo
40
Fig.3.13. Bode diagram of the uncompensated and the compensated closed-loop magnitude. Note how the bandwidth is decreased, when phase-lag controller is used. This is also seen in the step response. Finally, let us compute the step response of the compensated closed-loop with the command step(T1); grid
Fig.3.14. The compensated closed-loop step-response. The overshoot is still slightly above 20%. This is because the assumption of second order dominant poles does not hold as well as expected.
Heikki Koivo
41
The roots of the closed-loop system are obtained from [numcl dencl]=tfdata(T1,'v'); roots(dencl) ans = -2.2506 + 4.2089i -2.2506 - 4.2089i -0.5487 There are two complex poles, but the third pole clearly has a strong effect on the response. Checking also the zeros: roots(numcl) ans = -0.5000. The zero is quite close to the pole p = -0.5487 and thus cancels most of the effect, but not quite enough. The uncompensated and compensated unit step responses can be drawn in the same Figure by using the following: [numcl dencl]=tfdata(T1,'v'); [numc denc]=tfdata(T,'v'); t=linspace(0,3); y1=step(numc,denc,t); y2=step(numcl,dencl,t); plot(t,y1,'g',t,y2,'b--'); grid xlabel('time');ylabel('Stepresponses, uncomp (-), comp (- -)'); The result is shown in Fig.3.15.
Fig.3.15. The closed loop unit step responses, pure gain compensation (K = 50) (-), and compensation with lag compensator (--). The overshoot is not quite satisfactory. As indicated above this is due to the error in dominant pole assumption.
Heikki Koivo
42
The result is not quite good enough, because the overshoot is almost 30% - maybe a larger requirement for phase margin leading to a smaller value of a 1 and a larger . Calculations are exactly the same as before. EXERCISE: Conclude the design so that also the overshoot requirement is satisfied.
STEP 5 Gain must be decreased at high frequencies without disturbing it at lower frequencies. This is guaranteed by choosing the upper cut-off frequency to be one decade below .
c
STEP 6 Check by simulating step response. STEP 7. If requirements are met, stop. Otherwise go back to STEP 1. REMARK: If the system includes feedback dynamics H(s), because of a sensor, then the design is carried out by including it in the Bode diagram. So instead of the open-loop G(s), the design is performed for G(s)H(s). Exactly the same steps are followed. Special care must be taken e.g. in computing steady-state error.
Heikki Koivo
43
APPENDIX FEEDBACK Feedback connection of two systems. SYS = FEEDBACK(SYS1,SYS2) produces the feedback loop u --->O---->[ SYS1 ]----+---> y | | +-----[ SYS2 ]<---+ Negative feedback is assumed and the resulting system SYS maps u to y. To apply positive feedback, use the syntax SYS = FEEDBACK(SYS1,SYS2,+1). SYS = FEEDBACK(SYS1,SYS2,FEEDIN,FEEDOUT,SIGN) builds the more general feedback system +--------+ v --------->| | --------> z | SYS1 | u --->O---->| |----+---> y | +--------+ | | | +-----[ SYS2 ]<---+ The vector FEEDIN contains indices into the input vector of SYS1and specifies which inputs u are involved in the feedback loop. Similarly, FEEDOUT specifies which outputs y of SYS1 are used for feedback. If SIGN=1 then positive feedback is used. If SIGN=-1 or SIGN is omitted, then negative feedback is used. In all cases, the resulting system SYS has the same i nputs and outputs as SYS1). See also STAR, PARALLEL, SERIES, and CONNECT.
ROOTS Find polynomial roots. ROOTS(C) computes the roots of the polynomial whose coefficient sare the elements of the vector C. If C has N+1 components,the polynomial is C(1)*X^N + ... + C(N)*X + C(N+1). See also POLY. TFDATA TFDATA Quick access to transfer function data. [NUM,DEN] = TFDATA(SYS) returns the numerator(s) and denominator(s) of the transfer function SYS. NUM and DEN are cell arrays with as many rows as outputs and as many columns as inputs, and their (I,J) entries specify the transfer function from input J to output I. SYS is first converted to transfer function if necessary. [NUM,DEN,TS,TD] = TFDATA(SYS) returns the sample time TS and input delays TD. For con tinuous systems, TD is a vector with one entry per input channel. For discrete systems, TD is the empty matrix[]. For SISO systems, the convenience syntax [NUM,DEN] = TFDATA(SYS,'v') returns the numerator and denominator as row vectors rather than cell arrays. Other properties of SYS can be accessed with GET or by direct structure-like referencing (e.g., SYS.Ts) See also GET, SSDATA, ZPKDATA. PLOTTING PHASE MARGIN VS. ZETA zeta=0:0.1:1; PO=100*exp(-zeta*pi./sqrt(1-zeta.^2)); PM=atan(2*zeta./sqrt(sqrt(4*zeta.^4+1)-2*zeta.^2)); plot(zeta,PM);
Heikki Koivo
44
Heikki Koivo
44
(4- 1)
(4-2)
(4- 3)
(4- 4)
(4- 5)
(4- 6)
occurs at frequency
m = 1 . a2
(4- 7)
(4- 8)
Heikki Koivo
45
Bode Diagrams
From: U(1) 15
10 5 0 50 40 To: Y(1) 30 20 10 0 -2 10 10
-1
10
10
Frequency (rad/sec)
1 + 5s . 1+ s
a 1 51 Computing max = sin 1 ( 2 ) = sin 1 ( ) = 4180 at . a2 + 1 5+1 1 1 m = = = 0.45 rad / s holds with the values read from Figure 4.1. a2 5
The name of phase-lead controller follows from the property that the phase of the output of WLead(s) is leading ahead the phase of the input signal. As can be seen from Figure 4.1 the gain increases at higher frequencies. The gain at higher frequencies is a 2. Since a 2 > 1, this means that W Lead ( ) = (a 2 ) dB is positive, which is clear from Figure 4.1. Let us study more
dB
carefully how much phase margin can be added for various values of a 2 .
Heikki Koivo
46
a2 (a2 ) (dB) phimax () 1.00 0 0 2.00 3.01 19.47 3.00 4.77 30.00 4.00 6.02 36.86 5.00 6.98 41.81 6.00 7.78 45.58 7.00 8.45 48.59 8.00 9.03 51.05 9.00 9.54 53.13 10.00 10.00 54.90 Figures 4.2 and 4.3 display graphically the same dependencies.
1
0.8
5 a2
10
Fig.4. 2. The maximum phase max in phase lead circuit as a function of a2. The change in gain at the same frequency is (a2) dB.
Heikki Koivo
47
0.8
Fig.4. 3. The maximum phase max in phase lead circuit as a function of (a2)dB. Phase-lead compensator behaves like a PD controller at small frequencies. Let us draw a PD controller, which roughly corresponds to the phase-lead compensator in Figure 4.1:
W PD ( s) = 1 + 5 s
(4- 9)
Heikki Koivo
48
10 5 0 80 60 To: Y(1) 40 20 0 -2 10
-1 0
10
10
Frequency (rad/sec)
Fig.4. 4. Bode diagram of PD controller WPD ( s) = 1 + 5s . For > 4 rad/s the PI controller behaves like the phase-lead compensator of Figure 4.1.
o system has phase (-180 +PM), where PM = desired phase margin by choosing a few values of a 2 starting with a 2 =2 and going up to 10-20. Construct a table showing how much this 1 choice will add to phase margin and also to magnitude. In this way a 2 and m = can a2 be determined. This procedure also reveals if one phase lead circuit is enough. Remember also that the bigger a 2 is, the more susceptible it is for noise.
Heikki Koivo
49
This completes the design of the phase-lead compensator. STEP 5. Check the design by simulating step response. Draw also the open-loop Bode diagram of the compensated system for comparison purposes. STEP 6. If requirements are met, stop. Otherwise go back to STEP 1.
EXAMPLE
Open-loop transfer function of a unity feedback system of Fig.4.5 is given by
G (s ) = 1 . s(1 + 0.2 s)
(3- 1)
Controller
R(s) + WLEAD (s) -
System
G( s ) = 1 s(1 + 0.2 s)
Y(s)
Fig.4. 5. The block diagram of the overall system. Here WLead (s) represents the phase-lag controller or compensator and G(s) the open-loop system transfer function. The system has unity feedback, H(s) = 1. Specifications for the system are: Accuracy for a unit ramp input < 2%, i.e. steady-state error < 0.02. Maximum percent overshoot = PO < 20%. Design a phase-lead compensator that satisfies the requirements. SOLUTION: STEP 1. (is the same as in phase lag) Compute the steady-state for unit ramp input ess
ess = lim sE (s) = lim s(
s 0
1 ) R( s) s 0 1 + G ( s)
(4- 10)
Heikki Koivo
50
1 K s(1 + 0.2s)
)]
1 =K s2
(4- 11)
This implies that K > 1/0.02 = 50, choose K = 50. (4- 12)
Gain is now sufficient. The controller is at this point a P (proportional) controller. STEP 2. (As in phase lag) From Fig.2.5 percent overshoot PO <20% corresponds to > 48 phase margin, PM. This holds for second order systems and therefore we will make the dominant pole assumption. Draw the Bode dia gram of the transfer function KG(s) = 50 / s(1 + 0.2s) as before. It is redrawn in Fig.4.6. kg=zpk([],[0 -5],250) Zero/pole/gain: 250 ------s (s+5)
Bode Diagrams
From: U(1) 60 40 20
0 -20 -40 -80 -100 To: Y(1) -120 -140 -160 -180
0 1 2
10
10
10
Frequency (rad/sec)
Fig.4.6. Fig.3.4 redrawn. The Bode diagram of the open-loop transfer function KG(s). The steady-state requirement is now satisfied. Plotting is done with bode(kg) command.
Heikki Koivo
51
REMARK: If you want grids on Bode diagram as shown, activate in e.g. magnitude in Bode diagram figure. Then choose Tools from menu and under this Axis properties. Finally, choose Grid On for both X and Y.
1 and that a2
W ( m ) = a 2 = ( 2 )dB a or phase-lead circuit adds ( 2 )dB in dB:s at the same time as max is added to the original a phase margin. Construct the following table using Bode diagram by going through values of a2 between 2-10. num=[50];den=[0.2 1 0]; kg=tf(num,den); w=logspace(-1,2);[mag phase] =bode(kg,w); a2=1:0.2:10.8; halfa2db=0.5*20*log10(a2); phimax=asin((a2-1)./(a2+1)); phi=180.+phase; magdb = 20*log10(mag); phim=phi'+phimaxdeg; [a2' halfa2db' magdb phi phimaxdeg' phim' w'] Table 4.2. Effect of phase-lead circuit on phase margin of KG(s)
Heikki Koivo
52
The first three columns, a 2 , (a2)dB, and phimax(), come from the phase-lead compensator. The third, fourth and fifth, magdb, w, phi (current phase margin, if gain would become zero), are the original magnitude and phase. The final column, phim= phimax + phi , gives the phase margin of the compensated system. a2 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 (a2 )dB phimax() magdb 3.0103 19.4712 -3.0 4.7712 30.0000 -4.5 6.0206 36.8699 -6.1 6.9897 41.8103 -6.9 7.7815 45.5847 -7.7 8.4510 48.5904 -8.5 9.0309 51.0576 -9.0 9.5424 53.1301 -9.7 10.0000 54.9032 -10.1 w 18.4 20.2 22.2 23.3 24.4 25.6 26.3 27.9 28.1 phi() 15.2 13.9 12.7 12.1 11.6 11.1 10.7 10.4 10.1 phim() 34.65 43.9 49.6 53.9 57.2 59.7 61.8 63.5 65.0
How is the above table constructed? Start with the phase-lead compensator. Consider the third row. Give a value for a2, a 2 = 4 , which in dB:s is ( a2 ) dB = (4 )dB = 12 dB . Half of that is ( 2 ) dB = 6 dB , which is the value in the second column. a On the third column we see the additional phase max = 37 (= 36.8699 0) of the phase-lead compensator when a 2 = 4. Next determine the frequency at which the gain has approximately the value ( 2 )dB = 6dB , because the effect of phase-lead will add this much to the gain. The a corresponding frequency is = 22.2 rad / s and the gain -6.1 dB. These are seen in columns five and four respectively. It is further seen that the original phase margin at this frequency is phi = m = 12.7 o . This is displayed in the sixth column. Adding this to phimax = max of the third column gives the new phase margin phim = 'm = m + max = 12.7 0 + 369 0 = 49.6 0 , which is shown in the last . column. The phase margin is now enough. STEP 4 Since m =
1 4
Heikki Koivo
53
numw=[0.088 1]; denw=[0.022 1]; w=tf(numw,denw); The open loop, compensated transfer function W(s)G(s) is calculated by wg=w*g; Plotting the Bode diagram of W(s)G(s) bode(wg) The result is given in Figure 4.7.
Bode Diagrams
From: U(1) 100 50
0 -50 -100 -80 -100 To: Y(1) -120 -140 -160 -180 10
0 1 2
10
10
Frequency (rad/sec)
Fig.4. 7. The Bode diagram of the open-loop, phase-lead compensated transfer function W(s)G(s). Let us compare the Bode diagrams of the uncompensated and compensated systems by drawing them in the same figure, Figures 4.8. bode(kg,wg)
Heikki Koivo
54
Bode Diagrams
From: U(1) 100 50
0 -50 -100 -80 -100 To: Y(1) -120 -140 -160 -180 10
0 1 2
10
10
Frequency (rad/sec)
Fig.4. 8. Bode diagrams of open-loop uncompensated and compensated magnitudes (above) and phases (below). Observe how the phase-lead compensator adds gain and at higher frequencies and phase in the middle frequencies. The closed-loop uncompensated (K=50) transfer function is calculated by: gcl=feedback(kg,1) Zero/pole/gain: 250 ---------------(s^2 + 5s + 250) The unit step response is obtained by t=linspace(0,3); y1=step(gcl,t) The closed-loop transfer function of the compensated system is computed similarly: gcl1=feedback(wg,1) Zero/pole/gain: 1000 (s+11.36) -------------------------------(s+17.44) (s^2 + 33.01s + 651.4) The step responses are plotted in the same figure, Fig.4.10: step(gcl,gcl1)
Heikki Koivo
55
Step Response
From: U(1) 1.8 1.6 1.4 1.2
Amplitude
To: Y(1)
Time (sec.)
Fig. 4.9. The step responses of the closed-loop systems, P-compensated (K=50) and the phase-lead compensated (--). The overshoot for the compensated system is slightly more than is required. This is due to the dominant pole approximation. Note how the phase-lead compensation makes the response faster. The system also becomes more susceptible to noise. The overshoot is 23% or almost what was required. Note the fast response that the phaselead compensated system produces. Recall that the phase-lag compensation slows the response compared with the original one.
Test the dominant pole assumption by computing the closed-loop roots. First transfer from zpk mode to tf-mode. tf(gcl1) Transfer function: 1000 s + 1.136e004 -----------------------------------s^3 + 50.45 s^2 + 1227 s + 1.136e004 Roots of the denominator are roots([1 50.45 1227 11360]) ans = -16.5034 +19.4652i -16.5034 -19.4652i -17.4432
Heikki Koivo
56
There are two complex poles, but the third pole clearly has a strong effect on the response. Checking also the zeros: roots([1000 11360]) ans = -11.3600 The zero is not very close to the pole p = -17.4439 but seems to cancel most of its effect, but not quite enough. This is probably the reason why the PO requirement was not satisfied right away. Let us finally draw the Bode diagram of the phase-lead compensator. numw=[0.088 1]; denw=[0.022 1]; w=tf(numw,denw); bode(w)
Bode Diagrams
From: U(1) 15
10
0 40 30 To: Y(1) 20 10 0 0 10
10
10
Frequency (rad/sec)