ECE382/ME482 Spring 25 Homework 8 Solution December 11, 27 1 Solution to HW8 P1.21 We are given a system with open loop transfer function G(s) = K s(s/2 + 1)(s/6 + 1) and unity negative feedback. We are asked to design a pair of identical cascaded phase-lead networks to compensate the system such that the closed-loop system has velocity error constant K v = 2, phase margin near 45 degrees, and closed loop bandwidth at least ω = 4 rad/s. Solution: We might ask why we would want to design a pair of identical phase-lead networks rather than a single network or two not necessarily identical ones. Hardware constraints would be most likely the reason we could not use a single network to obtain the entire phase margin adjustment. As for the request that the networks be identical, that minimizes the opportunity for installation errors (from the controls standpoint, they re in series so it doesn t matter which is first, but from a hardware standpoint, they may contain active components which require power sources or other connections which should not be confused). Also, if we wanted to keep a spare component on the shelf in case of failure, making the two networks the same means we only need to keep one spare rather than two. Now, to solve the stated problem, we first note that the definition of the velocity error constant is K v = lim sg(s), (2) s (see Section 5.7, page 262, of the textbook). Thus, to meet the design specification K v = 2 we must choose K = 2. Our next step (following the outline on page 69 of the text) is to determine the phase margin of the uncompensated system. Using the Matlab command margin(tf([2],[1/12 1/2+1/6 1 ])) we obtain the Bode plot shown in Figure 1, which indicates that the phase margin of the uncompensated system is 2.7 degrees at 5.29 rad/s. Next, we determine α. If we were designing a single lead compensator to add the entire needed phase margin 45 + 2.7 66 degrees (1) α 1 = sin 66 deg (3) α + 1 but since we want to use a pair of identical compensators, we let each of them provide half the required phase margin, so solve instead using the Matlab command α 1 = sin33 deg, (4) α + 1
ECE382/ME482 Spring 25 Homework 8 Solution December 11, 27 2 1 Figure 1: Open Loop for P1.21 Gm = 7.96 db (at 3.46 rad/sec), Pm = 2.7 deg (at 5.29 rad/sec) 1 9 1 2 1 1 1 1 1 1 2 1 3 alfa = (1+sin(33*pi/18))/(1-sin(33*pi/18)) to obtain α = 3.3732, so we ll let α = 3.4. Note that we must not call our variable alpha because Matlab has a function called alpha. Next, we find the frequency at which the magnitude for the uncompensated network is 1log 1 α or 5.3 db. This gives us ω m = 6.8 rad/s, as shown in Figure 2. We must also multiply by α to compensate for the attenuation, therefore each of our twin compensators is α(s + ωm / α) 3.4(s + 6.8/ 3.4) G c (s) = = s + ω m α s + 6.8. (5) 3.4 Our combined open loop transfer function is then G 2 c(s)g(s) = 2(3.4)(s + 6.8) 2 s(s + 12.5) 2 (s/2 + 1)(s/6 + 1) for which the phase margin is degrees, as shown in Figure 3. (6)
ECE382/ME482 Spring 25 Homework 8 Solution December 11, 27 3 1 Figure 2: Finding ω m in the Open Loop for P1.21 Gm = 7.96 db (at 3.46 rad/sec), Pm = 2.7 deg (at 5.29 rad/sec) System: untitled1 : 6.81 : 5.25 1 9 1 2 1 1 1 1 1 1 2 1 3 Now we have to make a decision based on our application. Is degrees close enough to 45 degrees? If not, we would adjust the estimated phase margin needed, recompute α, and repeat the procedure above. Not having a specific application in mind, we ll assume that degrees will do. Finally, we must check to see that we have achieved the required closed loop bandwidth. As shown in Figure 4, we have achieved a bandwidth of ω BW = 7.75 rad/s which exceeds 4 rad/s so we have met our design criteria. Here s the Matlab script that I used, so that you can see how I automated the steps of checking the Bode plot to obtain the needed phase margin and the new crossover frequency. P1_21.m solves part of problem P1_21 from Dorf and Bishop 1th ed. 3 April 5 --sk clear all
ECE382/ME482 Spring 25 Homework 8 Solution December 11, 27 4 Figure 3: Open Loop for Compensated System of P1.21 Gm = 14.5 db (at 12.9 rad/sec), Pm = deg (at 4.26 rad/sec) 1 9 1 1 1 1 1 1 2 1 3 G = tf([2],[1/12 1/2+1/6 1 ]); figure(1) margin(tf([2],[1/12 1/2+1/6 1 ])) print -deps p1_21a having determined that the phase margin of the open loop system is -2.7 degrees, we solve for alpha to obtain half the needed additional phase margin of 66 degrees. (To automate things, I ve reiterated the margin command, this time with arguments to obtain the phase margin in the variable Pm.) [Gm,Pm,Wcg,Wcp] = margin(g); ph_needed = (45-Pm)/2; alfa = (1+sin(ph_needed*pi/18))/(1-sin(ph_needed*pi/18)) mmag = -1*log1(alfa)
ECE382/ME482 Spring 25 Homework 8 Solution December 11, 27 5 Figure 4: Closed Loop for Compensated System of P1.21 Gm = 12.7 db (at 12.9 rad/sec), Pm = 76.3 deg (at 6.9 rad/sec) System: untitled1 : 7.75 : 2.97 1 9 1 1 1 1 1 1 2 1 3 having obtained alpha I automate the process of finding the frequency omega_m at which the magnitude is mmag and then determine Gc wrange = logspace(-2,3,1); [mag,ph] = bode(g,wrange); wm = interp1(2*log1(squeeze(mag)),wrange,mmag) Gc = tf(sqrt(alfa)*[1 wm/sqrt(alfa)],[1 wm*sqrt(alfa)]) GcGcG = series(series(gc,gc),g) figure(2) margin(gcgcg) print -deps p1_21ol figure(3) margin(feedback(gcgcg,1)) print -deps p1_21cl
ECE382/ME482 Spring 25 Homework 8 Solution December 11, 27 6 P1.22 We are asked to design a phase-lag network for the same system, having open loop transfer function K G(s) = (7) s(s/2 + 1)(s/6 + 1) and unity negative feedback, such that the closed-loop system has velocity error constant K v = 2, phase margin near 45 degrees, and closed loop bandwidth at least ω = 2 rad/s. What s changed from P1.21 is that the bandwidth requirement has been relaxed. Solution: As in the previous problem, we first note that the definition of the velocity error constant is K v = lim sg(s), (8) s (see Section 5.7, page 262, of the textbook). Thus, to meet the design specification K v = 2 we must choose K = 2. As determined in the previous problem from the Bode plot shown in Figure 1, the phase margin of the uncompensated system is 2.7 degrees at 5.29 rad/s. From the Bode plot in Figure 1, we find the frequency ω c at which the phase margin (plus 5 degrees for the phase lag network) would be satisfied if the magnitude curve crossed db there. As shown in Figure 2, we choose ω c to be that frequency at which the phase is + 45 + 5 = 13 degrees, namely ω c = 1.12 rad/s. We see that we will need to adjust the attenuation by a gain of 23.7 db in order to have the magnitude curve cross db at ω c. We place the zero of the compensator one decade below ω c, i.e. at ω z =.11. We determine the value of α from 2log 1 α = 24 (9) to be α = 15.22. The pole of the lag network is then placed at ω z /α.74, so lag compensator has transfer function G c = (s +.11) 15.22(s +.74) (1) and the closed-loop transfer function will be T(s) = G c(s)g(s) 1 + G c (s)g(s) = 2(s +.11) 15.21(s +.74)(s/2 + 1)(s/6 + 1) + 2(s +.11). (11) As shown in Figure 5, the phase margin requirement is met. Figure 6 shows that the bandwidth requirement is met to within one percent, which we will declare to be adequate. Otherwise, we d have to fiddle with gains and pole locations to improve it. The Matlab script used to generate these results is shown below.
ECE382/ME482 Spring 25 Homework 8 Solution December 11, 27 7 1 Figure 5: Open Loop for Compensated System of P1.22 Gm = 15.1 db (at 3.34 rad/sec), Pm = 44.6 deg (at 1.13 rad/sec) 1 1 9 1 4 1 3 1 2 1 1 1 1 1 1 2 1 3 P1_22.m solves part of problem P1_22 from Dorf and Bishop 1th ed. 3 April 5 --sk clear all G = tf([2],[1/12 1/2+1/6 1 ]) figure(1) margin(tf([2],[1/12 1/2+1/6 1 ])) print -deps p1_22a wrange = logspace(-2,3,1); [mag,ph] = bode(g,wrange); wc = interp1(squeeze(ph),wrange,-13) mmag = 2*log1(interp1(wrange,squeeze(mag),wc)) alfa = 1^(-mmag/-2)
ECE382/ME482 Spring 25 Homework 8 Solution December 11, 27 8 Figure 6: Closed Loop for Compensated System of P1.22 Gm = 13.4 db (at 3.34 rad/sec), Pm = 62 deg (at 1.67 rad/sec) System: untitled1 : 1.99 : 2.98 1 9 1 2 1 1 1 1 1 1 2 1 3 Gc = tf([1 wc/1],alfa*[1 (wc/1)/alfa]) figure(2) margin(series(gc,g)) print -deps p1_22ol figure(3) margin(feedback(series(gc,g),1)) print -deps p1_22cl P1.23 We are again given the system with unity negative feedback and forward path transfer function open loop transfer function G(s) = K s(s/2 + 1)(s/6 + 1). (12) We are asked to design a lead-lag compensator such that the closed-loop system has
ECE382/ME482 Spring 25 Homework 8 Solution December 11, 27 9 velocity error constant K v = 2, phase margin near 45 degrees, and closed loop bandwidth at least ω = 2 rad/s but not more than 1 rad/s. We are given the general form of the lead-lag compensator transfer function, with α = 1 for both the lead and lag portions, that is, G c (s) = (1 + s 1a )(1 + s b ) (1 + s a )(1 + s (13) ), and told to select a to characterize the lag portion of the compensator and b to characterize the lead portion of the compensator. Actually, if we check the text, we find that a should correspond to the lead portion and b should correspond to the lag portion. Solution: As in the previous problem, we first note that the definition of the velocity error constant is K v = lim sg(s), (14) s (see Section 5.7, page 262, of the textbook). Thus, to meet the design specification K v = 2 we must choose K = 2. We are told on page 612 of the textbook that the idea of using a lead-lag network is to [provide] the attenuation of a phase-lag network and the lead-phase angle of a phase-lead network. Let s see what this means. The network structure that s been specified in (13) fixes α = 1 for both the lead network and the lag network. Looking first at the lead network, we can solve 1b sinφ m = α 1 α + 1 (15) for the phase angle that we will obtain from the lead filter (irrespective of the actual values of the zero and pole that we eventually choose). The resulting phase contribution is φ m = sin 1 (9/11) = 55 deg. (16) On the other hand, the attenuation introduced by the phase lag network is 2log 1 α at the chosen crossover frequency, (see Step 6 on page 69 of the text). This is 2 db. The uncompensated system has magnitude 2 db at 1.54 rad/s as shown in Figure 7. Then from Step 6, we choose crossover frequency ω c = 1.54 and (as in Step 4), place the zero of the lag filter one decade below the crossover frequency at.154 rad/s. The pole is then placed at.154/α =.154 rad/s. Let s see what we have so far. The phase margin of the combined system is 22.2 degrees as shown in Figure 8. Now we have to correct the phase margin. Our lead filter will give us 3 degrees of phase margin at its crossover frequency, so we must choose the zero and pole accordingly. The crossover frequency should be ω m = zp with p = ω m α. From the Bode plot of this open loop system, we choose ω m to be that frequency at which the phase is + 45 3 = 165 rad/s. This gives us ω m = 2.35 rad/s. Accordingly, we choose p = 2.35 1 and
ECE382/ME482 Spring 25 Homework 8 Solution December 11, 27 1 1 Figure 7: Open Loop for System of P1.23 Gm = 7.96 db (at 3.46 rad/sec), Pm = 2.7 deg (at 5.29 rad/sec) System: G : 1.54 : 2 1 9 1 2 1 1 1 1 1 1 2 1 3 z = 2.35/ 1 and obtain phase margin of 47 degrees, as shown in Figure 9, and closed-loop bandwidth of around 6.35 rad/s as show in Figure 1. The lead-lag compensator obtained has transfer function G c = The Matlab script used is given below. (s +.154)(s +.154). (17) s +.743)(s + 7.43) P1_23.m solves part of problem P1_23 from Dorf and Bishop 1th ed. 3 April 5 --sk clear all G = tf([2],[1/12 1/2+1/6 1 ]) figure(1)
ECE382/ME482 Spring 25 Homework 8 Solution December 11, 27 11 1 Figure 8: Open Loop for Lag Compensated System of P1.23 Gm = 11.2 db (at 3.3 rad/sec), Pm = 32.8 deg (at 1.54 rad/sec) 1 1 9 System: untitled1 : 2.35 : 165 1 4 1 3 1 2 1 1 1 1 1 1 2 1 3 margin(g) print -deps p1_23a alfa=1; mmag = -2*log1(alfa) wrange = logspace(-2,3,1); [mag,ph] = bode(g,wrange); wcp = interp1(2*log1(squeeze(mag)),wrange,-mmag) Gc_lag = tf(1/1*[1 wcp/1],[1 (wcp/1)/alfa]) figure(2) margin(series(gc_lag,g)) print -deps p1_23ol1 wm=2.35 where phase is -18+45-3=-165 Gc_lead = tf(alfa*[1 wm/sqrt(alfa)],[1 wm*sqrt(alfa)])
ECE382/ME482 Spring 25 Homework 8 Solution December 11, 27 12 1 Figure 9: Open Loop for Compensated System of P1.23 Gm = 1.7 db (at 7.69 rad/sec), Pm = 47 deg (at 3.69 rad/sec) 1 1 45 9 1 4 1 3 1 2 1 1 1 1 1 1 2 1 3 figure(3) margin(series(gc_lead,series(gc_lag,g))) print -deps p1_23ol2 figure(4) margin(feedback(series(gc_lead,series(gc_lag,g)),1)) print -deps p1_23cl
ECE382/ME482 Spring 25 Homework 8 Solution December 11, 27 13 Figure 1: Closed Loop for Compensated System of P1.23 Gm = 7.74 db (at 7.69 rad/sec), Pm = 41.5 deg (at 5.59 rad/sec) System: untitled1 : 6.37 : 3.5 1 9 1 1 1 1 1 1 2 1 3