TExcelTAD
Home › Control Systems & Automation › Thermal and Fluid Systems

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 TT stores heat in its thermal capacitance C=mcC = mc (J/K) and loses it to the surroundings at TaT_a through a thermal resistance RthR_\text{th} (K/W), which lumps conduction through a mount, convection and radiation:

CdTdt=P−T−TaRth⟹ΔT(s)P(s)=RthRthC s+1,τ=RthCC\frac{dT}{dt} = P - \frac{T - T_a}{R_\text{th}} \quad \Longrightarrow \quad \frac{\Delta T(s)}{P(s)} = \frac{R_\text{th}}{R_\text{th}C\,s + 1}, \qquad \tau = R_\text{th} C

with ΔT=T−Ta\Delta T = T - T_a. It is exactly an RC circuit driven by a current source: heat flow is the current, temperature the voltage, the ambient the ground node.

P C = 75 J/K Rth = 4 K/W T (block) reference node: ambient Ta heat flow = current, temperature = voltage q_in q_out h A = 0.02 m^2, orifice a = 50 mm^2

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):

G(s)=K e−θsτs+1G(s) = \frac{K\,e^{-\theta s}}{\tau s + 1}

A practical rule (half rule): keep the largest lag as τ\tau, add half of the second-largest to τ\tau and the other half plus all smaller lags to θ\theta. The heater block with a 10 s10\ \text{s} sensor lag and 2 s2\ \text{s} of transport delay becomes K=4 K/WK = 4\ \text{K/W}, τ≈305 s\tau \approx 305\ \text{s}, θ≈7 s\theta \approx 7\ \text{s}. Dead time is what limits how fast any controller can be (Model-Based Tuning).

Fluid systems: volume balance

A tank of cross-section AA with inflow qinq_\text{in} and outflow qoutq_\text{out} (in m3/s\text{m}^3/\text{s}):

Adhdt=qin−qoutA\frac{dh}{dt} = q_\text{in} - q_\text{out}

If the outlet is a long narrow pipe (laminar flow), qout=h/Rfq_\text{out} = h/R_f and the tank is linear, τ=ARf\tau = A R_f. A free orifice instead follows Torricelli's law, qout=a2ghq_\text{out} = a\sqrt{2gh}, which is nonlinear: the tank drains fast when full and slowly when nearly empty. Near an operating level h0h_0 with flow q0q_0 it behaves like a linear tank with Rf=dhdq=2h0q0R_f = \frac{dh}{dq} = \frac{2h_0}{q_0}, 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 V/(RgasT)V/(R_\text{gas} T) (moles stored per pascal of pressure, isothermal; Rgas=8.314 J/(mol⋅K)R_\text{gas} = 8.314\ \text{J/(mol} \cdot \text{K)}), 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: Rth=4 K/WR_\text{th} = 4\ \text{K/W}, τ=300 s\tau = 300\ \text{s}, room Ta=25 ∘CT_a = 25\,^\circ\text{C}, heater power stepped from 0 to 6.25 W6.25\ \text{W}; (b) a tank with A=0.02 m2A = 0.02\ \text{m}^2, orifice a=5×10−5 m2a = 5 \times 10^{-5}\ \text{m}^2, inflow q0=1×10−4 m3/sq_0 = 1 \times 10^{-4}\ \text{m}^3/\text{s} (6 L/min6\ \text{L/min}), g=9.81 m/s2g = 9.81\ \text{m/s}^2.

Find: (a) CC, the final temperature, the time to reach 45 ∘C45\,^\circ\text{C}, and the mass of an aluminium block with this CC (c=900 J/(kg⋅K)c = 900\ \text{J/(kg} \cdot \text{K)}); (b) the steady level and the linearised time constant.

Solve:

  • (a) C=τ/Rth=75 J/KC = \tau/R_\text{th} = 75\ \text{J/K}, i.e. 83 g83\ \text{g} of aluminium. Final 25+4×6.25=50 ∘C25 + 4 \times 6.25 = 50\,^\circ\text{C}. 45 ∘C45\,^\circ\text{C} is 80 %80\,\% of the rise: t=−τln⁡(0.2)=483 st = -\tau\ln(0.2) = 483\ \text{s}.
  • (b) Steady state qout=q0q_\text{out} = q_0: h0=(q0/a)22g=2219.62=0.204 mh_0 = \frac{(q_0/a)^2}{2g} = \frac{2^2}{19.62} = 0.204\ \text{m}. Rf=2h0/q0=4077 s/m2R_f = 2h_0/q_0 = 4077\ \text{s/m}^2, τ=ARf=81.5 s\tau = A R_f = 81.5\ \text{s}.

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 +20 %+20\,\% inflow step.

