hello and welcome back to control system lectures in the last video I showed you the steps to designing a lead compensator using the root locus method now in this video we're going to design the lead compensator using the bode plot method now before we get started I want to make a quick statement regarding one of the driving reasons behind how I choose which information to put into these videos and which information I leave out now the math involved in classical control theory is very basic most of it can be done using solely algebra the occasional
dip into trigonometry and only the easiest parts of calculus so the question I have is why is control theory so difficult to understand if the math involved is pretty straightforward and I believe that it's really the concepts that are hard to grasp not actually the mathematical steps that you need in order to find the answer so with that in mind let's go through the concepts of how to use the bode plot to design a lead compensator and I'll leave a lot of the math side of things to some of the textbooks and other references and
I've placed a few references in the description below if you're interested in checking them out so let's get started I'll set the problem up the same way that I did in the root locus video you've got an open loop system and you've determined that it's not capable of meeting the system requirements so you feed back the measured output compare it against a reference signal and generate an error term which is then converted into an actuator command via the controller and the compensation technique of choice for this controller is once again a lead compensator and the
question is where do you place that single zero and that single pole in order to meet the requirements stated for the system we know how to do this using the root locus method first you convert the requirements into a dominant pole location in the S plane and then you set the zero and pole in such a way that the root locus goes through that specific location the technique for the bode plot method isn't much different here though you start by converting your system requirements into frequency domain requirements if they're not already there instead of the
pole locations in the S plane frequency domain requirements are things like the following phase margin gain margin gain crossover frequency the bandwidth and zero frequency magnitude value there's also a requirement of steady-state error but this is kind of a time domain requirement but it applies both in the frequency domain here and in the S domain on the root locus method and we'll talk more about that in a future video this in my mind is the hardest part of any compensation technique in the classical sense figuring out where you want your poles in the S domain
or how you want the open-loop frequency response plots to look in the frequency domain but once you know that the designing the compensator to give you that look is mostly graphical in nature let me show you where these frequency requirements exist on a bode plot for a generic second-order system phase margin is the difference between your phase and minus 180 degrees of phase at the point where the gain crosses 0 DB and gain margin is the difference between your gain and 0 dB at the point where your phase crosses minus 180 degrees the point where
your gain crosses 0 DB is called the gain crossover frequency and the point where the gain drops to minus 3 DB is called the bandwidth the zero frequency magnitude which is sometimes called the DC gain is just the gain at very very low frequencies or zero frequency in this case for this plot it's about minus 6 dB so in the most simplistic explanation I can come up with you're trying to bend and more if your bode plot for your particular system so that it goes through these particular points at the requirements that are set for
your system so let's see an example with this let's design a system that has a steady-state error of less than 0.02 to a unit ramp input and the system also has to have a phase margin of greater than 48 degrees so basically this red line needs to be longer than 48 degrees for our particular bode plot once we're done designing our compensator and we'll also say that we're given this exceedingly boring plant which is 1 divided by 0.2 s plus 1 now whenever you're given a steady state error requirement the very first thing that you
should always check is system type check out my video on final value theorem and steady-state error for more information on this but the system type is the number of poles at the origin and this number dictates whether you're going to have infinite steady-state error finite steady-state error or no steady-state error based on the type of input signal so in our case with a unit ramp input in order for the system to have a finite steady-state error then the system needs to be at least type 1 or a single pole at the origin and if it's
a type 2 it will have 0 steady state error right away we can tell that this system is type 0 since it has no poles at the origin and therefore cannot meet the steady-state requirement with a lead compensator alone and that's because the lead compensator isn't going to add a pole at the origin and since we need less than 2 percent steady-state error at the very least we need to add a single pole at the origin to make this a type 1 system now if you forget this step and you design a lead compensator to
meet the phase margin requirement first then you try to add a pole at the origin at the end to meet the steady-state requirement you're going to mess up the phase margin and have to start all over so always start with the system type also we could have added a second pole at the origin to decrease our steady-state error to zero but this would be an over designed system and possibly bad in the long run the reason I say this is because adding poles aren't free it adds complexity to your design complexity to the hardware to
build it and can reduce stability in your system since the requirement for steady-state error is less than 2% and not zero you'd be better off just meeting the requirement in most cases rather than exceeding it so let's close the loop around our plant and our single pole here and we'll also add a gain in line with it and now we can move on to step two which is choosing the gain necessary in order to meet our steady state error requirement which in our case is less than point zero two now you'll recall that the equation
for steady state error is the limit as s goes to 0 of s divided by 1 plus G of s times the input R of s and for us G of s is the plant times K divided by s and Aarav s is a ramp input or 1 over s squared and you can plug all of these values in and then solve for the value of K that makes this equation less than point zero two and what you'll find is K needs to be greater than 49 so just to make the math simple I'm going
to choose K equals 50 for our control system and I'll plug that into our block diagram for K so now we know that our system meets our steady state error requirement but we don't know yet whether it meets our phase margin requirement and in order to figure that out we need to plot the bode plot for our open-loop system you can estimate this by hand by taking the bode plot of the plant and adding it to the bode plot of our compensator K over s or 50 over s but I wanted something accurate so I
plotted it up in MATLAB and I'll put it right here to determine the phase margin find the gain crossover frequency follow that down and then measure the distance between your phase and minus 180 degrees also MATLAB shows me up here at the very top of the title that I have 18 degrees of phase margin and 18 degrees is less than 48 degrees so we don't meet our requirement so we're going to need additional compensation and that's where our lead compensator comes in to give us that additional phase margin the basic premise is this try to
move the phase curve upwards so that you can increase your phase margin without disrupting the magnitude plot too much and to see how this is accomplished let's look at the bode plot of a typical lead compensator so you can see that we're adding phase for a certain frequency band and if you design the lead compensator correctly when you add that phase gain it'll cause the phase to go right through our new phase margin point that we want and this is exactly what we want unfortunately we're also adding a little bit of gain to what that
does is it moves the gain crossover frequency to a higher frequency which means that you're not getting the full amount of phase that you were expecting because our gain crossover frequency goes through a different portion of the phase plot so now you can see why this is grabbed ethical in nature we're just adding these to bode plots together to get one that we want in the end but to determine how much phase we need to add and at what frequency we're going to need some equations and let me first start by showing you an equation
for a lead compensator written in a slightly different format than you might have seen this is a 2 x tau s plus 1 over tau s plus 1 and I like this form because it's easy to see that the zero frequency gain is 1 which means it's not going to disrupt our steady-state error that we did in steps 1 and 2 and of course in order for this to be a lead compensator a 2 has to be greater than 1 if it's less than 1 then it's a lag compensator but we'll talk about that later
and you can determine the upper cutoff frequency with this equation which is approximately where the gain and the phase start to head upward and the lower cutoff frequency with this equation which is the tail end of the phase and where the gain starts to flatten out V Max is the maximum amount of phase lead that the compensator can provide and Omega Max or Omega M is the frequency at which that maximum phase occurs and lastly the gain at Omega M is given by this equation so with these equations you can solve for a 2 and
tau which are the only two unknowns in our lead compensator like this step one is choose the amount of phase that you want to add to your system and then solve for a two using the V Max equation and then determine the frequency that you want to add all that phase to and then you can solve for tau using the Omega M equation and the previously solved for a two and then finally you can just construct your lead compensator by plugging in a 2 and tau and you're done but wait a second there's a catch
and I've already mentioned it a little bit earlier remember we can choose the phase that we want to add to the system but again is going to add gain to the system at that frequency as well which is going to move the gain crossover frequency to the right which means you're not going to get that maximum phase increase you're really only going to get something slightly less than that so you're not going to meet your requirements still and then this is going to ensue a potentially infuriating iteration where you try to add even more phase
lead and see if that did the trick and then add more and then more until you're done but there are at least two ways around this but first is just to add a safety factor to your original phase lead so you only have to do this once something like V Max equals the fee that I need plus something like 15 degrees and the second way is to just try a bunch of different values of a2 and construct a table and then just pick the correct value from the table after you're done and I agree that
neither way is really an attractive way of generating a lead filter but it works and sometimes control design is an iterative process and you just can't get away from that completely now I'll show you the final lead compensator for this system that I built up but I think it's a good exercise for you to work out one on your own and there isn't a one-size-fits-all solution here so you'll probably come up with slightly different values for me I chose 37 degrees for fie max which works out to a2 equals 4 and Omega M at 22
point 2 radians per second which works out to tau equals point 0 to 2 and now I can lay this lead compensator in line with the other compensators and this is going to make up the entire controller and we can see that we meet our phase margin requirement by plotting the bode plot for this fully compensated system and I did that bode plot in MATLAB and I'll show you that here shortly but I also overlaid it on top of the bode plot for the system without the lead compensator so you can see the effect and
here it is so again we find the gain crossover frequency and now you can see that the phase at that frequency has increased a lot in fact our phase margin is met it is greater than 48 degrees like we wanted and the other good news is that the magnitude plot looks pretty much the same except for high frequencies and we've only barely moved that gain crossover frequency to the right a little bit so it all worked out which is pretty awesome so I think it helps to think of the lead compensator at least in the
bode sense as just a delta to your original uncompensated bode plot and you just need to try to if you late your lead compensator bode plot shape so that when you add it to your original one all of your requirements are met there's one last thing that I wanted to say and that's that you can only add up to 90 degrees of phase with a lead compensator that's because there's only a single 0 in the compensator but realistically with how you implement a phase lead compensator with your components you really should only ever try to
add about 55 degrees with it anything more than that the component values that you need become too large or too small to be practical therefore if you need more phase lead than 55 degrees you'll need to add two compensators or two stages in series and they're going to add on top of each other so you can get up to a hundred and ten degrees of phase lead if you have two in series if you guys have any questions or comments on what I've said here leave them in the section below and I'll try my best
to answer them and as always thanks for watching