*PID is the most common industrial technology for closed-loop control. Despite the elegant mathematics behind PID loops, they are easily implemented with modern PLC technology.*

Closed-loop control, where a digital system monitors a measured value and then controls some device to accurately drive the process to a desired setpoint, is a fundamental strategy widely applied to equipment and processes. Although there have been many computing advances over the years, traditional proportional-integral-derivative (PID) control remains the leading workhorse for closed-loop process automation.

PID control can be accomplished with a dedicated hardware controller, within a PLC or an industrial PC, or within another intelligent device like a VFD or a servo controller. The math behind PID control may look intimidating, but the reality is that suppliers like AutomationDirect offer a wide variety of products to help users easily implement this high-performance control method.

**PID Loop Control Basics**

Many designers find it necessary to control an industrial-grade operation so that a process variable achieves the target value as closely as possible, even in the face of disturbances and changing conditions.

The process variable could be one of the “big four”—flow, level, pressure, or temperature—or another characteristic, such as an analytical value, or even the position of a mechanism. Each of these characteristics are *analog* because they can vary over a range, as opposed to *discrete* which is simply on/off.

Control of the process variable is commonly implemented with an analog device, such as a modulating valve or a variable speed pump. However, sometimes control is implemented using a discrete device, like an open/close valve or an on/off heating circuit. In this case, most applications will need a pulse width modulation function, or time-proportioned control logic, so that this method of discrete control behaves much like an analog function.

#### A PID control loop involves the following analog variables:

- Process variable (PV): The characteristic measured by the PID equation.
- Controlled variable (CV): The output signal as commanded by the PID equation.
- Setpoint (SP): The desired value for the PV to reach and remain at.

The PV and SP are usually expressed in engineering units, such as PSI or DegF, but it is also possible for these to be represented in %, such as for a tank level. The CV is often expressed in %, such as 0 to 100% for a valve opening or pump speed, but it can also be in other engineering units. It is important for the user to carefully assign and scale the associated real-world signal values, which may interact with the controller via wired 4-20mA signals or communicated over a serial or network connection, and then apply them with reasonable limits.

**The PID Equation**

There are several forms of the PID equation itself, and it is beyond the scope of this blog to describe the equation in detail, but users typically need to apply the following tuning parameters, or terms:

- Proportional (P): Also known as
*gain,*associated with the scale of corrective action based on the*error*(or the difference between PV and SP). - Integral (I): Also known as
*reset,*associated with the scale of corrective action based on the integral sum of errors over time. - Derivative (D): Also known as
*rate,*associated with the scale of corrective action based in the rate of change of error.

Simplistically, the P term acts on the immediate error, the I term acts increasingly as error persists over time, and the D term acts to anticipate error as it changes. Many applications run fine with only PI terms, and some work adequately with just a P term. More difficult applications, notably temperature control, often require all three PID terms.

It is possible to manually tune a PID equation, but it is difficult to tune all three terms at once, and users need to ensure the process continues to operate safely during the tuning. For manual tuning, a user typically would:

- Start with only the P term (I and D set to zero).
- Raise the P term to provide quick response, but once the PV becomes unstable and oscillates, then reduce the P term until stability is achieved with only a slight oscillation or error.
- With a stable PV, raise the I term slightly to help reduce the error to zero.
- If desired, increase the D term slightly to reduce overshoot, although this can slow the response.

Automatic tuning—also called autotune—if available in the controller or separate software, reduces or eliminates the trial and error of manual tuning. AutomationDirect hardware PID controllers, and the PID algorithm in several PLC families, include integrated autotuning.

A typical autotune cycle controls the CV, sometimes in a step wave format, and measures the rate of change, overshoot, and response time of the PV to calculate the ideal PID terms. Sometimes a little further manual adjustment is needed, but in most cases a built-in autotune capability quickly provides workable parameters, saving time and effort.

**Implementing a PID Control Loop**

There can be many other loop implementation and tuning considerations, such as the *sample time* of the loop, how aggressively the loop is tuned to minimize *rise time*, and the acceptable *percent overshoot*, *settling time*, and *steady-state error*. Some loops experience a large *deadtime*—which is a delay introduced due to the mechanics of control, physics of monitoring, or inherent characteristics of the process—which complicates tuning, and in extreme cases may preclude the use of PID control. Other methods of control are available for these situations.

In other instances, multiple loops may interact with each other, or one loop may need to be operated as a *cascade* of another. On occasion, a loop may be *split-range* because it performs two functions (like both heating and cooling), with each needing their own tuning terms. Users may need the ability to place a loop controller in *automatic* or *manual*, and they may need to be warned of *limit*, *deviation*, and *rate-of-change* alarms.

For a wide variety of process situations, PID loop control is the best solution. AutomationDirect panel-mounted process controllers—and PLCs like the Productivity, BRX, and CLICK families—include easily configured PID functionality and autotuning capabilities, helping users get up and running quickly. AutomationDirect offers many resources—including specifications, documents/drawings, and videos—all accessible through the website, along with support staff ready to help designers identify the right solutions for their applications.