python · try it yourself
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 45 ∘C45\,^\circ\text{C} about 10 s10\ \text{s} 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 0.2854 m0.2854\ \text{m} instead of the exact 0.2936 m0.2936\ \text{m}: linearisation is accurate for small steps, and 20 %20\,\% 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 1 V1\ \text{V} to 2 K2\ \text{K}: a 12.5 V12.5\ \text{V} source charging C=100 μFC = 100\ \mu\text{F} through R=1 kΩR = 1\ \text{k}\Omega (τ=100 ms\tau = 100\ \text{ms}) is the 25 K25\ \text{K} rise of the block, 3000 times faster. At t=1.609τt = 1.609\tau the lab shows vC=10.0 Vv_C = 10.0\ \text{V} (80.0 %80.0\,\% of the final value), the 45 ∘C45\,^\circ\text{C} point the heater reaches at 483 s483\ \text{s}.

+-R = 1.00 kOhmswitch closed at t = 0V = 12.5 V, C = 100 uFtau = RC = 100 mst161 mst/tau1.61vC10.0 Vi2.50 mAvR2.50 V0.03.16.39.412.501 tau2 tau3 tau4 tau5 tau6 tautv (V)0 A6.3 mA13 mAi63.2 %5 tau: 99.3 %vC(t), capacitor voltagei(t)

Guided lab: a step test on a low-voltage heater

Hand calculation. For a heater on a known supply, P=V2/RP = V^2/R: 10 Ω10\ \Omega at 12 V12\ \text{V} is 14.4 W14.4\ \text{W}, at 7.9 V7.9\ \text{V} it is 6.25 W6.25\ \text{W}. Expect a rise of RthPR_\text{th}P with time constant RthCR_\text{th}C; with the reference numbers, 25 K25\ \text{K} and 300 s300\ \text{s}.

Simulation. Replace Rth, C, ts in the program with your estimates and overlay your log.

What you would measure. A 10 Ω10\ \Omega aluminium-clad resistor on an aluminium block, sensor in a drilled hole with thermal paste, a bench supply at 7.9 V7.9\ \text{V} with a 1 A1\ \text{A} limit (or PWM at 43 %43\,\% duty from 12 V12\ \text{V}). Log temperature every second for 30 minutes after switching on from room temperature. Fit KK, τ\tau and θ\theta: the 28 % and 63 % times give τ=1.5(t63−t28)\tau = 1.5(t_{63} - t_{28}) and θ=t63−τ\theta = t_{63} - \tau. Expect RthR_\text{th} within ±20 %\pm 20\,\% of the design value (it depends on airflow), θ\theta 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 60 ∘C60\,^\circ\text{C}; mount them on a ceramic tile or metal plate, add a thermal fuse or cut-out rated around 70–80 ∘C70\text{–}80\,^\circ\text{C}, 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 12 V12\ \text{V} 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 V2V^2.
  • 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 (h0→0h_0 \to 0 makes Rf→0R_f \to 0): the linear model is only good near its operating point.
  • Ignoring that RthR_\text{th} changes with airflow: it is a disturbance the loop must reject, not a constant.

Practice

  1. A 200 g200\ \text{g} steel part (c=490 J/(kg⋅K)c = 490\ \text{J/(kg} \cdot \text{K)}) on a mount of Rth=2 K/WR_\text{th} = 2\ \text{K/W}. Give CC and τ\tau.
  2. Apply the half rule to 2(100s+1)(20s+1)(5s+1)\frac{2}{(100s + 1)(20s + 1)(5s + 1)}.
  3. A tank at h0=0.5 mh_0 = 0.5\ \text{m} with q0=2×10−4 m3/sq_0 = 2 \times 10^{-4}\ \text{m}^3/\text{s} through an orifice, A=0.05 m2A = 0.05\ \text{m}^2. What is its linearised time constant?
Answer
  1. C=0.2×490=98 J/KC = 0.2 \times 490 = 98\ \text{J/K}, τ=196 s\tau = 196\ \text{s}.
  2. K=2K = 2, τ=100+10=110 s\tau = 100 + 10 = 110\ \text{s}, θ=10+5=15 s\theta = 10 + 5 = 15\ \text{s}.
  3. Rf=2×0.5/(2×10−4)=5000 s/m2R_f = 2 \times 0.5/(2 \times 10^{-4}) = 5000\ \text{s/m}^2, τ=0.05×5000=250 s\tau = 0.05 \times 5000 = 250\ \text{s}.

Test yourself

In the thermal-electrical analogy, heater power corresponds to

  1. a voltage source
  2. a current source
  3. a resistor
  4. a capacitor

The heater block has Rth=4 K/WR_\text{th} = 4\ \text{K/W} and τ=300 s\tau = 300\ \text{s}. Its thermal capacitance is

  1. 1200 J/K1200\ \text{J/K}
  2. 75 J/K75\ \text{J/K}
  3. 0.013 J/K0.013\ \text{J/K}
  4. 300 J/K300\ \text{J/K}

Why is a tank draining through an orifice nonlinear?

  1. the inflow is pulsed
  2. the outflow goes with h\sqrt{h}
  3. the area changes
  4. water is compressible

A chain of several small lags behind a large one is usually approximated as

  1. a pure integrator
  2. a dead time added to a first-order lag
  3. a second-order underdamped system
  4. a zero