Assgnment 6 solution - College of Engineering · First convert this given transfer function to a...

7

Click here to load reader

Transcript of Assgnment 6 solution - College of Engineering · First convert this given transfer function to a...

Page 1: Assgnment 6 solution - College of Engineering · First convert this given transfer function to a state equation by tf2ss in analog domain, ... αc The Ackermann method can be applied

Assignment 6 Design a state feedback control system that makes the following 3rd order underdamped system to be critically damped by the pole assignment method. (this system is similar to Figure 9-1 in page 338 in textbook, but 3rd order instead of 2nd order) --> sampler --> ZOH --> 1/(s(s^2+s+1)) --> sampler --> First convert this given transfer function to a state equation by tf2ss in analog domain, then use c2d to convert the obtained continuous time state equation into a discrete time state equation. Then, apply Ackermann's design formula. Use T=0.05 second. MATLAB program for this problem is provided in MATLAB directory: PoleAssignment2004.m The specific assignment is, therefore, to run this program and interpret the results. Solution, This system presents a response which depends on the time duration of the pulse applied. To calculate this relationship, the final value theorem can be used, ( ) ( ) ( )zRzEz

z1lim

1−

Where, E(z) = Transfer Function of System R(z) = Input Signal The transfer function of the uncompensated system can be obtained after running the program PoleAssignment2004.m provided, in matlab, >> numA numA = 1 >> denA denA = 1 1 1 0 >> stf=tf(numA,denA) % System Transfer Function Transfer function: 1 ------------- s^3 + s^2 + s >> dtf=c2d(stf,0.05,'zoh') % Convert to discrete domain Transfer function: 2.057e-005 z^2 + 8.126e-005 z + 2.006e-005 ------------------------------------------ z^3 - 2.949 z^2 + 2.9 z - 0.9512 Sampling time: 0.05 The input signal applied R(z) is an impulse of 25 samples of duration. This final value can be calculated as 25 times the result of a unit impulse, i.e. one sample impulse. The physical explanation for this is that the final value depends on the application of the impulse at some point in the past regardless of when; therefore

Page 2: Assgnment 6 solution - College of Engineering · First convert this given transfer function to a state equation by tf2ss in analog domain, ... αc The Ackermann method can be applied

applying 25 consecutive impulses will produce 25 times the final change. The z-transform of a unit impulse response is the number 1.0. The transfer function contains a pole at z=1, which will be eliminated in the calculation of the limit. In matlab, >> [zz,pp,kk,tt]=zpkdata(dtf,'v') % zz=zeros, pp=poles, kk=gain zz = -3.68535660297599 -0.26464444424815 pp = 1.00000000000022 % this pole will cancel 0.97439570184443 + 0.04221896170684i 0.97439570184443 - 0.04221896170684i kk = 2.057293821305011e-005 tt = 0.05000000000000 >> sum(poly(zz))/sum(poly(pp(2:3)))*kk % calculating the limit ans = % the final value is 0.04999999999981 >> sum(poly(zz))/sum(poly(pp(2:3)))*kk*25 % 25 impulses will give ans = 1.24999999999525 This result is the same as shown in the simulation plot, The response has some overshoot, which is explained because the poles of the uncompensated system have some imaginary component. To obtain critical damping the poles of the compensated system should be equal and real. In the PoleAssignment2004 program, options 3 and 4 provide that, see the following lines of matlab code, case '3' newpoles=[1, 0.97, 0.97] case '4' newpoles=[1, 0.95, 0.95]

Page 3: Assgnment 6 solution - College of Engineering · First convert this given transfer function to a state equation by tf2ss in analog domain, ... αc The Ackermann method can be applied

This response (case ‘3’) has no overshoot, as expected, although the response time was affected. The Ackermann’s method moves the poles of the system to the desired locations, which is confirmed finding the roots of the characteristic equation of the compensated system. Notice that the eigenvalue calculation function in matlab eig() is an equivalent way of obtaining the poles of the system, see the following lines of matlab code, % find poles of this system disp('Poles of the discrete time model'); poles=eig(P) The result of running the program provided is listed below, with added comments in the appropriate lines, >> PoleAssignment2004 numA = % Original System Transfer Function 1 denA = 1 1 1 0 A = % State space matrices in Laplace domain -1 -1 0 1 0 0 0 1 0 b = 1 0 0 c = 0 0 1 d = 0 P = % State space matrices in z domain 0.95002057293821 -0.04875025781265 0 0.04875025781265 0.99877083075087 0 0.00122916924913 0.04997942706179 1.00000000000000 q = 0.04875025781265 0.00122916924913 0.00002057293821 Poles of the discrete time model poles =

Page 4: Assgnment 6 solution - College of Engineering · First convert this given transfer function to a state equation by tf2ss in analog domain, ... αc The Ackermann method can be applied

