EE/ME 7: Advanced Linear Systems Solution Solution to HW Name On each item, grading is, or (full points, /2 points, points) EE/ME 7: Advanced Linear Systems Solution State-feedback control of the motor with load (from text problem.3) Problem # Parts Points Each Part Your Part Points. A 6 B 6 C 6 D 6 E 5 F 2 2 /4 G 5 H 3 2 /6 I 3 2 /6 2. A B C D 8 E 3 4 /2 Your Total Points /5 /5 Total: / Notes Consider the system of figure with the parameters of table, and with V a (t) θ L (t) as the output. V La (t) V Ra (t) I a (t) L a R a E a (t) - Motor Electrical Side τ m (t) θ m (t) J m B m Motor Mechanical Side Figure : Augmented motor model. Parameter values [ ] R a.4 Ohms K t 4.5 Newton-meter amp L a 3. Henries Table : Parameters for the motor drive. K θ L (t) Load J L Parameters values B L J m.3 kg-m 2 B m.2 N-m rad/sec J L 6. kg-m 2 B L 5. N-m rad/sec K 2 N-m rad Homework Solution (Revised: Nov 2, 23) Page Homework Solution (Revised: Nov 2, 23) Page 2
EE/ME 7: Advanced Linear Systems Solution EE/ME 7: Advanced Linear Systems Solution A) Put together the system model. For verification: your open-loop poles and zeros should be: >> Poles = pole(ssmodel) >> Zeros = zero(ssmodel) Poles = -.358 7.988i Zeros = Empty matrix: -by- -.358-7.988i -. -.4586.753i -.4586 -.753i >> Jm =.3 >> JL = 6 >> %% Build the state model of the mo >> Ksp = 2 >> Bm =.2 >> >> %% States: >> BL = 5 >> %% ThetaM >> Ra =.4 >> %% ThetaM dot >> La = 3 >> %% ThetaL >> Kt = 4.5 >> %% ThetaL dot >> >> %% Ia >> Ap = [ -Ksp/Jm -Bm/Jm Ksp/Jm Kt/Jm Ksp/JL -Ksp/JL -BL/JL -Kt/La -Ra/La ] Ap =. -4. -.6667 4. 5.. 2. -2. -.8333 Homework Solution (Revised: Nov 2, 23) Page 3 -.5 -.333 >> Bp = [ ; ; ; ; /La] >> Bp ans =.3333 >> Cp = [ ] >> Dp = Make LTI model and find poles, >> SSModel = ss(ap, Bp, Cp, Dp) >> pole(ssmodel) ans = -.358 7.988i -.358-7.988i -. -.4586.753i -.4586 -.753i >> zero(ssmodel) ans = Empty matrix: -by- A block diagram for a state-variable system with feedback is seen in 2. K is the feedback gain vector. A p, B p, C p and D p are the state-variable model matrices of the open-loop motor with load model. The control signal is given as: u(t) = K x(t)n f r(t) () Homework Solution (Revised: Nov 2, 23) Page 4
EE/ME 7: Advanced Linear Systems Solution EE/ME 7: Advanced Linear Systems Solution r(t) N f r (t) u(t) A p, B p, C p, D p x(t) x(t) y(t) Putting this into the state equation gives ẋ(t) = A p x(t)b p ( K x(t)nf r(t) ) Figure 2: Block diagram of a state-variable system with feedback control. B) Design a state-feedback controller to place the poles at -K [ ] P d = 2 3 4 5 6 Which gives Or with ẋ(t) = (A p B p K) x(t)b p N f r(t) ẋ(t) = A cl x(t)b cl r(t) A cl = A p B p K Use Matlab s place() command. B cl = B p N f Using the SS model >> Pd = [ -2, -3-4 -5-6] >> K = place(ap, Bp, Pd) K = -62.546 2.4389 34.546 49.374 55. (Note to grader: if the states are ordered differently in the model, the elements of K come out in a different order.) C) The closed-loop system and input matrices is given as A cl = A p B p K B cl = B p N f (2) Starting with Eqn (), show how the expression for A cl can be derived. The expression for u(t) is: u(t) = K x(t)n f r(t) Homework Solution (Revised: Nov 2, 23) Page 5 Homework Solution (Revised: Nov 2, 23) Page 6
EE/ME 7: Advanced Linear Systems Solution EE/ME 7: Advanced Linear Systems Solution D) Determine the closed-loop system matrix, A cl F) With N f =, build the closed-loop system model and plot the step response. F.) Include your step response plot >> Acl = Ap - Bp*K Acl =. -4. -.6667 4. 5.. 2. -2. -.8333 2.8349-5.6463-44.8349-6.457-8.5.4.2..8.6 E) Show that the eigenvalues of A cl are { 2 3 4 5 6}.4.2 >> eig(acl) ans = -2. -3. -4. -5. -6..5.5 2 2.5 3 3.5 4 4.5 Figure 3: Step response of pole-placement controller, with N f =. F.2) What is the DC Gain of the system, determined as the steady-state value of the step response? y ss =.4 G) The DC gain of a state-variable model can be computed as T DC = C p ( A cl ) B p (3) Using Eqn (3), determine the DC gain of the system. >> TDC = Cp * inv(-acl) * Bp TDC =.39 Homework Solution (Revised: Nov 2, 23) Page 7 Homework Solution (Revised: Nov 2, 23) Page 8
EE/ME 7: Advanced Linear Systems Solution EE/ME 7: Advanced Linear Systems Solution H) By setting N f = /T DC (4) The DC gain level can be raised. H.) Determine N f from Eqn (4) >> Nf = /TDC Nf = 72. H.2) Incorporate this value of N f into your closed-loop state model, and plot a new step response. What is the new value of DC gain of the closed-loop system..8.6.4.2 >> step( ss( Ap-Bp*K, Bp*Nf, -K, Nf) ).5.5 2 2.5 3 3.5 4 4.5 5 Time (seconds) 5 5.5.5 2 2.5 3 3.5 4 Time (seconds) Figure 5: Output and control step response. SSry = ss(acl, Bp*Nf, Cp-Dp*K, Dp*Nf) SSru = ss(acl, Bp*Nf, -K, Nf) figure(), clf subplot(2,,) step(ssry) subplot(2,,2) step( SSru ) SetLabels(2) print( -deps2c, StepRYU ).9.8.7.6.5.4.3 I.) Using Eqn () and the form for the state-variable model output equation, explain how the step command indicated above shows the control output in response to a step input. Setting up the state-variable model as given sets the model output equation to be.2. y(t) = K x(t)n f r(t).5.5 2 2.5 3 3.5 4 4.5 Figure 4: Step response of pole-placement controller, with N f = 72. Which will cause the model to produce the control signal as its output. I.2) What is the peak (maximum) level of control effort required in response to a step input. The new gain r(t) y(t) is.. I) u(t) as an output. Control signal u(t) is given by Eqn (). We can plot this as the output of a state variable model with Homework Solution (Revised: Nov 2, 23) Page 9 72. I.3) Does the control signal ever go negative, in response to a step input? Yes. Homework Solution (Revised: Nov 2, 23) Page
EE/ME 7: Advanced Linear Systems Solution 2 Controller Design, Linear Quadratic Regulator Staring again with the 5 th order model of the motor drive, A p, B p, C p and D p of problem. Design a linear quadratic regulator controller with >> Q = * eye(5) >> R = >> K = lqr(ap, Bp, Q, R) >> Acl = Ap - Bp*K >> Nf = /(Cp*inv(-Acl)*Bp) A) What are the controller gains (K vector and N f value) for this LQR controller? >> Q = * diag([ ]) >> R = >> K = lqr(ap, Bp, Q, R) K = -48.2496 25.54 92.97 9.6728 56.6223 >> Acl = Ap - Bp*K Acl =. -4. -.6667 4. 5.. 2. -2. -.8333 6.832-9.8385-3.993-6.5576-9.74 >> Nf = /(Cp*inv(-Acl)*Bp) Nf = 44.724 Homework Solution (Revised: Nov 2, 23) Page EE/ME 7: Advanced Linear Systems Solution B) What are the pole locations of for the system with the new controller design >> Poles = eig(acl) Poles = -8.675 8.756i -8.675-8.756i -.24.3892i -.24 -.3892i -.955 C) Plot and examine the step response for the closed-loop system with both θ L (t)and u(t) as outputs, that is θ L (t) y(t) = (5) u(t) Include your plot for the case with y(t) given by Eqn (5). To: Out() To: Out(2).8.6.4.2 6 4 2 2 2 3 4 5 6 7 Figure 6: Step response for y(t) given by Eqn (5). Homework Solution (Revised: Nov 2, 23) Page 2
EE/ME 7: Advanced Linear Systems Solution EE/ME 7: Advanced Linear Systems Solution D) (Essay Question) Write a few words about the speed and stability of the response of the LQR controlled, compared with the pole-placement controller. Mention also the size of motor required in each case (the motor size scales with the magnitude of the maximum value of u(t)). (Note to grader, responses will vary, should at least address the rise and/or settling time (speed), that both systems are stable and that the LQR shows lower peak control effort). Both the pole-placement and LQR controllers appear very over-damped. Neither shows overshoot. Looking at figure 6, the settling time of the LQR controller is approximately 5 seconds, somewhat slower than the 3.5 second settling time of the pole-placement controller. The peak control effort for the LQR controller is about 45, or about 2/3 the peak control effort for the pole-placement controller. E) In LQR design, the designer determines the system performance by selecting Q and R. Modify the Q matrix according to >> Q = 2 * diag([.2 ]) (This was found with a few iterations of cut-and-try.) Repeat your calculations and analyses of steps B-D. E.) What are the pole locations of for the system with the new controller design >> Poles = eig(acl) Poles = -9.245 2.382i -9.245-2.382i -.764.475i -.764 -.475i -.9925 Homework Solution (Revised: Nov 2, 23) Page 3 E.2) Include your step-response plot with both θ L (t)and u(t) as outputs. To: Out() To: Out(2).5.5 6 4 2 2 2 3 4 5 6 7 8 Figure 7: Step response ([ for y(t) given by Eqn (5), with ]) Q = diag 2 2 2 2 4 E.3) (Essay Question) Write a few words about the speed and stability of the response of the new LQR controlled, compared with the pole-placement controller. Mention also the size of motor required in each case (the motor size scales with the magnitude of the maximum value of u(t)). (Note to grader, full credit for any answer that addresses speedstabilitycontrol effort). The new controller is faster than the original LQR controller and about the same speed as the pole-placement controller, while requiring significantly lower control effort. The new controller shows overshoot, which is to say that it is less stable than either of the original two controllers. But only a small amount of overshoot is present, which could be acceptable in many applications. Homework Solution (Revised: Nov 2, 23) Page 4