EEE83 hapter #4 EEE83 Linear ontroller Deign and State Space nalyi Deign of control ytem in tate pace uing Matlab. ontrollabilty and Obervability.... State Feedback ontrol... 5 3. Linear Quadratic Regulator (LQR)... 9 4. Open loop and cloed loop etimator... Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk /9
EEE83. ontrollability and Obervability (Review) tate pace ytem i completely obervable if the rank of the obervability matrix (M o ) M O n i n (n i the ytem order). Thi implie that thi matrix contain n linearly independent row or column vector. (that i the matrix M o i non-ingular having non-zero determinant). If the rank of thi matrix M o i le than n then the ytem i unobervable. To check if the ytem i obervable or not in Matlab we ue the command rank(obv()). The anwer i the rank of the obervability matrix M o which hould be n for the ytem to be obervable. Example 4.: x x u heck if the following tate pace ytem i y 3 x obervable. in the lecture note we can check the ytem obervability by checking the determinant of the obervability matrix M o a follow: 3 3 MO MO. Which mean that the matrix 6 6 M o i ingular and the ytem i unobervable. If we want to ue Matlab: >> =[- ; -]; >> =[3 ]; >> rank(obv()) an = Thi mean that the rank of the obervability matrix i and ince the ytem order n= then the ytem i unobervable. Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk /9
EEE83 tate pace ytem i completely controllable if the rank of the n controllability matrix (M c ) M i n (n i the ytem order). Thi implie that thi matrix contain n linearly independent row or column vector. (that i the matrix Mc i non-ingular having nonzero determinant). If the rank of thi matrix M c i le than n then the ytem i uncontrollable. To check if the ytem i controllable or not in Matlab we ue the command rank(ctrb()). The anwer i the rank of the controllability matrix M c which hould be n for the ytem to be controllable. Example 4.: x x u heck if the following tate pace ytem i y 3 x controllable. in the lecture note we can check the ytem controllability by checking the determinant of the controllability matrix M c a follow: 4 4 M M. Which mean that the matrix M c i ingular and the ytem i uncontrollable. If we want to ue Matlab: >> =[- ; -]; =[ ]'; >> rank(ctrb()) an = Thi mean that the rank of the controllability matrix i and ince the ytem order n = then the ytem i uncontrollable. Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk 3/9
EEE83 Example 4.3: x x u y x Show that the following ytem 3 minimal realiation. >> clear all >> =[- ; -];=[ ]';=[3 ]; >> rank(ctrb()) an = >> rank(obv()) an = i. State Feedback ontrol In tate pace ytem we can have two kind of feedback; the output and the tate feedback (we will only tudy the tate feedback method): r ontroller u Dx dt x y x The tak of the controller i to produce the appropriate control ignal u that will inure that y=r. Let aume the implet form of control: u t K R t Kx t where K and K are appropriately elected gain vector/matrice. The exact dimenion of thee vector will be defined later. The cloed loop ytem tate pace model can be decribed by the following equation: Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk 4/9
EEE83 L L x t x t r t y t x t D u t L L where r= the ytem i called regulator. L K L K L DK DL DK are the cloed loop matrice. If The cloed loop tate matrix L i a function of K therefore by appropriate changing K we can change the eigenvalue of L which mean that we can improve the ytem performance i.e. to make it fater/table. Thi method i called pole placement. WE MUST HEK IF THE SYSTEM IS ONTROLLLE. Example 4.4: ume that we have an RL circuit with R=4 ohm and L=.5H and x()=.5 L R I V Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk 5/9
EEE83 If we want to make the ytem fater then we can ue a tate feedback control trategy. The new ignal u i -Kx Thi implie that L R K eigenvalue at L R K 6R/L then L R K L K L R K. The new ytem ha an L (EXTLY a before). If we want to place the eigenvalue at - R 6 K 5R : L Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk 6/9
EEE83 Example 4.5: ume x 3x u (untable ytem) x()=. We ue a tate feedback controller u kx which implie that the loed Loop (L) tate equation i x 3 kx hence the eigenvalue of the L ytem i 3-k. If we want the L eigenvalue at - (table and very fat) then k=3: Open loop ytem x'=3x Integrator Scope Gain 3 loed loop ytem u=-kx x' x Integrator Scope 3 K -3 3 Untable output..4.6.8 time Stable time.5..4.6.8 time Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk 7/9
EEE83 Example 4.6: x Find the eigenvalue of t xt u 3 4. If the ytem i untable yt xt create a controller that will tabilie the ytem. Find the repone if x()=[ ] T. >> clear all >> =[ ;3 4];=[ ]';=[ ]; >> eig() an = -.373 5.373 The eigenvalue are: -.373 5.373. Hence we need to create a feedback controller to tabilie the ytem. efore that we need to check if the ytem i controllable?? >> rank(ctrb()) an = Hence the ytem i controllable and I can then ue a tate feedback controller uing a pole placement trategy. Our tak i to find the gain vector K that will be ued in the tate feedback control law to place the cloed loop eigenvalue at and. In Matlab we can ue the command K=place([ ])to find K. ume that we want to place the cloed loop pole at - and - then we can ue >> K=place([- -]) K = 6. 7. Thi mean that K 6 7 Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk 8/9
EEE83 State Integrator Output ve State Integrator Output ve -K 6 x 5 4 tate 3.5.5.5 3 3.5 4 4.5 5 time Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk 9/9
EEE83 3 x.5 Output.5.5.5.5.5 3 3.5 4 4.5 5 time.5.5 State -.5 - -.5 - -.5-3.5.5.5 3 3.5 4 4.5 5 time.5 -.5 Output - -.5 - -.5-3.5.5.5 3 3.5 4 4.5 5 time Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk /9
EEE83 Example 4.7 5 5 T =[ ] D= Deired cloed loop location: P=[-5 -+j --j] (x()=[ ]) >> =[- -5-5; ; ]; =[ ]'; =[ ]; D=; >> eig() an = -5. +.i -5. -.i -. Stable but not very fat!! To make the ytem fater we ue a tate feedback law but we need firt to check controllability: >> rank(ctrb()) Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk /9
EEE83 an = 3 >> K=place([-5 -+j --j]) K =.e+3 *.5.975 8.75 Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk /9
EEE83 Example 4.8 with a non zero input: The overall block diagram i: RK u=rk -Kx R K -KX Dx dt x y -K 5 5 T =[ ] D= (x()= 3 ). Find the open loop tep repone then deign a pole placement controller with pole located at -- and -3. OL tep repone (u=): >> =[- -5-5; ; ];=[;;]; >> rank(ctrb()) Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk 3/9
EEE83 an = 3 >> K=place([- - -3]) K =.e+3 *.4.875 4.75 The value of K i.e. the value that we need to get a teady tate of i found after trial and error: K =6 then: loed loop ytem R Step K K*R U Integrator X Gain5 Scope KX ve Gain6 ve K Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk 4/9
EEE83 3. Linear Quadratic Regulator (LQR) What i the correct location of the pole i.e. a compromie between peed and energy (or control effort) that we ue? Tak: Deign a controller (called LQR) u T T i going to minimie: Kx for x x u uch a it J x Qx u Ru dt where Q and R are poitive definite matrice. Q: Importance of the error R: Importance of the energy that we ue. Uing Matlab: [K P E]=lqr(Q R). E matrix give the eigenvalue of -K and K i the tate feedback control gain. You can then imulate the LQR a a normal tate feedback control with a gain of K. Example 4.9: Find K the eigenvalue of -K and the repone of the ytem for R= and Q=eye() and Q=*eye() (x()=[ ]). >> =[ ; -]; =[;]; R=; Q=eye(); Q=*eye(); >> rank(ctrb()) an = >> [KPE]=lqr(QR) K =.. Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk 5/9
EEE83 P =.... E = -. -. >> [KPE]=lqr( QR) K = 3.63 3.63 P = 3.63 3.63 3.63 3.63 E = -. -3.63 Integrator Scope ve K Scope Integrator Scope3 ve K Scope5 State Repone Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk 6/9
EEE83 Q Q Q Q -Kx -Kx State State Input U (Energy) Q i fater but more energy i needed. So we can ee that U ha increaed when we increaed Q to give fater repone. Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk 7/9
EEE83 4. Etimating Technique Open loop etimator: u u + + x dt x y x Plant u + + x ~ ~ x dt X ~ Y ~ Etimator The error between the etimated and real tate i e t x t x t e t x t x t x t u t t x t u t e t e t loed loop etimator: If we ue the error between the actual and the etimated output y yand feed thi ignal back into the etimator we form a cloed loop etimator. Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk 8/9
EEE83 U U + + X dt X Y X Y + - Y ~ Plant G U + + -+ X ~ dt X ~ Y ~ X ~ Etimator e t x t x t G x t x t e t Ge t G e Hence by appropriately chooing G we can force the error to converge to zero very fat. If G i deigned uch that converge aymptotically toward xt. G i table then xt will ut the ytem mut be obervable!! State etimator can be deigned if and only if the obervability condition i atified. How to check the performance of the etimation proce?? We can ue different method to meaure the etimation error. Here we will ue quantitie to ae the etimation performance of the etimator: the abolute etimation error and the Integral bolute of the etimation Error (IE). Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk 9/9
EEE83 The abolute etimation error for each tate i: e t x t x t i= n. for i i i The Integral bolute of the etimation Error (IE) i: for a nd order ytem: IE n i i e t dt o IE i e t dt e t dt e t dt x t ~ x t dt x t ~ x t i dt Example 4.: Ue an open loop etimator to etimate the tate of the tate pace ytem 6 3 given by 3 4 x T auming that the initial condition of the etimated tate vector i ~ x.95.95 T. Find the Integral bolute of the etimation Error (IE) and plot the abolute tate etimation error (ume u(t)=). Deign a cloed loop etimator for the ytem auming that the etimator pole are located at - -5. Find the Integral bolute of the etimation Error (IE) and plot the abolute tate etimation error in thi cae then deign a tate feedback control with pole at -4-6. Original ytem: State Repone Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk /9
EEE83 Output Repone Open loop etimator: I=[ ] Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk /9
EEE83 Gain7 Integrator Gain8 Scope Gain6 ve I=[.95.95] In Out In Error calculation Scope5 Thi i meaurement of the etimation error Integral bolutr Error (IE).68 Gain Integrator3 Gain Scope3 IE Gain9 ve Error calculation: e ~ x x t t t bolute etimation error In In u b u b Scope Scope4 Integrator Integrator4 IE e ~ x x t t t e ~ x x t t e x t t t ~ x t IE=.68 (Scope ) (Scope 4) loed loop etimator: Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk /9
EEE83 Firt we need to check obervability!! >> =[ ;- -6];=[;3];=[3 4]; >> rank(obv()) an = Hence the ytem i obervable. Then we can deign an etimator for that ytem. To locate the pole of the etimator at - -5 ( and ) we need to find G. In Matlab we can ue the command G=place( [ ]) to find G where ( and ) are the eigenvalue of G >> G=place(''[- -5])' G =.9355 -.456 Gain7 Integrator Gain8 Scope G Gain ve In Out In Error calculation Scope5 Thi i meaurement of the etimation error Gain Integrator3 Gain Scope3.589 IE Gain ve Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk 3/9
EEE83 e x t ~ x t e x t t t ~ x IE=.589 t y deigning a cloed loop etimator we can have better error dynamic (etimation error converge to zero very fat) and hence le IE compared to the open loop etimator cae. Then by properly chooing G the cloed loop etimator provide better etimation performance than the open loop etimator. Deign a tate feedback controller with pole located at -4-6 uing the open loop and cloed loop etimator. >> eig() an = -.354-5.6458 We need to check if the ytem i ontrollable?? >> rank(ctrb()) an = Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk 4/9
EEE83 Then the ytem i controllable. To find the K matrix for the tate feedback control we ue the command place: >> K=place([-4-6]) K =.557.488 Sytem+OL etimator+controller U Integrator ve Scope In IE u b.54 Integrator IY Thi i meaurement of the peed that the ytem converge (Decay Rate) Integrator3 In Error calculation Scope3 Scope5 Thi i meaurement of the etimation error Integral bolutr Error (IE).68 IE ve -KX~ Gain -K Output repone Original ytem Sytem+OL etimator+ontroller Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk 5/9
EEE83 Sytem+L etimator+controller u Integrator Scope u b Integrator IY.7 G ve In Out In Error calculation Scope5 Thi i meaurement of the etimation error Thi i meaurement of the peed that the ytem converge (Decay Rate) Integrator3 Scope3.589 IE ve -KX~ -K To check which ytem how better output repone we ue IY (Integral abolute of the output) that give a meaure of the peed of convergence (decay rate). Small value how fat convergence and hence better performance. Output repone Sytem+L etimator+ontroller Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk 6/9
EEE83 Exercie: 3 x t x t u 4 yt xt heck the tability of the tate pace ytem:. Simulate the tate pace ytem and plot the output repone auming u(t)= and x()=[ ] T. Deign a cloed loop etimator with pole located at -5-6. Simulate the ytem with the cloed loop etimator auming T x. 95. Find the Integral bolute of the etimation Error (IE) and plot the abolute tate etimation error. If the ytem i untable create a tate feedback controller that will tabilie the ytem. Sugget a proper location for the cloed loop pole of the control ytem. G 699 59 K 5. 33. 66 Now imulate the overall ytem with the tate feedback controller and the cloed loop etimator then plot the output repone before and after compenation. Find the Integral bolute of the Output IY for each cae. Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk 7/9
EEE83 Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk 8/9 State Space nalyi and ontroller Deign EEE83 Tutorial Exercie IV. ytem i decribed by 5 I it table? Find the ytem repone (x()= x ()=) and hence crocheck your anwer. Stabilie the ytem uing a pole placement controller. Place the pole of the controller at -5-6. Simulate the cloed loop ytem and ketch the output repone.. Repeat exercie for 5. 3. ytem i decribed by 5 I it table? Find the ytem repone (x()= x ()=) and hence crocheck your anwer. Ue a tate feedback controller that will locate the cloed loop pole at --. Plot the output repone. Ue a tate feedback controller that will locate the cloed loop pole at -3-5. Plot the output repone. Plot the ignal -Kx in the previou cae. What do you notice? Deign an LQR for the ytem with the following pecification R Q. Find the new eigenvalue and plot the output repone in thi cae and Kx ignal
EEE83 Module Leader: Dr Damian Giaouri - damian.giaouri@ncl.ac.uk 9/9 Deign another LQR for the ytem with the following pecification R Q. Find the new eigenvalue and plot the output repone in thi cae and Kx ignal 4. Repeat quetion 3 for 5 5. ytem i decribed by 5. Find the ytem repone (x()= x ()=) and comment on the output ignal. (ume u(t)=) Ue an open loop etimator to etimate the tate when the initial condition of the etimated tate vector i T.99 ~ x. Plot the abolute etimation error for each tate and the Integral bolute of the etimation Error (IE). Deign a tate feedback controller uing the above etimator to locate the pole of the cloed loop ytem at [- -6] then create another controller to locate the pole at [-.5-3]. Simulate the overall ytem in each cae and comment on your reult. 6. Ue a cloed loop etimator for 5. Place the pole of the etimator at [- -]. Plot the abolute etimation error for each tate and the Integral bolute of the etimation Error (IE). 7. reate different pole placement control trategie and then ue the above etimator: One with deired cloed loop pole at [-5-6] One with deired cloed loop pole at [-5-6]. Which control law i more appropriate? omment on your reult. 8. Repeat quetion 6 when 5.