Topic #15 16.30/31 Feedback Control Systems State-Space Systems • Closed-loop control using estimators and regulators. • Dynamics output feedback • “Back to reality” • Reading: FPE 7.6 Fall 2010 16.30/31 15–2 Combined Estimators and Regulators • Now evaluate stability and/or performance of a controller when K designed assuming u(t) = −Kx(t) but implemented as u(t) = −Kx̂(t) • Assume we have designed a closed-loop estimator with gain L x̂˙(t) = (A − LC)x̂(t) + Bu(t) + Ly(t) ŷ(t) = Cx̂(t) • The closed-loop system dynamics are given by: ẋ(t) x̂˙(t) y(t) ŷ(t) u(t) = = = = = Ax(t) + Bu(t) (A − LC)x̂(t) + Bu(t) + Ly(t) Cx(t) Cx̂(t) −Kx̂(t) • Which can be compactly written as: �� � � � � A −BK x˙ (t) x(t) = ⇒ ẋcl (t) = Acl xcl (t) ˙ x̂(t) x̂(t) LC A − BK − LC • This does not look too good at this point – not even obvious that the closed-system is stable. λi(Acl ) =?? November 5, 2010 Fall 2010 16.30/31 15–3 • Can fix this problem by introducing a new variable x̃ = x − x̂ and then converting the closed-loop system dynamics using the similarity transformation T �� � � � � I 0 x(t) x(t) x̃cl (t) � = = T xcl (t) x̂(t) x̃(t) I −I • Note that T = T −1 • Now rewrite the system dynamics in terms of the state x̃cl (t) Acl ⇒ T Acl T −1 � Ācl • Since similarity transformations preserve the eigenvalues we are guaranteed that λi(Acl ) ≡ λi(Ācl ) • Work through the math: � �� �� � I 0 A −BK I 0 Ācl = I −I LC A − BK − LC I −I � �� � A −BK I 0 = A − LC −A + LC I −I � � A − BK BK = 0 A − LC • Because A¯cl is block upper triangular, we know that the closed-loop poles of the system are given by det(sI − Ācl) � det(sI − (A − BK)) · det(sI − (A − LC)) = 0 November 5, 2010 Fall 2010 16.30/31 15–4 • Observation: Closed-loop poles for this system consist of the union of the regulator poles and estimator poles. • So we can just design the estimator/regulator separately and com­ bine them at the end. • Called the Separation Principle. • Keep in mind that the pole locations you are picking for these two sub-problems will also be the closed-loop pole locations. • Note: Separation principle means that there will be no ambiguity or uncertainty about the stability and/or performance of the closed-loop system. • The closed-loop poles will be exactly where you put them!! • And we have not even said what compensator does this amazing accomplishment!!! November 5, 2010 Fall 2010 16.30/31 15–5 The Compensator • Dynamic Output Feedback Compensator is the combination of the regulator and estimator using u(t) = −Kx̂(t) x̂˙(t) = (A − LC)x̂(t) + Bu(t) + Ly(t) ⇒ x̂˙(t) = (A − BK − LC)x̂(t) + Ly(t) u(t) = −Kx̂(t) • Rewrite with new state xc(t) ≡ x̂(t) ẋc(t) = Acxc(t) + Bcy(t) u(t) = −Ccxc(t) where the compensator dynamics are given by: Ac � A − BK − LC , Bc � L , Cc � K • Note that the compensator maps sensor measurements to actuator commands, as expected. • Closed-loop system stable if regulator/estimator poles placed in the LHP, but compensator dynamics do not need to be stable. λi(A − BK − LC) =?? November 5, 2010 Fall 2010 16.30/31 15–6 • For consistency with the implementation of classical controllers, define the compensator transfer function as Gc(s) = Cc(sI − Ac)−1Bc so that u(t) = −Gc(s)y(t) • Note that it is often very easy to provide classical interpretations (such as lead/lag) for the compensator Gc(s). • Can implement this compensator with a reference command r(t) using feedback on e(t) = r(t) − y(t) rather than just −y(t) r e − Gc(s) u Gp(s) y ⇒ u(t) = Gc(s)e(t) = Gc(s)(r(t) − y(t)) • Still have u(t) = −Gc(s)y(t) if r(t) = 0. • So now write state space model of the compensator as ẋc(t) = Acxc(t) + Bce(t) u(t) = Ccxc(t) • Intuitively appealing setup because it is the same approach used for the classical control, but it turns out not to be the best approach ⇒ More on this later. November 5, 2010 Fall 2010 16.30/31 15–7 Mechanics • Basics: e(t) = r(t) − y(t), Gc(s) : u(t) = Gce(t), y(t) = Gu(t) ẋc(t) = Acxc(t) + Bce(t) , G(s) : ẋ(t) = Ax(t) + Bu(t) • Loop dynamics L(s) = G(s)Gc(s) ⇒ u(t) = Ccxc(t) , y(t) = Cx(t) y(t) = L(s)e(t) ẋ(t) = Ax(t) +BCc xc(t) ẋc(t) = +Ac xc(t) +Bce(t) � L(s) :⇒ ẋ(t) ẋc(t) � � A BCc �� x(t) xc(t) 0 Ac � � � � x(t) y(t) = C 0 xc(t) = � � + 0 Bc � e(t) • To “close the loop”, note that e(t) = r(t) − y(t), then � �� � � � � �� � �� � � x(t) A BCc ẋ(t) x(t) 0 = + r(t) − C 0 ẋc(t) xc(t) Bc xc(t) 0 Ac � �� � � � A BCc x(t) 0 = + r(t) xc(t) Bc −BcC Ac � � � � x(t) y(t) = C 0 xc(t) • Acl is not exactly the same as on page 15-2 because we have re­ arranged where the negative sign enters into the problem. Same result though. November 5, 2010 Fall 2010 16.30/31 15–8 Scaling DOFB Compensator • DOFB = Dynamic Output Feedback • Assume that the closed-loop system has been written for the system on 15-6, then it is still possible that the DC gain of the response from r to y is not unity • Scalar input/output assumed for now • Need to scale the closed-loop to fix this using r ⇒ N r • Closed-loop dynamics are ẋcl (t) = Acl xcl (t) + Bcl N r(t) y(t) = Ccl xcl (t) • So to have the TF of y/u have unity gain at DC, must have � �−1 N = − Ccl (Acl )−1Bcl November 5, 2010 Fall 2010 16.30/31 15–9 Simple Compensator Example • Let G(s) = 1/(s2 + s + 1) with state-space model given by: � � � � � � 0 1 0 A= , B= , C= 1 0 , D=0 1 −1 −1 • Design the regulator to place the poles at s = −4 ± 4j � � λi(A − BK) = −4 ± 4j ⇒ K = 31 7 • Regulator pole time constant τc = 1/ζωn ≈ 1/4 = 0.25 sec • Put estimator poles with faster time constant τe ≈ 1/10 • Use real poles, so Φe(s) = (s + 10)2 � �−1 � � C 0 L = Φe(A) CA 1 ⎛� � �2 � � �⎞ � �−1 � � 0 1 0 1 100 0 1 0 0 ⎠ = ⎝ + 20 + 1 −1 −1 −1 −1 0 100 0 1 � �� � � � 99 19 0 19 = = 1 80 −19 80 November 5, 2010 Fall 2010 16.30/31 15–10 • Compensator: Ac = � A − BK −� LC � � � � � � 0 1 0 � 19 � − = 31 7 − 1 0 1 80 −1 −1 � � −19 1 = −112 −8 � Bc = L = 19 80 � � � Cc = K = 31 7 1 2 3 4 5 6 7 a=[0 1;−1 −1];b=[0 1]';c=[1 0];d=0; k=acker(a,b,[−4+4*j;−4−4*j]); l=acker(a',c',[−10 −10]')'; % % For state space for G c(s) % ac=a−b*k−l*c;bc=l;cc=k;dc=0; • Compensator transfer function: Gc(s) = Cc(sI − Ac)−1Bc � = 1149 U E s + 2.553 s2 + 27s + 264 • Note that the compensator has a low frequency real zero and two higher frequency poles. • Thus it looks like a “lead” compensator. November 5, 2010 Fall 2010 16.30/31 15–11 Fig. 1: Simple plant – compensator ∼ lead 2–10 rads/sec. Fig. 2: Loop transfer function L(s) shows the slope change near ωc = 5 rad/sec. Note that we have a large PM and GM. November 5, 2010 Fall 2010 16.30/31 15–12 Fig. 3: Freeze compensator poles and zeros; look at root locus of closed- loop poles versus an additional loop gain (nominally α = 1.) Fig. 4: Closed-loop transfer function. November 5, 2010 Fall 2010 Code: Dynamic Output Feedback Example 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 % Combined estimator/regulator design for a simple system % G= 1/(sˆ2+s+1) % Jonathan How % Fall 2010 % %close all;clear all set(0,'DefaultLineLineWidth',2) set(0,'DefaultFigureColor','None') set(0,'DefaultlineMarkerSize',8);set(0,'DefaultlineMarkerFace','b') set(0, 'DefaultAxesFontSize', 12);set(0, 'DefaultTextFontSize', 12); % a=[0 1;−1 −1];b=[0 1]';c=[1 0];d=0; k=acker(a,b,[−4+4*j;−4−4*j]); l=acker(a',c',[−10 −11]')'; % % For state space for G c(s) % ac=a−b*k−l*c;bc=l;cc=k;dc=0; 19 20 21 G=ss(a,b,c,d); Gc=ss(ac,bc,cc,dc); 22 23 24 25 f=logspace(−1,2,400); g=freqresp(G,f*j);g=squeeze(g); gc=freqresp(Gc,f*j);gc=squeeze(gc); 26 27 28 29 30 31 32 33 34 35 36 figure(1);clf;orient tall subplot(211) loglog(f,abs(g),f,abs(gc),'−−');axis([.1 1e2 .02 1e2]) xlabel('Freq (rad/sec)');ylabel('Mag') legend('Plant G','Compensator Gc','Location','East'); grid subplot(212) semilogx(f,180/pi*angle(g),f,180/pi*angle(gc),'−−'); axis([.1 1e2 −200 50]) xlabel('Freq (rad/sec)');ylabel('Phase (deg)');grid 37 38 L=g.*gc; 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 figure(2);clf;orient tall subplot(211) loglog(f,abs(L),[.1 1e2],[1 1]);axis([.1 1e2 .2 1e2]) xlabel('Freq (rad/sec)');ylabel('Mag') legend('Loop L'); grid subplot(212) semilogx(f,180/pi*phase(L.'),[.1 1e2],−180*[1 1]); axis([.1 1e2 −290 0]) xlabel('Freq (rad/sec)');ylabel('Phase (deg)');grid % % loop dynamics L = G Gc % al=[a b*cc;zeros(2) ac]; bl=[zeros(2,1);bc]; cl=[c zeros(1,2)]; dl=0; figure(3) rlocus(al,bl,cl,dl) % % closed−loop dynamics % unity gain wrapped around loop L % acl=al−bl*cl;bcl=bl;ccl=cl;dcl=d; % % scale closed−loop to get zero SS error N=inv(ccl*inv(−acl)*bcl) 67 68 69 70 71 72 73 74 75 hold on;plot(eig(acl),'d','MarkerFaceColor','b');hold off grid on axis([−25 5 −15 15]) % % closed−loop freq response % Gcl=ss(acl,bcl*N,ccl,dcl*N); gcl=freqresp(Gcl,f*j);gcl=squeeze(gcl); 76 November 5, 2010 16.30/31 15–13 Fall 2010 77 78 79 80 81 82 16.30/31 15–14 figure(4);clf loglog(f,abs(g),f,abs(gcl),'−−'); axis([.1 1e2 .01 1e2]) xlabel('Freq (rad/sec)');ylabel('Mag') legend('Plant G','closed−loop G {cl}');grid title(['Factor of N=',num2str(round(1000*N)/1000),' applied to Closed loop']) 83 84 85 figure(5);clf margin(al,bl,cl,dl) 86 87 88 89 90 91 figure(1);export figure(2);export figure(3);export figure(4);export figure(5);export fig fig fig fig fig reg reg reg reg reg est1 est2 est3 est4 est5 −pdf; −pdf; −pdf; −pdf; −pdf; 92 93 94 95 96 97 98 99 100 101 102 103 figure(6);clf % new form on 16−7 bcl=[−b;−b]; N=inv(ccl*inv(−acl)*bcl) Gnew=ss(acl,bcl*N,ccl,dcl*N); [yorig,t]=step(Gcl,2.5); [ynew]=step(Gnew,t); plot(t,yorig,t,ynew);setlines(2); legend('Original','New');grid on ylabel('Y');xlabel('Time (s)') figure(6);export fig reg est6 −pdf; November 5, 2010 Fall 2010 16.30/31 15–15 Mag 8·14·20 Fig. 5: Example #1: G(s) = (s+8)(s+14)(s+20) 0 10 G Gc −1 0 10 10 1 10 Freq (rad/sec) 2 10 3 10 Phase (deg) 50 0 −50 −100 G Gc −150 −200 −1 10 0 10 1 10 Freq (rad/sec) 2 10 3 10 Loop L Mag 0 10 −2 10 −1 10 0 10 1 10 Freq (rad/sec) 2 10 3 10 Phase (deg) 0 −50 −100 −150 −200 −250 −1 10 November 5, 2010 0 10 1 10 Freq (rad/sec) 2 10 3 10 Fall 2010 16.30/31 15–16 8·14·20 Fig. 6: Example #1: G(s) = (s+8)(s+14)(s+20) Bode Diagram Gm = 11 dB (at 40.4 rad/sec) , Pm = 69.7 deg (at 15.1 rad/sec) Magnitude (dB) 50 0 −50 −100 Phase (deg) −150 0 −90 −180 −270 −360 −1 10 0 10 1 10 Frequency (rad/sec) 2 3 10 10 2 10 Plant G Gcl unscaled Gcl scaled 1 Mag 10 0 10 −1 10 −2 10 −1 10 November 5, 2010 0 10 1 10 Freq (rad/sec) 2 10 3 10 Fall 2010 16.30/31 15–17 8·14·20 Fig. 7: Example #1: G(s) = (s+8)(s+14)(s+20) Root Locus 150 0.7 0.56 0.42 0.28 0.14 140 120 100 100 0.82 80 Imaginary Axis 0.91 60 50 40 0.975 20 0 20 0.975 40 −50 0.91 60 80 −100 0.82 100 120 0.7 0.56 −150 −150 0.42 −100 0.28 0.14 −50 140 0 50 100 Real Axis Root Locus 25 0.86 0.76 0.64 0.5 0.34 0.16 20 0.94 15 Imaginary Axis 10 0.985 5 50 0 40 30 20 10 −5 −10 0.985 −15 0.94 −20 0.86 −25 −50 −45 −40 0.76 −35 −30 0.64 −25 −20 Real Axis 0.5 −15 0.34 −10 0.16 −5 0 � – closed-loop poles, � -- Plant poles, � – Plant zeros, � – Compensator poles, � – Compensator zeros • Two compensator zeros at -21.54±6.63j draw the two lower frequency plant poles further into the LHP. • Compensator poles are at much higher frequency. • Looks like a lead compensator. November 5, 2010 Fall 2010 16.30/31 15–18 Mag 0.94 Fig. 8: Example #2: G(s) = s2 −0.0297 0 10 G Gc −1 0 10 10 1 10 Freq (rad/sec) 2 10 3 10 Phase (deg) 50 0 −50 −100 G Gc −150 −200 −1 10 0 10 1 10 Freq (rad/sec) 2 10 3 10 Loop L Mag 0 10 −2 10 −1 10 0 10 1 10 Freq (rad/sec) 2 10 3 10 Phase (deg) 0 −50 −100 −150 −200 −250 −1 10 November 5, 2010 0 10 1 10 Freq (rad/sec) 2 10 3 10 Fall 2010 16.30/31 15–19 0.94 Fig. 9: Example #2: G(s) = s2 −0.0297 Bode Diagram Gm = 11.8 dB (at 7.41 rad/sec) , Pm = 36.6 deg (at 2.76 rad/sec) Magnitude (dB) 50 0 −50 −100 Phase (deg) −150 −135 −180 −225 −270 −2 10 −1 0 10 1 2 10 10 Frequency (rad/sec) 3 10 10 2 10 Plant G Gcl unscaled Gcl scaled 1 Mag 10 0 10 −1 10 −2 10 −1 10 November 5, 2010 0 10 1 10 Freq (rad/sec) 2 10 3 10 Fall 2010 16.30/31 15–20 0.94 Fig. 10: Example #2: G(s) = s2 −0.0297 Root Locus 15 0.7 0.82 Imaginary Axis 10 0.56 0.42 0.28 0.14 0.91 5 0.975 20 0 17.5 15 12.5 10 7.5 5 2.5 −5 0.975 −10 0.91 0.82 −15 −20 0.7 0.56 −15 0.42 −10 0.28 0.14 −5 0 5 Real Axis 2 Root Locus 2 0.64 0.76 0.5 0.34 0.161.75 1.5 1.5 1.25 0.86 1 1 0.75 Imaginary Axis 0.94 0.5 0.5 0.985 0.25 0.985 0.25 0 −0.5 0.5 0.94 −1 0.75 1 0.86 1.25 −1.5 0.76 0.64 −2 −2 −1.5 1.5 0.5 −1 0.34 0.161.75 −0.5 20 Real Axis 0.5 1 1.5 2 � – closed-loop poles, � -- Plant poles, � – Plant zeros, � – Compensator poles, � – Compensator zeros • Compensator zero at -1.21 draws the two lower frequency plant poles further into the LHP. • Compensator poles are at much higher frequency. • Looks like a lead compensator. November 5, 2010 Fall 2010 16.30/31 15–21 Mag 8·14·20 Fig. 11: Example #3: G(s) = (s−8)(s−14)(s−20) 0 10 G Gc −1 0 10 10 1 10 Freq (rad/sec) 2 10 3 10 Phase (deg) 50 0 −50 −100 G Gc −150 −200 −1 10 0 10 1 10 Freq (rad/sec) 2 10 3 10 Loop L Mag 0 10 −2 10 −1 10 0 10 1 10 Freq (rad/sec) 2 10 3 10 Phase (deg) 0 −50 −100 −150 −200 −250 −1 10 November 5, 2010 0 10 1 10 Freq (rad/sec) 2 10 3 10 Fall 2010 16.30/31 15–22 8·14·20 Fig. 12: Example #3: G(s) = (s−8)(s−14)(s−20) Bode Diagram Gm = −0.9 dB (at 24.2 rad/sec) , Pm = 6.67 deg (at 35.8 rad/sec) Magnitude (dB) 50 0 −50 −100 −150 −200 −135 Phase (deg) −180 −225 −270 −315 −360 −1 10 0 1 10 2 3 10 10 Frequency (rad/sec) 4 10 10 2 10 Plant G Gcl unscaled Gcl scaled 1 Mag 10 0 10 −1 10 −2 10 −1 10 November 5, 2010 0 10 1 10 Freq (rad/sec) 2 10 3 10 Fall 2010 16.30/31 15–23 8·14·20 Fig. 13: Example #3: G(s) = (s−8)(s−14)(s−20) Root Locus 200 0.76 0.64 0.5 0.34 0.16 150 100 0.64 0.5 0.34 −100 −50 Real Axis 150 0.86 Imaginary Axis 100 0.94 50 0.985 250 0 200 50 −50 0.985 −100 0.94 −150 0.86 0.76 −200 −250 −200 −150 0.64 0.76 20 0.5 0.34 50 100 150 0.16 20 15 15 0.86 Imaginary Axis 0 Root Locus 25 25 10 0.16 10 0.94 5 5 0.985 0 −5 0.985 −10 5 0.94 10 −15 0.86 −20 0.76 0.64 −25 −25 −20 15 20 0.5 −15 0.34 −10 0.16 −5 250 Real Axis 5 10 15 20 25 � – closed-loop poles, � -- Plant poles, � – Plant zeros, � – Compensator poles, � – Compensator zeros • Compensator zeros at 3.72±8.03j draw the two higher frequency plant poles further into the LHP. Lowest frequency one heads into the LHP on its own. • Compensator poles are at much higher frequency. • Not sure what this looks like. November 5, 2010 Fall 2010 16.30/31 15–24 (s−1) Mag Fig. 14: Example #4: G(s) = (s+1)(s−3) 0 10 G Gc −1 0 10 10 1 10 Freq (rad/sec) 2 10 3 10 Phase (deg) 50 0 −50 −100 G Gc −150 −200 −1 10 0 10 1 10 Freq (rad/sec) 2 10 3 10 Loop L Mag 0 10 −2 10 −1 10 0 10 1 10 Freq (rad/sec) 2 10 3 10 Phase (deg) 0 −50 −100 −150 −200 −250 −1 10 November 5, 2010 0 10 1 10 Freq (rad/sec) 2 10 3 10 Fall 2010 16.30/31 15–25 (s−1) Fig. 15: Example #4: G(s) = (s+1)(s−3) Bode Diagram Gm = −3.4 dB (at 4.57 rad/sec) , Pm = −22.4 deg (at 1.41 rad/sec) Magnitude (dB) 20 0 −20 −40 −60 Phase (deg) −80 −120 −150 −180 −210 −2 10 −1 0 10 1 2 10 10 Frequency (rad/sec) 3 10 10 2 10 Plant G Gcl unscaled Gcl scaled 1 Mag 10 0 10 −1 10 −2 10 −1 10 November 5, 2010 0 10 1 10 Freq (rad/sec) 2 10 3 10 Fall 2010 16.30/31 15–26 (s−1) Fig. 16: Example #4: G(s) = (s+1)(s−3) Root Locus 50 50 0.64 0.5 0.38 0.24 0.12 40 40 0.76 30 30 0.88 20 Imaginary Axis 20 10 0.97 10 0.97 10 0 −10 −20 −30 20 0.88 30 −40 0.76 40 0.64 −50 −50 0.5 −40 −30 0.38 0.64 0.76 8 500 −20 −10 Real Axis 0.5 0.34 10 20 0.16 8 6 6 0.86 Imaginary Axis 0.12 Root Locus 10 10 4 0.24 4 0.94 2 2 0.985 0 −2 0.985 −4 2 0.94 4 −6 0.86 −8 0.76 0.64 −10 −10 −8 6 8 0.5 −6 0.34 −4 0.16 −2 100 Real Axis 2 4 6 8 10 � – closed-loop poles, � -- Plant poles, � – Plant zeros, � – Compensator poles, � – Compensator zeros • Compensator zero at -1 cancels the plant pole. Note the very unstable compensator pole at s = 9!! • Needed to get the RHP plant pole to branch off the real line and head into the LHP. • Other compensator pole is at much higher frequency. • Note sure what this looks like. November 5, 2010 Fall 2010 16.30/31 15–27 B747 DOFB • The previous B747 controller assumed full state feedback - would like to extend that now to consider output feedback using the output of the washout filtered yaw rate – e • To place the estimator poles, take the approach of just increasing the frequency of the LQR closed-loop poles by a factor of 2: λd(Aest) = 2 × λ(Alqr ) • Then use pole placement to determine the estimator gains place.m 1 2 3 4 5 6 Gp=WashFilt*sys*H; set(Gp, 'statename', {'xwo' 'beta' 'yaw rate' 'roll' 'phi' 'xa'}); set(Gp, 'inputname', {'rudder inputs' 'aileron'},... 'outputname', {'filtered yaw rate' 'bank angle'}); [Ap,Bp,Cp,Dp]=ssdata(Gp); [Klqr,S,Elqr]=lqr(Ap,Bp(:,1),Cp(1,:)'*Cp(1,:),0.1) 7 8 9 Eest=real(Elqr)*2+2*imag(Elqr)*sqrt(−1); Kest=place(Ap',Cp(1,:)',Eest);Kest=Kest'; • Note the transposes on the A and C here in the place command • Yields the gains � � Lest = −31.500 5.2985 −7.854 −122.6895 121.7798 54.858 • Much larger that LQR gains because the poles are moving further November 5, 2010 Fall 2010 16.30/31 15–28 • Now form DOFB compensator as before: 1 2 3 4 5 6 7 8 na=size(Ap,1); % Form compensator and closed−loop % see 15−5 ac=Ap−Bp(:,1)*Klqr−Kest*Cp(1,:);bc=Kest;cc=Klqr;dc=0; Gc=ss(ac,bc,cc,dc); % see 15−7 acl=[Ap Bp(:,1)*cc;−bc*Cp(1,:) ac];bcl=[zeros(na,1);bc];ccl=[Cpbeta,zeros(1,na)];dcl=0; Gcl=ss(acl,bcl,ccl,dcl); • Consider the DOFB compensator for this system – it is 6th order because the augmented plant is (4+1+1) – Gc pole-zero map and closed-loop poles shown 3 Gc zeros Gc poles 2 1 0 −1 −2 −3 −5 −4 −3 −2 −1 0 Root Locus 3 2 Imaginary Axis 1 0 −1 −2 −3 −5 −4 −3 −2 Real Axis November 5, 2010 −1 0 Fall 2010 16.30/31 15–29 • Now consider the time response again to an initial perturbation in β: 1 OL LQR Gain DOFB 0.8 0.6 0.4 β 0.2 0 −0.2 −0.4 −0.6 −0.8 −1 0 5 10 15 Time 20 25 30 • Time response looks good – perhaps even better than LQR, but note that is not inconsistent as this DOFB might be using more control effort, and LQR balances that effort with the state cost 1 LQR x2 2 DOFB x LQR u2 DOFB u2 0.9 0.8 x2 and u2 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 2 4 6 Time November 5, 2010 8 10 Fall 2010 Code: B747 LQR, Estimator and DOFB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 % B747 lateral dynamics % Jonathan How, Fall 2010 % working from Matlab Demo called jetdemo clear all;%close all % A=[−.0558 −.9968 .0802 .0415; .598 −.115 −.0318 0; −3.05 .388 −.4650 0; 0 0.0805 1 0]; B=[ .00729 0; −0.475 0.00775; 0.153 0.143; 0 0]; C=[0 1 0 0; 0 0 0 1];D=[0 0; 0 0]; sys = ss(A,B,C,D); set(sys, 'inputname', {'rudder' 'aileron'},... 'outputname', {'yaw rate' 'bank angle'}); set(sys, 'statename', {'beta' 'yaw rate' 'roll rate' 'phi'}); [Yol,Tol]=initial(ss(A,B,[1 0 0 0],zeros(1,2)),[1 0 0 0]',[0:.1:30]); [V,E]=eig(A) % % CONTROL − actuator dynamics are a lag at 10 actn=10;actd=[1 10]; % H(s) in notes H=tf({actn 0;0 1},{actd 1;1 1}); % tau=3;washn=[1 0];washd=[1 1/tau]; % washout filter on yaw rate WashFilt=tf({washn 0;0 1},{washd 1;1 1}); % Gp=WashFilt*sys*H; set(Gp, 'statename', {'xwo' 'beta' 'yaw rate' 'roll' 'phi' 'xa'}); set(Gp, 'inputname', {'rudder inputs' 'aileron'},... 'outputname', {'filtered yaw rate' 'bank angle'}); [Ap,Bp,Cp,Dp]=ssdata(Gp); [Klqr,S,Elqr]=lqr(Ap,Bp(:,1),Cp(1,:)'*Cp(1,:),0.1);rifd(Elqr) % % gain feedback on the filter yaw rate figure(1);clf rlocus(Ap,Bp(:,1),−Cp(1,:),0); sgrid([.1 .2 .3 .4],[.7 .8 .9 1]);grid on;axis([−1.4 .1 −1.2 1.2]) Kgain=−2; Egain=eig(Ap−Bp(:,1)*Kgain*Cp(1,:));rifd(Egain) hold on;plot(Egain+eps*sqrt(−1),'bd');hold off export fig b747 lqr1 −pdf 44 45 46 47 48 Cpbeta=[0 1 0 0 0 0]; % performance output variable Ggain=ss(Ap−Bp(:,1)*Kgain*Cp(1,:),Bp,Cpbeta,0); xp0=[0 1 0 0 0 0]'; [Ygain,Tgain]=initial(Ggain,xp0,Tol); %' 49 50 51 52 53 54 55 figure(2);clf srl(ss(Ap,Bp(:,1),Cp(1,:),0)); sgrid([.1 .2 .3 .4],[.7 .8 .9 1]) axis([−1.25 1.25 −1.25 1.25]);grid on hold on;plot(Elqr+eps*sqrt(−1),'bd');hold off export fig b747 lqr2 −pdf 56 57 58 59 60 61 62 63 64 % close the LQR loop Acl=Ap−Bp(:,1)*Klqr; Bcl=Bp(:,1); % choose output to just state beta and control u Ccl=[Cpbeta;Klqr]; Dcl=[0;0]; Glqr=ss(Acl,Bcl,Ccl,Dcl); [Y,T]=initial(Glqr,xp0,Tol); %' 65 66 67 68 69 70 71 72 figure(3);clf plot(Tol,Yol,T,Y(:,1),Tgain,Ygain);axis([0 30 −1 1]); setlines(2) legend('OL','LQR','Gain') ylabel('\beta');xlabel('Time') grid on export fig b747 lqr3 −pdf 73 74 % estimator poles made faster by jfactor November 5, 2010 16.30/31 15–30 Fall 2010 75 76 77 jfactor=2.05; Eest=jfactor*Elqr; Kest=place(Ap',Cp(1,:)',Eest);Kest=Kest'; 78 79 80 81 82 83 84 85 86 87 88 89 90 na=size(Ap,1); % Form compensator and closed−loop % see 15−5 ac=Ap−Bp(:,1)*Klqr−Kest*Cp(1,:);bc=Kest;cc=Klqr;dc=0; Gc=ss(ac,bc,cc,dc); % see 15−7 acl=[Ap Bp(:,1)*cc;−bc*Cp(1,:) ac]; bcl=[zeros(na,1);bc]; % choose output to be state beta and control u ccl=[Cpbeta,zeros(1,na);zeros(1,na) cc]; dcl=[0;0]; Gcl=ss(acl,bcl,ccl,dcl); 91 92 93 94 95 96 97 98 99 100 figure(5);clf [p,z]=pzmap(Gc(1,1)); plot(z+sqrt(−1)*eps,'mo','MarkerFace','m') hold on plot(p+sqrt(−1)*eps,'bs','MarkerFace','b') hold off legend('Gc zeros','Gc poles','Location','NorthWest') grid on;axis([−5.5 .5 −3 3]) export fig b747 lqr5 −pdf 101 102 103 104 105 106 107 108 109 110 111 112 113 114 figure(4);clf rlocus(Gp(1,1)*Gc);axis([−5.5 .5 −3 3]) hold on [p,z]=pzmap(Gp(1,1)); plot(p+sqrt(−1)*eps,'rx','MarkerFace','r') plot(z+sqrt(−1)*eps,'ro','MarkerFace','r') [p,z]=pzmap(Gc(1,1)); plot(p+sqrt(−1)*eps,'mx','MarkerFace','m') plot(z+sqrt(−1)*eps,'mo','MarkerFace','m') p=eig(acl); plot(p+sqrt(−1)*eps,'bd') hold off export fig b747 lqr4 −pdf 115 116 117 % initial comp at zero [Ycl,Tcl]=initial(Gcl,[xp0;xp0*0],Tol); %' 118 119 120 121 122 123 124 125 figure(3);clf plot(Tol,Yol,T,Y(:,1),Tgain,Ygain,Tcl,Ycl(:,1));axis([0 30 −1 1]); setlines(2) legend('OL','LQR','Gain','DOFB') ylabel('\beta');xlabel('Time') grid on export fig b747 lqr3a −pdf 126 127 128 129 130 131 132 133 134 135 figure(6);clf plot(T,Y(:,1).ˆ2,Tcl,Ycl(:,1).ˆ2,T,Y(:,2).ˆ2,Tcl,Ycl(:,2).ˆ2); axis([0 10 0 1]); hold off setlines(2) legend('LQR xˆ2','DOFB xˆ2','LQR uˆ2','DOFB uˆ2') ylabel('xˆ2 and uˆ2');xlabel('Time') grid on export fig b747 lqr3b −pdf November 5, 2010 16.30/31 15–31 Fall 2010 16.30/31 15–32 Satellite Control Design • Simple system model – goal is to point payload device (J2 = 0.1) using torque inputs on the larger spacecraft (J1 = 1) • Sensor is star tracker on payload (angle), and actuator is torque applied to spacecraft • Can form the state space model using the state x = [ θ2 θ̇2 θ1 θ̇1 ]T • Plant: Gp(s) = 10bs + 10k , k = 0.1 and b = 0.005 s2(s2 + 11bs + 11k) • Rigid body part easily controlled using a lead, such as 3s + 1 Klead(s) = 1.5 s+5 2 2 10 10 Mag Mag Loop L 0 10 Plant G Compensator Gc −1 10 0 1 10 −2 10 2 10 0 10 10 −1 0 10 1 10 Freq (rad/sec) 10 2 10 Freq (rad/sec) 200 Phase (deg) Phase (deg) 0 100 0 −100 −200 −1 10 0 1 10 2 10 −100 −200 −300 −1 10 0 10 1 10 Freq (rad/sec) 10 Freq (rad/sec) Root Locus 3 3 0.5 0.38 0.28 0.17 0.08 2.5 0.64 2 2 1.5 0.8 1 1 0.94 Imaginary Axis 0.5 0 0.5 0.94 −1 1 0.8 1.5 −2 2 0.64 2.5 0.5 −3 −2 November 5, 2010 0.38 −1.5 0.28 −1 0.17 −0.5 Real Axis 0.08 30 0.5 1 2 10 Fall 2010 16.30/31 15–33 • So problems with this “non-collocated” control is apparent – the flex­ ible modes are driven unstable by the lead controller • The problem with the lightly damped poles is that the loop phase changes very rapidly – get wrong departure angle for the root locus. • Can improve the design using notch filtering • The notch has a lightly damped zero pair at a frequency just below the resonant frequency of the system, resulting in a rapid phase change, but in the opposite direction. • Result is that the departure angle now to the left, not the right. • Fixes instability problem - but damping of the resonant pole is quite limited – need to find a better location for the notch zeros. 2 2 10 10 Mag Mag Loop L 0 10 0 10 Plant G Compensator Gc −1 10 0 1 10 −2 10 2 10 10 −1 0 10 1 10 Freq (rad/sec) 10 2 10 Freq (rad/sec) Phase (deg) Phase (deg) 0 200 100 0 −100 −200 −1 10 0 1 10 −100 −200 −300 2 10 −1 10 0 10 1 10 Freq (rad/sec) 10 Freq (rad/sec) Root Locus 3 3 0.5 0.38 0.28 0.17 0.08 2.5 0.64 2 2 1.5 0.8 1 1 Imaginary Axis 0.94 0.5 0 0.5 0.94 −1 1 0.8 1.5 −2 2 0.64 2.5 0.5 −3 −2 November 5, 2010 0.38 −1.5 0.28 −1 0.17 −0.5 Real Axis 0.08 30 0.5 1 2 10 Fall 2010 16.30/31 15–34 • Lets try to do it using DOFB – nothing particularly complicated here in the weights 1 2 3 4 5 6 7 8 9 kk=0.1;bb=0.05*sqrt(kk/10);J1=1;J2=0.1; a=[0 1 0 0;−kk/J2 −bb/J2 kk/J2 bb/J2;0 0 0 1;kk/J1 bb/J1 −kk/J1 −bb/J1];na=size(a,1); b=[0 0 0 1/J1]';c=[1 0 0 0];d=0; k=lqr(a,b,c'*c,.1); l=lqr(a',c',b*b',.01);l=l' % % For state space for G c(s) % ac=a−b*k−l*c;bc=l;cc=k;dc=0; • Look at the resulting DOFB controller - × are the plant poles; • are the compensator zeros; × are the compensator poles Root Locus 3 0.78 0.64 0.5 0.34 0.18 2.5 0.87 Imaginary Axis 2 1.5 0.94 1 0.985 0.5 4 0 3.5 3 2.5 2 1.5 1 0.5 −0.5 0.985 −1 −4 −3.5 −3 −2.5 −2 −1.5 Real Axis −1 −0.5 0 • So the DOFB controller puts zeros right near the plant poles – similar to the notch filter – ensures that the departure angle of the poles is to the left, not the right, so all the poles are stabilized. • Appears to achieve much higher levels of damping in that pole than the classical/notch filter design did. November 5, 2010 Fall 2010 16.30/31 15–35 2 2 10 10 Mag Mag Loop L 0 10 Plant G Compensator Gc −1 0 10 1 10 −2 10 2 10 0 10 10 −1 0 10 1 10 Freq (rad/sec) 2 10 10 Freq (rad/sec) 200 Phase (deg) Phase (deg) 0 100 0 −100 −200 −1 10 0 1 10 2 10 −100 −200 −300 −1 10 0 10 10 Bode Diagram Gm = 1.87 dB (at 1.89 rad/sec) , Pm = 11.6 deg (at 1.49 rad/sec) 10 100 Magnitude (dB) Plant G closed−loop Gcl 1 10 Mag 2 10 Freq (rad/sec) Factor of N=1 applied to Closed loop 2 1 10 Freq (rad/sec) 0 −100 −200 0 10 −300 0 Phase (deg) −90 −1 10 −180 −270 −360 −2 10 −1 10 0 1 10 10 Freq (rad/sec) November 5, 2010 2 10 −450 −2 10 −1 10 0 1 10 10 Frequency (rad/sec) 2 10 3 10 Fall 2010 16.30/31 15–36 DOFB Summary • Separation principle gives a very powerful and simple way to develop a dynamic output feedback controller • Note that the designer now focuses on selecting the appropriate reg­ ulator and estimator pole locations. • Once those and the implementation architecture (i.e., how refer­ ence input is applied, as on 15–5) are set, the closed-loop response is specified. • Can almost consider the compensator to be a by-product. • The examples show that the design process is extremely simple. November 5, 2010 MIT OpenCourseWare http://ocw.mit.edu 16.30 / 16.31 Feedback Control Systems Fall 2010 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.