Professional Documents
Culture Documents
Contents
1 CONTROL SYSTEM DESIGN III 2 Routh-Hurwitz stability criterion 3 Phase Lead or Lag Compensator 4 DIGITAL CONTROLLER DESIGN 3 5 PID Controller Design 3 10 17 22 56
Bilinear Transformation
Consider integration based on trapezoidal rule.
y(k) y(k-1)
x(k) x(k-1) T
Let the integrated area to k be y (k). Then, using the area to k 1 given by y (k 1), the approximated area under the curve is y (k) = y (k 1) + T [x(k) + x(k 1)] 2
3
= = =
z 1 Y (z ) +
T [X (z ) + z 1 X (z )] 2
)Y (z ) Y (z ) X (z )
T (1 + z 1 )X (z ) 2 T 1 + z 1 2 1 z 1 1 equal to the s
Then, we dene the bilinear transformation, 2 z1 2 1 z 1 = s= . 1 T 1+z T z+1 Since this is a new mapping function between s-domain and z -domain, we use w instead of s. The bilinear transformation denes w-domain as 2 z1 2 1 z 1 = w= , 1 T 1+z T z+1 2 z1 w= T z+1 1+ z= 1
T 2w T 2w
whereas the Laplace s-domain relates to the z -domian by z = esT Both mapping functions make the stable system poles be jz j < 1.
5
MATLAB function for the bilinear transformation is bilinear and corresponding impulse invariant transformation is impinvar. The following program shows the transformation applied to 2 G(s) = (s + 1)(s + 2)
% s-domain: s=2/(s+1)(s+2) z=[]; p=[-1,-2]; T=0.1; K=2; csys=tf(K*poly(z),poly(p)) [numd,dend]=bilinear(K*poly(z),poly(p),1/T) roots(numd) pbl=roots(dend) plot(pbl,[0,0],rx); axis([-1,1,-1,1]); axis square; hold on; [numd,dend]=impinvar(K*poly(z),poly(p),1/T) roots(numd) piv=roots(dend) plot(piv,[0,0],bx); axis([-1,1,-1,1]); axis square; hold on;
The impulse invariant transformation is z G(z ) = 0.0172 (z 0.9048)(z 0.8187) The bilinear transformation is (z 1)2 G(z ) = 0.0043 (z 0.9048)(z 0.8182) The poles are very close to each other, though the zeros are dissimilar. Exercise: Transform the following continuous time system to its Bilinear Transform. Sampling frequency is 10 samples per sec, or T = 0.1. 1 E (s) = s(s + 1)
2 1 ejT T 1 + ejT
T T T
2 ej 2 (ej 2 ej 2 ) = T T T ej T 2 (ej 2 + ej 2 ) 2 T = j tan T 2 = jw Thus, w has a nonlinear relation ship with given by w = 2 T tan . T 2
In the relationship between s-domain and z -domain, z = esT , analog frequency is dened by s = j whereas digital (discrete d jd jT time) frequency d is dened by e =e . Therefore, = . T
This means that one zone of periodic frequency axis produced by sampling, in s-domain, corresponds to 0 w < in the T frequency axis of w-plane. The frequency axis is the imaginary axis j . Therefore, the inside of the unit circle in z -plane is mapped into the entire LHP in the w-plane. Thus, we can see that the Routh-Hurwitz stability criteion becomes applicable if bilinear transformation is applied to a discrete time transfer function in z -transform and converted to w-domain.
10
Test the stability of this closed loop system. Determine the range of K that keeps the system stable. The open loop transfer function is z+1 G(z ) = K . z (z 1) 2 z1 w= T z+1 G(w) = K z+1 z (z 1) 1+ z= 1
T 2w T 2w
z=
1+ T w 2 1 T w 2
11
1+ T 2w +1 T 1 2w K T w 1+ T 1 + 2 2w ( 1) T T 1 2w 1 2w T 1 w 2 K T T (1 + w) w 2 2
w2 w1 w0
2 (T ) 2 T 2 (1
K 0 0
K)
13
bn bn1 c1 d1 . . .
bn2 bn3 c2 d2 . . . c2 =
bn4 bn5 c3 d3 . . .
The number of sign changes in the rst column gives the number of unstable poles.
14
Example An open loop transfer function z+1 G(z ) = K (z 1)2 yields G(w) = K The characteristic equation is T 2 w2 KT w + 2K = 0. w2 w1 w0 T2 KT 2K 2K 0 0 2 Tw (T w)2
15
Since the number of sign changes is 2, this system is always unstable regardless of the value of K . This system is the same as 1 analog system, 2 . So, the unity gain feedback always results in s instability.
16
A discrete time phase lead/lag compensator is designed by using the bilinear transformation that maps the inside of the unit circle in z -plane to the entire LHP of w-plane. The phase lead/lag compensator is designed in w-domain utilizing the techniques available for continuous time compensator design, then map it back to the z -domain by the bilinear transformation. The rst order w-domain compensator is given by analogy to s-domain as w 1+ w0 D(w) = a0 w 1+ wp
17
18
Substituting w = function,
D(z ) =
20
2 +2 2 +2
z0
zp
2 T) 2 T)
z - z0 z - zp
ZOH
G(s)
such that the (open loop) system satises a given phase margin of m 100 so that the (closed loop) system has damping ratio of .
22
Since the frequency response method based on phase margin and gain margin established in the Laplace domain (s-domain) is used here, the frequency response of D(z ) combined with a plant transfer function G(z ) with ZOH must be transformed into w-domain by using the bilinear transformation. Because, the stable region of the z -plane that is the inside of a unit circle, is mapped into the entire LHP (Left Half Plane) of the w-plane. The parameters Kd , z0 and zp of the rst order phase lead/lag compensator are determined in terms of a0 , w0 , wp dened in the w-domain.
23
G(s) )Z s
2. Calculate the frequency response G(ejT ) for 0 T with a proper step size. Record the actual frequncy scale of 0 s = T 3. Calculate corresponding frequency w to the frequencies used to calculate G(ejT ). w = 2 T tan T 2
24
4. Make a frequency response table to help drawing the Bode diagram. . . . jG(ejT )j . . . G(ejT ) . . . w . . .
5. Draw the Bode Diagram, both for jG(ejT )j and G(ejT ) using the frequency scale of w , not . This process is often called as frequency pre-warping.
25
Design Approach
Digital controller design to determine D(z ) by the frequency response method uses phase margin m as a key parameter. Design is to make the phase margin of the open loop trnasfer function D(w)G(w) have a specied phase margin m at a frequency w1 .
26
Finding the new cross-over frequency w1 requires several conditions to be met, and also requires try and error until a satisfactory value is found. We are designing (determining) w w0 D(w) = a0 w 1+ wp 1+ where, a pole is at w = wp and a zero is at w = w0 .
27
28
29
a1 b1
= =
where, = D(jw1 ) = 180 + m G(jw1 ). The DC gain a0 must be known from other criteria such as steady state error ess or DC gain.
30
Verication (check)
1 a0 jG(jw1 )j cos j w1 + a0 ja1 w1 + a0 w1 jG(jw1 )j sin = cos a0 jG(jw1 )j jb1 w1 + 1 w1 + 1 j w1 sin 1 j (1 a0 jGj cos ) + a0 jGj sin jG(jw1 )j j (cos a0 jGj) + sin
D(jw1 ) =
= Thus, D(jw1 )
2
= = =
31
For phase angle, a1 1 + j w1 a0 1 + jb1 jw1 1 a1 w1 tan1 b1 w1 tan a0 1 a1 w1 tan tan1 b1 w1 tan tan a0 a1 1 + tan tan1 w1 tan tan1 b1 w1 a0 a1 w b1 w1 a0 1 a1 1 + w1 b1 w1 a0
D(jw1 )
= =
tan D(jw1 )
32
tan D(jw1 )
2 sin (1 2a0 jGj cos + a2 0 jGj ) = 2 cos (1 2a0 jGj cos + a2 0 jGj ) = tan
33
and
b1 w1
the numerators must be positive as well. 1 a0 jGj cos > 0 and cos a0 jGj > 0
1 > cos > a0 jG(jw1 )j a0 jG(jw1 )j This condition is written for jG(jw1 )j as 1 cos < jG(jw1 )j < a0 a0 cos
35
Thus, cos jG(jw1 )j < , a0 which is more restrictive than the condition derived from the 1 gain, jG(jw1 )j < . a0
36
compensators. Referring to a1 w1 = 1 a0 jGj cos jGj sin and b1 w1 = cos a0 jGj . sin
the numerators must be negative as well. 1 a0 jGj cos < 0 and cos a0 jGj < 0
1 < cos < a0 jG(jw1 )j a0 jG(jw1 )j This condition yields, jG(jw1 )j > Thus, jG(jw1 )j >
38
39
diagram of G(w) alone without being aected by the compensator. First, nd a new crossover frequency w1 where the condition, G(jw1 ) = 180 + m + 5 is satised. 5 accounts for a slight phase angle derease by the phase lag compensator. The rule of thumb to set w0 in the compensators transfer function, w 1+ a1 w + a0 w0 D(w) = a0 w = b1 w + 1 1+ wp is to pick one decade lower than the w1 , i.e. w0 = 0.1 w1 .
41
jD(w1 )j = a0
42
The Bode diagram drawn for w-domain with respect to the frequency axis of w is shown.
43
Magnitude Response 20
Magnitude in dB
20
40
60 1 10
10
50 100
Phase in degrees
10 frequency in rad/s
10
44
Design a phase lag compensator that achieves a phase margin of m = 55 for a0 = 1. G(jw1 ) = 180 + 55 + 5 = 120 By the Bode diagram, w1 0.36. At this frequency jG(jw1 )j = 2.57 = 8.2dB. Therefore, w0 = 0.1 w1 = 0.036 wp = 0.1 w1 = 0.0140 a0 jG(jw1 )j z 0.9982 . z 0.9993
Magnitude Response 20 0
Magnitude in dB
20 40 60 80 1 10
10
50 100
Phase in degrees
10 frequency in rad/s
10
46
cos , a0 where, = D(jw1 ) = 180 + m G(jw1 ) > 0. jG(jw1 )j < The range that the rst condition G(jw1 ) < 180 + m = 125 , w1 > 0.45 according to the Bode diagram (phase). 1 requres w1 > 0.75 from The second condition jG(jw1 )j < a0 the Bode diagram (gain). So, try w1 > 1.2 to see if the third condition is satised. = 180 + m G(jw1 ) > 0. G(jw1 ) = 172.8 . Therefore, = 180 + 55 (172.8) = 47.8 . cos = 0.6709 and a0 jG(jw1 )j = 0.4576. Thus, the third condition is met. Therefore, the choice of w1 1.2 is acceptable for the use of the
48
formula. i.e. w1 = 1.2 Using the formula, a1 = We nd, a1 = 1.7016 and b1 = 0.2397 The parameters of the discrete time domain transfer function of the compensator z z0 D(z ) = Kd z zp are Kd z0 = = wp (w0 T + 2) wp (w0 + a0 = a0 w0 (wp T + 2) w0 (wp + w0 w0 T 2 = w0 T + 2 w0 +
49 2 T 2 T 2 T) 2 T)
and
b1 =
= 6.5230
= 0.9710
zp
w T 2 w p = p wp T + 2 wp +
2 T 2 T
= 0.8111
The frequency response of D(jw )G(jw ) in the w-domain is shown below. This shows that the phase margin was increased. The graph shows increased gain in a high frequency range caused by the phase lead compensator.
50
Magnitude Response 40 20
Magnitude in dB
0 20 40 60 1 10
10
50 100
Phase in degrees
10 frequency in rad/s
10
51
zeroG=[]; poleG=[0, -1, -2]; gainG=2; [zdG, pdG, kdG]=c2dzp(zeroG, poleG, gainG, T); numdG=poly(zdG)*kdG; dendG=poly(pdG); [numW, denW]=z2w(numdG,dendG,T); w=logspace(-1,1,100); jw=j*w; H=polyval(numW,jw)./polyval(denW,jw); mag=20*log10(abs(H)); radians=angle(H); phase=unwrap(radians)*180/pi; subplot(211),semilogx(w,mag,b),grid title(Magnitude Response); xlabel(frequency in rad/s),ylabel(Magnitude in dB); subplot(212),semilogx(w,phase,b),grid title(Phase Response); xlabel(frequency in rad/s),ylabel(Phase in degrees); %bode(kdG*numW, denW, W); print -dps exmpL8_1.ps % Phase lead compensator design a1*w +a0 / b1 w + 1 = a0 (w/(a0/a1) + 1)/(w/(1/b1)+1) Ww=input(Select Omega_w_1=);
53
Phmar=input(Specify Phase margin(+ in degrees)=); a0=input(compensator DC gain a0=) [G,GdB,Ph]=Gpha(numW,denW,Ww) theta=-180+Phmar-Ph theta=theta*pi/180; a1=(1-a0*G*cos(theta))/(Ww*G*sin(theta)) b1=(cos(theta)-a0*G)/(Ww*sin(theta)) % check disp(angle G(j omega_w_1) < -180 + Phmar); Ph -180+Phmar disp(gain G(j omega_w_1) < 1/a0); G 1/a0 disp(cos theta > a0 * gain G(j omega_w_1)); cos(theta) a0*G pause; figure(3); sysW=tf(numW,denW); w0=a0/a1; wp=1/b1; cmsW=tf(a1*[1, w0], b1*[1, wp]);
54
%cmsW=tf(0.014*[1,0.036],0.036*[1,0.014]) ttlW=sysW*cmsW; ttWmin=minreal(ttlW); [numW,denW]=tfdata(ttWmin,v); [G,GdB,Ph]=Gpha(numW,denW,Ww); w=logspace(-1,1,100); jw=j*w; H=polyval(numW,jw)./polyval(denW,jw); mag2=20*log10(abs(H)); radians=angle(H); phase2=unwrap(radians)*180/pi; subplot(211),semilogx(w,mag,k--,w,mag2,b),grid title(Magnitude Response); xlabel(frequency in rad/s),ylabel(Magnitude in dB); subplot(212),semilogx(w,phase,k--,w,phase2,b),grid title(Phase Response); xlabel(frequency in rad/s),ylabel(Phase in degrees); print -dps exmpL8_1c.ps disp(discrete time, z-domain compensator Kd(z-z0)/(z-zp)); Kd=a0*(wp*(w0+2/T))/(w0*(wp+2/T)) z0=(2/T-w0)/(2/T+w0) zp=(2/T-wp)/(2/T+wp)
55
A digital PID (Proportional, Integral and Dierential) controller is given by T z+1 1 D(z ) = KP + KI + KD (1 z 1 ), 2 z1 T whereas an analog PID controller is 1 + KD w w KD w 2 + KP w + KI = w w w (1 + )(1 + ) w1 w2 = KI w From the last expression, we can obtain the frequency response (Bode diagram) of D(w). D(w) = KP + KI
56
PID contoller is widely used as a compensator to stabilize closed-loop systems by adjusting the phase margin and gain margin. Here, we try to primarily adjust the phase margin to a 2 T desired value. Since w = tan , due to the term KD w, T 2 jD(jw )j when,
57
T .
We do not use w =
z1 Tz
prevents the gain of D-action from going to . In another word, the pole at z = 1 is unstable but not the pole at z = 0. We use the following D(w) for the purpose of PID controller design with
58
s s < . 2
1 + KD w. w
tan
1 2 ) + (KD w KI w 1 K K D w I w 1 KP
59
60
= =
jD(jw1 )j (cos + j sin ) 1 (cos + j sin ) jG(jw1 )j 1 cos jG(jw1 )j 1 sin jG(jw1 )j
1 KD w1 < KI w 1 KD w1 > KI w
1
= =
<0 >0
Increasing KD increases bandwidth. Increasing KI decreases steady state error ess provided that the system retains an acceptable gain margin. If the above two conditions are staised, varying KI and KD will change the gain margin, while the phase
61
margin remains unchanged. From the relationship, D(jw1 ) = 180 + m G(jw1 ) = the cross-over frequency w1 must be chosen depending on whether the PID controller should be of leading phase or lagging phase. w1 should be chosen where G(jw1 ) < 180 + m , if leading phase (more D-action than I-action). w1 should be chosen where G(jw1 ) > 180 + m , if lagging phase (more I-action than D-action).
62
PI and PD Controller
Referring to the Bode diagram of PID controller, PID controller increases its gain both at low frequecy and at high frequency. A large gain at low frequency decreases steady state error, ess . A large gain at high frequency may shift the cross-over frequency to a higher frequency causing the decrease of phase margin, but it adds
63
a leading phase up to 90 . A larger gain at high frequency makes the bandwidth wider. The previously described design method for PID controller does not give a unique solution for KI and KD . The PI or PD controller drops D-action or I-action, respectively. In the case where both D-action and I action need not to be present, one can use PI or PD controller for which the solution for KI or KD becomes uniquely determinable. In PID case, KP + j KD w1 KI 1 w1 = 1 (cos + j sin ) jG(jw1 )j
PI controller, < 0
1 1 KP jKI = (cos + j sin ) w1 jG(jw1 )j
64
KP KI
65
PD controller, > 0
KP + jKD w1 1 = (cos + j sin ) jG(jw1 )j 1 cos jG(jw1 )j 1 sin w1 jG(jw1 )j
KP KD
= =
Exact Solutions The digital PID controller 1 T z+1 + KD (1 z 1 ), D(z ) = KP + KI 2 z1 T is mapped to w-domain exactly as D(w) = KP + KI 1 + KD w w T 1+ w 2
66
The solutions derived from 1 D(w) = KP + KI + KD w w s s provided for the actual frequency to be < are 2 approximations. The frequency response is D(jw ) = KP jKI 1 + KD w jw T 1 + jw 2
The real part gives 2 ) cos T KP + = 2 jG(jw1 )j 2 ( )2 + w 1 T The imaginary part gives
2 KD w ( 1
2 2 KD w ( ) 1 sin T KI = 2 w1 jG(jw1 )j 2 ( )2 + w 1 T For PI controller with KD = 0, the equations for KP and KI remain the same as the approximated solutions. However, PD controller gains KD and KP are given as follows. 2 2 2 ( ) + w 1 sin T KD = 2 jG(jw1 )j ( )2 w1 T
68
KP =
cos 2 jG(jw1 )j 2 ( )2 + w 1 T
2 KD w ( 1
2 ) T
69
design a PI controller to have phase margin of 55 at w1 = 0.4. Using the design program below, Kp = 0.4392 and Ki = 0.0040 were found.
70
Magnitude Response 20 0
Magnitude in dB
20 40 60 80 1 10
10
50 100
Phase in degrees
10 frequency in rad/s
10
71
% % Example 8.4 and 8.5 page 317 and 318 % G(s)=1/s(s+1)(0.5s+1)=2/s(s+1)(s+2) % num=2; den=poly([0,-1,-2]); sys=tf(num,den); %-----------------dSys=c2d(sys,0.05,zoh); [dSyszeros,dSyspoles,Ksys,ts]=zpkdata(dSys,v); zeros=[dSyszeros]; poles=[dSyspoles]; num=poly(zeros); den=poly(poles); %-----------------w=logspace(-1,1,100); jw=j*w; H=polyval(num,jw)./polyval(den,jw); mag=20*log10(abs(H)); radians=angle(H); phase=unwrap(radians)*180/pi; subplot(211),semilogx(w,mag,b),grid title(Magnitude Response); xlabel(frequency in rad/s),ylabel(Magnitude in dB);
72
subplot(212),semilogx(w,phase,b),grid title(Phase Response); xlabel(frequency in rad/s),ylabel(Phase in degrees); figure(2); T=0.05; zeroG=[]; poleG=[0, -1, -2]; gainG=2; [zdG, pdG, kdG]=c2dzp(zeroG, poleG, gainG, T); numdG=poly(zdG)*kdG; dendG=poly(pdG); [numW, denW]=z2w(numdG,dendG,T); w=logspace(-1,1,100); jw=j*w; H=polyval(numW,jw)./polyval(denW,jw); mag=20*log10(abs(H)); radians=angle(H); phase=unwrap(radians)*180/pi; subplot(211),semilogx(w,mag,b),grid title(Magnitude Response); xlabel(frequency in rad/s),ylabel(Magnitude in dB); subplot(212),semilogx(w,phase,b),grid title(Phase Response);
73
xlabel(frequency in rad/s),ylabel(Phase in degrees); print -dps exmpL8_5.ps % PID controller design D(w)=Kp + Ki/w + Kd*w Ww=input(Select Omega_w_1=); Phmar=input(Specify Phase margin(+ in degrees)=); [G,GdB,Ph]=Gpha(numW,denW,Ww) theta=-180+Phmar-Ph theta=theta*pi/180; if theta>0 disp(D action > I action); else disp(I action > D action); end Kp=cos(theta)/G type=input(Which do you specify, Ki or Kd? ,s); notOK=1; while(notOK) if (type==Ki | type==ki) Ki=input(Enter value of Ki =); notOK=0; Kd=(sin(theta)/G+Ki/Ww)/Ww else if (type==Kd | type==kd) Kd=input(Enter value of Kd =);
74
notOK=0; Ki=(Kd*Ww-sin(theta)/G)*Ww end end end figure(3); sysW=tf(numW,denW); pidW=tf([Kd,Kp,Ki],[0,1,0]) ttlW=sysW*pidW; ttWmin=minreal(ttlW); [numW,denW]=tfdata(ttWmin,v); w=logspace(-1,1,100); jw=j*w; H=polyval(numW,jw)./polyval(denW,jw); mag2=20*log10(abs(H)); radians=angle(H); phase2=unwrap(radians)*180/pi; subplot(211),semilogx(w,mag,k--,w,mag2,b),grid title(Magnitude Response); xlabel(frequency in rad/s),ylabel(Magnitude in dB); subplot(212),semilogx(w,phase,k--,w,phase2,b),grid title(Phase Response);
75
76
77
Magnitude Response 40 20
Magnitude in dB
0 20 40 60 1 10
10
50 100
Phase in degrees
10 frequency in rad/s
10
78
Assignment No. 6
Work on a series of questions related to the same system in Figure P8-2 (page 329). 1. 8-2 textbook page 328 2. 8-3 textbook page 329 3. 8-10 textbook page 330 4. 8-11 textbook page 330
79