Вы находитесь на странице: 1из 5

Professor Fearing

EE C128 / ME C134 Problem Set 9 Solution Jansen Sheng and Wenjie Chen, UC Berkeley

Fall 2010

1. (25 pts) Controllability and Observability For the circuit below, input is voltage u(t), output is current y(t), states x1 = capacitor voltage, and x2 = inductor current. a) Write state and output equations for the circuit. b) Find conditions for R1 , R2 , L1, C1 that make the system controllable and observable. c) Interpret the conditions that make the system lose controllability or observability in terms of the time constants of the system.

y(t) + C1 x1 L1

+ u(t) R1

x2

Solution: a) We can begin by writing the KVL and KCL equations. Denote the current downward through the capacitor as iC and the voltage across the inductor as vL . y(t) = iC + x2 = C1 x1 + x2 u(t) = x1 + R1 iC = x1 + R1 C1 x1 u(t) = vL + R2 x2 = L1 x2 + R2 x2 Rearranging terms and solving for x1 and x2 we get: 1 1 x1 + u(t) R1 C 1 R1 C 1 1 R2 u(t) x2 = x2 + L1 L1 1 1 u(t) y(t) = x1 + x2 + R1 R1 x1 = These equations give us the state space matrices: x = Ax + Bu = R11C1 0 0 2 R1 L x+
1 R1 C1 1 L1

R2

(1) (2) (3)

(4) (5) (6)

u(t) ,

y=

1 R1

x+

1 u R1

(7)

b) To test for the controllability and observability of the system, we will look at the determinant of the C and O matrices.

|C| = |O| =

B AB C CA =

1 R1 C1 1 L1

R21 2 C
2 R2 L1 1 1

1 R2 2 + R2 C 2 L = 0 R1 C1 L1 1 1 1

(8) (9)

1 R1

1 R2 C1 1

1 2 R1 L

R2 1 =0 2 R1 L 1 R1 C 1

When |C| = 0 then we know that the system will not be controllable so from Equation 8 we see that this condition is equivalent to: 1
2 2 R1 C 1 L 1

R2 R1 C1 L2 1

L1 = R1 C 1 R2

(10)

When |O| = 0 then we know that the system will not be observable so from Equation 9 we see that this condition is equivalent to: 1 R2 = 2 R1 L 1 R1 C1 R1 C 1 = L1 R2 (11)

c) Looking at the conditions, we see that the circuit loses both controllability and observability when the time constant of the RC part and the time constant of the LC part are the same . 2. (25 pts) Control Canonical Form Given the following x = Ax + Bu = 2 1 2 0 x+ 1 3 u(t), y = [1 0] x

Find the transformation P such that (A, B) is in control canonical form, where A = P AP 1 and = P B. Find A, B, C such that x = A + Bu and y = C x. x B Solution: To nd the correct P, we use the method outlined in Professor Tomlins notes from Lecture 11. First, we compute the controllability matrix: C= Next, we compute P = p1 p2 B AB = 0 1 1 1 3 2 C 1 and p2 = p1 A: 1 5
3 5

(12)

where p1 = 1 2 3 =

p1 =

0 1

C 1 =
3 5 1 5

0 1

2 1 3 1 6 + 5
2 5 3 5

= =

3 1
4 5 3 5

1 5

(13) (14)

p2 = p1 A =

2 1 2 0

So nally we can construct P and P 1 as: 2

P = The resulting A, B, C are then A = P AP 1 =


3 5

4 5

3 5

1 5 3 5

P 1 =

3 1 4 3

(15)

4 5

1 5 3 5

2 1 2 0
3 5 1 5 3 5

3 1 4 3 1 3 = =

= 0 1 3 1

0 1 2 2

(16)

B = PB = C = CP 1 =

4 5

(17) (18)

1 0

3 1 4 3

3. (50 pts) Linear Quadratic Regulator Given LTI system (a mass spring damper system or series RLC) x + 2x + 100x = u with input u, and initial condition x(0) = 1 and x(0) = 0: a) Write the system equations in state space form, using x1 = x and x2 = x1 . b) Using state feedback with gains determined by the LQR method (from Matlab function lqr(sys,Q,R), nd a set of cost functions Q, R which result in the closed-loop system having a settling time of less than 2 seconds and max |u| < 10. Plot x1 (t), x2 (t), and u(t) for the given initial condition (Matlab initial). c) Repeat b), but with settling time less than 0.5 second and max |u| < 100. d) Find the solution to the Ricatti equation P using Matlab function care(A,B,Q,R) and estimate the cost J = xT (0)P x(0) for each of b) and c). e) Briey compare the tradeos between control eort and time response between the two cases. Solution: a). Let x1 = x and x2 = x1 , the system equation becomes x1 = x2 , x2 = 100x1 2x2 + u. In state space form, it is x = Ax + Bu = 0 1 100 2 x1 x2 + 0 1 u(t), y= 1 0 0 1 x (19)

