A Proportional-Integral-Derivative controller is a standard component in industrial control applications. It measures an "output" of a process and controls an "input."

The basic idea is that the controller reads a sensor. Then it subtracts the measurement from a desired "setpoint" to determine an "error".

The error is then treated in three different ways simultaneously:

  • To handle the present, the error is multiplied by a proportional constant P. P is always negative, to drive the output toward the setpoint.
  • To handle the past, the error is integrated (or averaged, or summed) over a period of time, and then multiplied by a constant I.
  • To handle the future, the first derivative of the error (its rate of change) is calculated with respect to time, and multiplied by another constant D.
  • If the sum of the above is nonzero, but too small to make a difference, produce the smallest value with the same sign (usually -1 or 1).

The sum of the above is added to the last output of the PID loop. This eliminates any constant offset in the control behavior.

The output variable is used to calculate the rate-of-change, rather than the error, because a change of setpoint induces a non-linear step-function in the error. This can make the loop oscillate. The output variable is always continuous, and yet still closely reflects the error's actual behavior.

Table of contents
1 Tuning a PID loop
2 Problems
3 Theory
4 How to get one
5 External Link

Tuning a PID loop

To manually tune a PID loop, first set the I and D values to zero. Increase the P until the output of the loop oscillates. Then increase I until oscillation stops. Finally, increase D until the loop is acceptably quick to reach its setpoint. The best PID loop tuning usually overshoots slightly to reach the set-point more quickly, however some systems cannot accept overshoot.

Another problem with the differential term is that small amounts of noise can cause large amounts of change in the output. Sometimes it's helpful to filter the measurements, with a running average, or a low-pass filter.

Problems

One common problem is "integral windup." It might take too long for the output value to ramp up to the necessary value when the loop first starts up. Sometimes this can be fixed with a more aggressive differential term. Sometimes the loop has to be "preloaded" with a starting output.

Some PID loops control a valve or similar mechanical device. Wear of the valve or device can be a major maintenance cost. In these cases, the PID loop may have a "deadband." The calculated output must leave the deadband before the actual output will change. Then, a new deadband will be established around the new output value.

Theory

A PID loop can be mathematically characterized as a filter applied to a frequency-domain system. Mathematical PID loop tuning induces an impulse in the system, and then uses the controlled system's frequency response to design the PID loop values. In loops with response times of several minutes, mathematical loop tuning is recommended, because trial and error can literally take days just to find a stable set of loop values. Optimal values are harder, and yet can save a company huge amounts of money. Commercial software is available from several sources, and can easily pay for itself is a PID loop runs a large, or expensive process.

How to get one

PID controller functionality is a common feature of programmable logic controllers. They can also be implemented with any physical system that can produce ratiometric behavior and integration. Mechanical systems (usually the cheapest) can use a lever, spring and a mass. Electronic systems can use an amplifier and a capacitor. Software PID loops are the most stable, because they do not wear out, and their high expense has been decreasing.

External Link