Sunteți pe pagina 1din 23

332: 505 Control Theory I Project Report Spring 2012 Sy-Min Chueng (a1)

The nonlinear differential equation of motion is given by


m d 2 x(t ) dt 2 = I 2 (t ) h 2 (t ) mg = ( I 0 + i (t )) 2 ( h0 + x(t ))2 mg

The linearized system F around equilibrium points defined by h0 and I 0 , is given by d 2 x t f f = x t i t 2 x x0 i x0 dt I0 I0

F =m where f =

I 2 t mg 2 x t

F=

f f x0 x t it x I0 i x0 I0

I2 f x0 =k x =2 0 x I0 h3 0 I2 f x0 =k x =2 0 i I0 h3 0 The linearized system is then,


m d 2 x(t ) dt
2

= k x x(t ) + kii (t ),

k x = 2

2 I0 3 h0

, ki = 2

I0
2 h0

(a2) The equation


m d 2 x(t ) dt
2

= k x x(t ) + kii (t ),

k x = 2

2 I0 3 h0

, ki = 2

I0
2 h0

can be written in state space form

[ ][

0 x1 = k x x2 m

0 x1 k i u t 0 x2 m

][ ] [ ]

y=[ 1 0 ] x 1 x2

[]

With the system parameters : 0=0.000011258 [N / A2 ] 2 A p=0.000146 m h 0=0.0005086 m m=0.3 kg N =0.3 kg =1.6437E-6 A set point controller with a constant disturbance has the form x = AxBuGd y=Cx The goal is to have y reach the desired value at steady state. Define e= y y ref where yref = ydesired t= e d d =e t= y t y ref dt

The matrix can be rewritten as A [x ]=[C 0][ xx ][ 0 ]u[G ]d [ y0 ] 0 B 0


1 2 ref

Where the state space metric are given by

A=

0 1 3 1.335710 0

B=

0 [2.940]

C=[0 2.940] and

D= 0 0

[]

Defined the new matrices


Aavg=[A zeros(2,1); C 0] Bavg=[0; B]

we need to find a linear feedback u=k x =k 1 xk 2 such that (Aavg-Bavg*K) is asymptotically stable. The eigenvalue can be placed by using the matlab function.
>>K=place(Aavg,Bavg, lambda_avg) >>K1 = K(1:1,1:2); K2= K(1:1, 3:3)

[]

Matlab/Simulink

Figure 1 The block diagram of the setpoint controller is shown in Figure 1.

2 The initial condition of the system x0, is x0= 2 Figure 2.

[ ] , and a disturbance is applied at t = 40 as in

Figure 2 When the eigenvalues are chosen to be in Figure 3 ABK = [2 3 4] the output waveform is shown

Figure 3 The system quickly reaches the desired value, y = 5. At time= 40, we see a spike but the system recovers to its desired value at about time = 44.

We can also show that the larger the eigenvalues, the faster the system reach its steady state. In Figure 4, the eigenvalues are changed to ABK = [10 11 12] .

Figure 4 The amplitude of the spike is smaller and the system is faster, but it introduces more noise.

(a3) In this problem, the disturbance is a piecewise constant signal. Figure 5 shows two periods of a square pulse. Since the eigenvalues ABK = [2 3 4] from part (a2) is fast enough for the time interval of 10, we can use it.

Figure 5

Figure 6 Figure 6 shows the output waveform. It makes sense because at t=10, there is a change in input from 0 to 2000. The system then quickly settles to its steady value. At t=20, there is another change in input but this time from 2000 to 0. That is why we see the output signal goes to negative. In fact the output swing is between y desired y swing =5183.74

(2) The Proton Exchange Membrane (PEM) Fuel Cell Linearized Model state space matrices are given by
0 10.9544 0 83.74458 0 0 24.05866 6.30908 0 161.083 0 0 51.52923 0 18.0261 0 18.7858 0 46.3136 0 275.6592 0 0 158.3741 0 0 0 17.3506 193.9373 0 0 0 A= 1.299576 0 2.969317 0.3977 38.7024 0.105748 0 0 0 38.02522 5.066579 479.384 0 0 0 16.64244 0 450.386 0 0 142.2084 0 80.9472 0 0 4.621237 0 0 0 0 51.2108 2.02257 B T = [ 0 0 0 3.946683 0 0 0 0]

