PID Control: Structure and the Role of Each Term
Open the configuration menu of almost any industrial temperature controller, motor drive or flight controller and you find the same three numbers: P, I and D. Well over 90 % of industrial loops are PID loops: Desborough and Miller (Honeywell, 2002) report that 97 % of the more than 11,000 regulatory controllers they surveyed in refining, chemicals and pulp and paper use a PID algorithm, and most loops in practice run as PI. The controller is simple enough to tune by hand and general enough to handle most plants that are roughly first or second order with some delay. But "PID" is not one formula: vendors use different forms and units, and a gain copied from one device to another can be off by a factor of ten. This lesson fixes the structure; the next ones tune it and make it practical.
The three actions
| Term | Reacts to | Main effect | Side effect |
|---|---|---|---|
| P, | the present error | faster response, smaller (but nonzero) steady-state error for a type-0 plant | more overshoot, noise passed to the actuator |
| I, | the accumulated past error | removes steady-state error to steps and constant disturbances (adds an integrator: type +1) | adds phase lag: overshoot, slower settling; windup when the actuator saturates (Anti-Windup) |
| D, | the predicted future error (slope) | adds damping, phase lead near crossover | amplifies high-frequency noise; a "kick" on setpoint steps (Practical PID) |
Written as one fraction, : a PID is a pole at the origin and two zeros. PI is a lag with its pole moved to the origin, PD an ideal lead (Lag and Lead-Lag, Lead Compensation).
Three forms, three sets of numbers
| Form | Formula | Used by |
|---|---|---|
| parallel (independent) | textbooks, many microcontroller libraries, this course | |
| standard (ideal, "ISA") | , , | most process controllers and PLC function blocks |
| series (interacting) | older pneumatic and some current controllers |
The standard form has one gain and two times in seconds (or minutes), and some devices use the proportional band (for normalised signals) and "repeats per minute" instead. The series form can only represent PIDs with real zeros (); its conversion to standard form is , , . Always check which form and which time unit a device uses before entering gains.
Worked example: one controller in three forms
Given: the PID lab's plant and , , (parallel form).
Find: the standard and series forms, the controller zeros, and the step response of P, PI, PD and PID.
Solve:
- Standard: , .
- Series: holds (). With : , , .
- Zeros: roots of : and , equal to and .
Check:
import numpy as np
import control as ct
Kp, Ki, Kd = 3.0, 2.0, 0.5
Ti, Td = Kp / Ki, Kd / Kp
r = np.sqrt(1 - 4 * Td / Ti)
Ti_s, Td_s, Kc_s = Ti / 2 * (1 + r), Ti / 2 * (1 - r), Kp / 2 * (1 + r)
print(f"standard: Kp = {Kp:.3f}, Ti = {Ti:.3f} s, Td = {Td:.4f} s")
print(f"series : Kc' = {Kc_s:.3f}, Ti' = {Ti_s:.3f} s, Td' = {Td_s:.4f} s")
back = (Kc_s * (1 + Td_s / Ti_s), Ti_s + Td_s, Ti_s * Td_s / (Ti_s + Td_s))
print(f"series -> standard: Kp = {back[0]:.3f}, Ti = {back[1]:.3f} s, Td = {back[2]:.4f} s")
print("PID zeros:", np.round(np.roots([Kd, Kp, Ki]), 3))
G = ct.tf([1], [0.5, 1.5, 1])
t = np.linspace(0, 10, 20001)
for name, (p, i, d) in {"P": (3, 0, 0), "PI": (3, 2, 0), "PD": (3, 0, 0.5), "PID": (3, 2, 0.5)}.items():
C = ct.tf([d, p, i], [1, 0]) if i else ct.tf([d, p], [1])
T = ct.feedback(C * G, 1)
info = ct.step_info(T, T=t)
print(f"{name:4s}: final {ct.dcgain(T):.3f}, overshoot {info['Overshoot']:5.2f} %, "
f"rise {info['RiseTime']:.3f} s, settling {info['SettlingTime']:.3f} s")standard: Kp = 3.000, Ti = 1.500 s, Td = 0.1667 s
series : Kc' = 2.618, Ti' = 1.309 s, Td' = 0.1910 s
series -> standard: Kp = 3.000, Ti = 1.500 s, Td = 0.1667 s
PID zeros: [-5.236 -0.764]
P : final 0.750, overshoot 14.01 %, rise 0.601 s, settling 2.043 s
PI : final 1.000, overshoot 12.99 %, rise 0.670 s, settling 3.469 s
PD : final 0.750, overshoot 5.12 %, rise 0.663 s, settling 1.939 s
PID : final 1.000, overshoot 1.94 %, rise 0.871 s, settling 1.213 s
Intuition with the PID lab
The lab uses the parallel form. Start from and switch the other terms on one at a time (its readouts):
| Controller | Final value | Overshoot | Rise time | Settling time (2 %) |
|---|---|---|---|---|
| P: | 0.7500 | 14.01 % | 0.600 s | 2.043 s |
| PI: | 1.000 | 12.99 % | 0.670 s | 3.468 s |
| PD: | 0.7500 | 5.12 % | 0.663 s | 1.938 s |
| PID: all three | 1.000 | 1.94 % | 0.870 s | 1.212 s |
I removes the 25 % error but settles more slowly; D damps the overshoot; together they give an accurate, well-damped loop. The lab's derivative is ideal (no filter), so it would hit a real actuator with an impulse on every setpoint step: switch "D term acts" to "on the measurement" and the overshoot becomes (settling ): the closed-loop poles stay put, but the zeros of the reference path change.
Guided lab: P, PI and PID on the heater block
Hand calculation. With the heater model (K/W) and P control , predict a steady-state error of (Intro); with PI () zero error.
Simulation. Run the intro's program with your identified model; add a D term and observe that it barely helps a first-order plant (its phase lead is wasted where there is little lag), but helps once the sensor delay is included.
What you would measure. The heater on a current-limited supply through a MOSFET, a sensor read every second, setpoint above the starting temperature. P: an offset of about 10 % of the step (more if the real is higher); PI: the offset disappears within a few minutes; the measured overshoot should be within a few tenths of a kelvin of the simulation once the actuator stays below its limit.
Hazards and safe setup. Hot surfaces: setpoints at most , a thermal fuse or software cut-off at , a heat-resistant base, never unattended; current limit about .
Pitfalls
- Entering parallel-form gains into a standard-form controller (or seconds into a minutes field).
- Expecting I to make a loop faster: it makes it accurate; speed comes from P (and D).
- Using pure D on a noisy measurement: always filter it.
- Forgetting the sign convention: a heater needs to rise when , i.e. when the measurement falls (reverse acting in process-controller terms, which name the action after the measurement), a cooler the opposite (direct acting: output rises as the measurement rises). Check the device manual: a few vendors name it after the error instead.
Practice
- Convert , , (standard) to parallel form.
- A controller shows "PB = 25 %, reset = 2 repeats/min". What are and ?
- Can the series form represent , , ?
Answer
- , .
- ; .
- No: , the zeros are complex.
Test yourself
Which PID term removes the steady-state error to a step for a type-0 plant?
- P
- I
- D
- none of them
In the standard form , of the parallel form equals
Adding to the lab's P loop () changed the overshoot from 14.01 % to
- 25 %
- 5.12 %
- 0 %
- 12.99 %
A PID controller has
- two poles, one zero
- one pole at the origin and two zeros
- no poles
- three zeros