design controller
TRANSCRIPT
Heikki Koivo
24
2. DESIGN OF CONTROLLERS USING BODE DIAGRAM The basic idea in using controllers is to shape and mold the Bode diagram of the open-loop system in such a way that the given specifications are met. When Bode diagrams are used in design, the specifications have to be transformed into phase and gain margins and usually the steady-state error is also given (here also so-called error coefficients are used). In this presen-tation we concentrate on Bode diagram design exclusively. Other approaches that could be used are Nyquist diagrams, Nichols diagrams and root locus. Essentially the same principle applies: the given representations are shaped so that the given requirements are met. Lately also robustness issues are taken into account in a more careful manner. The most common controllers or compensators are phase-lag, phase-lead and phase-lag-lead controllers. These have characteristics of more ideal proportional integral (PI), pro-portional derivative (PD), and proportional integral derivative (PID) controllers, respec-tively. Although we concentrate on each controller type separately, it is also possible to use, e.g., two phase-lead compensators in series in order to add more phase margin. In practice, so-called tachometer feedback is also quite common. Its design is very similar to phase-lead design. A somewhat different point of view is state-space design, where methods are developed in time domain and using differential equations. Here one could summarize the basic design idea to be pole placement. This means that the closed-loop system poles are placed in such a way that the requirements are met. Closed-loop poles correspond to the eigenvalues of the closed loop system matrix. This is explored more in other textbooks. There are sometimes differing opinions of various techniques of control system design. The strong point of the classical design is that first of the transfer function representation is often easy to obtain by modern spectral analyzers, which sweep through the frequency range and determine the transfer function automatically. Another significant advantage is that you can see graphically the representation of the whole system. This is not the case with state-space form, where you basically only deal with eigenvalues, poles and zeros, i.e., with numbers. Utilization of computer-aided design makes the classical design approaches extremely power-ful, although many textbooks have been written in the era when this was not he case. There-fore teaching of these methods in basics courses is easily confusing, without clear objective and exercises are tedious, mostly hand and pencil calculations. In reality the design is carried out with computers, with efficient tools to meet engineering specifications. In engineering the final goal is almost always the design of systems, synthesis, which requires skill and experi-ence. Analysis is part of it, since it is better to be sure beforehand that Tsernobyl does not happen. In both cases efficient tools are used. The rest of these notes show how to use such tools in design of control systems.
Heikki Koivo
25
2.2. Dominant poles In the subsequent section we will study how a number of basic design specifications can be connected to Bode diagram specifications. This is a crucial step in design. It can also deter-mine the design approach. Basic assumption in design is that even if the original open-loop system is of high order, the closed-loop system behaves like a second-order system:
Y sR s
G ss s
n
n n
( )( )
( )= =+ +
ω
ω ς ω
2
2 22 (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
jIm
Rex
xo
x
x
Dominant poles
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
2.2. Dominant poles - Percent Overshoot (PO) vs. ζ , PM vs. ζ Consider a unit step response of a second order system. It is possible to calculate exactly maximum percent overshoot as a function of damping ratio ζ. First determine the actual re-sponse y(t). Then calculate where the first peak of the response occurs. Subtract one from y(t) in order to get maximum overshoot. Then express it in percentage. After some calcula-tions the following expression is obtained for the magnitude of the first overshoot Mp:
M ep = + − −( )1 1 2ζπ ζ (2- 2)
and therefore percent overshoot PO
PO e= − −100 1 2ςπ ς/ (%) . (2- 3)
Consider a typical example (ω n = 2 and ζ = 0.2)
Y sR s s s
( )( ) .
=+ +
4
0 4 42 (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
Time (sec.)
Am
plit
ud
e
Step Response
0 5 10 15 20 25 3 0
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
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%.
PO≈72%
Heikki Koivo
27
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
10
20
30
40
50
60
70
80
90
100
Damping ratio tseta
%O
vers
hoot
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 coeffi-cient ζ.
Phase margin vs. ζ PM= −
+ −tan ( [
( )½ ]½)1 21
4 4 1 2 2ζζ ζ
(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
Fig.2.5. Added phase margin phimax as a function of percent overshoot (PO).
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
nως ς ς
22 2 21 2 2 4 1
= − + − −( ) ( ) (2- 6 )
Similarly for first order systems, it is easy show that
ωτc
c=
1 (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 con-stant is used for the same purpose as ζωn).
Heikki Koivo
29
3. DESIGN OF PHASE-LAG COMPENSATOR The basic idea in compensators, as the name says, is to compensate or modify the original transfer function in the way that the specifications of the closed loop system are met. Phase-lag compensator, which corresponds to PI controller, is appropriate, when speed is not an is-sue, because it will slow the original response. Transfer function of phase-lag compensators is given by
W sa s
saLag ( ) = +
+11
11
ττ
, < 1 (3- 1)
Gain at high frequencies
W aLag dB dB( ) ( )∞ = 1 . (3- 2)
Upper cut-off frequency
ωτu a
=1
1 (3- 3)
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 a1. Since a1 < 1, this means that W aLag dB dB( ) ( )∞ = 1 is negative, which is clear from Figure
3.1.
Frequency (rad/sec)
Pha
se (
deg)
; M
agni
tude
(dB
)
Bode Diagrams
-20
-15
-10
-5
0
10-1
100
101
1 02
-50
-40
-30
-20
-10
Fig.3.1. Bode diagram of a typical phase-lag circuit: W ss
sLag ( ).= +
+1 01
1 . Observe
the behavior at break frequencies 1 rad/s and 10 rad/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.
WPI ss
( ) (.
)= +11
01 (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.
Frequency (rad/sec)
Ph
ase
(d
eg
); M
ag
nit
ud
e (
dB
)
Bode Diagrams
-20
-10
0
10
20
10-1
100
101
102
-80
-60
-40
-20
Fig.3.2. Bode diagram of PI controller WPI ss
( ) (.
)= +11
01. For ω > 4 rad/s the PI
controller behaves like the phase-lag compensator of Fig. 3.1.
Steps in design of phase-lag compensator
STEP 1. Choose gain K to satisfy steady-state requirements.
STEP 2. Draw Bode-diagram of KG(s).
STEP 3. Determine the new crossover frequency ω
c, i.e., the frequency at which the uncompen-
sated system has phase (-180o+PM’), where PM’ = desired phase margin. Typically
the required phase margin is 45o-60o for electro-mechanical systems and 25o-30o
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 ss s
( )( . )
=+1
1 0 2. (3- 5)
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.
-
+
Controller System
WLAG(s)
R(s)R(s) Y(s)Y(s)G s
s s( )
( . )=
+1
1 02
Heikki Koivo
32
FEEDBACK Feedback connection of two systems. ROOTS Find polynomial roots.
SOLUTION: STEP 1. Compute the steady-state for unit ramp input ess
e sE s sG s
R ssss s
= =+→ →
lim ( ) lim (( )
) ( )0 0
11
(3- 6)
ess lims 0
[s( 1
1K
s(1 0.2s)
)] 1
s2
0.02
=→ +
+
=
<
K (3- 7)
This implies that
K > 1/0.02 = 50, choose K = 50. (3- 8)
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
Frequency (rad/sec)
Ph
ase
(d
eg
); M
ag
nit
ud
e (
dB
)
Bode Diagrams
-20
0
20
40
10-1
100
101
102
-160
-140
-120
-100
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 1800. 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
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 fig-ure. The open-loop system has been compensated with gain K = 50.
Frequency (rad/sec)
Ph
ase
(d
eg
); M
ag
nitu
de
(d
B)
Bode Diagrams
-20
0
20
40
Gm = Inf, Pm=17.964 deg. (at 15.421 rad/sec)
100
101
-180
-160
-140
-120
-100
Heikki Koivo
34
Phase margin Pm = 18° is not enough, at least 48° is needed. Phase margin relates to over-shoot. 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 %.
Time (sec.)
Am
plit
ud
e
Step Response
0 0.5 1 1.5 2 2.5
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
Unit step response of closed loop system
time in secs
Ou
tpu
t
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. Band-width 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 mar-gin is sufficient.
Bandwidth, about 25 rad/s – read at – 3dB point
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 a1 = - 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)
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 com-mands: % 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')
Frequency (rad/sec)
Ph
ase
(d
eg
); M
ag
nit
ud
e (
dB
)
Bode Diagrams
-50
0
50
10-3
10-2
10-1
100
101
102
-160
-140
-120
-100
Heikki Koivo
38
10-3
10-2
10-1
100
101
102
-60
-40
-20
0
20
40
60
80
100
Frequency (rad/s)
Ope
n an
d cl
osed
loo
p m
agni
tude
s in
dB
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, --) open-loop 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
New crossover frequency ωc
ωc
Heikki Koivo
39
Bode diagram of T is shown in Figure 3.12. »[magcl,phasecl]=bode(T1)
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 closed-loop 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 a1 and a larger τ. Calculations are exactly the same as before. EXERCISE: Conclude the design so that also the overshoot requirement is satisfied. SUMMARY OF PHASE-LAG DESIGN STEP 1. Choose gain K to satisfy steady-state requirements. STEP 2. Draw Bode-diagram of KG(s). STEP 3. Determine the new crossover frequency ωc. , i.e., the frequency at which the uncompensated
system has phase (- 180o+PM’), PM’ = desired phase margin .
(PM 45o-60o for electro-mechanical, 25o-30o for processes). STEP 4. Decide 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 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 in- volved 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. DESIGN OF PHASE-LEAD COMPENSATOR
Phase-lead compensator, which corresponds to PD controller, is appropriate, when speed is required, because it will speed up the original response. Typical applications are in servos. Transfer function of phase-lead compensators is given by
W sa s
sLead ( ) = ++
11
22
ττ
, a > 1 (4- 1)
Gain at high frequencies
W aLead dB dB( ) ( )∞ = 2 . (4-2)
and at low frequencies
WLead(0) = 1 = 0 dB. (4- 3)
Upper cut-off frequency
ωτu a
= 1
2 (4- 4)
and lower cut-off frequency
ωτl = 1 . (4- 5)
Maximum phase shift φ max of phase-lead compensator
φ max sin ( )=−+
−1 2
2
11
aa
(4- 6)
occurs at frequency
ωτm a
= 1
2. (4- 7)
The value of gain at that frequency is
W a am dB( ) ½ ( )ω = =2 2 (4- 8)
This information is used as design cornerstone! A typical Bode diagram of a phase-lead controller is given in Figure 4.1.
Heikki Koivo
45
Frequency (rad/sec)
Pha
se (
deg)
; Mag
nitu
de (
dB)
Bode Diagrams
0
5
10
15From: U(1)
10-2 10-1 100 1010
10
20
30
40
50T
o: Y
(1)
Fig.4. 1. Bode diagram of a typical phase-led compensator: W sss
( ) = ++
1 51
.
Checking the calculations:
Computingφ max sin ( ) sin ( ) .=−+
=−+
=− −1 2
2
1 011
5 15 1
418aa
at
ωτm a
= = =1 15
02
.45 rad / s holds with the values read from Figure 4.1.
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 a2. Since a2 > 1, this means that W aLead dB dB( ) ( )∞ = 2 is positive, which is clear from Figure 4.1. Let us study more
carefully how much phase margin can be added for various values of a2 .
Parameters a2, 1/2*(a2)dB and φ max Compute a table showing maximum phase φmax of the phase-lead compensator as a function of a2 and also as a function of ½(a2)dB. Here are the MATLAB commands required
» a2=1:.25:10; %Here a2 is computed at intervals of 0.25 »half a2db=0.5*20*log10(a2); »phimax=asin((a2-1)./(a2+1)); %Note dot after the term(a2-1).
Table 4.1. Dependencies of different parameters in phase lead circuit.
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 2 3 4 5 6 7 8 9 100
0.2
0.4
0.6
0.8
1
a2
phim
ax
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
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:
WPD s s( ) = +1 5 (4- 9)
or in MATLAB form
» WPD=tf([5 1],[1]);
The result is displayed in Figure 4.4.
0 2 4 6 8 100
0.2
0.4
0.6
0.8
1
½(a2) (dB)
phim
ax
Heikki Koivo
48
Frequency (rad/sec)
Pha
se (
deg)
; Mag
nitu
de (
dB)
Bode diagram of PD control
0
5
10
15From: U(1)
10-2 10-1 1000
20
40
60
80T
o: Y
(1)
Fig.4. 4. Bode diagram of PD controller WPD s s( ) = +1 5 . For ω > 4 rad/s the PI controller
behaves like the phase-lead compensator of Figure 4.1.
Steps in design of phase-lead compensator
STEP 1. Choose gain K to satisfy steady-state requirements.
STEP 2. Draw Bode-diagram of KG(s).
STEP 3. Determine the new crossover frequency ω
c, i.e.., the frequency at which the uncompensated
system has phase (-180o+PM’), where PM’ = desired phase margin by choosing a few values of a2 starting with a2 =2 and going up to 10-20. Construct a table showing how much this
choice will add to phase margin and also to magnitude. In this way a2 and ωτm a
=1
2 can
be determined. This procedure also reveals if one phase lead circuit is enough. Remember also that the bigger a2 is, the more susceptible it is for noise.
STEP 4.
The new crossover frequency ωc = ωτm a
= 1
2. This determines τ.
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 ss s
( )( . )
=+1
1 0 2. (3- 1)
-
+
Controller System
WLEAD (s)
R(s)R(s) Y(s)Y(s)G s
s s( )
( . )=
+
11 0 2
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
e sE s sG s
R ssss s
= =+→ →
lim ( ) lim (( )
) ( )0 0
11
(4- 10)
Heikki Koivo
50
ess lims 0
[s( 1
1K
s(1 0.2s)
)] 1
s2
0.02
=→ +
+
=
<
K (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 diagram 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)
Frequency (rad/sec)
Pha
se (
deg)
; Mag
nitu
de (
dB)
Bode Diagrams
-40
-20
0
20
40
60From: U(1)
100 101 102-180
-160
-140
-120
-100
-80
To: Y
(1)
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.
STEP 3
Recall that maximum phase shift φ max occurs at ωτm a
=1
2 and that
φ max sin ( )=−+
−1 2
2
11
aa
and
W a am dB( ) ½ ( )ω = =2 2 or phase-lead circuit adds ½ ( )a dB2 in dB:s at the same time as φ maxis added to the original 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, a2 , ½(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 ½(a2)dB phimax(°) magdb w phi(°) phim(°) 2.0 3.0103 19.4712 -3.0 18.4 15.2 34.65 3.0 4.7712 30.0000 -4.5 20.2 13.9 43.9 4.0 6.0206 36.8699 -6.1 22.2 12.7 49.6 5.0 6.9897 41.8103 -6.9 23.3 12.1 53.9 6.0 7.7815 45.5847 -7.7 24.4 11.6 57.2 7.0 8.4510 48.5904 -8.5 25.6 11.1 59.7 8.0 9.0309 51.0576 -9.0 26.3 10.7 61.8 9.0 9.5424 53.1301 -9.7 27.9 10.4 63.5 10.0 10.0000 54.9032 -10.1 28.1 10.1 65.0
How is the above table constructed? Start with the phase-lead compensator. Consider the third row. Give a value for a2, a2 4= , which in dB:s is ( ) ( )a dBdB dB2 4 12= = . Half of that is
½ ( )a dBdB2 6= , which is the value in the second column. On the third column we see the additional phaseφ max = 37° (= 36.86990) of the phase-lead compensator when a2 = 4. Next determine the frequency at which the gain has approximately the value − = −½ ( )a dBdB2 6 , because the effect of phase-lead will add this much to the gain. The 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 =φ mo= 12 7. . 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 369 49 60 0 0 , which is shown in the last column. The phase margin is now enough. STEP 4
Since ωτm a
=1
2 = 22.2 rad/s and a2 4= , we can solve τ:
14
22 4τ
= . or τ = 0.022.
Transfer function of the designed phase-lead network W(s) is
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.
Frequency (rad/sec)
Pha
se (
deg)
; M
agni
tude
(dB
)
Bode Diagrams
-100
-50
0
50
100From: U(1)
100 101 102-180
-160
-140
-120
-100
-80
To: Y
(1)
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
Frequency (rad/sec)
Pha
se (
deg)
; Mag
nitu
de (
dB)
Bode Diagrams
-100
-50
0
50
100From: U(1)
100 101 102-180
-160
-140
-120
-100
-80
To: Y
(1)
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
Time (sec.)
Am
plitu
de
Step Response
0 0.5 1 1.5 2 2.50
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8From: U(1)
To:
Y(1
)
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 phase-lead 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)
Frequency (rad/sec)
Pha
se (
deg)
; Mag
nitu
de (
dB)
Bode Diagrams
0
5
10
15From: U(1)
100 101 1020
10
20
30
40
To: Y
(1)
Fig. 4.10. Bode diagram of phase lead compensator.