Processing math: 100%

Proportional Integral Derivative (PID)

A PID (Proportional-Integral-Derivative) controller is a control loop feedback mechanism widely used in industrial control systems and other applications requiring continuously modulated control. It is a type of control system that uses feedback to continuously adjust the output of a process or system to match a desired setpoint.

PID controllers are widely used in a variety of applications, including temperature control, flow control, and motor control, due to the PID ability to provide stable and accurate control with relatively simple implementation. Below is an example with the Arduino-based Temperature Control Lab.

A PID (Proportional Integral Derivative) controller consists of three components that are adjusted based on the difference between a set point (SP) and a measured process variable (PV).

e(t)=SPPV

The output of a PID controller (u(t)) is calculated using the sum of the Proportional, Integral, and Derivative terms where KP, KI, and KD are constants that can be adjusted to fine-tune the performance of the controller.

u(t)=KPe(t)+KIt0e(t)dt+KDde(t)dt

Output=Proportional+Integral+Derivative

Proportional (P) control: This component adjusts the output of the process based on the current error between the setpoint and the process variable (PV). The larger the error, the larger the correction applied.

Proportional=KPe(t)

Integral (I) control: This component adjusts the output based on the accumulated error over time. It helps eliminate steady-state error and can improve the stability of the control system.

Integral=KIt0e(t)dt

Derivative (D) control: This component adjusts the output based on the rate of change of the error. It helps to dampen oscillations and improve the stability of the control system but is often omitted because PI control is sufficient. The derivative term can amplify measurement noise (random fluctuations) and cause excessive output changes. Filters are important to get a better estimate of the process variable rate of change.

Derivative=KDde(t)dt=KDd(PV)dt

The derivative of the error is substituted with the derivative of the Process Variable (PV) to avoid derivative kick when there is a setpoint change. The value of the controller output u(t) is transferred as the system input. The KP, KI, and KD parameters from the Independent form can also be written in terms of controller gain Kc, integral reset time τI, and derivative time constant τD. All terms depend on a single controller gain Kc and this is known as the Dependent form of the PID equation.

KP=Kc,KI=KcτI,KD=KcτD

u(t)=ubias+Kce(t)+KcτIt0e(t)dtKcτDd(PV)dt

Output=Bias+Proportional+Integral+Derivative

The ubias term is a constant that is typically set to the value of u(t) when the controller is first switched from manual to automatic mode. This gives bumpless transfer if the error is zero when the controller is turned on. The three tuning values for a PID controller are the controller gain, Kc, the integral time constant τI, and the derivative time constant τD. The value of Kc is a multiplier on the proportional error and integral term and a higher value makes the controller more aggressive at responding to errors away from the set point. The integral time constant τI (also known as integral reset time) must be positive and has units of time. As τI gets smaller, the integral term is larger because τI is in the denominator. Derivative time constant τD also has units of time and must be positive. The set point (SP) is the target value and process variable (PV) is the measured value that may deviate from the desired value. The error from the set point is the difference between the SP and PV and is defined as e(t)=SP-PV.

Overview of PID Control

PI or PID controller is best suited for non-integrating processes, meaning any process that eventually returns to the same output given the same set of inputs and disturbances. A P-only controller is best suited to integrating processes. Integral action is used to remove offset and can be thought of as an adjustable ubias.

Discrete PID Controller

Digital controllers are implemented with discrete sampling periods and a discrete form of the PID equation is needed to approximate the integral of the error and the derivative. This modification replaces the continuous form of the integral with a summation of the error and uses Δt as the time between sampling instances and k as the number of sampling instances. It also replaces the derivative with either a filtered version of the derivative or another method to approximate the instantaneous slope of the (PV).

uk=ubias+Kcek+KcτIki=1eiΔtKcτDPVkPVk1Δt

The same tuning correlations are used for both the continuous and discrete forms of the PID controller.

PID Velocity Form

An alternative to the positional form shown above is the velocity form. This is commonly implemented in control systems such as Programmable Logic Controllers (PLCs) and Distributed Control Systems (DCSs) for industrial control. The advantage of the velocity form is that changes in the Proportional and Integral tuning parameters do not lead to sudden jumps in the controller output. The velocity form is obtained by differentiating the positional form.

