Modelling Physical Systems for Control
Controllers are designed from models. Learn how to write differential equations for electrical, mechanical, thermal, fluid and process systems, the analogies between them, linearisation around an operating point, transfer functions, first-order-plus-dead-time (FOPDT) process models, and system identification from a step test — with an Euler simulation of a draining tank.
A controller is only as good as the understanding of the process behind it. A model tells you how the process output responds to inputs: how fast, how much, with how much delay — the numbers you need to tune a PID or design any controller.
Models come from physics (first principles: mass, energy and momentum balances) or from data (system identification: bump the process and fit a model to the response). Practising engineers use both.
An analogy
A model is like a flight simulator of your process: you can crash it a hundred times on the computer to learn how to fly the real plant safely.
Balances give differential equations
Accumulation = in − out (+ generation). A tank accumulates liquid volume, a room accumulates heat, a capacitor accumulates charge, a mass accumulates momentum. Writing the balance and the flow laws (Ohm, Fourier, orifice, Newton) gives the model.
Analogies between domains
The same mathematics appears everywhere:
- Effort variables — voltage, force, temperature difference, pressure
- Flow variables — current, velocity, heat flow, volumetric flow
- Capacitance — capacitor, spring (compliance), thermal mass, tank area
- Resistance — resistor, damper, insulation, valve/pipe restriction
- Inertance — inductor, mass, fluid inertia
Linearisation and transfer functions
Real processes are nonlinear (√h outflow, radiation T⁴, valve characteristics). Around a steady operating point, a Taylor series gives a linear model in deviation variables. Laplace-transforming gives transfer functions G(s) that can be combined with block-diagram algebra and analysed with root locus, Bode or Nyquist.
Empirical models and identification
Most process loops are tuned from a step (bump) test: in manual, step the controller output by 5–10%, record the PV, and fit a FOPDT model (K, τ, θ) by the tangent method or two-point method. Integrating processes (level with pump outflow) show a ramp and are modelled as K·e^(−θs)/s. Advanced identification uses PRBS excitation and least-squares or subspace methods to fit ARX/state-space models for MPC.
Formulas
- Electrical RC:
RC·dv/dt + v = v_in → G(s) = 1/(RCs + 1) - Mass-spring-damper:
m·ẍ + c·ẋ + k·x = F → G(s) = 1/(ms² + cs + k) - Thermal:
C_th·dT/dt = Q − (T − T_a)/R_th → τ = R_th·C_th - Tank (nonlinear):
A·dh/dt = q_in − k√h - Linearised tank:
τ = 2A√h_s / k, K = 2√h_s / k - FOPDT process model:
G(s) = K·e^(−θs) / (τs + 1) - Two-point identification (28.3%/63.2%):
τ = 1.5(t₆₃ − t₂₈), θ = t₆₃ − τ
Worked example: Thermal time constant
Given: Oven: C_th = 5 kJ/K, R_th = 0.02 K/W
Find: τ and steady rise for 2 kW.
- τ = 0.02 × 5000 = 100 s
- ΔT = Q·R = 2000 × 0.02
Answer: τ = 100 s, ΔT = 40 K
Worked example: Step-test identification
Given: Output step 10%, PV rises 5% total; 28.3% point at 12 s, 63.2% at 20 s
Find: K, τ, θ.
- K = 5/10 = 0.5
- τ = 1.5 × (20 − 12) = 12 s
- θ = 20 − 12 = 8 s
Answer: G = 0.5·e^(−8s)/(12s + 1)
Worked example: Tank linearisation
Given: A = 2 m², k = 0.1, h_s = 0.25 m
Find: τ.
- τ = 2 × 2 × 0.5 / 0.1
Answer: 20 s
Simulating a nonlinear tank and finding its linear model
# Euler simulation of a tank level: A dh/dt = qin - k*sqrt(h)
import math
A, k, qin = 2.0, 0.1, 0.05 # m^2, m^2.5/s, m^3/s
h, dt = 0.0, 1.0
for t in range(0, 2001):
if t in (0, 100, 500, 1000, 2000):
print(f"t={t:5d} s h={h:.3f} m")
h += dt * (qin - k * math.sqrt(max(h, 0))) / A
print(f"steady state h = (qin/k)^2 = {(qin/k)**2:.3f} m")
# linearised time constant at steady state: tau = 2*A*sqrt(h)/k
hs = (qin / k) ** 2
print(f"linearised tau = {2*A*math.sqrt(hs)/k:.1f} s")
# t= 0 s h=0.000 m
# t= 100 s h=0.249 m
# t= 500 s h=0.250 m
# t= 1000 s h=0.250 m
# t= 2000 s h=0.250 m
# steady state h = (qin/k)^2 = 0.250 m
# linearised tau = 20.0 sEuler integration (x += dt·f(x)) is the simplest simulator — the same idea runs inside every process simulator. The linearised model is valid only near h = 0.25 m; at other levels τ and K change, which is why nonlinear processes may need gain scheduling.
Common mistakes
- Wrong: Step testing during disturbances. — Right: Test when the process is steady; repeat up and down.
- Wrong: Using one linear model over a wide range. — Right: Check gain/time constant at several operating points.
- Wrong: Ignoring dead time. — Right: Dead time limits achievable performance most.
Applications
- Loop tuning: FOPDT models feed tuning rules.
- Operator training simulators: Dynamic plant models.
- Digital twins: Models updated with live data.
- MPC: Identified multivariable models.
Key takeaways
- Balances + flow laws → ODEs.
- Analogies unify domains.
- FOPDT (K, τ, θ) from a step test.
- Linear models are local.
Going further
- Bond graphs: Energy-based modelling across domains.
- Grey-box models: Physics structure with fitted parameters.
- Nonlinear identification: NARX and neural network models.