Thermal and Fluid Systems
Process plants are full of temperatures, levels, pressures and flows, and most of them are slow: a tank fills in minutes, an oven heats in a quarter of an hour. Slow does not mean easy. These processes come with large time constants, transport delays and strong nonlinearities, and they are where PID control earns most of its living. The good news is that the modelling is the same balance idea as for circuits: rate of storage = inflow − outflow, applied to heat or to volume. This lesson models the course's heater block (the roadmap's temperature-control project starts here) and a draining tank.
Thermal systems: heat as current, temperature as voltage
A lumped body at uniform temperature stores heat in its thermal capacitance (J/K) and loses it to the surroundings at through a thermal resistance (K/W), which lumps conduction through a mount, convection and radiation:
with . It is exactly an RC circuit driven by a current source: heat flow is the current, temperature the voltage, the ambient the ground node.
Real thermal systems add more stores (heater element, block, sensor housing), each with its own small RC. A sensor in a drilled hole with paste typically adds a lag of a few seconds; a sensor clipped to the outside or a thermocouple in a thick sheath adds tens of seconds. Several small lags in series look, from the outside, like a dead time: nothing seems to happen for a while, then the main time constant takes over. The usual process model is therefore first order plus dead time (FOPDT):
A practical rule (half rule): keep the largest lag as , add half of the second-largest to and the other half plus all smaller lags to . The heater block with a sensor lag and of transport delay becomes , , . Dead time is what limits how fast any controller can be (Model-Based Tuning).
Fluid systems: volume balance
A tank of cross-section with inflow and outflow (in ):
If the outlet is a long narrow pipe (laminar flow), and the tank is linear, . A free orifice instead follows Torricelli's law, , which is nonlinear: the tank drains fast when full and slowly when nearly empty. Near an operating level with flow it behaves like a linear tank with , the method of Linearisation. Two tanks in series are second order; if the first drains into the second through a pipe that depends on both levels (interacting tanks), the poles move apart compared with two independent tanks.
Pneumatic systems (a pressure vessel fed through a restriction) give the same first-order form with capacitance (moles stored per pascal of pressure, isothermal; ), and hydraulic actuators add a fluid inertance analogous to inductance. The analogies of Electrical and Mechanical Models carry over.
Worked example: heater block and draining tank
Given: (a) the heater block: , , room , heater power stepped from 0 to ; (b) a tank with , orifice , inflow (), .
Find: (a) , the final temperature, the time to reach , and the mass of an aluminium block with this (); (b) the steady level and the linearised time constant.
Solve:
- (a) , i.e. of aluminium. Final . is of the rise: .
- (b) Steady state : . , .
Check: the program integrates both nonlinear-ready ODEs, adds the sensor lag to the heater, and compares the tank with its linear model for a inflow step.
import numpy as np
from scipy.integrate import solve_ivp
# (a) heater block with a 10 s sensor lag
Rth, C, Ta, P, ts = 4.0, 75.0, 25.0, 6.25, 10.0
def heater(t, x):
T, Ts = x # block and sensor temperatures, degC
return [(P - (T - Ta) / Rth) / C, (T - Ts) / ts]
t = np.linspace(0, 1800, 18001)
s = solve_ivp(heater, (0, 1800), [Ta, Ta], t_eval=t, rtol=1e-9, atol=1e-9)
T, Ts = s.y
for target in (45.0,):
print(f"block reaches {target:.0f} C at {t[np.argmax(T >= target)]:.0f} s, sensor at {t[np.argmax(Ts >= target)]:.0f} s")
print(f"after 30 min: block {T[-1]:.2f} C, sensor {Ts[-1]:.2f} C")
# (b) tank with an orifice, inflow step +20 % at t = 0 from the steady level
A, a, g, q0 = 0.02, 5e-5, 9.81, 1e-4
h0 = (q0 / a) ** 2 / (2 * g)
q1 = 1.2 * q0
tank = solve_ivp(lambda t, h: [(q1 - a * np.sqrt(2 * g * max(h[0], 0.0))) / A], (0, 600), [h0],
t_eval=np.linspace(0, 600, 601), rtol=1e-9, atol=1e-12)
tau = A * 2 * h0 / q0
lin = h0 + (q1 - q0) * (2 * h0 / q0) * (1 - np.exp(-tank.t / tau))
print(f"h0 = {h0:.4f} m, tau = {tau:.1f} s, exact new level {(q1 / a) ** 2 / (2 * g):.4f} m")
for k in (60, 180, 600):
print(f"t = {k:3d} s: nonlinear {tank.y[0][k]:.4f} m, linearised {lin[k]:.4f} m")block reaches 45 C at 483 s, sensor at 493 s
after 30 min: block 49.94 C, sensor 49.94 C
h0 = 0.2039 m, tau = 81.5 s, exact new level 0.2936 m
t = 60 s: nonlinear 0.2468 m, linearised 0.2463 m
t = 180 s: nonlinear 0.2803 m, linearised 0.2765 m
t = 600 s: nonlinear 0.2934 m, linearised 0.2854 m
The sensor reports about after the block reaches it: its lag behaves like a dead time of roughly its own time constant on this slow ramp. The tank's linear model predicts a new level of instead of the exact : linearisation is accurate for small steps, and is not small for a square-root law.
In the lab: the RC twin of the heater
The heater block is an RC circuit. Scale to : a source charging through () is the rise of the block, 3000 times faster. At the lab shows ( of the final value), the point the heater reaches at .
Guided lab: a step test on a low-voltage heater
Hand calculation. For a heater on a known supply, : at is , at it is . Expect a rise of with time constant ; with the reference numbers, and .
Simulation. Replace Rth, C, ts in the program with your estimates and overlay your log.
What you would measure. A aluminium-clad resistor on an aluminium block, sensor in a drilled hole with thermal paste, a bench supply at with a limit (or PWM at duty from ). Log temperature every second for 30 minutes after switching on from room temperature. Fit , and : the 28 % and 63 % times give and . Expect within of the design value (it depends on airflow), of a few seconds, and a slightly faster rise at first than a pure first order would give (the resistor heats before the block).
Hazards and safe setup. Hot surfaces: the block and resistor can exceed ; mount them on a ceramic tile or metal plate, add a thermal fuse or cut-out rated around , set the supply's current limit, and do not leave the test unattended. Keep water and flammable material away. Fluid systems in this lesson are simulation only; if you build a water-tank rig, use a pump on an isolated supply, keep electronics above and away from the water, and add an overflow.
Pitfalls
- Using the heater's rated power without checking the supply: power goes with .
- Placing the sensor far from the heater "to read the average": every centimetre of metal adds lag that the controller must live with.
- Linearising a tank around an empty level ( makes ): the linear model is only good near its operating point.
- Ignoring that changes with airflow: it is a disturbance the loop must reject, not a constant.
Practice
- A steel part () on a mount of . Give and .
- Apply the half rule to .
- A tank at with through an orifice, . What is its linearised time constant?
Answer
- , .
- , , .
- , .
Test yourself
In the thermal-electrical analogy, heater power corresponds to
- a voltage source
- a current source
- a resistor
- a capacitor
The heater block has and . Its thermal capacitance is
Why is a tank draining through an orifice nonlinear?
- the inflow is pulsed
- the outflow goes with
- the area changes
- water is compressible
A chain of several small lags behind a large one is usually approximated as
- a pure integrator
- a dead time added to a first-order lag
- a second-order underdamped system
- a zero