Вы находитесь на странице: 1из 23
Introduction: Frequency Domain Methods for Controller Design Gain and Phase Margin Consider the following unity feedback system: gain plant > K > G(s) 7, where is « variable (constant) gain and (is the plant under consideration, The gain margin is defined as the ange in openoop gain required to make the system unstable. Systems with greater gain mar anges in system parameters before becoming unstable in closed, ‘The phase margin is define as the change in open-loop phase sift required fo make a eloseHoop system unstal iargin also measures the system's tolerance to time delay. If there is a time delay greater than 180/Woein the loop (where pe is the frequency where the phase shift is 180 deg), the system will become unstable in closexHloop. ‘The time delay, 7 can be thought of as an extra block inthe forwand path of the block diagram that ads phase to the system but has no effect on the gain, That i, time delay can be represented as a black with maguitude of 1 and pase? 7¢ (in radians secon) ns can withstand greater ‘The phase For nos, we won't worry about where allthis comes from and will concentrate on identifying the gain and phase margins ‘on a Bode plot ‘The phase margin is the difference in phase betworn the phase curve and 180 degrees at the point corresponding to the frequency that xives us a gnin of 0 dB (the gain crossover frequency, 424), Likewise, the gain margin is the diference between the magnitude curve and 0 dB at the point corresponding to the frequency that gives us phase of 180 degrees (the phase crossover frequency, oq, 100 ‘Woe rte thal 1 PI i euencr trad ‘One nice thing about the phase margin is that you don't nocd to replot the Bode in order to find the new phase margin when changing the gains. If you recall, adding gain only shifts the magnitude plot up. This is equivalent to changing the axis on the magnitude plot. Finding the phase margin is simply a matter of finding the new erass-over frequency’ and reading off the phase margin, For example, suppose you entered the command bodsvs). You will get the following bode plot = tls); sys = BO/(°3 + 92 + 30s +40); bodes} sridon title( Bode Plot with No Gain) Bode Plet with No Gain Magrituce (48) po 2 100 eee J a so" 10" a0! 10° Frequency (reds) ‘You should see that the phase margin is about 100 degrees. Now suppose you added a gain of 100, by entering the ‘command bode(100%ys). You should get the following plot: bocle(100%ys) gridon title( Bode Plot with Gain = 100') aro ren oe a Fresutney pas) As you ean see the phase plots exactly the same as before, and the magnitude plot is shifted up by 40 dB (gain of 100). ‘The phase margin is now about -G0 degrees. ‘Ths same result could be achieved if the y-axis of the magnitude plot was shifted down 40 dB. Try this, look at the first Bode plt, find where the curve crasies the 10 dB line, and read off the phase margin. It should be about 90 degrees, the same as the second Bode plot. Wecan have MATLAB calculate and display the gain and phase margins using the margin (sys) command. ‘This command returns the gain and phase margins, the gain and phase eross over frequencies, and a graphical representation of these on the Bode plot. Let's check it out: ‘margin(100"sys) om? act SAG rate ac EH) ee Marans) Freeney es) Bandwidth Frequency ‘The bandwidth frequency is defined as the frequency at which the closed-loop magnitude response is equal to <3 dB. However, when we design via frequency response, we ate interested in predicting the closedloop behavior from the open- loop response. ‘Therefore, we will us a second-order system approximation and say that the bandwidth frequency equals the frequeney at which the openloop magnitude response is between -6 and 7.5 dB, assuming the opesloop phase response is between -135 deg and -225 deg. For a complete derivation of this approximation, consult your textbook. In oer to ilustrate the importance of the bandwith fueney, we wll show how the output changes with diferent inp ee, We wl i! hat xno int wih qu lew hn Wr bans recy) ae tack “rsonaly well” bythe stn, Sino inpts with runny greater than Wate atenustd (magnitude) bya factor of 0707 or grater (ad ate ao hifi pase) Lats tay we have the following closoop transfer function representing te 1 we 2 F058e1 sys= 1/(s2 + 05s + 1); bode(sys) Bode Diegram Magrtuce (8) Pace (dea) Ww at ao! aw Frequency (redls) Since this is the clasedloop transfer function, our bandwidth frequency will be the frequency corresponding to a gain of 4B, Looking at the plot, we find that it is approximately 14 rad/s. We ean also read off the plot that for an input frequency of 03 radians, the output sinusoid should have a magnitude about one and the phase should be shifted by perhaps a few degrees (Dehind the input). For an input frequency of 3 rad/see, the output magnitude should be about - 20 dB (or 1/10 as large as the input) and the phase should be nearly -180 (almost exactly out-oEphase). We ean use the Isim command to simulate the response of the system to sinusofdal inputs. Piast, consider a sinusoidal input with a frequency lower than Wbw. We must also keep in herofore, we will modify the axes in order to see the steady state response clearly (ignoring nd that we want to view the steady state response the transient response) sys 1/(s2 + 0.5% +1); w= 03; t= 0101-100; u=sin(w*t) [v.t] = bim(sysant) plot{ty.tu) axis({50 100-2 2)) 18 os 4 15 2 a 6 © 6 0 6 O 8 oF 9 10 Note that the output (ble) tracks the input (green) fairly well itis perhaps «few degtees behind the input as expected. However, if we set the frequency of the input higher than the bandwidth freq distorted response (with respect to the input): cy for the system, we get a very sys 1/(s2 + 0.5% +1); w=3; t= 0101-100; u=sin(w*t) [v.t] = bim(sysant) plot(ty,t.u) xi((00 100-1 1) 08 os oa 02 oO Of @ 9 84 0 6 OOF lB 8 tO Again, note that the magnitude is about 1/10 that of the input, as predicted, and that it is almost exactly out of phase (180 degrees beliind) the input, Feel free to experiment and view the response for several different frequencies, anc see if they mateh the Bede plot Nyquist Diagram The Nyaist plot allows us to predict the stability and performance of @ closerbloop system by observing its open-loop bbeltavio. ‘The Nyquist criterion ean be used for des ign purposes regardless of oper-loop stability (remember that the Bode design methods assume that the system is stable in open-loop). Therefore, we use this eriterion to determine closed-loop stability when the Bode plots display confusing information. Note: The MATLAB nyquist command does not providesn adequate representation for systems that have ‘opemloop poles in the jwaaxis. Therefore, we suggest that you copy the waist Lu file as « new mefile This m- fle creates more arcuate Nsquist plots, sine it comectly deals with poles and zeros on the jax ‘The Nsquist diagram is basically a plot of © U) where CS) is the opemloop transfer function andW is a vector of frequencies which encloses the entite righthalf plane. In drawing the Nyquist diagram, both positive and negative frequencies (ftom zero to infinity) are taken into account. We will represent positive fequencies in red and negative feequences in gen, The frequency vector usedin plotting the Nyquist diagram usually’ looks ike this (if you can imagine the plot stretching out to infinity}: wraxis, Infinity Real Axis However, if we have apentoop poles or 2ez08 on the jw axis, (8) wil not be defined at those points, and we must loop ‘round them when we are plotting the contour. Such a contour would look as follows jwaxis, Infinity Real Axis Please note that the eomlour loops around the pole on the jw axis. As we mentioned before, the MATLAB nyquist command does not take poles of zeros onthe jw axis into account and therefore preuces an incortect plot, To correct this, please download and use uvauist Lan. If we have a pole on the jw axds, we have to use nygust If there ate no poles of zerason the jveaxis, or if we have polozero cancellation, we can use ether the nyquist command or nyquistlm ‘The Cauchy Criterion ‘The Cauchy criterion (from comple analysis) states that when taking a closed contour inthe complex plane, and mapping it theough «complex function C8), the number of times that the plot of (8) encgces the origin i equal tothe musaber of zeras of O09) enclose by the fequency contour minus the number of poles of © close by the frequency contour Enciclements of the origin are counted as positive if they are in the same direction as the original closed contour ae negative if they are in the opposite direction, When studying feck controls, we are not as intersted in (8)as inthe closedloop transfer function Gs) gilt Ge) 11 + (8) enciecies the origin, then C$) wil enclose the point-1. Since we ae interested in the closed-loop stability we want to know if there ate any closedHoop poles (2eras of! + G(S) in the right-half plane. More details on haw to determine this will come later ‘Therefore, the behavior of the Nyquist diagram around the-1 point in the real axis is very important; however, the axis ‘on the standard nyquist diagram might make it hard to soe what's happening axound this point, ‘To eoteect this, you ean ‘add the luvuist.mn funetion to your files, The huyquist. command plots the Nyquist diagram using a logarithunie scale ‘and preserves the characteristics of the-1 point ‘To view a simple Nyquist plot using MATLAB, we will deine the following transfer function and view the Nyquist plot: 05 (s—05 s=tils)} sys = 05/{(s- 05) nyquist(sys) axis(}1 0-1 1)) Nyauist Diagram oa os. os 0a Imagnary Axis 02 8 os 08 “0908 07 08 08 4 03 a2 01 0 Real Axie Now we will look at the Nyquist diagram for the following transfer function: s+2 ae Note that this function has a pole at the origin. We will see the difference between using the nyauist, ms ‘and Inyquist commands with this partic ist Function (e+ 2/(52; nyquist(sys) yatta meghary a nayquist (sys) 1a aca] Ina ais f 7 a io 780 ae os Axie Inyquist(sys) Imag Axis 0 2 4 6 8 Real Axio Note that the nyquist plot is not the ccrrect one, the nyquist plot is eortect, but it's hard to see what happens close to the -1 point, and the lnvquist plot is cortect and has an appropriate scale Closed-Loop Performance from Bode Plots In order to predict loseHoop performance from openoop frequency response, we new to have several concepts clear The system must be stable in opemloop if we are going to design via Bose plots. . I the gain crossover frequency is less than tlhe phase crossover frequeney (ie. Vor < Weq, then the ‘closed-loop system wil be stable, * For second-order systems, the elosextloop damping ratio fs approximately equal to the phase margin divided by 100 if the phase margin is betwoen 0 and 6D degeees. We can use this concept with caution if the phase margin is greater than G0 degrees. * For socondorder systems, a relationship between damping ratio, bandwidth frequency ‘and settling time is given by an equation described on the Extras: Bandwidthpage, A very rough estimate that you can use is that the bandwidth is approximately equal to the natural frequency. Let's use these concepts to design a contvoller for the fllowing system: control plant y G(s) > G(s) > + Where (8) isthe controller and (8) s 10 eel oe Lt ‘The design must meet the following specifications * Zero stewly state extor * Maximum overshoot must be less than 40% * Settling time must be less than 2 seconds ‘There are two ways of solving this problem: one is graphical and the other is numerical. Within MATLAB, the graphical approach is best, so that is the approach we will use. First, let's look at the Bode plot. Create a fle with the following code: 10/(1.25%s + 1) bode(sys) Bode Diegram 2 10 Magrtuce (8) Phase (deg) w Ww at ao! aw Frequency (redls) ‘There are several characteristics ofthe system that can be read diteetly from this Bode plot, First ofall, weean soe that the bandwidth frequency is around 10 rad/see. Since the bandwidth frequency is roughly the same asthe natural frequency (for a frst order system of this type), the rise time is .8/BW = 1.8/10 = 1.8 seconds This is a rough estimate, so we will say the rise time is about 2 seconds, ‘The pliase margin for this system is approximately 95 degrees. The relation damping ratio << 60, Since the system is frstorder, there should be no overshoot. ‘The last major point of intewsst is steadyestate error. The steady-state error can be read ditectly off the Bode plot as well. The constant p, Ky, or Ka) is found from the intersetion of the bw frequency asymptote with the w = 1 line, Just extend the low frequency line to the w= 1 live. The magnitude at this point is the constant. Since the Bode plot of this system is a horizontal line at low frequencies (slope = 0), we know this system is of type zero. ‘Therefore, the "M/100 only olds for PM jon is easy to find, The gain is 20 4B (magnitude 10). What this means is that the constant for the error function 1e steady-state erzor is 1/(1++Kp) = 1/(1+10) = 0.091, If our system was type one instead of type aero, the constant for the steadyestate error would be found in a n to the following ner similar Let's chock our predictions by looking at a step response plot. This can be done by adding the following two lines of cade into the MATLAB command window sys_cl = feedbacks); steplsys_el) title( Closed-Loop Step Response, No Controller’) ‘Cesed.Lo0p Sep Resense > Cortioet 1 : : 7 , rate Tne ceoon) AAs you can see, our predictions were very good. The system has a rise time of about 2 seconds, has no oversiont, and has 4 steady-state error of about 9%, Now we nood to choese a controller that will allow us to meet the design criteria, We choose a PL controller because it will yield zero steady-state error for a step input. Also, the PI controller has a zero, ‘which we can place, This gives us additional design flexibility to help us meet our criteria. Recall that-a PL controller is sven by: Gale K(s+a) of ~~ ‘The is thing we need to find isthe damping ratio corresponding to a percent overshoot of 40%. Plugging in this value into the equation relating overshoot and damping rato (or consulting a plot ofthis relation), we find thatthe damping ratio corresponding to this overshoot is approximately 0.28. Therefore, our phase margin should be atleast 20 degrees. We must have a bandwidth frequency greater than or equal to 12 if we want our settling time toe les than 1.75 secon whic meets the design specs Now that we know our desired phase margin and bandwidth frequency, we can start our design, Remember that we are looking at the openloop Bode plots. Therefore, our bandwidth frequency will be the frequency corresponding to. gain of approximately-7 dB. Let's see how the integrator portion of the PL or affects our response. Change your mefile to look like the following (this adds an integral term but no proportional term): 10/(1.25%8 + 1): 1s brde(conte*plant, logspace(0.2)) Bode Disgran Maite 2) Phase (eec) 170 180 10 10 1 Freeuency (rat) ‘Our phase margin and bandwidth frequency are too small. We will add gain and phase with a zero, Let's place the 2ev0 at L for now and sce what happens. Change younnfile to look like the following plant = 10/(1.25%s + 1) contr = (8 + 1)/s bodle{contr*plant,logspace(0.2)) Bode Diegram 2 w Magnituce (8) Phase (deg) io 10° ta Frequency (redls) It tums out that the zero at 1 with a unit gain gives usa satisfactory answer, Our phase margin is greater than G0 degrees (even less overshoot than expected) and our bandwidth frequency is approximately 11 rad/s, which will give us a satisfactory response. Although satisfactory, the response is not quite as good as we would like, Therefore, let's try to get 4 higher bandwidth froqueney without changing the phase margin too much, Let's try to increase the gain to 5 and see what happens. This will make thegain shift and the phase will remain the same. plant = 10/(1.25%s + 1) conte = 5 * ((s + 1)/s): bode{contr*plant, logspace(0.2)) Bode Diegram 40 a 2 0 Magnituce (8) sto 96 Phase (deg) 10 1 Frequency (redls) ‘That looks wally good, Let's look at our step response and verify our results. Add the following two lines to vour m-fike: sys_cl = feedback(conte*plant,1) steplsys_el) sep Repro ents) As you can see, our response is better than we had hoped for. However, we are not always quite as lueky and usually have to play around with the gain and the position of the poles and/or zeros in order to achieve our design requiremen Closed-Loop Stability from the Nyquist Diagram ‘Consider the negative festback system: plant O—| Gs) >, controller H(s) \* Remember from the Cauchy eriterion that the number N of times that the plot of G(s)H(s) encieeles-1 is equal to the numberZof zeros of1 + G(s}H{(s) enclosed by the frequency contour minus the number P of poles of 1 + G{s}H(s) enclosed by the frequency contour (N = 2 P). Keeping careful track of open and closedoop transfer functions, as well as numerators and denominators, you should eonvinoe yourself that: © ‘The zeros of 1 + G(s} H(s) are the poles of the closeHoop transfer funtion, ‘The poles of 1+ G(s}H(s) are the poles ofthe openloop transfer function. ‘The Nyquist criterion then states thot: * P= the number of opemtoop (unstable) poles of G(s)H(s). "N= the number of times the Nyquist diagram enciteles-1 clockwise encitclements of -1 count as postive eneirclements, ‘counterclockwise encinclements of-1 count as negative encitlements. * Z= the number of right-half plane (positive, real) poles of the close loop system, ‘The important equation wilt relates these three «quantities is (WZ=P+N Note: This is only one convention for the Nyquist criterion, Another convention states that a positive N counts the counterclockwise or anticlockwise encirelements of -1. The P and 2 variables remain the same. Tn this case the equation becomes Z = P - N. Throughout these tutorials, we will use a positive sign for clockwise encirclement It is very important (and somewhat tricky) to leam how to count the number of times that the diagram enciveles-1 ‘Therefore, we will go into so tail to help you visualize this. You can view this movie as an example Another way of looking at itis to imagine you are standing on top of the 1 point and are following the diagram from beginning to end, Now ask yourself: How many times did I turn my head a full 360 degrees? Again, if the motion was clockwise, N is postive, and ifthe motion is anticlockwise, N is negative Knowing the number of righthalf plane (unstable) poles in open loop (P), and the number of encirelements of -1 made boy the Nyquist diagram (N), we can determine the closed-loop stability of the system. IfZ = P + N is a positive, nonzero number, the closedloop system is unstable. We can abso use the Nyquist diagram to find the range of guins for a closed-loop unity feedback system to be stable. The syste we will test Iooks like this: gain plant where Gls) is 324 10s (8)? Be 15 ‘This system has again K which ean be varied inorder to modify the responseof the closed-loop system. However, we will see that we can only vaty this gain within certain limits, since we have to make sure that our elosedlaop system will be stable. This is what we wil be loking for: the range of gains that will make this system stable in the eloseoop, ‘The frst thing we need to dois ind the numberof positive real poles in our opetloop transfer function: roots([1-8 15)) ‘The poles of the opestoop transfer function are both positive. Therefore, we need two antzclockwise (N = -2) cencirclements of the Nyquist diagram in order to have a stable closedHoop system (Z =P +N). If the number of ‘encitclements is ess than two or the eneinclements ate not anti-clockwise, our system will be unstable Let's look at our Nyquist diagram fora gain of 1: sys = (2 + 10%S + 28)/(s°2- 84s + 15); rayquist(sys) ‘There are two anti-clockwise encisclemnts of 1. Therefore, the system is stable for a gain of 1. Now we will soe how the system behaves if we inctease the gain to 20: nayquist(20%sys) Nyauist Diagram x 2 10 Imaginary Axis “0 “20 =o 0 0 20 2 Real Avie ‘The diogram expanded. Therefore, we know that the system will be stable no matter how much we inerease the gain, However, if we decrease the gain, the diagram will contract and the system might become unstable. Let's see what happens for a gain of 05: niyquist(0.5°5vs) Nyauist Diagram oa os os 02 Imeginary Axis 02 08 os 08 1 08 08 04 02 0 02 Oa 08 08 Real Axie ‘The system is now unstable, By trial and error we find that this system will become unstable for gains less than 0.80. We can verify our answers by zooming in on the Nyquist plots as well as by looking at the clasedloop steps responses for gains of 0.79, 0.80, and 0.81 Gain Margin We already defined the gain margin as the change in openloop gain expressed in decibels (AB), required at 180 degrees of phase shift to make the system unstable. Now we are going to find out where this comes from. First of all, let's say that we have a system that is stable if there are no Nyquist encitclements of -1, such as 50 (+ 982+ B08 + a Looking at the roots, we find that we have no open loop poles in the right half plane and therefore wo closeoop poles in the right-half-plane if there are no Nyquist encirclements of 1. Now, how much can we vary the gain before this system bbecomes unstable in closeHoop? Let's look at the following figure: Gain Difference Before CL Instability Imag Axis Rea Axis ‘The openloop system represented by this plot will become unstable in elesod loop if the gain is increased past a certain boundary. The negative real axis area between-1/a (defined as the point where the 180 degree phase shift accurs...that is, where the dagram crosses the real axis) and 1 represents the amount of increase in gain that can he tolerated before closed-loop instability I we think about it, we realize that if the gain is equal toa, the diagram will touels the point: G(jw) (ao careG (iw) = ‘Therefore, we say thatthe gain margin ia units, However, we mentioned befote thatthe gain margin is usually measured in debels Hence, the gain margin is (yjEM = 20L09%0(a) (0B) We will ow find the gain margin ofthe stable, openloop transfer function we viewed befor. Recall that the funtion is 50 (19) FOF B08 a0 and that the Nyquist diagram can be viewed by typing ss = (SS + 9D + Bt + 20): rayquist(sys) Nyauist Diagram 1s os Imagnary Axis og 4 48 a5 7 at 75 2 2S Real Avie As we discussed Iefre all that we need to do to find the gain margin s finda, as defined in the preceding figure. To do this, we now to find the point where there is exactly 180 degrees of phase sift. This means that the transfer function a this point i eal (has no imaginary patt) The numerator is aleady real, so we just need to lok at the denominator When s = ju, the only terms in the denominator that wil have imaginary parts ate those which ate odd powers of: ‘Therefore, for G(jw) to be veal, we must have (up dw? + 30jw = 0 which means w = 0 (this the rightmost point inthe Nyquist diagram) ora ~ sget(0). We ean then ind the value of G{jw) at this point using pola: w= sgrt(30) polyval(0j* /poyval 930 40]j¢w) 0217 ‘The answer i: 0.2174 + OF. ‘The imaginary part is zero, so we know that our answer is comreet. We ean also verify by looking at the Nyquist plot again. The real part also makes sense. Now we can proceed to find the gain margin, Wo found tluat the 180 degrees phase shift occurs at -0.2174 + OL This point was provionsty defined as-1/a. Therefore, ‘we nowy have a, which isthe gain margin. However, we noed to express the gain margin in decibels — =-0.2174 6 (ye (>a (17> GM = 2iog.o(4.6) = 13.26aB We now have our gain margin. Let's see how acvurate iti by using « gain of a= 4.6 and zooming in on the Nyquist plo a= 46; niyquist(a*sys) Nyauist Diagram Imaginary Axis a 2 4 6 2 0 a Real Avie ‘The plot appears to go right through the-1 point. We will wow verify the accuraey of our results by viewing thez0omed Nyquist diagrams and step responses for gains of 4.5, 46, and 4.7. Phase Margin We have already discussed the importance of the phase margin, ‘Therefore, we will only talk about. where this concept comes from. We have defined the phase margin as the change in openloop phase shift required at unity gain to make a on of this concept to get a better idea of what closed-loop system unstable, Let's look at the following graphical we are talking about. Imag Axis & -1 quit Diagram! 2 Rea Axis Let's analyze the previous plot and think about what i happening, From our previous example we know that this particular system will be unstable in closed-loop if the Nyquist diagram ences the -1 point. However, we must also realize that ifthe diagram is sifted by theta degrees, it will then touch the-1 point at the negative real axis, making the system marginally stable in clossHoop. Therefore, the angle required to make this system marginally stable in closed loop is ealled the phase margin (measured in degrees). In order to find the point we measure this angle from, we draw a circle with radius of 1, find the point in the Nyquist diagram with a magnitude of 1 (gain of zero dB), and measure the phase shift needed for this point to be at an angle of 180 degre

Вам также может понравиться