# Fixing PID, Part 2

**Suppressing the derivative kick**

On the other hand, there are occasions when a PID controller's performance can be improved by deliberately ignoring setpoint changes. Once again, the controller's derivative action is at the center of this issue.

Recall that the derivative action tends to add a dramatic spike or "kick" to the overall control effort when the error changes abruptly during a setpoint change. This forces the controller to act immediately without waiting for the proportional or integral action to take effect. Compared to a two-term PI controller, a full three-term PID controller can even appear to anticipate the level of effort that will ultimately be required to maintain the process variable at the new setpoint, especially when the controlled process is particularly fast.

But overly dramatic spikes in the control effort can do more harm than good in applications, such as room temperature control, that require slow and steady changes in the process variable. A blast of hot air following every adjustment to the thermostat would not only be uncomfortable for the occupants of the room but hard on the furnace as well.

In those cases, it is advantageous to forgo derivative action altogether or to calculate the derivative from the negative of the process variable rather than directly from the error between the setpoint and the process variable. If the setpoint is constant, the two calculations will be identical anyway. If the setpoint only changes in a stepwise manner, the two calculations will remain identical except at the instant when each step change is initiated, but using the negative derivative of the process variable in the calculation of the derivative action eliminates the spike present in the derivative of the error. See the "Derivative Kick" section below for more information.

The spike induced by a setpoint change can also be mitigated by filtering the setpoint just like the process variable or the control effort. However, a setpoint filter doesn't remove noise so much as it takes advantage of the averaging operation's tendency to make abrupt changes appear much slower. When filtered, stepwise changes in the setpoint appear to the controller to be more gradual, thereby eliminating the abrupt changes in the error that would otherwise lead to spikes in the control effort.

Setpoint filters can also be useful in cascade control applications. Filtering the setpoint for the inner loop also filters the control effort for the outer loop with all the advantages detailed above. For more details on how such filters are implemented, see "The Basics of Numerical Filtering," *Control Engineering*, September 2008.

**Filtering**

A numerical filter averages its input history F_{in}(0) through F_{in}(k) to generate its next output F_{out}(k+1). The most basic filter algorithm, known as "first order," adds a fraction of the most recent input to a fraction of the most recent output to create a running total:

That fraction α between 0 and 1 determines how much of the input history figures into the averaging operation according to this equivalent formula:

Choosing a value of α close to 0 as in Filter A above makes

so that the output sequence looks very much like the input sequence with limited filtering. Choosing a value of α close to 1 as in Filter B makes

so the output changes particularly slowly but incorporates a very long sequence of inputs into its average for maximum filtering. The fraction α is known as the filter's time constant when describing how long it takes for the output to reach a steady state after the input has stopped changing. Alternately, α is known as the smoothing factor when describing how much filtering is being accomplished along the way. When applied to a PID controller's process variable, setpoint, or control effort, a numerical filter can reduce the effects of measurement noise at the expense of closed-loop responsiveness or vice-versa, depending on the value chosen for α.

**Derivative kick**

Here two PID controllers are applied to the same process driven by the same sequence of setpoint values. At each sampling interval, Controller A calculates the derivative component of its control effort (the derivative action) by computing the latest change in the error between the setpoint and the process variable. Controller B computes its derivative action by subtracting the process variable from zero rather than the setpoint. If the process is relatively slow, as in this example, both methods will drive the process variable toward the setpoint along more-or-less the same trajectory. However, Controller A will tend to "kick" the actuator toward 0% or 100% capacity for an instant following each setpoint change as shown by the green spikes at times 1, 2, and 3. Controller B avoids those potentially damaging spikes but otherwise generates roughly the same control efforts as Controller A.

And for more ways to fix PID problems, including time delays, modeling, integrating process, multi-variable control, and loop tuning, watch for the next installment of this series.

Vance VanDoren, PhD, PE, is *Control Engineering* contributing content specialist. Reach him at controleng@msn.com

**Key concepts:**

- PID controllers are deployed in many process applications, but not always thoroughly understood.
- Manufacturers of PID controllers adjust the mechanism at various times to solve specific control challenges.

**ONLINE**

Read more about PID control strategy and tuning below.

- Events & Awards
- Magazine Archives
- Oil & Gas Engineering
- Supplements
- Salary Survey
- Blogs
- Digital Reports

### Annual Salary Survey

Before the calendar turned, 2016 already had the makings of a pivotal year for manufacturing, and for the world.

There were the big events for the year, including the United States as Partner Country at Hannover Messe in April and the 2016 International Manufacturing Technology Show in Chicago in September. There's also the matter of the U.S. presidential elections in November, which promise to shape policy in manufacturing for years to come.

But the year started with global economic turmoil, as a slowdown in Chinese manufacturing triggered a worldwide stock hiccup that sent values plummeting. The continued plunge in world oil prices has resulted in a slowdown in exploration and, by extension, the manufacture of exploration equipment.

**Read more: 2015 Salary Survey**

Regarding the feed-forward, it is definitely what you should use whenever it is possible.

Maybe I am wrong but shouldn't we read in Figure 2:

PID Controller A using SP-PV...

PID Controller B using -PV...?