TExcelTAD
Home › Control Systems & Automation › PID Control: Structure and the Role of Each Term

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

e Kp proportional Ki / s integral Kd s derivative + + + u G(s) plant y
u(t)=Kp e(t)+Ki∫0te(τ) dτ+Kd de(t)dt⟺C(s)=Kp+Kis+Kd su(t) = K_p\,e(t) + K_i\int_0^t e(\tau)\,d\tau + K_d\,\frac{de(t)}{dt} \qquad \Longleftrightarrow \qquad C(s) = K_p + \frac{K_i}{s} + K_d\,s
Term Reacts to Main effect Side effect
P, KpeK_p e the present error faster response, smaller (but nonzero) steady-state error for a type-0 plant more overshoot, noise passed to the actuator
I, Ki∫eK_i \int e 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, Kde˙K_d \dot e 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, C(s)=Kds2+Kps+KisC(s) = \frac{K_d s^2 + K_p s + K_i}{s}: 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) Kp+Kis+KdsK_p + \frac{K_i}{s} + K_d s textbooks, many microcontroller libraries, this course
standard (ideal, "ISA") Kp(1+1Tis+Tds)K_p\left(1 + \frac{1}{T_i s} + T_d s\right), Ti=KpKiT_i = \frac{K_p}{K_i}, Td=KdKpT_d = \frac{K_d}{K_p} most process controllers and PLC function blocks
series (interacting) Kc′(1+1Ti′s)(1+Td′s)K_c'\left(1 + \frac{1}{T_i' s}\right)(1 + T_d' s) 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 PB=100 %/KpPB = 100\,\%/K_p (for normalised signals) and "repeats per minute" =1/Ti= 1/T_i instead. The series form can only represent PIDs with real zeros (Ti≥4TdT_i \ge 4T_d); its conversion to standard form is Kp=Kc′(1+Td′Ti′)K_p = K_c'\left(1 + \frac{T_d'}{T_i'}\right), Ti=Ti′+Td′T_i = T_i' + T_d', Td=Ti′Td′Ti′+Td′T_d = \frac{T_i' T_d'}{T_i' + T_d'}. 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 G(s)=1(s+1)(0.5s+1)G(s) = \frac{1}{(s + 1)(0.5 s + 1)} and Kp=3K_p = 3, Ki=2 s−1K_i = 2\ \text{s}^{-1}, Kd=0.5 sK_d = 0.5\ \text{s} (parallel form).

Find: the standard and series forms, the controller zeros, and the step response of P, PI, PD and PID.

Solve:

  • Standard: Ti=3/2=1.5 sT_i = 3/2 = 1.5\ \text{s}, Td=0.5/3=0.167 sT_d = 0.5/3 = 0.167\ \text{s}.
  • Series: Ti≥4TdT_i \ge 4T_d holds (1.5≥0.6671.5 \ge 0.667). With r=1−4Td/Ti=0.745r = \sqrt{1 - 4T_d/T_i} = 0.745: Ti′=Ti2(1+r)=1.309 sT_i' = \frac{T_i}{2}(1 + r) = 1.309\ \text{s}, Td′=Ti2(1−r)=0.191 sT_d' = \frac{T_i}{2}(1 - r) = 0.191\ \text{s}, Kc′=Kp2(1+r)=2.618K_c' = \frac{K_p}{2}(1 + r) = 2.618.
  • Zeros: roots of 0.5s2+3s+20.5 s^2 + 3 s + 2: −0.764-0.764 and −5.236 s−1-5.236\ \text{s}^{-1}, equal to −1/Ti′-1/T_i' and −1/Td′-1/T_d'.

Check:

python · try it yourself
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 Kp=3K_p = 3 and switch the other terms on one at a time (its readouts):

Controller Final value Overshoot Rise time Settling time (2 %)
P: Kp=3K_p = 3 0.7500 14.01 % 0.600 s 2.043 s
PI: +Ki=2+K_i = 2 1.000 12.99 % 0.670 s 3.468 s
PD: +Kd=0.5+K_d = 0.5 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 7.72 %7.72\,\% (settling 2.808 s2.808\ \text{s}): the closed-loop poles stay put, but the zeros of the reference path change.

r = 1+C(s): Kp 3, Ki 2, Kd 0.5P(s) = 1/((1s+1)(0.5s+1))y-T(s) = (0.500 s^2 + 3.000 s + 2.000) / (0.500 s^3 + 2.000 s^2 + 4.000 s + 2.000)closed-loop poles: -0.70, -1.65+j1.72, -1.65-j1.720.00.51.001 s2 s3 sty(t)t_s 1.21 s+1.9 %y(t)setpoint10-90 % rise

Guided lab: P, PI and PID on the heater block

Hand calculation. With the heater model 4300s+1\frac{4}{300 s + 1} (K/W) and P control Kp=2 W/KK_p = 2\ \text{W/K}, predict a steady-state error of 1/(1+8)=11 %1/(1 + 8) = 11\,\% (Intro); with PI (Ti=300 sT_i = 300\ \text{s}) 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 10 Ω10\ \Omega heater on a current-limited 12 V12\ \text{V} supply through a MOSFET, a sensor read every second, setpoint 5 K5\ \text{K} above the starting temperature. P: an offset of about 10 % of the step (more if the real RthR_\text{th} 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 14.4 W14.4\ \text{W} limit.

Hazards and safe setup. Hot surfaces: setpoints at most 60 ∘C60\,^\circ\text{C}, a thermal fuse or software cut-off at 70 ∘C70\,^\circ\text{C}, a heat-resistant base, never unattended; current limit about 1.5 A1.5\ \text{A}.

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 uu to rise when e=r−y>0e = r - y > 0, 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

  1. Convert Kp=2K_p = 2, Ti=4 sT_i = 4\ \text{s}, Td=0.5 sT_d = 0.5\ \text{s} (standard) to parallel form.
  2. A controller shows "PB = 25 %, reset = 2 repeats/min". What are KpK_p and TiT_i?
  3. Can the series form represent Kp=1K_p = 1, Ti=1 sT_i = 1\ \text{s}, Td=0.5 sT_d = 0.5\ \text{s}?
Answer
  1. Ki=Kp/Ti=0.5 s−1K_i = K_p/T_i = 0.5\ \text{s}^{-1}, Kd=KpTd=1.0 sK_d = K_p T_d = 1.0\ \text{s}.
  2. Kp=100/25=4K_p = 100/25 = 4; Ti=0.5 min=30 sT_i = 0.5\ \text{min} = 30\ \text{s}.
  3. No: Ti=1<4Td=2T_i = 1 < 4T_d = 2, the zeros are complex.

Test yourself

Which PID term removes the steady-state error to a step for a type-0 plant?

  1. P
  2. I
  3. D
  4. none of them

In the standard form Kp(1+1Tis+Tds)K_p(1 + \frac{1}{T_i s} + T_d s), KiK_i of the parallel form equals

  1. KpTiK_p T_i
  2. Kp/TiK_p / T_i
  3. Ti/KpT_i / K_p
  4. 1/Ti1/T_i

Adding Kd=0.5K_d = 0.5 to the lab's P loop (Kp=3K_p = 3) changed the overshoot from 14.01 % to

  1. 25 %
  2. 5.12 %
  3. 0 %
  4. 12.99 %

A PID controller C(s)=Kp+Ki/s+KdsC(s) = K_p + K_i/s + K_d s has

  1. two poles, one zero
  2. one pole at the origin and two zeros
  3. no poles
  4. three zeros