du(t)dt=KPde(t)dt+KIe(t)+KDd2e(t)dt2

Type A: Textbook PID

In discrete form, this leads to PID equation Type A, known as the textbook PID where k is a sample index and ek=SPk-PVk.

uk=uk1+KP(ekek1)+KIekΔt+KDek2ek1+ek2Δt

The textbook PID is rarely used in practice because of undesirable derivative kick when there is a setpoint change.

Type B: Remove SP from Derivative

Type B PID equation removes the setpoint from the derivative term to avoid derivative kick when there is a setpoint change because the error is discontinuous and leads to an impulse in the controller output (u).

uk=uk1+KP(ekek1)+KIekΔtKDPVk2PVk1+PVk2Δt

Type C: Remove SP from Proportional and Derivative

Type C PID equation also removes the setpoint from the proporational term to avoid a similar impulse when there is a setpoint change. In velocity form, the proportional term uses the derivative of the error and eliminating sudden changes in the controller output is often desirable when there are setpoint changes.

uk=uk1KP(PVkPVk1)+KIekΔtKDPVk2PVk1+PVk2Δt

Type B and Type C (preferred) are commonly used in industrial practice. The PID output is initialized to the starting manual controller output u0 when the controller is first initialized. If the controller output reaches an upper or lower actuator limit, then the output uk is clipped to that limit. Changes in tuning parameters do not lead to a sudden jump in the controller output.

IMC FOPDT Tuning Correlations

The most common tuning correlation for PID control is the IMC (Internal Model Control) rules. IMC is an extension of lambda tuning by accounting for time delay. The parameters Kp, τp, and θp are obtained by fitting dynamic input and output data to a first-order plus dead-time (FOPDT) model.

AggressiveTuning:τc=max(0.1τp,0.8θp)

ModerateTuning:τc=max(1.0τp,8.0θp)

ConservativeTuning:τc=max(10.0τp,80.0θp)

Kc=1Kpτp+0.5θp(τc+0.5θp)τI=τp+0.5θpτD=τpθp2τp+θp

Optional Derivative Filter

The optional parameter α is a derivative filter constant. The filter reduces the effect of measurement noise on the derivative term that can lead to controller output amplification of the noise.

α=τc(τp+0.5θp)τp(τc+θp)

The PID with the filter is augmented as:

u(t)=ubias+Kce(t)+KcτIt0e(t)dtKcτDd(PV)dtατDdu(t)dt

Simple Tuning Rules

Note that with moderate tuning and negligible dead-time (θp0 and τc=1.0τp), IMC reduces to simple tuning correlations that are easy to recall without a reference book.

Kc=1KpτI=τpτD=0Simpletuningcorrelations

IMC SOPDT Tuning Correlations

IMC tuning correlations are available for a range of model forms. With a second-order plus dead-time model there are 4 parameters Kp, τs, ζ and θp adjusted to fit the model response to data.

Kc=2ζτsKp(θp+τc)τI=2ζτsτD=τs2ζ

Anti-Reset Windup

An important feature of a controller with an integral term is to consider the case where the controller output u(t) saturates at an upper or lower bound for an extended period of time. This causes the integral term to accumulate to a large summation that causes the controller to stay at the saturation limit until the integral summation is reduced. Anti-reset windup is that the integral term does not accumulate if the controller output is saturated at an upper or lower limit.

Derivative Kick

Although the "derivative" term implies de(t)dt, the derivative of the process variable d(PV)dt is used in practice to avoid a phenomena termed "derivative kick". Derivative kick occurs because the value of the error changes suddenly whenever the set point is adjusted. The derivative of a sudden jump in the error causes the derivative of the error to be instantaneously large and causes the controller output to saturate for one cycle at either an upper or lower bound. While this momentary jump isn't typically a problem for most systems, a sudden saturation of the controller output can put undue stress on the final control element or potentially disturb the process.

To overcome derivative kick, it is assumed that the set point is constant with d(SP)dt=0 .

de(t)dt=d(SPPV)dt=d(SP)dtd(PV)dt=d(PV)dt

This modification avoids derivative kick but keeps a derivative term in the PID equation.

Exercise

Plot the error, integral of error, and derivative of the PV for the following response. Show the value of the PID controller output and the contributions of each term to the overall output.

Streaming Chatbot
💬