0 0 0 5.066579 116.446 0 0 0 C= 0 0 0 0 1 0 0 0 12.96989 10.32532 0.56926 0 0 0 0 0

D=[ 0 0 0] The control variable u(t) = is the compressor motor voltage. Full Order Observer The system state space equations have the form x =AxBu y=CxD u Using the above parameters, the system matrices are set to >> A= A; B=B; C = C; D= zeros(3,1) The Observer is implemented as x t= AKC x tB u t K y t A KC t[B K ] u t x y t

[ ]

with the observation error e t = x t t x In Simulink the observer state space block is specified as >> Aobs = A-K*C; Bobs = [B K]; Cobs=eye(0); Dobs=zeros (8 , 4) From the separation principle, we set the observer and system poles separately. The observer should be much faster than the system, thus, we must obtain the state feedback gain first. The state feedback gain F is obtained by minimizing the quadratic cost function

J u= x T Q xu T R u dt
0

This can be done by using the Matlab function F = LQR(A,B,Q,R) Where Q and R are weighting matrices. The Q should have the same dimension as A, and R should have the same number of column as B. Here the Q is an 8x8 identity matrix and R is just 1. Now we know what our feedback matrix F is we need to decide the observer gain. We first obtain the closed-loop eigenvalue of the systematic _system=(A-BF) >>eig(A-B*F) and we have _system=[ -219.6262 -89.4856 -46.1853 -22.4040 -18.6275 -3.0975 -1.6615 -1.3908] we can simply make the observer eigenvalues 10 times bigger _observer = [ -2196.262 -894.856 -461.853 -224.040 -186.275 -30.975 -16.615 -13.908] and use the pole placement design to obtain observer gain. >>K= place (A',C',lambda_observer)' The initial condition of the system x0 is set to x0=[1 1 1 1 1 1 1 1]T

