Discrete PID Level Control
Brian T. Carcich
Simple Outflow-controlled Level Control System
Inflow
Level
Setpoint
Measured
Level
PV
PID
SP
CV
Controlled
Outflow
Define terms
In
= inlet flow rate = constant
Out = Outlet flow rate, via PID output
PV
= Measured Level (Present Value)
SP
= Level Setpoint
E
= Level Error = PV - SP
CV
= PID output CV (Controlled Value)
Inflow
Level
Setpoint
Measured
Level
PV
PID
SP
CV
Controlled
Outflow
Discrete PID equation*
CVn = Kp (En + Σn(Ej ∆t / Ti)) + bias
●
●
●
●
●
●
●
CVn is the PID output after the nth PID loop update
Kp is the PID proportional gain
En is the error when the PID instruction executes (PV-SP) on the nth loop update
Ti is the PID integral time; larger values make the PID respond slower to load (inlet flow rate) changes, and vice versa
∆t is the PID loop update time
The sum Σn(Ej ∆t / Ti) is the PID's I-term (Integral term)
○
It is the accumulation of the term (Ej ∆t / Ti) evaluated at each of n discrete PID loop update times:
■
On each PID loop update j (i.e. once per time period ∆t),
■
multiply the loop update time ratio, ∆t / Ti, by that update’s (j) error, Ej (En = E)
■
and adds (accumulates) the resulting product into this sum
■
the subscript j implies that this sum was accumulated using multiple Ej values for loop updates j=1-n
The bias offset term is eventually irrelevant if the I-term is active (Ti > 0)
○
Over time, the bias offset induces an equivalent but opposite offset in the I-term
* N.B. PI-only; the D-term (Derivative term) is disabled (Td = 0) and not shown here.
PID equation (discrete; PI-only; D = 0)
CV = kp (E + Σ(E dt) / ti) + bias
cv’ = kp (E + Σ(E dt) / ti)
●
●
●
●
cv’ = PID output CV without the bias
CV = cv’ + bias
CV = kp (E + Σ(E dt) / ti) + bias
cv’ = kp (E + Σ(E dt) / ti)