ECE382/ME482 Spring 2004 Homework 4 Solution November 14, 2005 1 Solution to HW4 AP4.3 Intead of a contant or tep reference input, we are given, in thi problem, a more complicated reference path, r(t) = (2 t t 2 /2)u(t). (1) (a) To determine the teady tate error with zero diturbance, we determine the tranfer function from R() to Y (). Uing block diagram tranformation we obtain T() = Y () R() = 5( + 1) 3 + 3 2 + 5 + 5. (2) Then taking the Laplace tranform of r(t) to obtain and noting that R() = 2 1 2 + 2 2 3 = 22 + 1 3 (3) E() = R() Y () = R()(1 T()) (4) we have ( 2 2 ) ( + 1 3 + 3 2 ) E() = 3 3 + 3 2 + 5 + 5 o we obtain = (22 + 1)( + 3) ( 3 + 3 2 + 5 + 5) (5) e = lim 0 E() = 3 5. (6) (b) Next we are aked to plot the error for thi path over the time interval 0 to 10 econd. To obtain the required plot, we note that we can factor 1/ from the expreion for E() o that we can ue the Matlab command tep to generate the repone uing the following Matlab code : >> y = tf(conv([2-1 1],[1 3]),conv([1 0],[1 3 5 5])) Tranfer function: 2 ^3 + 5 ^2-2 + 3 ------------------------- ^4 + 3 ^3 + 5 ^2 + 5 >> y1 = tf([2 5-2 3],[1 3 5 5]) Tranfer function: 2 ^3 + 5 ^2-2 + 3 ----------------------- ^3 + 3 ^2 + 5 + 5 >> t = [0:.01:10] ; u = 0*t; >> y = tep(y1,t);
ECE382/ME482 Spring 2004 Homework 4 Solution November 14, 2005 2 >> plot(t,y) >> grid >> xlabel( Time() ); ylabel( e(t) ); >> title( Error Plot for AP4.3 ); >> print -dep ap4_3b.ep The reulting plot, hown below, indicate a teady tate error of approximately 0.6, agreeing with our anwer in part (a). 2 Error due to input in AP4.3b 1.5 1 e(t) 0.5 0 0.5 1 0 1 2 3 4 5 6 7 8 9 10 Time() (c) Now for zero input (r(t) = 0), we are aked to find the teady tate error due to a tep diturbance D() = 1/. We firt redraw the block diagram a
ECE382/ME482 Spring 2004 Homework 4 Solution November 14, 2005 3 D() + 1 ( + 3) Y () 5( + 1) from which we can ue block diagram tranformation to find the tranfer function from D() to Y (), which i o T() = 3 + 3 2 + 5 + 5 e = lim 0 T()( D()) = lim 0 T() = 0. (8) (d) Finally we ue Matlab to plot the error due to the diturbance a we did in part (b), uing the command below to generate the plot hown. >> y2 = tf([1 0],[1 3 5 5]) Tranfer function: --------------------- ^3 + 3 ^2 + 5 + 5 >> t = [0:.01:10] ; u = 0*t; >> y = -tep(y2,t); >> plot(t,y) >> grid >> xlabel( Time() ); ylabel( e(t) ); >> title( Error due to diturbance in AP4.3d ); >> print -dep ap4_3d.ep (7)
ECE382/ME482 Spring 2004 Homework 4 Solution November 14, 2005 4 0.04 Error due to diturbance in AP4.3d 0.02 0 0.02 0.04 e(t) 0.06 0.08 0.1 0.12 0.14 0.16 0 1 2 3 4 5 6 7 8 9 10 Time() AP4.4 In thi problem we chooe a gain K to enure that the teady tate error due to a ramp input ignal v(t) doe not exceed 0.1, and then plot the error a a function of time for a ramp diturbance input applied for the time period 0 to 5 econd. (a) Finding an expreion for the teady tate error due to a ramp input i traightforward. The Laplace tranform of the input i V () = 1/ 2. Standard block diagram tranformation allow u to determine the tranfer function from V () to ω(), which i KK m T() = R a J 2 (9) + K m K b + KK m K t and a in problem AP4.3a, we find the Laplace tranform of the error to be E() = V () K t ω() = V ()(1 K t T()) (10) o [ ] R a J + K m K b E() = V () R a J 2 + K m K b + KK m K t (11) and ( ) [ ] 1 R a J + K m K b e = lim E() = lim 0 0 2 R a J 2 = K b + K m K b + KK m K t K. (12) Since K b = 0.1, to keep the teady tate error le than 0.1, we need K > 1.
ECE382/ME482 Spring 2004 Homework 4 Solution November 14, 2005 5 (b) Proceeding a in AP4.3c, we find the tranfer function from D() to ω() to be T() = We are given the diturbance K m R a J 2 + K m K b + KK m K t. (13) d(t) = { t 0 t 5 0 5 < t 10 (14) where the minu ign come from the fact that D() i input to the ummer in the block diagram with a negative ign. Thi input ha the Laplace tranform { 1/ 2 0 t 5 D() = 0 5 < t 10. (15) The teady tate error due to a ramp input of infinite duration may or may not be (approximately) attained when the diturbance i applied for only a finite time. Whether it i attained will depend on the value we chooe for K, which affect the peed of the ytem repone. However, uing the teady tate error correponding to a diturbance of infinite duration will give u an upper bound on the error due to a temporary diturbance. Uing the given parameter value and our choen gain, K = 2, we obtain e = lim 0 E() = lim 0 T()D() = 1 2. (16) We ll plot the repone to the temporary diturbance input uing the command lim a hown below. Note that the tate pace repreentation of the ytem ha a tate vector of length 2 o the initial condition in the lim command i alo a vector of length 2. We aume zero initial condition. >> t = [0:.01:10] ; >> u(1:501) = -t(1:501); >> u(502:1001) = zero(500,1); >> x0 = [0 0] ; >> y3 = tf([10 0],[1 10 20]) Tranfer function: 10 --------------- ^2 + 10 + 20 >> _y3 = (y3) a = x1 x2 x1-10 -5 x2 4 0
ECE382/ME482 Spring 2004 Homework 4 Solution November 14, 2005 6 b = u1 x1 4 x2 0 c = x1 x2 y1 2.5 0 d = u1 y1 0 Continuou-time model. >> [y,t,x] = lim(_y3,u,t,x0); >> plot(t,y) >> xlabel( Time() ); ylabel( e(t) ); >> title( Error due to diturbance in AP4.4b ); >> grid >> print -dep ap4_4b.ep We obtain the following plot. Notice that before the diturbance goe to zero at 5 econd, the error ha leveled off to the teady tate value of -1/2 that we found above.
ECE382/ME482 Spring 2004 Homework 4 Solution November 14, 2005 7 3.5 Error due to diturbance in AP4.4b 3 2.5 2 e(t) 1.5 1 0.5 0 0.5 0 1 2 3 4 5 6 7 8 9 10 Time() AP4.6 In thi problem we analyze the lead network circuit hown in Figure AP4.6, page 217. (a) To determine the tranfer function from V () to V 0 () we note that we have a imple voltage divider with v 0 taken acro the impedance Z 2 = R and the total impedance being the erie connection of Z 1 and Z 2 where Z 1 i the impedance reulting from the parallel connection of the capacitor and reitor. Accordingly, and the tranfer function i then ) ( Z 1 = R 1 C ( R + 1 C ) = R RC + 1. (17) G() = V 0() V () = Z 2 Z 1 + Z 2 = RC + 1 RC + 2. (18) (b) To obtain the enitivity of G() with repect to the capacitance C, we apply equation (4.16) of the text which tell u that S G C = SN C SD C (19) where N() and D() are the numerator and denominator, repectively, of G(). We then have SC N = N C C N = R C (20) RC + 1
ECE382/ME482 Spring 2004 Homework 4 Solution November 14, 2005 8 and o SC D = D C C D = R C RC + 2 S G C = (21) RC (RC + 1)(RC + 2). (22) (c) The tranient repone with V () = 1/ can be determined analytically uing a partial fraction expanion of V 0 () = V ()G() and invere tranforming. Since V 0 () = 1 ( ) RC + 1 RC + 2 (23) we olve A + B RC + 2 = RC + 1 (RC + 2) for A and B to obtain A = 1/2 and B = RC/2, o (24) v 0 (t) = L 1 {V 0 ()} = 1 2 (1 + e 2 RC t) u(t). (25) We can plot thi uing Matlab by plotting v 0 ( t) v. t = t RC. We find and plot v 0(t) uing the command >> for index = 1:1001, v0(index) = (1+exp(-2*t(index)))/2;end >> plot(t,v0) >> xlabel( t/(rc) ); ylabel( v_0 ); >> title( Step repone for problem AP4.6c ); >> print -dep ap4_6c.ep and obtain the plot below.
ECE382/ME482 Spring 2004 Homework 4 Solution November 14, 2005 9 1 Step repone for problem AP4.6c 0.95 0.9 0.85 0.8 v 0 0.75 0.7 0.65 0.6 0.55 0.5 0 1 2 3 4 5 6 7 8 9 10 t/(rc) DP4.2 Thi problem ak u to chooe controller gain K 1 K in order to reject tep diturbance while maintaining acceptable tranient repone. We are told that keeping K 1 K < 35 will achieve acceptable tranient repone, o we need only concern ourelve with the diturbance rejection quetion. The block diagram relating T d () to θ() ha G() in the forward path and K 1 K/ in the backward path. The tranfer function i thu θ() T d () = 3 + 4 2 + 9 + K 1 K). (26) We can now ue Matlab to plot the repone of the ytem to a tep input uing the following command. >> KK1 = [1 6 12 18 24] KK1 = 1 6 12 18 24 >> for index = 1:5, y(index,:) = tf([1 0],[1 4 9 KK1(index)]) end
ECE382/ME482 Spring 2004 Homework 4 Solution November 14, 2005 10... Tranfer function from input to output... #1: --------------------- ^3 + 4 ^2 + 9 + 1 #2: --------------------- ^3 + 4 ^2 + 9 + 6 #3: ---------------------- ^3 + 4 ^2 + 9 + 12 #4: ---------------------- ^3 + 4 ^2 + 9 + 18 #5: ---------------------- ^3 + 4 ^2 + 9 + 24 >> for index = 1:5, y(:,index)=tep(y(index),t); end; >> plot(t,y) >> legend( K_1K = 1, K_1K = 6, K_1K = 12, K_1K = 18, K_1K = 24 ) >> grid >> xlabel( Time () ); ylabel( \theta ); >> title( Step Repone for DP4.2 ) >> print -depc dp4_2.ep We ee from the plot below that chooing K 1 K in the range of 6 to 12 damp the diturbance reaonably quickly without introducing too much ocillation.
ECE382/ME482 Spring 2004 Homework 4 Solution November 14, 2005 11 0.12 0.1 0.08 Step Repone for DP4.2 K 1 K = 1 K 1 K = 6 K 1 K = 12 K 1 K = 18 K 1 K = 24 0.06 0.04 θ 0.02 0 0.02 0.04 0.06 0 1 2 3 4 5 6 7 8 9 10 Time () DP4.3 For the control ytem hown in Figure DP4.3, p. 219 of the text, we are aked to find a range of value of the gain K 1 for which the teady tate error will be le than 1%. We are then aked to determine value of K 1 and K o that the teady tate error due to a wind diturbance d(t) = 2t mrad/ for 0 t < 5 econd i le than 0.1 mrad. Solution: Following the ame procedure a in earlier problem we find that the tranfer function from ω d () to ω() i T() = ω() ω d () = K 2 + 5 + KK 1. (27) The problem i not well poed in that it doe not ay within 1% of what the teady tate error hould be. Let aume that they mean that the teady tate error hould be le than 1% of abolute value of the magnitude M of a tep input. Uing E() = ω d () ω() = ω d ()(1 T()) we find e = lim 0 E() = lim 0 M ( 2 ) + 5 + K(K 1 1) 2 + 5 + K 1 K = MK(K 1 1). (28) K 1 K Then e < 0.01 M require K(K 1 1) < 0.01K 1 K (29)
ECE382/ME482 Spring 2004 Homework 4 Solution November 14, 2005 12 or o we need K 1 < 1.01. 0.99KK 1 < K (30) Next we conider the diturbance input. We notice that the wind diturbance occur only for a period of 5 econd and then top. We ll find the teady tate error ignoring the tranient nature of the diturbance and then make the (not unreaonable in thi cae) aumption that the teady tate error due to the temporary diturbance will be upper bounded by that of a permanent diturbance. With D() = 2 10 3 / 2 and (proceeding a in earlier problem) we obtain E() = 2 ( D()) (31) + 5 + K 1 K 2 10 2 e = lim E() = 0 K 1 K o to make thi le in magnitude than 0.1 10 3 require K 1 K > 20. To be ure that our aumption i reaonable, we can ue Matlab to plot the repone to the diturbance, jut a we did in problem AP4.4. With K 1 K = 30, we ue the following Matlab command to generate a plot of the diturbance repone. Notice that only the teady tate value and not the tranient value of the diturbance repone i within the required range. If we wihed to maintain ω < 0.1 mrad for all time we would need a much more conervative deign. >> t = [0:.01:10] ; >> u(1:501) = 2*t(1:501); >> u(502:1001) = zero(500,1); >> x0 = [0 0] ; >> y = tf([1 0],[1 5 30]) Tranfer function: -------------- ^2 + 5 + 30 >> _y=(y) a = x1 x2 x1-5 -7.5 x2 4 0 (32) b = u1
ECE382/ME482 Spring 2004 Homework 4 Solution November 14, 2005 13 x1 1 x2 0 c = x1 x2 y1 1 0 d = u1 y1 0 Continuou-time model. >> [y,t,x] = lim(_y,u*1e-3,t,x0); >> plot(t,y*1000) >> figure(1) >> grid >> xlabel( Time () ); ylabel( \omega (mrad/) ); >> title( Plot of diturbance repone for DP4.3 ) >> figure(1) >> print -dep dp4_3b.ep
ECE382/ME482 Spring 2004 Homework 4 Solution November 14, 2005 14 1.2 Plot of diturbance repone for DP4.3 1 0.8 0.6 ω (mrad/) 0.4 0.2 0 0.2 0.4 0 1 2 3 4 5 6 7 8 9 10 Time () MP4.6 We are aked to compute and compare the open- and cloed-loop repone to a tep diturbance for the given ytem. With the given parameter value we ue the following Matlab code to produce the plot below. We ee that cloing the loop reduce the effect of the diturbance to approximately 1/10 of it open-loop value. >> t = [0:.01:10] ; >> oly = tf([1],[1 0.9 5]); >> oly = tep(oly,t); >> cly = tf([1],[1 0.9 55]); >> cly = tep(cly,t); >> plot(t,oly, -.,t,cly, - ) >> legend( Open Loop, Cloed Loop ); >> xlabel( Time () ); ylabel( \theta (rad) ); >> grid >> title( Repone to Step Diturbance in MP4.6 ) >> print -dep mp4_6.ep
ECE382/ME482 Spring 2004 Homework 4 Solution November 14, 2005 15 0.35 Repone to Step Diturbance in MP4.6 Open Loop Cloed Loop 0.3 0.25 0.2 θ (rad) 0.15 0.1 0.05 0 0 1 2 3 4 5 6 7 8 9 10 Time ()