1.00000000000000 0.97439570184454 + 0.04221896170680i 0.97439570184454 - 0.04221896170680i Enter case number 1 or 2 or 3 or 4 =3 newpoles = % desired new poles 1.00000000000000 0.97000000000000 0.97000000000000 alphac = % characteristic equation for Ackermann 1.00000000000000 -2.94000000000000 2.88090000000000 -0.94090000000000 K = % feedback matrix 0.19624148078823 -0.63084810609270 -0.00000000000273 Pc = % compensated state matrix 0.94045375015625 -0.01799625000001 0.00000000000013 0.04850904381906 0.99954624984375 0.00000000000000 0.00122513198527 0.04999240546090 1.00000000000000 new poles by state feed back K newpoles = % double check of new poles 0.96999999999981 + 0.00000010395850i 0.96999999999981 - 0.00000010395850i 1.00000000000037 num1 = 1.0e-004 * 0 0.20572938213448 0.81263127485354 0.20064974882938 den1 = 1.00000000000000 -2.94000000000000 2.88090000000000 -0.94090000000000 DCgain1 = % for a unit step being applied -3.659956539600000e+011 check if poles of the transfer ftn are the same check_poles = % double check on transfer function poles 1.00000000000139 0.96999999999931 + 0.00000019927220i 0.96999999999931 - 0.00000019927220i

Page 5: Assgnment 6 solution - College of Engineering · First convert this given transfer function to a state equation by tf2ss in analog domain, ... αc The Ackermann method can be applied

2. Do Problem 9-11 in page 378. Try both manual calculations and MATLAB solution. A satellite control system is modeled as shown in Figure P9-11. This system is described in Problem 1.12. For this problem, let D(z) = 1. In addition, K = 1, T = 1 s, J = 4 and Hk = 1. From the z-transform tables,

( )

( )23 11125.0

411

−+

=⎥⎦⎤

⎢⎣⎡Ζ

−z

zsz

z

A state model is given by

( ) ( ) ( )kukk ⎥⎦

⎤⎢⎣

⎡+⎥

⎤⎢⎣

⎡=+

25.0125.0

1011

1 xx

( ) [ ] ( )kky x01= Where x1(k) is angular position and x2(k) is angular velocity. (a) Show that the closed-loop system is unstable (b) Using pole-placement design, find the gain matrix K that yields the closed-loop damping ratio ζ =

0.707 and the time constant τ = 4 s. (c) Show that the gain matrix K in part (b) yields the desired closed-loop characteristic equation, using (9-

15) (d) Verify all calculations by computer. Solution, (a) To verify the stability, the roots of the closed loop characteristic equation are required,

01 =+GH ( )

( )( ) ( )

( )0

11125.01

11125.01 2

2

2 =−

++−=

−+

+z

zzz

z

The roots of the numerator will be enough to satisfy the equation, In matlab, >> num = 1*[1,-2,1]+0.125*[0,1,1]; >> abs(roots(num)) % ans =

Page 6: Assgnment 6 solution - College of Engineering · First convert this given transfer function to a state equation by tf2ss in analog domain, ... αc The Ackermann method can be applied

% 1.06066017177982 % 1.06066017177982 The roots are located outside the unit circle, therefore the closed-loop system is unstable (see p.236 of text book for further explanation). (b) The first step is to assemble the characteristic equation; in order to do this the specifications need to be translated to roots in the z-plane,

41−−

== eerTτ (see p.216 of text; or see p.20 or Part1 and p.215 of text)

( ) 2

2

2

2

707.0707.01

411

ln −=

−−=

ζζ

θ r

In matlab, >> T = 1; >> tau = 4; >> r = exp(-T/tau) % r = % 0.77880078307140 >> zeta = 0.707; >> theta = -log(r)*sqrt(1-zeta^2)/zeta % theta = % 0.25007551140394 The characteristic equation is then, In matlab, % characteristic equation : expanding (z-z1)*(z-z2) % (z-z1)(z-z2) -> z1,2 = r @ (+/- theta) >> alphaz = conv([1,-r*exp(i*theta)],[1,-r*exp(-i*theta)]) % alphaz = % 1.00000000000000 -1.50915040237654 0.60653065971263 ( ) 9712630.6065306537654.50915040212 +−= zzzcα The Ackermann method can be applied now, In matlab, % state matrices >> A = [1,1;0,1]; >> B = [0.125;0.25]; % Ackerman's method : finding K >> alphaA = A^2 + A*alphaz(2) + eye(2)*alphaz(3)

Page 7: Assgnment 6 solution - College of Engineering · First convert this given transfer function to a state equation by tf2ss in analog domain, ... αc The Ackermann method can be applied

>> BABi = inv([B A*B]) >> K = [0 1]*BABi*alphaA % alphaA = % 0.09738025733610 0.49084959762346 % 0 0.09738025733610 % BABi = % -4 6 % 4 -2 % K = % 0.38952102934439 1.76863787582166 (c) The characteristic equation can be obtained from the state and feedback matrices using (9-15) ( ) BKAI +−= zzcα The result should match the characteristic equation used in (b) with the Ackermann’s method. In matlab, % Eq.(9-15): % det(zI - A + B*K) = (z-z1)(z-z2) >> ABK = A - B*K >> a11=ABK(1,1); >> a12=ABK(1,2); >> a21=ABK(2,1); >> a22=ABK(2,2); % the desired determinant is % |z-a11 -a12| % |-a21 z-a22| >> conv([1,-a11],[1,-a22])-[0,0,(-a12)*(-a21)] % ABK = % 0.95130987133195 0.77892026552229 % -0.09738025733610 0.55784053104458 % ans = % 1.00000000000000 -1.50915040237654 0.60653065971263 This matches with (b) (d) Done.