The least square solution for the initial condition of full order observer is x =C T C 1 C T y 0 even though CT*C does not have full rank, a generalized inverse can be applied here, we have >>y0=C*x0; >>x0hat=pinv(C'*C)*C'*y0; x0hat=[1.0712 0.8528 -0.0470 1.0000 1.0000 0 0 0]

To evaluate the optimal performance criterion loss due to the use of the full-order observer , we compute the Jloss , which is given by 1 J loss= e T 0 P 22 e 0 2 The matrix P has the form P=

P11 P
T 12

P 12 P 22

P11 can be obtain by solving P 11 ABF ABF T P 11R1F T R2 F =0 If we use the optimal feedback gain F =R1 BT P 11 , 2
>> [F,P11]=lqr(A,B,R1,R2)

P12 has an unique solution that equals zero. And P22 can be solved through P 22 A KC A KC T P 22P 11 B R1 BT P11 =0 2 >> P22 = lyap(A-K*C, P11*B*R2^-1*B'*P11) The performance criterion under the observer-driven optimal control is given by
1 T 1 T 1 T J opt = x 0 P 11 x 0 e 0 P 22 e 0= tr { P 22 e 0 e 0 } 2 2 2

To avoid the dependence on initial condition 1 J loss= tr { P 22 }=16.4171 2 and 1 J opt = tr { P }=43.2777 2 hence 1 1 J opt = tr { P } tr { P 22 }=43.277716.4171=59.6948 2 2 and compare it with the corresponding full-state, we have loss of 16.4171 due to the use of observer. Figure 7 shows the block diagram of the full order observer in Simulink.

Figure 7 The ouput of the system is shown in Figure 8

Figure 8

The output of the observer, we can see the slight differences between Figure 8 and 9.

Figure 9 and the error signal

Figure 10

Reduced order observer The goal here is to construct C1 that would make rank C =n C1 where n is the dimension of system matrix A. This can be done by trial and error, below is just one of the possible C1 . 1 0 C 1= 0 0 0

[ ]

0 1 0 0 0

0 0 0 0 0

0 0 0 0 0

0 0 0 0 0

0 0 1 0 0

0 0 0 1 0

0 0 0 0 1

And L1 and L2 are given by

[ ]
C C1

=[ L1 L2 ]

The reduce order observer has the form q t= Aq q tB q ut K q y t Where Aq =C 1 A L2K 1 C A L 2 , Bq =C 1 BK 1 C B K q=C 1 A L2 K 1 C 1 A L1 K 1 C A L1K 1 C A L2 K 1 and the calculated matrices are 137.36 10.311 0.0597 10.8246 11.1545 61.4046 223.175 0.0586 19.6227 1.9033 Aq = 6241.9 10088 4.9205 588.9504 702.0948 386.798 0.1124 0.2192 64.1821 19.9858 160.613 58.3481 0.2509 7.5825 42.1716 1.0304 0.9458 K q= 89.6718 3.0417 1.6109 10.4097 2.7983 75.4894 0.9448 40253 124.7227 32.1893 10.9 10.5527 1.5439

[ [

] [ ]
, 0.0970 0.0951 Bq = 7.9897 0.3559 .4074

The initial condition of the reduce-order observer is chosen to be x0hat_reduced=[1 2 3 2 1]

The error signal due the reduce-order observer is much smaller than the full-order observer. The block diagram is shown in Figure 11, and the error signal is shown in Figure 12. Since the error signal is very small, the output of the observer is about identical to the system output, which is shown in Figure 8.

The block diagram of reduce-order observer.

Figure 11 The error signal

Figure 12

Part ( C ) For a following transfer function H s= s0.258 =C s I A1 B D s 0.4906 s0.085


2

we obtain the canonical form x =AxBu y=CxD u Where A=

0.4906 0.0850 1 0

B= 1 0

[]

C=[1 0.258] , and

D=0

The function balreal computes a particular similarity transformation T such that W c =W c =diag Where Wc and Wo are controllability and observability gramians are identical and diagonal. The state x coordinate transformation =Tx produces the equivalent model
1 x x =TAT TBu=Ab xB b u 1 y=CT barx C b x Db u

and transforms the gramians to W c =TW c T T , W o=T T W o T 1 The balanced system is now Ab = 0.3133 0.1716 0.1716 0.1773

B= 1.0314 0.2525

],

C b=[1.0314 0.2525] , and

D=0

The transformation matrix T is T = 0.6192 1.4308 1.5976 6.5245

(C1) A reduce-order model using the balancing truncation is given by dx 1 t =A11 x 1 tB1 u t dt y t=C 11 xD u t The corresponding transfer function becomes
G 11 s=C 11 sI A11 B1D
1

The step response and impulse response of reduce-order model comparing to the full order systems are shown in Figure 14 and 15.

Figure 14 It shows considerable steady state error for step response, this is because the reduced order system has different DC gain than the original system.

Figure 15 The result for impulse response shows a very good approximation of a full-order system.

(C2) The balanced residualization technique was proposed to produce the exact DC gain. It gives good approximation at low and medium frequency. dx 1 t =Ar x 1 tBr u t dt y t=Cr x Dr ut Where Ar =A11A12 A22 A21 , B r =B11 A12 A22 B 22 C r =C 11C22 A1 A21 , D r =DC 22 A1 B22 22 22 and the transfer function is given by
G r s=C r sI Ar Br D r
1

In Figure 16, we can see the steady state value is a better approximation than truncation for step response.

Figure 16

Figure 17 Figure 17 shows the impulse response of both systems.

References
Karl J.A, & Murray R. M. (2011) Feedback System :An Introduction for Scientists and Engineers Gajic, Z., & Lelic, M. (2001) improvement of system order reduction via balancing using the method of singular perturbations. Automatica, Vol. 37, 1859-1865, 2001. Class notes

Appendix (Matlab codes)


Part A clc clear all Ap=0.000146; h0=0.000508; m=0.3; n=1000; g=9.8; u=0.000011258; a=u*n*Ap; I0=(m*g*h0^2/a)^1/2; kx=-2*a*I0^2/h0^3; ki=2*a*I0/h0^2; A=[0 1; kx 0]; B=[0; ki ] C=[1 0]; D=zeros(2,1) x0=[2;2] r=rank(ctrb(A,B)) Aavg=[A zeros(2,1); C 0] Bavg=[B; 0] rcond = rank([A B; C 0]) ydesired=5; lambda_avg=([-2 -3 -4]) K=place(Aavg,Bavg, lambda_avg) K1 = K(1:1,1:2); K2= K(1:1, 3:3) M=[A-B*K1 B; C 0] SS= inv(M)*[zeros(2,1); ydesired] Xss=SS(1:2,1:1) Uss = SS(3:3, 1:1)

Part B observer % a PEM Fuel Cell clear all clc A=[-6.30908 0 0 -161.083 -18.7858 0 0 0 1.299576 0 16.64244 0 0 -450.386 2.02257 0

-10.9544 0 83.74458 0 0 24.05866; 0 0 51.52923 0 -18.0261 0; -46.3136 0 275.6592 0 0 158.3741; 0 -17.3506 193.9373 0 0 0; 2.969317 0.3977 -38.7024 0.105748 0 0; 38.02522 5.066579 -479.384 0 0 0; 0 0 142.2084 0 -80.9472 0; 4.621237 0 0 0 0 -51.2108];

B=[ 0 0 0 3.946683 0 0 0 0]'; C=[ 0 0 0 5.066579 -116.446 0 0 0; 000 0 1 0 0 0; 12.96989 10.32532 -0.56926 0 0 0 0 0]; D= [0 0 0]'; Q=eye(8); R=eye(1); F=lqr(A,B,Q,R) lambda_system = eig(A-B*F) x0=[1 1 1 1 1 1 1 1]'; y0=C*x0; x0hat=pinv(C'*C)*C'*y0; lambda_observer=lambda_system*10 % lambda_observer=[-1000 -400 -200 -120 -100 -99 -80 -60]; K= place (A',C',lambda_observer)' % reduced order observer C1=[1 0 0 0 0 0 0 0;0 1 0 0 0 0 0 0; 0 0 0 0 0 1 0 0; 0 0 0 0 0 0 1 0; 0 0 0 0 0 0 0 1] Caug=[C;C1] L= [C ; C1]^-1; L1=L(1:8,1:3);L2=L(1:8,4:8); if rank(obsv(C1*A*L2,C*A*L2))== rank(C1) 'observerable' else 'not observable' break end lamsys=eig(A-B*F) maglamsys=abs(real(lamsys)) lamobs=10*lamsys' K1T=place((C1*A*L2)',(C*A*L2)',lamobs(4:8)); K1=K1T' Aq=C1*A*L2-K1*C*A*L2; Bq=C1*B-K1*C*B; Kq=C1*A*L2*K1+C1*A*L1-K1*C*A*L1-K1*C*A*L2*K1; X0hat_reduced=[1 2 3 2 1]

Part C clear clc num=[1 0.258]; den=[1 0.4906 0.085]; [A, B, C ,D] = tf2ss(num, den);

P = lyap(A, B*B') K = lyap(A, C'*C) [Ab,Bb,Cb,Sigma,Trans]=balreal(A,B,C) Db=D Ar=Ab(1,1) Br=Bb(1,1) Cr=Cb(1,1) Dr=D % Ar=Ab(1,1)-Ab(1,2)*inv(Ab(2,2))*Ab(2,1) % Br=Bb(1,1)-Ab(1,2)*inv(Ab(2,2))*Bb(2,1) % Cr=Cb(1,1)-Cb(1,2)*inv(Ab(2,2))*Ab(2,1) % Dr=D-Cb(1,2)*inv(Ab(2,2))*Bb(2,1) [ybstep,xbstep,tbstep]=step(Ab,Bb,Cb,Db); [yrstep,xrstep,trstep]=step(Ar,Br,Cr,Dr); figure(1) plot(tbstep, ybstep, trstep, yrstep, '--') xlabel('Time [s]') ylabel('Step Responses') legend('full-order system','reduced-order system') title('step response') figure(2) % Impulse Responses [ybimp,xbimp,tbimp]=impulse(Ab,Bb,Cb,Db); [yrimp,xrimp,trimp]=impulse(Ar,Br,Cr,Dr); plot(tbimp,ybimp,trimp,yrimp,'--') xlabel('Time [s]') ylabel('Impulse Responses') legend('full-order system','reduced-order system') title('impulse response')

S-ar putea să vă placă și