## The third factor in PID is the least understood. Derivative action can do good things, but when used improperly, it causes headaches.

You’ve probably heard the expression, “a little knowledge is dangerous.” This certainly applies to PID loops, especially when you try to dabble with the derivative factor. This element of the control strategy can improve performance, but only in the right situations and when applied properly. Understanding those situations begins with a quick basic review of how PID operates.

*Proportional*control applies an effort in proportion to how far you are from the setpoint. It’s main drawback is that the closer you get to the setpoint, the less it pushes. Eventually it doesn’t push hard enough to move the variable, so the process can run continuously close to the setpoint, but not quite there.

*Integral*control tries to even out the difference of the time spend on both sides of the line. If you’ve spent a minute running at 98%, it will try to push you over to 102% for similar amount of time. This action compensates for P’s inability to make that last effort.

Many, if not most, control applications can run perfectly well with just P and I control. (See sidebar.) Ziegler-Nichols tuning produces the traditional curve where the process variable oscillates briefly but settles onto the line with each cycle reducing amplitude by 75%. For applications that require the fastest possible response, seeing that kind of action after a setpoint change would be hugely rewarding to a control engineer.

But let’s say the process in your case is a tank of liquid product that you’re trying to heat. If the process variable (temperature) goes above the setpoint, the product may be ruined or catch on fire. So, how do you get the process variable to move, but not overshoot the setpoint excessively? One answer is introducing a derivative factor.

*Derivative*acts as a brake or dampener on the control effort. The more the controller tries to change the value, the more it counteracts the effort. In our example, the variable rises in response to the setpoint change, but not as violently. As it approaches the setpoint, it settles in nicely with a minimum of overshoot. It doesn’t move as quickly as the PI-only effort, but without the oscillations, the right amount of derivative action can stabilize the process variable at the setpoint sooner.

Bob Rice, Ph.D., director of solutions engineering for Control Station, sums up the three elements: “The proportional term looks at where my value is currently. Integral looks at where I’ve been over time, and derivative tries to predict where I’m going. Derivative tries to work opposite of where proportional and integral are trying to drive the process. P and I are trying to drive one way, and D is trying to counteract that. Derivative has its largest effect when the process is changing rapidly in one direction. The P and I terms are saying, 'Keep going.’ The derivative catches it and says, 'You’re going too fast. You need to slow down.’”

## Factors act when needed

If you think in terms of what the controller wants to do in a given situation, you can begin to analyze how the factors are working at any point in the process. Looking at the situation in the top diagram of the sidebar, the operator has raised the setpoint. How does the controller respond?

As the process variable passes the “cliff” formed by the setpoint change, suddenly the proportional error is huge, although integral and derivative actions are effectively zero. The controller begins to raise the variable responding to the proportional action. As it moves, the P action declines as it gets closer to the setpoint, but the integral action grows as long as the variable is below the line. As the curve suddenly turns up, derivative wakes up in response to the sudden shift and begins to counteract what’s happening with P and I.

As the variable approaches the setpoint, proportional action is almost zero but integral has increased. The derivative braking action continues. Once the variable crosses the line, it changes. P begins to increase its effort in the other direction as it moves above the line. Integral begins to relax now that it has moved past the setpoint. D sees the slope beginning to decline and relaxes as well. Soon the proportional action brings it around, the variable heads toward the setpoint again and all the actions are reversed.

Proportional action is the strongest when the distance from the setpoint is the greatest. Integral increases its effort with every moment that passes with the variable on just one side of the line. Derivative makes no effort when the line is flat, even if it is nowhere close to the setpoint. D will not move the line itself, it can only counteract P and I efforts. So a D controller, if such exists, would be stable and easy to tune, but not particularly effective.

The art of loop tuning is determining the optimum values for each of those actions so that they balance each other and move the specific loop in a way that is best for that process.

## So where’s the value?

So if the main purpose is slowing the control effort of the other factors, what’s D good for? Fast acting loops, such as flow and pressure loops, don’t really need it. If a loop can change in a matter of seconds or a minute or two, making it respond 10% faster isn’t much of an improvement. As already mentioned, the best uses are for slow moving loops where overshoot is undesirable.

Rice suggests, “With a slow loop, the future’s pretty easy to predict because you know it’s going to keep going for 20 to 30 minutes. But if you’ve got something like a flow loop where in two or three samples, your process can be in a completely different direction, derivative is not going to provide any benefit. If you’ve got processes that tend to overshoot and are very slow, that’s where your benefit’s going to come: one-way batch systems where you can only heat but you can’t cool, or you can only cool but you can’t heat. Overshoot is completely unacceptable in those cases, because if you go past your setpoint, you don’t have an opposite action to bring it back. You use derivative to be sure you don’t.”

So you don’t need D in most cases? Probably not. Rice adds, “About 90% of the loops out there are probably PI control. It’s going to get you good enough control for most of your applications, and it’s simpler. A well tuned PI controller is going to beat a moderately tuned PID controller every time. Adding the extra tuning parameter adds complexity, which can confuse a lot of people. It’s only in those remaining percentage points where you’ve got a really slow loop but you can’t afford MPC or other advanced controls, then you can add some derivative to take the edge off so it doesn’t overshoot and tend to oscillate as much.”

