Introduction to PID Control

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone and welcome to another video so today I'd like to introduce the idea of PID control so today we're going to keep the discussion fairly brief and fairly high level because we're going to have several other dedicated videos which explore various aspects of PID controls in much greater detail so this extended discussion is very well warranted because PID controllers are probably the most popular control scheme in history so if you spend any amount of time working with controllers or looking at Control Systems you're almost guaranteed to run across at least one or two PID controllers throughout the course of your career so for today I just want to get everyone comfortable with some of the Core Concepts surrounding PID control so if that sounds like fun let's take a look at the board over here all right so to set the stage for PID control let's go back to our standard feedback control architecture that we've discussed in previous videos so in this scheme just to refresh your memory right we've got some kind of plant here G and the idea is that this plant produces some kind of output and we would like this output to match some reference signal if they don't match we're going to take their difference to create some kind of error signal and the controller is then going to look at this error signal and compute a control signal which is applied to the plan so that hopefully in closed loop this output signal y will eventually match the input reference signal R so again that's the grand scheme that's the very general idea of a simple sometimes referred to as an inner loop or a single Loop controller right so the whole game at this point is what does this controller look like right let's think about this um what is probably the simplest thing that you can do here well the simplest thing you can do is you can probably just take this e and run it into a gain of some value let's call this uh gain k right so something like this this is about the dumbest thing you could possibly do right this is the simplest controller and in this case let's think about what is the control law all right so the control law basically says that the control signal at any given time it's just going to be here which is just nothing more than this gain K times the error okay so you can see that the control signal it's just the error multiplied by a number K so you can say that the control signal is actually directly proportional to the error right it's proportional by this gain Factor K so this is actually what's referred to as proportional control right and this P here is actually the same p in the PID scheme so this is pretty much the simplest scheme it's actually a p it's a type of PID controller is the simplest controller you could come up with right it's nothing more than take the error multiply it by a static gain K to compute your control uh U okay so that's the simplest thing you can do and what PID control is and PID controllers is just extending on this so instead of just having one term what if we had multiple terms like what what else could we potentially do so the thing we could do is let's start adding on extra terms to our control law so to distinguish this we're gonna have multiple games so I'm actually going to call this KP okay and actually I'm going to draw this in a slightly different fashion I'm going to move this up a little bit you're going to see why we're doing this in a second I'm gonna do it like this okay so you've got this KP okay really I haven't done anything fancy yet right but now what we're going to do is let's add on another term here so the next term in my control law it's actually going to be again k i multiplied by the integral of the error D Tau from time 0 to time t Okay so this term right here is sometimes referred to as an integral component right and again this I here is this I in the PID scheme right and then what we're going to do is uh let's add on a third term which is going to be k d times the time rate of change of the error right and this is sometimes referred to as a derivative right and again the D here is this D in PID control so we can see that P ID control stands for proportional integral derivative because it basically has the control law being computed using three terms so this term right here is the proportional part let's go ahead and maybe I'm gonna put this here in blue let's call this U proportional okay or sorry I'm going to do this in green and then let's go ahead and put this I term here this entire I term here is going to be u i okay and then finally this term down here is u d okay so we see that the control signal here is made up of three components so maybe let's actually draw this in a block diagram format because I I like to always see things in block diagram format I mean this is an explicit control law right you could go ahead and implement this in in a you know C plus plus or something like that but I like to think in terms of block diagram so let's translate this control law into a block diagram so we already have this term right here right you can see clearly that right here this signal here is u p right it's the green part right it's nothing more than KP times the error now we got to get this this blue part right it's Ki times the integral of the error so what we need to do here is we need to integrate and I'm going to write 1 over s for the LaPlace version of an integral so this is an into Gray tour right so what this thing does is you give it e it just accumulates or integrates all the error that's coming in so coming out of this is basically this term here integral of e Tau D Tau from 0 to time T right that's what that integrator block does it just does the the integration of the error signal now all I got to do is multiply this by again k i right so now here's your k i right and then that goes into this summing block and right here we have the signal u i time T right that's this signal right here okay and then lastly what we've got to do is take into account this term right so what this term says is you need to compute the instantaneous time rate of change or the error dot right so this is the derivative of the error at time T so again let's go ahead and Branch this off and I'm going to go write it like this again let's just use the LaPlace version of an integrator so this is a uh an S and you can think about this block as just a different she a Tor right whose sole job in life is you give it a signal it computes its time rate of change of that signal so coming out here is e dot this term so I just need to now multiply it by KD KD right and that goes into the summing block and now this signal here is our u d okay so this is what's great about a PID controller is that it is actually surprisingly simple that's all there is to it it's just a controller where you have the error coming in and the arrow then gets sort of split into these three branches or these three terms and that's all you do right you just take the arrow multiply it by KP that gives you the proportional component of control there's also an integral component of control which you get by basically integrating the error and then multiplying by Ki or you can flip these around right from our block diagram algebra discussion for the fact that this is a linear system you can actually it doesn't matter if the Ki comes before or after the integral right and then same thing for the derivative right you can basically switch this around it can be KD times s or S times KD it doesn't matter but at the end of the day you have this third branch here which is basically has something to do with the derivative of the error right so in a nutshell that's pretty much what this does all right so Computing it is really really simple okay now I'm going to put in your mind right now just stick in the back of your head that yes this seems simple but there are a lot of ways this can go pear-shaped and we're going to talk about that in other dedicated videos but for the time being let's assume everything is hunky-dory and we're gonna go ahead and maybe let's examine each one of these terms this up UI and UD or the proportional control the integral control and the derivative control portions in isolation by themselves just so we can get a better feel for what they uh what they do and how they behave all right so to get a better feel for what each of these terms do why don't we start with just the proportional control and what we can do is let's consider it by itself so in other words let's see if we can ignore the integrator so I'm going to have a little sticker here that says just ignore that and let's also ignore the the derivative components so the only thing we've got is this proportional control right and let's again we said earlier at the beginning of this discussion that this is probably the simplest controller you can have so let's see if we can understand how it behaves and just some general characteristics about it right okay so what I've done here is let's just look at since we're only caring about the controller let's look at the error signal going in and what the control signal coming out might be and again the control signal is just up right it's only that's the only component so I'm going to draw the error in purple um and let's go ahead and say that everything is fine everything is fine if we have zero steady state error or excuse me zero error and then at some point we introduced some errors so the what what that could mean is that suddenly you know everything is fine the output is actually matching the reference and then at some point we maybe have a step input of magnitude a at some time and that will create a jump in the reference signal the plant can't respond instantaneously right so this signal Y is still going to be at the old value so when you introduce this step there's going to be a step in the error right of also of magnitude a so what the error signal is going to do is it's going to jump up to a okay and I'm going to just label all of these about and I'm going to put a little Dash to line so we can see this kind of Event Horizon okay and this is now going to jump up to a value of a okay so let's now go ahead and draw in green what is the the proportional control signal going to do so again we can see very easily what it's going to do in this window right because there's zero error right there's going to be zero control right because that's how this works the control is just the error multiplied by KP so I don't care what number KP you have if e is zero this is going to be zero so the the control signal just zero zero zero zero zero zero until this event horizon again and now this is now going to instantaneously jump up to a value now of what this value is going to be a times KP right so this is what's actually kind of nice about a proportional controller is a proportional controller is going to respond instantaneously right this gain is just a multiplication that happens right away there are no Dynamics associated with it so a proportional controller is going to kind of freak out a little bit right it's going to realize there's a large error and it's going to then apply a large control signal right and hopefully you've got this control signal set up in uh in the correct orientation in the sense that this positive number of AKP it's going to start pushing the signal y to start matching the signal R so what the error is probably going to do is it's going to probably start coming down right would you agree right as the plant starts to respond it's going to start coming down now what is the control signal going to do again the nice thing about this is to get the green line we just multiply the purple line by a gain KP so this is going to basically mirror it like that right so this is where it gets interesting though if you thought this long enough eventually this error is going to keep going down hopefully you're getting closer and closer and closer and now what's going on is at the same time the control signal is is getting smaller and smaller and smaller right at some point for real systems what might end up happening is you might get stuck and there might be some steady state error and the reason this occurs right is if you think about this what's going on is as the error starts going down so does the control signal right the control signal also starts going down so the control starts getting weaker and weaker and weaker so you're applying less and less control to the all to the plant so if you think about like what if your system is uh a mass on some surface right and you're sitting here at the location Y and now you want to move over here to a location R right there's a step input of magnitude a right so you are going to start applying some proportional control to this guy right and initially when the error is large this signal is large so you're pushing the block hard the block is going to start moving over and maybe it's going to get to over here right at this point here's your y here's your R the error is now much smaller right so the force on the Block is going to be much smaller do you see how like maybe if there are non-linear effects like friction right friction might grab the block and at some point the control signal is going to be too weak to overcome friction and the block is going to stop and it's not going to move anymore so the problem that you may see with proportional controllers is that at some point they become basically the control signal becomes too weak to drive this steady state error to zero right but it's actually quite simple though the the reason why the proportional control it's easy to understand what's going on we got a good feel for what it's doing all it's doing is it's exerting your control which is directly proportional to the amount of error right but one of the drawbacks of this is that in many situations a proportional control by itself is subject to this uh this steady state error which leads us to uh the next component okay so let's modify our little diagram here and now instead Let's ignore KP and KD and just look at an integral term let's pretend like you decided to make a controller which just has an integrator so let's look at this uh integral control component and see what happens so again we've got error on the top and now let's ask ourselves what is the integrator going to do right now remember all this integrator does this integral control component it's given by this equation right here right all you have to do is integrate the error and then multiply by some number KP okay so let's take a look at this again um okay again the error is zero and then suddenly you give it some kind of input right or some step in reference to generate some step in error okay so again let's ask ourselves what is the integrator going to be doing here so again down here the integrator is doing zero nothing zero zero zero zero zero zero zero zero right until some action happens here when we introduce this this error step something hap now we got to ask ourselves what is that something okay so the way I like to think about this is let's go ahead and look at a little time here okay after this step it gets introduced okay let's say that the error signal does something like that okay now we got to ask ourselves what is the control signal at this time well the way you get that control signal at this time T is apparently you integrate the error so let's just focus on this integral term where is this integral term in this picture well again the integral of the error signal it's just the area under the curve of the E of T right so in other words it's this area under here right this amount of area is what this integral term is it's how much error the integrator has accumulated right so that is this area multiplied by the number Ki that's going to tell you what the output of your system of the Integra of the integral control component is at this time and as you can see because there hasn't been a large time this area is small right sure it might have a large height but the width is small so this area is kind of small you multiply it by some Ki you probably get some small numbers so it's probably something like this right so the integrator is going to do something like this does everyone see what's going on right now all we got to do is just March along a little bit further in time right and ask ourselves the same question right so again the the maybe the air signals doing this right so now the total area is this so the total area is now bigger right so the integrator keeps pushing harder right and etc etc you can see what this is going to be doing is it's going to keep going and let's say that this thing goes down to here let's say it does this at this point the area looks like that right and we can trace this the exact same point down and we're going to see what's interesting is at this time T the integrator has has accumulated all of this green area so it's actually you know it's actually quite large at this point right and here's the rub with integrators by themselves and this is one of the reasons why you usually never see an integrator by itself think about what's happening right here here everything is fine right this is perfect this is what you want right you want error to be zero so at this point you want to just say stop right if your controller was intelligent you'd be like okay stop doing whatever you're doing the system is where it needs to be let's let's quit right um but think about what the integrator is doing right here the integrator has accumulated all of this green area so actually it is still pushing in fact it is pushing and applying as much control as it ever is going to be doing it's built up some um almost like some momentum right it's almost got some mass and this integrator has got some momentum and it's going along and actually what's going to happen is it's going to keep pushing on the system right it's just keep a client control so the system error it's probably going to overshoot right the block is going to go you know if this was our Mass spring system it's going to start going down uh right it's going to overshoot the system and now what you've got is you actually have negative area here right so again if you think about this what's going to happen is the error sign changes it becomes negative at this point right so now that integral in the red component is negative area the green is positive area so maybe let's just label it so this is sort of positive area that we the integrator has accumulated this red is negative area right so what's the net between the green and the red there's still much more green than there is red so this signal it's it's it's going to start coming down but it's still positive right so do you see what's going on you overshot where you wanted to be but the integrator is still pushing in the in that same direction right it's not pushing as hard as it used to but it's still pushing in the same direction or in that same direction so this is probably going to get worse before it gets better right because at some point you're going to have to accumulate a net difference between the uh positive and negative area such that you get something like this right what's going to end up happening is that eventually this thing is going to get you zero steady state error and that's what's actually the nice benefit of this integral control is that eventually and I I should I should make sure I draw this accurately right eventually what you're going to end up with is zero steady state error okay and what's going to end up happening is that the control needed to achieve that zero steady state error is going to be output by the integrator and the integrator alone and again we are going to explore that statement further in future lectures future discussions um I just want to state that right now the thing to take away from this is that the integrator is going to eliminate steady state error the integrator will not allow your system to have steady state error okay um and it does so through this sort of exchange of um positive area and negative area when you're integrating the error signal right and again this isn't one of the reasons why often this is coupled with other components the the proportional and the derivative to try to get rid of some of these oscillations because this is probably not great now I do want to dwell a little bit further on this idea of this this claim that we made here that you're going to have zero steady state error right the way you can actually kind of think about it and prove that to yourself is almost sort of in a in a paradoxical sense right what I mean by that is let's let's draw a quick picture maybe a smaller picture of error versus time like a smaller version of this picture up here because it's really quite simple the idea let's say that this thing is doing whatever right and let's say you have steady state error okay let's assume that somehow you have a non-zero steady state error okay what is the integrator going to do in this situation right what does the UI component look like well according to our discussion above right all we're doing is we are integrating the area under the curve right so what the integrator is going to do I think we're drawing it in blue is it's going to do something like this and then it's going to start integrating error right so this thing is increasing in fact this is this is all monotonically increasing because I only have green positive area so this thing is going up right going up going up going up going up going up now think about this right if you have a non-zero steady state error what that means is the area under the Curve is going to become unbounded right it's going to go to Infinity Therefore your control signal is also going to go to Infinity so there is something really wrong with your system if you have an integrator in it and it keeps pushing harder and harder and harder and harder and harder and exerting more and more Control Authority eventually it has to be able to move the system um towards the the reference signal right if it's not you you've broken something right something else is going wrong but mathematically speaking it should not be allowed to do that right because of this pair this this is a paradox right here right you can't have zero steady state uh you cannot have non-zero steady state error because that would lead to an unbounded infinite control signal which is sort of a catch-22 because if this control signal became large enough it has to be able to eventually move this signal y towards the reference right so this is one way you can kind of prove to yourself that that the the whole reason of adding an integrator is to get rid of steady state error it does create some complications like you're seeing here and again we are going to dig into some of the complications and problems of things that can go wrong with an integrator in a lot greater detail in a future video but I just want to throw this out here now just to kind of put it on your radar so people can start thinking about this idea um here okay great so that's the integrator um give me a second to clean up the board let's look at the last term all right so the last term we want to look at is let's look at the derivative terms so we'll kind of ignore the proportional in the integral and again I'm going to say kind of because the you're going to see in a second that the derivative control really cannot operate by itself that doesn't really make a lot of sense so maybe maybe let me let me kind of halfway put the ignore on these let's assume that there are other components that maybe drive the air signal but mostly I want to talk about what does this UD look like so let's just look at the derivative control portion and what does the ud signal look like okay so again same idea let's presume everything is hunky dory uh until this time when we introduce some step in R which generates a step in the error signal okay so again let's ask ourselves what is the derivative doing so again the derivative is looking at basically the slope of the error plot right and then it's multiplying it by KD so you look at this slope here and you're like oh that's easy that's a big fat zero so again it doesn't matter what your KD number is your k your derivative gain this is going to be zero okay now at this point here when we introduce this step you actually see that we have a little bit of a discontinuity right because the slope here is infinite right it just jumped from zero to something not zero instantaneously so actually the derivative control is going to be ignore you're going to some spike here right you're gonna get a giant number okay and now what's going to happen is this is why again the derivative maybe doesn't work by itself maybe the proportional control of the integral control something starts driving the error down right this thing starts going down towards the reference point okay so now what we can start asking is I can start looking at the slope here so the slope here is kind of you know something right and uh it's it's small so let's just say that this is I don't know maybe maybe this thing comes down nicely down to down to here or something like that maybe your KD is negative so that even though this is a negative slope by the time you multiply by a negative KD you get a positive u d all right so again the sign doesn't really matter I'm more interested in the concepts right so the idea is okay that's like that and then you see here the slope is a little bit steeper so now it's a little bit more and then it's even steeper so you get even more so I think everyone gets the idea right what's happening is that this derivative signal is basically looking at the uh the slope of the error to basically compute what it's going to do right so again uh I'm not a great artist but I think it's gonna you know something something like this okay okay so again the other thing that is maybe interesting to mention here is that at steady state right so here is where we have sort of steady state Behavior so maybe there's zero steady state error maybe there's non-zero steady state error I don't really care all I care is that it's at steady state and what that means right is that steady state what's the slope here the slope is zero right so at steady state Behavior the the derivative is zero right so interesting right at steady state the derivative does nothing right so the derivative is really this D term this control comes into play only when the system has Dynamics right when the error signal is changing that's when this thing actually kicks in and contributes something to your overall control signal right now again you couple that with the factors we talked about earlier that if you had zero steady state error let's draw maybe an alternate signal maybe it's like dashed right and again the derivative will look pretty darn close here so again this is maybe a nice part to maybe mention you have steady state behavior and you have zero steady state error right this is the picture you want right we want whatever our control scheme to do we want the error signal to eventually settle out to zero okay now think about this if this is zero right the slope of this is flat so the derivative controller is doing nothing right so this here is basically zero I mean it is zero right so this is zero and now let me take away these ignore things because now really we can start talking about all of these together right because that's what a PID controller is is when you've got interplay between all three of these components right and we already talked about the up idea right the the proportional part it's just the error multiplied by KP well if you have zero steady state error you have zero error so therefore this is actually also zero right so again this supports what I what I kind of briefly weighed my hands on or very quickly earlier is that in a good situation where everything is do where things are behaving the way you wanted to when you have this picture the integrator is the only thing that is non-zero right it is the only thing that is contributing to your controller or to your control signal in this configuration so again this is just there's a lot more discussion to be had but I just wanted to kind of give everyone some core ideas and get a rough feeling of how all these little terms contribute what they do what they feel like and now the game is considering all of them simultaneously so to maybe get a little bit more um intuitive feel for what these are let me um let me actually let's jump outside and I've got a little demo that we can look at uh with a physical system to see how these all interplay all right so I've got a little experimental setup here and what we'd like to do is think about I've got this little weight here and you can see might be a little hard to see on the camera but I 3D printed this little green piece of plastic that's going to be our variable of interest that's our position y so let's track the position y of this green uh disc on this weight okay so now what I'd like to do is you know let's just sit this down okay so the weight is just hanging around here and the position Y is just you know down here at the floor right now and again if the reference position of where I'm trying to track is also down here at the floor everything is fine right there's zero error right now what makes this interesting is okay if this is all fine what if we go ahead and change this reference position so what if I want the reference position now to be oh I don't know uh something up here maybe right so now you can very clearly see there is a difference between R and Y so we have a non-zero error and now that's the job of the controller so we need the PID controller to try to fix this error and make this error go to zero so now right now you can see we have there's there's no control the control in this case is going to be a force that we're going to apply on this Mass to try to move it to this position R so right now there's there's nothing right there's no control input so let's again start simple let's start with the proportional component so remember the proportional component of the controller it's going to be a control signal which is directly proportional to this error right and if the error grows then the force or the control on this is going to grow so now you got to think is there some kind of thing that we can apply to this Mass whose force is proportional to this distance that's exactly what a spring is right or a spring or maybe like a like a rubber band or something like that right so maybe when I'm to do is I'm going to hook up this rubber band and I've measured this in such a way that again we need this to be when this rubber band is not elongated right when it is when it is uh yeah basically not elongated right there's no Force by the rubber band so this is perfect right so when there's zero error there's going to be zero force from this rubber band and now we should be able to let this thing go and and see how does this proportional controller work right because right now if the position Y is right here at R there's no force on the rubber band but the problem is as you can kind of see is that that's actually not the case right so this thing it's doing better than it was before right it used to be all the way down on the floor but now this proportional controller is able to move the position y to about you know something like that so we see there is steady state error in this case so it's trying to bring it up to this R but the fact that you actually need some finite error in order to have a finite control is what makes this problem um with a proportional controller a little bit uh it's not going to solve the entire problem right now you might ask is there something better I can do how can I um how can I decrease this error right we talked about that well that just means your first try might be to do something like just go ahead and increase the gain on your proportional controller so in this case what's the gain of the proportional controller what's the physical equivalent it's basically this spring constant right if we increase the spring constant we should increase the gain and therefore um the behavior should change so I've got a stiffer rubber band here let's do the same thing let's go ahead and add now are stiffer spring and see if that changes anything okay so again now aha now look at this right so again we still don't make it all the way up to R but we have reduced the amount of steady state error but again the problem with the proportional controller is again no matter how stiff you make this spring in other words no matter how big you make that gain KP you are not going to get zero steady state error right that's the whole issue now what we talked about on the board is all right so if that's the problem with a proportional controller maybe what you're going to do is start adding an integrator right so now what I need is to add some type of control to this system where the control component right the UI it's somehow related to the integral of the error because right now with just a proportional control array we can be sitting here at steady state error like this forever and nothing is ever going to change right that's what the integrator is going to do so I'm going to go ahead and add this pink string this pink string is supposed to represent the integral component of control and right now it's slack you can see the integrator is doing nothing because we're going to pretend we start our experiment right now and now the integrator starts seeing there's some non-zero error right so it's going to start integrating it so this string is going to start whoops hold on it's stuck this integrator component of the force it's going to add on top of the the proportional part but it's going to start pulling harder and harder and harder so I'm gonna I'm gonna have to play the part of the integrator and I'm going to have to integrate the area under this air error curve and I'm gonna have to start pulling and pulling and pulling and as I see that the the error is still non-zero right I'm going to keep pulling harder and harder and harder until eventually it hits here but I've wound up so much error in my integrator that I might overshoot a little bit and then I might come down and oscillate and whatnot but at some point right the pink string which is the integrator component you can see brings the actual position of the weight up to R so now R and Y are the same thing and there's zero error and what we said earlier is because there is zero error right this rubber band this the the spring or the proportional component is doing nothing right the pink string is taking up all of the force it's generating all of the control right so this is kind of interesting so there you go here's a physical demonstration of a pi controller why don't we add the last component let's go all the way to maybe PID and and for Giggles let me go back to the um to the weaker spring because this one is actually more interesting so let's go back here uh if I can hook all this back up okay all right okay so now we're back here right here's our P only controller again our we've got some error now let's go ahead and make let's make a mark where that is okay again we're trying to get up to this reference and now um you know we made the claim earlier that this is a p controller only right because right now there's only a force which is directly proportional to this distance right actually if you think about this long enough this is actually a p and a very weak D controller right now because there is a force that is acting on this weight which is proportional to its velocity right that's because we're sitting in we're sitting in a fluid right we're sitting in air so there's some air resistance right that the faster you try to go through the air the more Force it's going to put onto it of course that that magnitude is negligible right because the air is it's it's not very viscous there's not a lot of aerodynamic drag in this regime okay but what if we increase that so for example let me put this inside maybe this little graduated cylinder we've got here okay let me scoot this over just I'll just goes just to make this line up a little bit more nicely okay okay so I want to add now or or I guess I to be technically correct I want to increase the derivative component of the PID controller right so what I need is I need to increase the amount of force that is applied to this which is proportional to its velocity so if air is not a very good viscous fluid why don't we try something a little bit more viscous like what about water so if I pour water in here right now what we have is I have basically increased the decomponent of this controller right because now you see how much more damped out it is right you see how this thing does not um bounce around or oscillate as much right because there is now a lot more Force it's much harder for that weight to move through the fluid quickly right but what's interesting also is look at this like we said earlier at steady state the derivative is doing nothing right the velocity is zero right error dot is zero so the velocity is zero so write the derivative component actually isn't playing that much of a role in this situation right so again just to maybe compare contrast let me oscillate this a few times and you can kind of see that when we increase the damping ratio or or excuse me increase the decomponent of the PID controller you see there's a lot less oscillations right and again just to compare and contrast that is like what it is with water let's go ahead and pour this out and again now you can kind of see with air whoops right there's a lot more I guess it's kind of sticking now okay this isn't quite the way I envisioned it but you get the idea right and we can even go even further right what if I want some even more viscous what about like honey right if I pour honey into here this is going to really increase the D component of this controller actually probably to the point of it being a little bit ridiculous um so give me a second to fill this up I'm just kind of curious to see if this is going to work okay let's try that boy oh boy okay so now we have really messed it up there the the D component is way too high so you can see the thing does not want to move but it is moving right if we let this thing sit long enough right that Decon component of the control is not going to affect it right because the velocity is going to be zero so there's going to be no force on it so all of that should work out and again I guess in the in the interest of completeness let's talk about the full thing now so we've got the proportional we've got the derivative right which is this viscous fluid now let's add the integrator back into this picture again my integrator is this pink string and again we can play this game so now this is sort of uh you can think of as a physical manifestation of this full PID controller so now you know it it has moved around and now I'm going to start pulling on this integrator I'm going to start integrating this non-zero error and I'm going to start bringing this up to where it wants to be right that so now the integrator is doing the work the integrator is doing the work the integrator is doing the work until we come up to around here right and now again you can see here at this point even with the full PID controller right at steady state when everything is where it wants to be it's the pink string which is taking all of the work right the all the control Authority is coming from the pink string the rubber band slash spring which is the proportional component is doing nothing and the derivative component which is basically the viscous fluid is doing nothing right so that's my uh my demo hopefully this gives a little bit of an intuitive feel for what this PID controller is doing right you can almost think about it as a proportional component is adding some amount of springiness um to your system sometimes people refer to this as uh you know the proportional part is interested in the present it cares about what's happening right now it cares about what is the amount of error right now in the present moment and it acts upon that right then we saw the integral right this pink string is uh it kind of thinks about it like uh like it cares about the past error right it integrates all of the error that has occurred in the past and that's how you compute your current control signal so the integral sort of thinks about the the past and from this analogy you can also see that I guess um the integral you can kind of think about it as like adding inertia to your system right because the integrator winds up all of this state error and it has a tendency to overshoot it's like this idea of momentum of inertia or inertia of your system right and then finally we saw the D component of the derivative component right that is almost thinking about you can you can kind of again think about like thinking about the future right it thinks about looks at time rates of change to kind of help predict where the system is going to go so you can see the PID controller is sort of looking at the present the past and the future all at the same time in kind of a loose hand wavy sense and then lastly um the last analogy to maybe draw is that again we saw the derivative component is sort of related to you can think about it as adding damping to your system right so there's a couple ways you can think about this you can think about the PID controller as basically a past present or sorry present past future kind of system or you can think of it as like a adding a spring mass and damper to your system so there's a lot of nice kind of parallel analogies but again I think the the rigorous way to look at it is mathematically as we saw earlier on the board I hope this demonstration just gives a little bit of a physical intuition of what all these components are doing all right so now hopefully you've got a good intuitive feel for what all of these terms do um so maybe it might be helpful to just make a little quick table this is sort of some rules of thumb about how adjusting these parameters are going to affect different parts of your system so if you adjust KP let's ask about how does that affect things like the rise time overshoot settling time steady state error and the stability and again keep in mind these are real loose generalizations shooting from the hip kind of ideas don't take any of these for gospel we will do the actual analysis down the road in other discussions so we can make quantitative and qualitative uh statements but for now let's just look at these General ideas so again what we're talking about here is if you make KP bigger and again maybe this is maybe really if you make the absolute value of these terms larger right as these sort of increase basically you're talking about making these components more aggressive um what does that do to all these parameters so we saw that KP right this is really like it's kind of like you can think about is adding like a spring right a stiffer spring to your system right so what this does for Rise time is this is going to generally try to it's going to decrease your rise time right you're going to get there faster the consequence of this is usually this is going to make your oscillations or your overshoot go up um settling time this is really a small change it doesn't have much effect here okay steady state error we saw that this is going to decrease your steady state error right but you're still going to have steady state error with a proportional only and instability the problem with this is it sort of decreases your stability right it degrades your stability it makes you more likely to have um issues and become unstable okay let's talk about the integrator as you make the integrator magnitude larger how does this affect it okay so your rise time this tends to go down your overshoot we saw the you know the integrator is one source of major overshooting cases so this goes up um settling time this also tends to go up okay now the nice thing about the integrator though is steady state error uh this really you know it eliminates it right that's the whole point of the integrator so let's just write eliminate here okay and in terms of stability though the price you pay for this is again you add the integrator you add some Dynamics and you're more likely to make this overall system unstable okay so you got to be you got to be careful with that right okay let's talk about the derivative okay so the derivative again this doesn't really do much to the rise time so it's not going to matter a ton right what it does do right we saw that the derivative it's it's like adding a damper to your system so actually this decreases your overshoot right it makes it like you're you're sitting there in Honey and it's making it uh slower so it's less likely to overshoot um okay settling time this also if you increase KD it usually makes your settling time a little bit less because your oscillations go down now and we saw steady state error this is really no effect in theory there are we're gonna see when we start looking at this from designing uh from a root Locus perspective or other techniques that this does sort of affect it but really right we saw that at steady state the derivative really is not playing a role okay um and this is also uh the stability is I don't know if I want to draw any hard conclusions here let's just say that maybe this this might improve stability if KD is small so it's again it's one of these things everything in moderation you don't want to go overboard because you definitely can drive things unstable with the large KD but if you keep them small it's it's usually pretty reasonable so again these are some rules of thumb um about how to tune these gains again right because the whole game with the PID controller we said it's incredibly versatile it's used all over the place the only thing you got to really do is pick these three numbers kpki and KD and this will hopefully get you a little bit of the way there but hopefully there are you know some their warning Bells going off in the back of your heads that says I don't want to design an engineered system based on a rule of thumb table right but this gives us some intuitive feel what we instead want to do in some of our future discussions is look at mathematically rigorous ways to synthesize a PID controller AKA pick those gains using things like root Locus or other techniques so that hopefully set the stage I think this is probably a good spot to leave it um and like I said we're gonna have a ton of future other videos looking at a lot of Topics in PID so please stay tuned so I hope you enjoyed the video If so I also hope you all consider subscribing to the channel it really does help me continue making these videos If you scroll a little ways down and click on that subscribe button also remember the new videos come out every Monday so I hope I'll be able to catch you at a future discussion and we can all learn something new together so until next time I think I'll sign off talk to you later bye
Info
Channel: Christopher Lum
Views: 51,156
Rating: undefined out of 5
Keywords: Proportional integral derivative, PID controller, proportional control
Id: _VzHpLjKeZ8
Channel Id: undefined
Length: 49min 17sec (2957 seconds)
Published: Mon May 01 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.