Ask Dr Bob: What is PID Control?
Hi, I’m Bob Rice. And today we’re going to talk about the derivative portion of PID control. So again, let’s start with the equation. For proportional integral derivative controllers, we start with the controller output; we add the bias term, which is our starting position, we add our controller gain, which looks at how much error there is, then we add our integral, which is going to be your controller gain over that reset time parameter. And we have our little fancy integral sign here. Alright, now we’re going to add this new term called derivative. The derivative is again going to have a component of the proportional term in it. But it’s also going to have this derivative time in there. And what we’re looking at here is the derivative of error or the change in error.
Okay, so these three components make up the P, I, and D equation. All right, these components add together to give you a full response. So again, if we look at the proportional part, we’re looking at the instantaneous error. So if we take a setpoint change, and we look at our process variable response, right, the proportional term is looking at whatever the error is, right? So if our proportional contribution for our error correction, or controller output correction is going to come up, because I have a large error, then over time, it’s actually going to drop back down. That’s my proportional, the integral is going to be an accumulation. So I’m going from no error, no error, then I’m accumulating a little bit of air, right? I’m accumulating, I’m accumulating, I’m building, and then I’m going to start accumulating less and less air. And it’s going to look something like that. So that’s the integral contribution.
What is the derivative contribution doing? So what’s interesting about derivative is it doesn’t care about the magnitude or the deviation between the process variable and the setpoint. It is purely concerned with the rate of change or how quickly the error changes. All right. So if we take this setpoint and Process Variable plot and convert it into an error trace, right, so if we look at this setpoint and measurement and plot the error of that, you get a large amount of error, and then your error starts to decrease as a function of time. As a side note, if this is the error, notice how this looks just like the proportional because it is it’s the error times some proportional. So this is just the proportional is just a scaled version of the error, right? But let’s look at the derivative, the rate of change of error. So we’re looking at the rate of change, the derivative is how quickly that error is changing. So the rate of change right here is zero, right? All of a sudden, we make a setpoint change, and the rate of change is very, very steep. So it’s a very, very big number, right? Then it’s flat again, at zero. And then the air starts to change, and drop back down, right? And the air has some negative value in here, right? It’s changing down, and then it goes back to zero again. So what do you think the derivative looks like? Well, it starts at zero, you get this crazy spike, and then you’re back down to zero, right? And then you have some big number, and then it kind of comes back down again, like that.
Alright, first off, this is just ridiculous, right? This is called a derivative kick. And you actually fix this in your controller by using an option called derivative on measurement. So in all of your PID blocks, you have an option to switch from derivative on measurement versus derivative on air. And what it does is it changes this term. So you’re looking at the rate of change of the measurement as a function of time instead of the air. And what that does is it says instead of looking at the error like this, you’re looking at the derivative of this. And essentially, what you end up with is the derivative of error equals the negative derivative on measurement. So mathematically, you can kind of use them somewhat interchangeably. There’s just a negative sign in front of it. And what that does is it gets rid of this derivative kick, right? And we’re on, right? But what’s interesting is the derivative doesn’t actually work in the same direction as I’ve drawn here. It actually does the exact opposite.
It starts up, and then it goes down and comes back up again. Because it doesn’t like when the error is changing or when the measurement is changing. When the measurement is moving, the derivative wants to tamp that down. So the proportional and the integral are moving that process variable up towards the setpoint. Right, it’s driving it’s pushing. The derivative is actually Pulling back and saying, Hey, look, I don’t want that measurement to be changing that quickly. So I’m going to pull back. So all three of these go together to create your proportional integral derivative. Proportional provides that initial kick at the beginning to the set point change gets that process that controller output moving, it’s that process moving, starts driving it up, then as it as my process variable gets to setpoint, my proportional contribution starts to drive back, because to pull back a little bit, the integral is starting to accumulate and kind of shift and kind of move that controller output balancing point to a new location to try to get that process variable up here without any overshoot. Meanwhile, Mr. Derivative over here is just looking at the rate of change. It doesn’t care if I’m close or far away from my target. It’s just saying, hey, look, I’m
either changing too much, right? And I don’t like that. So I’m going to tamp that down. So it actually pulls back. So proportional and integral push, derivative pulls back, right?
Well, where’s that beneficial? Well, think about it very slow temperature applications, such as a furnace application, right, you’re adding heat into the furnace, right? All the brick and the refractory, everything gets nice and hot, right, the temperature starts to go up. Well, if you turn off the energy to the furnace, it’s like the temperature immediately flattens out, it has some momentum that keeps going, right? In a lot of cases, you can’t cool the furnace, you can only add heat. So if you overshoot that temperature, it’s going to take a long time for that temperature to come back down again. So with derivative, what you’re seeing is the temperature is going to go up. But as the rate of change of that temperature starts to increase, the derivative starts to come in earlier and pull back on that controller output, preventing that process variable from overshooting. So it comes in nice and neat. So the derivative works to fight inertia loops that want to keep going, after you’ve pulled back on the controller output derivative helps to fight those types of momentum, that type of inertia. So loops that are very slow temperature control, pH control, and batch temperature control, can generally benefit from having derivative apply.
Now, where you don’t want to use derivative apply is any loop that has a lot of noise in the process variable, and a lot of chatter in the signal. So if your flow is doing this, right, if the measurement of your flow is doing this, what is the derivative see, it’s seeing all of these crazy rates of change, moving up and down, which are really going to confuse the heck out of the derivative. So anytime you have noise in the process variable and you use a derivative, you’ll start to amplify and reflect that noise in the controller output, which causes a lot of chatter in the controller output. Now controllers do implement things called derivative smoothing or derivative filters to help alleviate some of that chatter. But it still does show up. So you generally don’t want to use derivatives on most of your flow loops. For most of your pressure loops, some pressures are okay if they’re smooth and don’t have a lot of chatter, and derivatives can provide some benefit in those applications. But anywhere there’s a lot of movement, the derivative is a big no-no, right? So proportional integral derivative, the right derivative is looking at the rate of change, proportional and integral, our deviation from Target.
The inner derivative is looking at the rate of change, the faster you’re changing, the more the derivative is going to work to push back. In this video, we finalized the last term here in the PID equation by introducing this derivative component, which looks at the rate of change of error or the measurement to make sure that your process variable is flat at all times when possible, and it tries to prevent the process from changing quickly. Alright, so proportional integral derivative, we have finally wrapped up the PID equation. Thank you for your time.
If you have a particular topic or an idea that you would like us to cover, please email us at email@example.com. Thank you, and I hope you enjoy this video series.