George Buckbee, P.E., vice president of marketing and product development for ExperTune warns that some traditional loop tuning beliefs should not be considered as universal. “That Ziegler-Nichols quarter amplitude damping thing is a bit of a fallacy for a lot of loops,” he advises. “The criteria for what is 'good performance’ really do change from one loop to the next, but usually it’s faster movement toward the setpoint with less risk of overshoot. You have to choose those criteria wisely, and define them for control performance on a per-loop basis”.

As the sidebar shows, there are approaches that can achieve the effect of derivative control without using it at all. However, as Buckbee points out, each loop has to be approached individually using the right tuning for a given situation.

## D for dangerous

This all sounds very positive, so where does the problem come in? Buckbee compares using derivative to learning to drive: “Derivative is like trying to drive your car with one foot on the gas and one foot on the brake. To my 16-year-old son who’s just learning, that was the first thing he wanted to do.” Such an approach might work for a skilled race car driver, but most loops don’t need that kind of immediate and violent action.

It is derivative’s tendency to act quickly that introduces most of the problems. Anytime it sees the process variable head up or down, it’s going to respond even if the change is really nothing but noise. Buckbee adds, “Derivative is looking at fast, short-term changes in the process variable, and that’s all that noise is. It goes up by 1%, and the next sample it’s down by 1%. Derivative looks at that and says, 'Wow, a 1% change in one second—that’s pretty fast, something’s going on, I better make a change.’ The controller is going to try and compensate for that kind of movement, and you’re going to beat up the valve.”

So the main negative result from derivative action is excessive wear on equipment. If you drive your car by alternately flooring the gas and slamming on the brakes, or worse, driving with both pressed at the same time, it will wear out quickly. One solution, at least in some cases, is using a filter on the process variable to reduce noise. But this can introduce its own problems. “You need to coordinate the amount of derivative action with the amount of filtering that you do,” Buckbee suggests. “If you overfilter, you might as well not have derivative at all. You shouldn’t find the filtering value and the derivative value independently of each other.”

Rice also cautions, “A lot of controllers that use derivative have internal filtering. You have four parameters, P, I, D, and derivative lag filter. A lot of controllers implement this derivative filtering concept and don’t always tell you what they’re doing. Some don’t do a very good job of it. You get into a very complicated algorithm where there isn’t just one or two PID forms, there’s 10 or 12 or 15 variations that can really muck up the tuning process.”

## D for destabilizing

Even in situations where loops move slowly and fit the description for appropriate derivative deployment, you have to be careful how much you use. Rice suggests that if the dampening action is too high, you have to turn up the P and I action to compensate, like trying to accelerate your car with a foot on the brake.

“If you have a system like a really slow temperature loop, users tend to put a lot of derivative in there because they don’t like the overshoot,” he says. “What ends up happening is you have to put a pretty large proportional and integral effect in there to get the process to even move, and the derivative sits there and fights it all day long. If you’ve got a system where there’s an upset, you want to be able to recover from that upset quickly, but derivative’s dampening effect is going to hamper that response. Large derivative action tends to destabilize a loop because it doesn’t allow it to change. The rule of thumb is that if your derivative time is greater than the reset time of your controller, you’ve got issues. That should never, ever occur.”

Ultimately, the use of derivative action can be beneficial, but it has to be used in the right situations and in the right amounts. Your starting assumption should be to see if the process will run satisfactorily on PI control alone for the reasons already mentioned. As the sidebar shows, careful tuning of P and I factors can achieve much of the same no-overshoot benefit in certain conditions, so that is probably a better approach to begin with. Adding derivative should be done cautiously and with appropriate filtration. Like cooking with hot sauce, in the right context and in skilled hands, the result can be remarkable. But if it’s used inappropriately, it’s a recipe for disaster.

## Derivative action at work

John Ziegler and Nathaniel Nichols, the fathers of PID loop tuning, recognized as far back as 1942 that derivative action dampens the control effort. They discovered through trial and error that setting the derivative time to at least half of the process deadtime would slow the controlled response to a step change in the setpoint.

The top trend chart shows a typical first-order process responding to a setpoint change under the influence of a full, three-term PID controller tuned according to the Zeigler-Nichols rules. The middle trend chart shows the same response with the brakes off; that is, with derivative action disabled. The rate at which the process variable climbs after the setpoint change and the degree by which it overshoots the setpoint have both increased.

Ironically, overshoot can be eliminated entirely by leaving the derivative action disabled, decreasing the proportional gain and increasing the integral time. The bottom trend chart shows the process’s setpoint response under the influence of a PI-only controller tuned according to the critical damping rules that call for a 69% smaller proportional gain and an integral time lengthened by a factor equal to the process gain. No derivative action is required.

A great and simple explanation. My friend Dr. Rice really simplifies the PID too, in his single sentence explanation. Thanks.

ReplyDelete