Professor Fearing EE C8 / ME C34 Problem Set 7 Solution Fall Jansen Sheng and Wenjie Chen, UC Berkeley. 35 pts Lag compensation. For open loop plant Gs ss+5s+8 a Find compensator gain Ds k such that the unity gain feedback system has steady state error lim t et <. for a ramp input rt tut. b With the gain k above, use a MATLAB Bode plot to determine phase margin. c Use MATLAB to find a lag compensator Ds k lag α s+/t s+/αt with appropriate gain k lag so as to obtain phase margin of 45 and unity gain frequency ω c > rad/sec, with steady state error from ramp input <.. d Using MATLAB, plot the steady state error for a ramp input for the closed-loop gain compensated and lag compensated systems. a. For Ds k, the closed loop transfer function from input rt to the error et is Es Rs +GD k + ss+5s+8 s3 +3s +4s s 3 +3s +4s+k Thus, the steady state error for a ramp input rt tut is given by lim t et lim ses s Rs Rs lim s s s 3 +3s +4s s 3 +3s +4s+k s 4 k The steady state error criteria yields k > 4.. Pick k 5 as the final choice. b. The Bode plot of the above gain compensated system with k 5 is shown in Fig.. The phase margin is given as o at 4. rad/sec. 5 Bode Diagram Gm 6.36 db at 6.3 rad/sec, Pm deg at 4. rad/sec Magnitude db 5 5 9 Phase deg 35 8 5 7 3 Frequency rad/sec Figure : Bode Plot of Gain Compensated System c. The design of lag compensator can follow the procedure given in FPE6e P36-36.
Bode Diagram Gm 4.3 db at 6.3 rad/sec, Pm 5.8 deg at. rad/sec 5 Magnitude db 5 5 9 Phase deg 35 8 5 7 3 Frequency rad/sec Figure : Bode Plot of System kg G Step. Fig. shows the Bode plot of k G with open-loop gain k, which meets the phase margin criteria 45 o and crossover frequency criteria ω c > rad/sec. Step. In this open loop system k G, the crossover frequency is. rad/sec, and the phase margin is 5.8 o. The steady state error of ramp input given by this gain k is 4 k.4. Step 3. From the steady state error requirement, the gain k should be raised by a factor of at least α >. Pick α.5. Then k lag k α 5. Step 4. Choose the corner frequency for the zero to be approximately a factor of 8 slower than the expected crossover frequency. So, T. 8 rad/sec, or T 3.699 sec. Step 5. We then have the value for the other corner frequency: ω The lag compensator is thus αt.5 3.699 9.498 rad/sec. Ds k lag α s+/t s+/αt s+/3.699 s+/9.498 3 Step 6. Fig.3 shows the Bode plot of GD. The phase margin is given by 46.4 o and the crossover frequency is ω c. rad/sec. It meets the design criteria and no iteration is needed. d. The error response from ramp input for the closed-loop gain compensated and lag compensated systems are shown in Fig.4 and Fig.5, respectively. The MATLAB codes for this problem is attached below: %% a,b G tf, convconv[,[ 5, [ 8; D 5; figure ; marging D; %% c klag D; k ; figure ; marging k; alpha klag/k; wc.; T /wc/8; D klag/alpha tf [, /T,[, /alpha/t;
Bode Diagram Gm 3.8 db at 6.5 rad/sec, Pm 46.4 deg at. rad/sec 5 Magnitude db 5 5 9 Phase deg 35 8 5 7 3 3 Frequency rad/sec Figure 3: Bode Plot of System GD Error Response of Ramp Input for Gain Compensated System Error Response of Ramp Input for Lag Compensated System.35.5.3.45.4.5.35 Amplitude..5 Amplitude.3.5...5..5.5 3 4 5 6 7 Time sec 4 6 8 4 6 Time sec Figure 4: left Error Response from Ramp Input for the Closed-loop Gain Compensated System Figure 5: right Error Response from Ramp Input for the Closed-loop Lag Compensated System figure 3; marging D; %% d s tf s ; E /+G D/sˆ; figure 4; impulsee; title Error Response of Ramp Input for Gain Compensated System, FontSize,; E /+G D/sˆ; figure 5; impulsee; title Error Response of Ramp Input for Lag Compensated System, FontSize,;
. pts State Space For the following transfer function, give state space description with state variable x in controllable canonical form: Ys Us s3 +4s +6s+8 s 3 +8s +3s+6 Define the state variable x with the Laplace form as Xs Us s 3 +8s +3s+6, Ys s3 +4s +6s+8Xs 4 Thus, following the controllable canonical form, the state space description is given by ẋ Ax+Bu ẋ ẋ ẋ 3 6 3 8 y Cx+Du [ 8 6 6 3 4 8 x x x + ut 5 x +u [ 4 x +ut6 x 3. pts State space Convert the following differential equation to state space in controllable canonical form with state variable x, where u is the input and y is the output. d y dt +5dy du +6y u+ dt dt We can put the equation into the form we are familiar with by taking the Laplace transform. s Ys+5sYs+6Ys Us+sUs 7 s +5s+6Ys s+us 8 Ys Us s+ s +5s+6 From this, we can easily convert into state space form using the methods outlined in the Lecture #6 handout. Since the power of our denominator is, we will need states in our equation. ẋ Ax+Bu [ [ x x 6 5 [ x x + [ 9 ut [ x y Cx+Du [ x 4. pts State space to transfer function Given ẋ Ax+Bu x x 3 5 x x + ut and y [ x 3 3 x x
Figure 6: left Part a: Initial block diagram Figure 7: right Part b: After block diagram manipulations a Draw a block diagram for this system with input u and output y. We have three states so we need three integrators in our block diagram. This is also a single input single output system so in our block diagram there is only one U and one Y. This is shown in Fig. 6. b Starting from the block diagram, determine the transfer function Ys Us. First we simplify by using block diagram manipulations on the feedback loops. The result is shown in Fig. 7. The final transfer function is a weighted sum of the three individual components: Ys Us s+3 + 3 s+5 + s+ 5. 5 pts State space solutions Given the following ẋ Ax+Bu [ 3 [ x+ [ ut, y [3 x x Solve for the state transition matrix e At, xt, and yt, where ut is the unit step. We will use L {si A } to solve for e At : { [ e At L { si A } } L s+3 s { L ss+3+ {[ L L {[ s s+s+ s+s+ s+ + s+ s+ + s+ [ s s+3 s+s+ s+3 s+s+ s+ + s+ s+ + s+ [ e t +e t e t e t e t +e t e t e t } } } 3 4 5 6 7
Now, we can calculate xt from the formula: t xt e At x+ e At τ Buτdτ 8 [ t [ e At + e At τ uτdτ 9 [ e t +e t t [ e e t +e t + t τ e t τ e t τ e t τ uτdτ [ [ [ e t +e t e e t +e t + t τ e t τ e e t τ t τ e t τ e t τ e t τ τt e t τ τ [ e t +e t [ +[ e t +e t e 3 t e t e t e t [ e t + 5 e t 3 4e t + 5 3 e t Finally, we can calculate yt from xt: yt [ 3 xt 4 3 e t + 5 3 e t + 4e t + 5 e t 5 9 4e t + 5 e t 6 Note: You could also solve this using Laplace transforms instead of integration by solving: 7 ẋ Ax+Bu 8 sxs X AXs+B s Xs si A X+B s 9 3 and then taking the inverse Laplace transform. Another note: If the original values are used instead of the new values - instead of - in the bottom left of A we would have the following: e At xt [ yt 9+ + 3 5 9 3+ 5 e rt + 5 5 ert e rt + 3 5 3 8 5 3 5 where r 3 5 and r 3+ 5. 3 5 5 e rt e rt e rt + 9 5 e rt + 8 5 5 e rt 5 5 ert e rt e rt + 3 3 3 5 e rt + 3 5 e rt 3 3 e rt 33