Controller Design
5.1 Cascade Lead-Lag Compensator Design
5.1.2 Lead-Lag Synthesis by Phase Margin Assignment
0 5 10
Magnitude (dB)
10−2 10−1 100 101 102 103 104
−30 0 30
Phase (deg)
Bode Diagram
Frequency (rad/sec)
← lead-lag
← lag-lead
← lag-lead
← lead-lag
Figure 5.10. The Bode diagrams of the lead-lag and lag-lead compensators.
It can be observed that in the phase lead-lag compensator, the phase is positive (lead) before it becomes negative (lag). However, the phase lag action is taken first, followed by the lead action for lag-lead compensator.
In practical applications, the lead-lag compensator is usually used. In what follows, we will show a method for designing a phase lead-lag compensator.
5.1.2 Lead-Lag Synthesis by Phase Margin Assignment
The transfer function of a lead-lag compensator can be written as Gc(s)= Kc(s+ zc1)(s+ zc2)
(s+ pc1)(s+ pc2) , (zc1 ≤ pc1, zc2 ≥ pc2). (5.7) Denote by Kpthe desired static position error constant which is defined as
Kp= lim
s→0Gc(s)G(s) with G(s) the plant model.
If the phase angle of the plant model is φ1(ωc)at the expected crossover frequency ω= ωc, the phase angle of the compensator at ωcshould be φc(ωc)= γ − 180◦− φ1(ωc), where γ is the expected phase margin of the compensated system. The magnitude of the plant model at ωcis denoted by A(ωc). The following synthesis procedure can be used.
Case 1. When φc(ωc) >0, a lead compensation is required which can be designed as α= zc1
pc1 =1− sin φc
1+ sin φc
(5.8)
and
zc1 =√
αωc, pc1 = zc1 pc1 = ωc
√α, Kc=
ω2c+ p2c1
ω2c+ z2c1A(ωc)
. (5.9)
The static position error constant of the system can be obtained as K1= lim
s→0svGo(s)= bm an−v
Kczc1
pc1 , (5.10)
where v is the multiplicity of the pole s= 0 of the plant model G(s) with G(s)= b0sm+ b1sm−1+ · · · + bm−1s+ bm
sv(a0sn−v+ a1sn−v−1+ · · · + an−v+1s+ an−v),
and Go(s)is the open-loop transfer function with the compensator, i.e., Go(s) = Gc(s)G(s).
If K1 ≥ Kp, the designed phase lead compensator is adequate according to the phase margin assignment. Otherwise, a phase lead-lag compensation is required.
Case 2. For phase lead-lag compensation, it is required to further specify zc2 =ωc
10, pc2 =K1zc2
Kp . (5.11)
Case 3. If φc(ωc) <0, the phase lag compensation is expected, and Kc= 1
A(ωc), zc2 = ωc/10, pc2 = K1zc2/Kp, (5.12) where K1= bmKc/an−v.
A MATLAB functionleadlagc()has been written to implement the three cases in the above algorithm:
1 function Gc=leadlagc(G,Wc,Gam_c,Kv,key) 2 G=tf(G); [Gai,Pha]=bode(G,Wc);
3 Phi_c=sin((Gam_c-Pha-180)*pi/180);
4 den=G.den{1}; a=den(length(den):-1:1);
5 ii=find(abs(a)<=0); num=G.num{1}; G_n=num(end);
6 if length(ii)>0, a=a(ii(1)+1); else, a=a(1); end;
7 alpha=sqrt((1-Phi_c)/(1+Phi_c)); Zc=alpha*Wc; Pc=Wc/alpha;
8 Kc=sqrt((Wc*Wc+Pc*Pc)/(Wc*Wc+Zc*Zc))/Gai; K1=G_n*Kc*alpha/a;
9 if nargin==4, key=1;
10 if Phi_c<0, key=2; else, if K1<Kv, key=3; end, end
11 end
12 switch key
13 case 1, Gc=tf([1 Zc]*Kc,[1 Pc]);
14 case 2, Kc=1/Gai; K1=G_n*Kc/a; Gc=tf([1 0.1*Wc],[1 0.1*K1*Wc/Kv]);
15 case 3
16 Zc2=Wc*0.1; Pc2=K1*Zc2/Kv; Gcn=Kc*conv([1 Zc],[1,Zc2]);
17 Gcd=conv([1 Pc],[1,Pc2]); Gc=tf(Gcn,Gcd);
18 end
The syntax of the function is Gc=leadlagc(G,ωc,γ,Kp,key), where G is the LTI (linear time-invariant) object of the plant model, ωcis the expected crossover frequency, γ is the expected phase margin of the compensated system, and Kp is the static position error constant. If keyis provided, the controller will be designed according to the type specified inkeywithkey= 1, 3, 2 for Cases 1, 2, 3, respectively, discussed in the above.
Ifkeyis not provided, the controller structure will be selected automatically. The returned Gcis the transfer function object of the compensator.
Example 5.3. Consider the plant model in Example 5.1. Different phase margins are as-signed with the crossover frequency at ωc= 100 rad/sec. The corresponding compensators can be designed using the following MATLAB statements:
>> G=tf(100,[0.04,1,0]); wc=100; f1=figure; f2=figure;
for gamma=[30,40,50,60,70,80,90]
Gc=leadlagc(G,wc,gamma,10); G_o=Gc*G; G_c=feedback(G_o,1);
figure(f1), bode(G_o), hold on;
figure(f2), step(G_c,0.1), hold on end
The Bode diagrams of the systems under some different γ ’s can be obtained as shown in Figure 5.11(a), and it can be seen that the phase margins of the compensated systems are consistent with the predefined values. The closed-loop step responses of the systems are shown in Figure 5.11(b), where it can be seen that when the specified phase margin increases, the step response is improved in terms of a smaller overshoot. However, for this example, if the phase margin is specified too large, for instance, 80◦ ∼ 90◦, the system responses are not satisfactory. Because the integrator gives a 90◦phase lag, the bandwidth has to be reduced considerably to obtain the high phase margin, and the result is a slow response.
This illustrates that the program needs to be used with a good physical understanding and will not give results for poor assumptions. In this example, a good compensator can be designed, when setting γ = 70◦, as
Gc(s)= 13.4708s+ 30.61 s+ 326.7.
Now, let us fix the specified phase margin to γ = 70◦ and change the values of the crossover frequencies ωc. The Bode diagrams and closed-loop step responses of the compensated systems are compared in Figures 5.12(a) and (b), respectively, by using the following MATLAB statements:
>> G=tf(100,[0.04,1,0]); gamma=70; f1=figure; f2=figure;
for wc=[50,100,200,300,500]
Gc=leadlagc(G,wc,gamma,10); G_o=Gc*G; G_c=feedback(G_o,1);
figure(f1), bode(G_o), hold on;
figure(f2), step(G_c,0.1), hold on end
Clearly, the overshoots under different ωc’s are almost the same. However, when ωc in-creases, the step response becomes faster.
Example 5.4. Consider the transfer function of the plant model given by
G(s)= 100
s(s+ 1)(0.0125s + 1).
Set the crossover frequency at ωc= 50 rad/sec and assign the expected phase margin of the compensated system to γ = 50◦. The compensator Gccan be designed by calling in the leadlagc()function. The Nichols charts of the systems before and after compensation
−150
(a) Bode diagrams comparison
0 0.02 0.04 0.06 0.08 0.1
(b) step response comparison
Figure 5.11. The effect of the desired phase margin γ .
−150
(a) Bode diagrams comparison
0 0.02 0.04 0.06 0.08 0.1
(b) step response comparison
Figure 5.12. The effect of the desired crossover frequency ωc.
are compared in Figure 5.13(a) using the following MATLAB statements:
>> s=zpk(’s’); G=100/(s*(s+1)*(0.0125*s+1));
Gc=leadlagc(G,50,50,100); zpk(Gc), G1=Gc*G;
nichols(G,G1); grid; axis([-360,0,-40,40])
The controller designed is
Gc(s)= 368.8908(s+ 3.997) s+ 625.5 .
From the Nichols chart, the closed-loop uncompensated system is unstable. By introducing the lead compensator, at high frequencies, the Nichols chart is kept away from the M= 1dB contour, which not only makes the closed-loop compensated system stable, but also ensures a rather good time domain response of the compensated system.
To get an even larger phase margin by using the lead compensator, for instance, γ = 60◦at ωc = 80 rad/sec, a new design result can be obtained by using the following
−360 −315 −270 −225 −180 −135 −90 −45 0
Figure 5.13. Nichols charts for different controllers.
MATLAB statements:
>> Gc=leadlagc(G,80,60,100); zpk(Gc)
G2=G*Gc; nichols(G,G2), grid; axis([-360,0,-40,40]) [G1,P1,w1,w2]=margin(G2); [G1,P1,w1,w2]
The controller is now
Gc(s)=722.4022(s+ 10.02) s+ 638.5 .
It is found that the gain and phase margins are 5.5430, 31.4323◦at frequencies 211.1766, and 80 rad/sec, respectively. The Nichols charts of the systems are shown in Figure 5.13(b).
The actual phase margin under this newly designed controller is γ = 28.28◦, which is, surprisingly, well below the expected γ = 90◦. It can be seen that although the system is stabilized, the closed-loop behavior of the compensated system may not be very good, due to the poor Nichols charts. Therefore, the prespecified phase margin of 90◦ cannot be met and the requirements are too demanding for the implementation under a lead-lag compensation.
Similarly, if one wishes to achieve a phase margin of γ = 50◦and, at the same time, to have a crossover frequency at ωc= 100 rad/sec, the following MATLAB statements can be used:
>> Gc=leadlagc(G,100,50,100); zpk(Gc)
G3=G*Gc; nichols(G,G3), grid; axis([-360,0,-40,40]) [G1,P1,w1,w2]=margin(G3); [G1,P1,w1,w2]
The controller is designed as
DGc(s)=1698.7153(s+ 9.424) s+ 1061 ,
and the actual gain and phase margins are 6.3204, 28.4655◦at frequencies 274.3693 and 100 rad/sec, respectively. The Nichols charts are shown in Figure 5.14(a). Once more, it can be seen that the prespecified properties of the desired system cannot be achieved. Therefore, the
−360 −315 −270 −225 −180 −135 −90 −45 0
(b) step response comparison
Figure 5.14. System responses comparisons.
controller design objective is overspecified. The closed-loop step responses of the systems under the three compensators designed in the above are compared in Figure 5.14(b), with the following MATLAB statements:
>> step(feedback(G1,1),feedback(G2,1),feedback(G3,1),0.3);
It can be seen that the closed-loop response comparison agrees with the analysis performed earlier from the Nichols charts.
In fact, even if the expected crossover frequency ωcand the phase margin γ are both assigned, the compensator designed using the approach given above may not guarantee a compensated system satisfying all the specifications. Moreover, the closed-loop system may not be even stable with the designed compensator. The closed-loop behavior of the system should be examined before the controller can be used in practice.
Other lead-lag compensator design approaches, such as the root locus method, will not be discussed in this book.