b). Based on Brysons rule (FPE6e, P463 ), we can start from the cost functions to be the diagonal matrices with (1/maximum acceptable value)2 as the diagonal elements. Since we are 1 0 1 only given max|u| < 10, we can simply start from Q = and R = 102 . Then we tune Q and 0 1 R through MATLAB simulation to check controller performance. A general idea is, by increasing R, we penalize more on the control input and by increasing Q, we put more eorts to achieve the 1 0 1 output performance. So after a few trials, we end up with Q = and R = 5 . The state 0 1 response and control input using this controller is shown in Fig.1 and Fig.2. The dotted lines in Fig.1 are the 5% settling threshold for x, which show the settling time of x is less than 2 sec.

State Response Using LQR Controller 3b


5 x1 x2

Control Input Using LQR Controller 3b


10 8 6

4 2 0

u
10

2 4 6

time (sec)

time (sec)

Figure 1: (left) State Response Using LQR Controller 3b Figure 2: (right) Control Input Using LQR Controller 3b 1 0 0 1
1 200 1 , 1002

c). Start from Q = Q= 1 0 0 1 and R =

and R =

and repeat the process of b). We end up with

. The state response and control input using this controller is shown

in Fig.3 and Fig.4. The dotted lines in Fig.3 are the 5% settling threshold for x, which show the settling time of x is less than 0.5 sec.
State Response Using LQR Controller 3c
1 x1 x2 0
50 60

Control Input Using LQR Controller 3c

40

1
30

u
20 10 0

10

time (sec)

time (sec)

Figure 3: (left) State Response Using LQR Controller 3c Figure 4: (right) Control Input Using LQR Controller 3c d). Through MATLAB function (care(A,B,Q,R) or lqr(sys,Q,R)), we can nd the solution P

to the Ricatti equation. For b), P = c), P = 6.2476 0.0050 0.0050 0.0618

20.1815 0.0050 0.0050 0.2017

, and J = xT (0)P x(0) = 20.1815 . For

, and J = xT (0)P x(0) = 6.2476 .

e). We can see from b) and c) that, it is usually necessary to compromise between the control eort and time response performance. In case b), with relatively smaller control eort, the transient performance is also poorer with larger oscillation. In case c), with increased control eort, the transient performance is greatly improved with damped response. (This can also be expected from the resulting closed loop eigenvalues. The closed loop poles resulted from b) are 1.5042 9.8875i and the ones from c) are 7.1762 7.0354i, which have larger damping ratio and more negative real part.) The MATLAB codes for this problem is attached below: (Note: the way Q dened in MATLAB lqr(sys,Q,R) is for state x cost function, not output y cost function as discussed in lecture) %% a ) A = [ 0 1 ; 100 2]; C = eye ( 2 ) ; s y s = s s (A, B, C, D ) ; x0 = [ 1 ; 0 ] ; t = 0:0.001:5; B = [0; 1]; D = [0; 0];

%% b , c , d ) Q=C eye ( 2 ) C ; R= 0 . 2 ; % For b ) % Q=C eye ( 2 ) C ; R= 0 . 0 0 5 ; % For c ) [K, S , E ] = l q r ( s ys ,Q,R ) ; [ X, L ,G] = c a r e (A, B, Q,R ) ; Ac = A B K; Bc = [ 0 ; 0 ] ; Cc = C D K; Dc = [ 0 ; 0 ] ; s y s c = s s ( Ac , Bc , Cc , Dc ) ; [ y , t , x ] = i n i t i a l ( s y s c , x0 , t ) ; u = [K x ] ; J = x0 S x0 ; figure (1); p l o t ( t , x ( : , 1 ) , , t , x ( : , 2 ) , LineWidth , 1 ) ; g r i d on ; h old on ; p l o t ( t , 0 . 0 5 on es ( s i z e ( t ) ) , . , t , 0.05 on es ( s i z e ( t ) ) , . , LineWidth , 1 ) ; l e g e n d ( x1 , x2 ) ; x l a b e l ( time ( s e c ) , Fon tS ize , 1 2 ) ; y l a b e l ( x , Fon tS ize , 1 2 ) ; t i t l e ( S t a t e Response Using LQR C o n t r o l l e r 3b , Fon tS ize , 1 2 ) ; figure (2); p l o t ( t , u , LineWidth , 1 ) ; g r i d on ; x l a b e l ( time ( s e c ) , Fon tS ize , 1 2 ) ; y l a b e l ( u , Fon tS ize , 1 2 ) ; t i t l e ( C o n t r o l I n p u t Using LQR C o n t r o l l e r 3b , Fon tS ize , 1 2 ) ; 5

Вам также может понравиться