One equation, many machines
A car's suspension, a motor warming up under load, a water tower draining into a town's pipes and a coffee machine's boiler coming up to temperature look like four unrelated problems. Each, though, is a machine whose present behaviour depends on its past: on how fast the body is already moving, how hot the copper already is, how much water is already in the tank. And once their equations are written down, the four problems turn out to be nearly the same problem.
That is the subject of this level of Lumenary ME: machines as systems. You have already met the pieces separately. Vibrations modelled a mass on a spring with a damper, Heat transfer treated a body that heats and cools as a whole, and Viscous flow and pipes related pressure drops to flows. This lesson joins them into one method: cut a machine into a few ideal elements, recognise the same three kinds of element in every physical domain, write the model in a standard form a computer can simulate and analyse, and, most importantly, find out whether the model is any good.
Engineers build these models for three reasons: to predict how a design will behave before it is built, to design the controllers of the next lesson, and to diagnose a machine that misbehaves. In all three, the art is in what you leave out.
Lumped parameters
A real car spring has mass, stiffness and a little internal friction spread along every millimetre of it, and a real motor's temperature varies from point to point. Modelling every point would mean partial differential equations, the subject of the finite element method and computational fluid dynamics. A lumped-parameter model takes a shortcut: it gathers each property into an ideal element at a single point. All the mass goes into rigid blocks, all the stiffness into massless springs, all the friction into massless dampers; all the heat capacity of the winding goes into one node at one temperature, and all the resistance to heat flow into the links between nodes.
The shortcut is justified when the lumps really do behave as wholes. A car body is far stiffer than its suspension springs, so at the frequencies of a bumpy road it moves as a rigid block. A small aluminium part in a gentle air stream is nearly uniform in temperature because heat crosses it far more easily than it leaves its surface, which is what a small Biot number means. The test is always the same: the lumps must respond much faster inside than they do to each other and to the outside world, over the range of frequencies and times you care about.
Once a system is lumped, every element either stores energy, in one of two ways, or dissipates it as heat for good. A mass stores kinetic energy, a spring strain energy, and a damper dissipates. A capacitor and an inductor store energy in electric and magnetic fields, and a resistor dissipates. A tank stores water at a height, a long pipe stores the kinetic energy of the water moving in it, and a valve dissipates. A block of metal stores internal energy, a thermal resistance dissipates, and the thermal world has no second kind of store. The same pattern, again and again.
Analogies across domains
To make the pattern precise, pick in each domain an across variable, measured as a difference between two points (velocity, voltage, temperature, pressure), and a through variable, which flows through an element from one point to the other (force, current, heat flow, volume flow). Their product is power in the mechanical, electrical and fluid domains; in the thermal domain heat flow is itself a power, a quirk worth remembering.
| Domain | Across | Through | Store A (across) | Store B (through) | Dissipator |
|---|---|---|---|---|---|
| Mechanical (translation) | velocity | force | mass: | spring: | damper: |
| Electrical | voltage | current | capacitor: | inductor: | resistor: |
| Thermal | temperature | heat flow | heat capacity: | none | thermal resistance: |
| Fluid | pressure | volume flow | tank: | inertance: | resistance: |
Here for a body of mass and specific heat ; for convection from an area and for conduction through a slab; an open tank of area has fluid capacitance ; and water in a pipe of length and bore area has inertance . Rotation fits in the mechanical row with angular velocity, torque, moment of inertia and torsional stiffness.
Definition— lumped-parameter model, through–across analogy
A lumped-parameter model represents a system by a finite network of ideal elements, each relating the across and through variables at its two ends by an algebraic or first-order differential law. In the through–across analogy (Firestone's mobility analogy), elements of different domains correspond when their laws have the same form; connections then correspond too: elements that share an across variable are in parallel, and elements that carry the same through variable are in series.
Every first result you know in one domain now has a twin in each of the others. A capacitor charging through a resistor has time constant ; so does a lumped body heating through a convection resistance, ; so does a tank draining through a valve, . A mass on a spring is an LC circuit in disguise: with the mass as a capacitor and the spring as an inductor , the circuit's natural frequency becomes . That is the reason the quality factor of Lumenary EE's RLC circuits and the damping ratio of a mass–spring–damper are the same idea.
Note
There is a second, older convention, the force–voltage analogy, in which a mass corresponds to an inductor and a spring to a capacitor. Both are mathematically correct; they simply pair the variables the other way round. The through–across version used here keeps the topology of the network, which is why multi-domain tools such as Modelica build their connectors on it, and why its thermal and fluid rows need no rearranging. When you read an older text, check which convention it uses before transferring a result.
Example— A tank as a first-order system, linearised
A header tank of plan area m² is fed with water and drains through a valve at its base. At the design level m the outflow is L/s. Through a valve, the flow goes roughly as , so the model is nonlinear: .
For small changes around the design point, replace the square root by its tangent. Since , a change changes the outflow by , so the valve behaves like a linear resistance (in head) of s/m². The tank's level then obeys , a first-order system with time constant
A step increase in inflow of 0.2 L/s raises the level by m, 63 per cent of the way in 20 minutes and 95 per cent within an hour. Simulating the nonlinear model for the same step gives a final rise of 0.21 m: over a 20 per cent change in level the square root bends only gently, and the linear model is never more than 1 cm out. That is linearisation about an operating point, and it is how nearly every model of a valve, a pump, a tyre or an engine enters a linear analysis.
Electrical systems belong to Lumenary EE, and are here mainly as a source of intuition you may already have from capacitors and inductors. The mechanical engineer's systems mix all four rows: an electric motor turns current into torque, a hydraulic cylinder turns pressure into force, a brake turns kinetic energy into heat. Elements that convert between domains, the transducers, are the subject of Mechatronics and actuators.
State-space form
A lumped model is a set of differential and algebraic equations. To simulate it, analyse it or design a controller for it, it helps to put it in one standard shape.
Definition— state, state-space model
The state of a system is a set of variables such that, given at one instant and the inputs from then on, the future is determined. A linear time-invariant state-space model is
where are the outputs of interest (what you would measure or care about) and , , , are constant matrices.
The natural choice of state is one variable for each independent energy store: the velocity of every mass, the force in (or the stretch of) every spring, the temperature of every heat capacity, the level of every tank. That is no accident. Energy cannot change instantly without infinite power, so these quantities are continuous in time, and together they are exactly the system's memory. The number of states is the order of the model. For a mass–spring–damper, becomes two first-order equations with :
The payoff of the standard form is that the matrix alone tells you how the system behaves when left to itself.
Theorem— Free response from the eigenvalues of A
With , the solution is . If has distinct eigenvalues with eigenvectors , then , with the constants set by . So the model is stable (every free response decays) exactly when every eigenvalue has a negative real part. A real eigenvalue is a first-order lag with time constant ; a complex pair is a mode oscillating with natural frequency and damping ratio .
Proof
Substituting into gives , so each eigenpair gives a solution. With distinct eigenvalues the eigenvectors are linearly independent, so any is a combination , and by linearity and uniqueness of solutions the combination is the solution. Each term decays exactly when . For a complex pair, comparing with the roots of from Vibrations gives and .
∎
This is the generalisation of the vibrations lesson's characteristic equation to any number of states and any mix of domains, and it is the language of state-space control in Lumenary Robotics. The thermal row of the analogy table has a striking consequence.
Theorem— Passive thermal networks do not oscillate
For any network of heat capacities joined to each other and to fixed-temperature surroundings by thermal resistances, every eigenvalue of is real and, if every node has some path to the surroundings, negative.
Proof
Energy balance at node gives (temperatures measured from the surroundings, conductances ). So , where is the diagonal matrix of capacities and is symmetric with . Then is similar to the symmetric matrix , whose eigenvalues are real and not positive; the quadratic form vanishes only if linked nodes share a temperature and every node linked directly to the surroundings is at zero. If every node has a path to the surroundings, that forces , so is positive definite and every eigenvalue is negative.
∎
A quarter-car suspension, simulated
Vibrations modelled a car body bouncing on its springs as a single mass. That captures the ride, but a car engineer also cares about the wheel, because the force between the tyre and the road is what steers and brakes the car. The quarter-car model adds the wheel as a second mass: a quarter of the body, , on the suspension spring and damper , above the wheel, hub and brake, , which sits on the tyre, a stiff spring standing on the road.
With and the road height as input, Newton's law for each mass gives
The program finds the two modes from the eigenvalues of , then drives the car at 20 m/s (72 km/h) over a rough road for 30 seconds with five dampers, from very soft to very hard. Because the model is linear, it can step forward exactly: over a time step in which the road height is held constant, . The matrix exponential is computed the classical way, by scaling down until it is small, summing its Taylor series and squaring back up. Three outputs matter: the body's acceleration (comfort), the stretch of the suspension (whether it will hit its bump stops) and the change in tyre force as a fraction of its static value (grip).
import numpy as np
# Quarter-car model. State x = [zs, vs, zu, vu]: body height and velocity, wheel height and velocity,
# all measured from static equilibrium. Input u = zr, the height of the road under the tyre.
ms, mu = 320.0, 40.0 # kg: a quarter of the body; one wheel with its hub, brake and arm
ks, kt = 22e3, 200e3 # N/m: suspension spring; tyre
def quarter_car(cs):
A = np.array([[0.0, 1.0, 0.0, 0.0],
[-ks / ms, -cs / ms, ks / ms, cs / ms],
[0.0, 0.0, 0.0, 1.0],
[ks / mu, cs / mu, -(ks + kt) / mu, -cs / mu]])
B = np.array([0.0, 0.0, 0.0, kt / mu])
return A, B
A, B = quarter_car(1600.0)
lam = np.linalg.eigvals(A)
for l in sorted(lam[lam.imag > 0], key=abs): # each mode is a complex-conjugate pair
print(f"mode: {abs(l) / (2 * np.pi):5.2f} Hz, damping ratio {-l.real / abs(l):.2f}")
def expm(M):
"""Matrix exponential: scale M down, sum a Taylor series, square back up."""
s = max(0, int(np.ceil(np.log2(max(np.abs(M).sum(axis=1).max(), 1e-12)))) + 1)
X, E, term = M / 2**s, np.eye(len(M)), np.eye(len(M))
for k in range(1, 18):
term = term @ X / k
E = E + term
for _ in range(s):
E = E @ E
return E
# A rough road: 200 sine waves of random (but seeded) phase, the longer waves taller, at 20 m/s.
rng = np.random.default_rng(7)
speed, dt = 20.0, 1e-3
t = np.arange(0.0, 30.0, dt)
n = np.linspace(0.02, 2.0, 200) # waves per metre (wavelengths 0.5 m to 50 m)
amp = 1.0e-4 / n # amplitude in metres
phase = rng.uniform(0, 2 * np.pi, n.size)
zr = (amp[:, None] * np.sin(2 * np.pi * n[:, None] * speed * t + phase[:, None])).sum(axis=0)
print(f"road: rms height {1000 * zr.std():.1f} mm")
print("\ndamper body-mode body accel suspension tyre load")
print("(kN s/m) zeta rms m/s^2 travel mm variation %")
for cs in [500.0, 1000.0, 1600.0, 3000.0, 6000.0]:
A, B = quarter_car(cs)
Ad = expm(A * dt) # exact step for a linear model:
Bd = np.linalg.solve(A, (Ad - np.eye(4)) @ B) # x[k+1] = Ad x[k] + Bd u[k]
x, X = np.zeros(4), np.empty((t.size, 4))
for i in range(t.size):
X[i] = x
x = Ad @ x + Bd * zr[i]
keep = t > 5.0 # ignore the start-up transient
accel = (X[keep] @ A[1] + B[1] * zr[keep])
travel = X[keep, 0] - X[keep, 2]
tyre = kt * (zr[keep] - X[keep, 2]) # change in tyre force from its static value
print(f"{cs / 1e3:5.1f} {cs / (2 * np.sqrt(ks * ms)):4.2f} {accel.std():8.2f}"
f" {1000 * travel.std():8.1f} {100 * tyre.std() / ((ms + mu) * 9.81):8.1f}")The model has two modes, and they are very different. The body mode at 1.27 Hz is the gentle bounce of the vibrations lesson. The wheel-hop mode at 11.7 Hz is the wheel bouncing between the stiff tyre and the body, which barely moves at that frequency. With the 1.6 kN·s/m damper both are damped at a ratio of a little under 0.3.
The table is the classic suspension compromise. Comfort (body acceleration) is best with a fairly soft damper, around 1.0 kN·s/m (). Grip (fluctuation of tyre force) is best with a firmer one, 1.6 to 3.0 kN·s/m, because a soft damper lets the wheel hop. Suspension travel falls steadily as the damper stiffens. No damper is best at everything, which is why ride engineers spend weeks on test tracks choosing damper curves, and why some cars carry dampers whose setting a controller changes many times a second.
A thermal system: how long can a motor be overloaded?
Electric motors are rated by temperature. The winding's insulation ages rapidly above its temperature class (classes such as 130, 155 and 180 °C are defined in the IEC 60085 standard, published by the IEC). A motor's continuous rating is the load it can carry forever without exceeding that limit, but motors are routinely asked for more for short periods: a conveyor starting with a full load, a crane lifting, a press stroke. How long is safe depends on the thermal dynamics.
The simplest model that captures them has two nodes: the winding (capacity ), where the electrical losses appear, and the iron core and frame (a much larger ). Heat crosses the slot insulation into the iron through and leaves the frame for the air through : an electrical network in thermal clothing.
The numbers below are typical of a 4 kW industrial motor losing about 400 W at its rated load: a winding of kJ/K, a core and frame of kJ/K, K/W and K/W, in a machine room at 40 °C. The program writes the model in state-space form, reads its time constants from the eigenvalues, and then simulates a 50 per cent overload (losses go as the square of current, so 400 W becomes 900 W), starting from cold and from a motor already at its rated-load temperature.
import numpy as np
# A two-node thermal model of a 4 kW electric motor. Node 1: the copper winding; node 2: the iron
# core and frame. Heat flows from winding to frame through R1, and from frame to the air through R2.
C1, C2 = 2.5e3, 15e3 # heat capacities, J/K
R1, R2 = 0.05, 0.15 # thermal resistances, K/W
Ta = 40.0 # ambient air, deg C (a warm machine room)
# State x = [T1 - Ta, T2 - Ta] (temperature rises); input u = P, heat generated in the winding (W).
A = np.array([[-1 / (R1 * C1), 1 / (R1 * C1)],
[ 1 / (R1 * C2), -1 / (R1 * C2) - 1 / (R2 * C2)]])
B = np.array([1 / C1, 0.0])
lam = np.sort(np.linalg.eigvals(A).real)
print("eigenvalues of A (1/s):", ", ".join(f"{l:.5f}" for l in lam))
print("time constants:", ", ".join(f"{-1 / l / 60:.1f} min" for l in lam))
x_rated = np.linalg.solve(A, -B * 400.0)
print(f"steady state at the rated 400 W of losses: winding {Ta + x_rated[0]:.0f} C, frame {Ta + x_rated[1]:.0f} C")
def simulate(power, t_end, x0, dt=1.0):
"""Integrate x' = A x + B P(t) with fourth-order Runge-Kutta; P is a function of time (s)."""
x, out = np.array(x0, float), []
f = lambda t, x: A @ x + B * power(t)
for k in range(int(round(t_end / dt)) + 1):
out.append(x.copy())
t = k * dt
k1 = f(t, x); k2 = f(t + dt / 2, x + dt / 2 * k1)
k3 = f(t + dt / 2, x + dt / 2 * k2); k4 = f(t + dt, x + dt * k3)
x = x + dt / 6 * (k1 + 2 * k2 + 2 * k3 + k4)
return np.array(out)
# An overload at 1.5 times rated current: copper loss goes as current squared, so 400 W -> 900 W.
limit = 155.0 # winding temperature limit, deg C
print("\nminutes winding temperature (C) under a steady 900 W overload")
print(" from cold from rated-load steady state")
runs = {name: Ta + simulate(lambda t: 900.0, 3600, x0)[:, 0]
for name, x0 in [("cold", [0.0, 0.0]), ("hot", x_rated)]}
for m in [0, 1, 2, 5, 10, 20, 30, 60]:
print(f"{m:5d} {runs['cold'][60 * m]:8.0f} {runs['hot'][60 * m]:8.0f}")
for name, T1 in runs.items():
over = np.nonzero(T1 > limit)[0]
print(f"starting {name}: the winding reaches {limit:.0f} C after {over[0] / 60:.1f} min")The two eigenvalues are real and negative, as the theorem promised, and far apart: a fast time constant of 1.8 minutes (the winding warming relative to the iron) and a slow one of 44 minutes (the whole motor warming relative to the room). At its rated load the winding settles at 120 °C, comfortably below 155 °C. A cold motor can carry the overload for 36 minutes, because the big thermal mass of the iron soaks up the heat. A motor already hot from hours at rated load reaches the limit in about 10 minutes, and its winding jumps 16 °C in the first two, as the fast mode responds. The state of the motor, not just the load, decides what is safe, which is why modern motor drives and protection relays run a thermal model like this one in real time and trip the motor on its estimated winding temperature.
Validating a model against data
Every number so far came from assumed parameters. A model earns trust only by comparison with measurements, under three rules. Fit on one experiment and check on another: with enough adjustable parameters a model can match any one curve. Look at the residuals, not just their size: a good model leaves residuals that look like sensor noise, while a wrong structure leaves a pattern. Check that fitted parameters make physical sense: a negative heat capacity says the model is wrong, however well it fits.
The program applies them to the motor. In place of a real test rig, it "measures" the winding temperature with a more detailed three-node model plus thermocouple noise with a fixed seed, so you can see the truth behind the data. Test 1 is a three-hour heat run at constant power, logged once a minute; test 2, never used for fitting, is a duty cycle of five minutes at 900 W and ten at 200 W. Two structures are fitted to test 1 by least squares, one first-order lag and two lags (the step response of the two-node model), and each then predicts test 2 as a sum of shifted step responses, which linearity allows.
import numpy as np
# Stand-in for a test rig: a more detailed three-node motor model (winding, stator core, frame)
# plus sensor noise with a fixed seed. In real life these numbers would come from a data logger.
rng = np.random.default_rng(42)
C = np.array([2.5e3, 9e3, 7e3]) # J/K
G = {(0, 1): 1 / 0.04, (1, 2): 1 / 0.03} # conductances between nodes, W/K
G_air = 1 / 0.14 # frame to air, W/K
A = np.zeros((3, 3))
for (i, j), g in G.items():
A[i, i] -= g; A[j, j] -= g; A[i, j] += g; A[j, i] += g
A[2, 2] -= G_air
A /= C[:, None]
def rig(power, minutes):
"""'Measure' the winding temperature rise every minute while the heat input follows power(t)."""
dt, x, log = 1.0, np.zeros(3), []
for k in range(60 * minutes + 1):
if k % 60 == 0:
log.append(x[0] + rng.normal(0, 0.3)) # thermocouple noise, 0.3 K rms
x = x + dt * (A @ x + np.array([power(k * dt) / C[0], 0, 0]))
return np.array(log)
t = np.arange(0, 181.0) # minutes
heat = rig(lambda s: 400.0, 180) # test 1: a 3-hour heat run at 400 W
def fit(n_exp):
"""Least-squares fit of the step response to a sum of n_exp first-order lags (grid over taus)."""
best = None
grids = [np.arange(5, 120.5, 0.5)] if n_exp == 1 else [np.arange(0.5, 10.01, 0.1), np.arange(10, 120.5, 0.5)]
for taus in np.array(np.meshgrid(*grids)).reshape(n_exp, -1).T:
Phi = np.column_stack([400.0 * (1 - np.exp(-t / tau)) for tau in taus])
a, *_ = np.linalg.lstsq(Phi, heat, rcond=None)
r = heat - Phi @ a
if best is None or r @ r < best[0]:
best = (r @ r, taus, a, r)
return best
def predict(taus, a, power, minutes):
"""Response of the fitted linear model to piecewise-constant power, by superposing steps."""
tt = np.arange(0, minutes + 1.0)
step = lambda s: sum(ai * (1 - np.exp(-np.clip(s, 0, None) / tau)) for ai, tau in zip(a, taus))
P = np.array([power(60 * m) for m in tt])
dP = np.diff(np.concatenate([[0.0], P]))
return sum(dP[k] * step(tt - tt[k]) for k in np.nonzero(dP)[0])
duty = lambda s: 900.0 if (s // 60) % 15 < 5 else 200.0 # test 2: 5 min at 900 W, 10 min at 200 W
check = rig(duty, 120)
for n in (1, 2):
sse, taus, a, r = fit(n)
p = predict(taus, a, duty, 120)
print(f"{n}-lag model: time constants {', '.join(f'{x:.1f}' for x in taus)} min, "
f"thermal resistances {', '.join(f'{x:.3f}' for x in a)} K/W")
print(f" heat run (fitting data): rms error {np.sqrt(sse / t.size):.2f} K, "
f"mean error in the first 10 min {r[:11].mean():+.2f} K")
print(f" duty cycle (fresh data): rms error {np.sqrt(np.mean((check - p) ** 2)):.2f} K, "
f"peak rise measured {check.max():.1f} K, predicted {p.max():.1f} K")On the heat run, the one-lag model looks respectable: an rms error of 2.4 K on a rise of about 82 K. But its residuals have a pattern. In the first ten minutes the measurements sit on average 6.8 K above the model, because a single lag cannot rise as fast as the real winding does at first. On the duty cycle that structural error matters: the one-lag model underestimates the peak winding temperature by 11 K, an error in the dangerous direction. The two-lag model leaves residuals of 0.26 K, the size of the sensor noise, with no pattern; it finds time constants of 1.7 and 47 minutes and a total thermal resistance of 0.210 K/W, which match the physics; and it predicts the unseen duty cycle to within 0.4 K rms and the peak to 0.1 K.
The two-lag model did not need the third node to be useful; the real motor will always be more complicated than any model. A model is validated for a purpose (here, winding temperature under duty cycles) and over a range (the loads and times tested). The duty cycle was a fair test because it exercised the fast time constant that a slow, steady heat run barely reveals. If the motor will see two-second current spikes, validate with two-second current spikes: a model validated on minutes says nothing about seconds.
Modelling in professional practice
Equation-based, multi-domain tools. Writing and by hand is fine for four states and error-prone for four hundred. Professional system models are assembled from components, a motor, a gearbox, a pipe, a heat exchanger, each with connectors that carry an across and a through variable, and a tool derives and solves the equations. The open Modelica language works this way, with the open-source OpenModelica and several commercial environments, including Dassault Systèmes' Dymola; MathWorks' Simulink with Simscape, and Siemens' Simcenter Amesim, are widely used in automotive, aerospace and hydraulics. A Modelica version of the motor's thermal model (shown for illustration, not run here) reads almost like the physics:
model MotorThermal "Two-node thermal model of a motor (illustration; not run here)"
parameter Real C1 = 2.5e3 "winding heat capacity, J/K";
parameter Real C2 = 15e3 "core and frame heat capacity, J/K";
parameter Real R1 = 0.05 "winding to frame, K/W";
parameter Real R2 = 0.15 "frame to air, K/W";
parameter Real Ta = 40 "ambient temperature, degC";
input Real P "losses in the winding, W";
Real T1(start = Ta) "winding temperature, degC";
Real T2(start = Ta) "frame temperature, degC";
equation
C1 * der(T1) = P - (T1 - T2) / R1;
C2 * der(T2) = (T1 - T2) / R1 - (T2 - Ta) / R2;
end MotorThermal;Exchanging models. The Functional Mock-up Interface lets a model be exported as a self-contained unit and run inside another tool, so a gearbox supplier's model can join a carmaker's vehicle model without either sharing source code.
System identification. Fitting models to data, as in the last program, is a field of its own, with methods for choosing model structure, designing test signals and estimating uncertainty. Many machines identify themselves: servo drives run a short test movement to estimate their load's inertia before tuning their loops.
Digital twins. A digital twin is a model kept in step with one particular machine in service by feeding it that machine's measurements, to estimate what cannot be measured (a winding hot spot, a bearing's wear). The motor protection relay above is a modest one. The name is sometimes stretched to cover any 3D model, so ask what a given twin computes and how it was validated.
The statistician George Box observed that all models are wrong but some are useful. The engineer's version is to know how a model is wrong, for which inputs and by how much, and to keep that knowledge attached to it.
From analogies to equation-based models
Telephone engineers of the 1920s designed gramophones and loudspeakers as if they were circuits, using the analogy between mechanical and electrical oscillators. Floyd Firestone proposed the through–across (mobility) analogy in 1933, and Harry Olson's Dynamical Analogies (1943) taught it to a generation. For decades the most practical way to solve the equations was to build their analogue: Vannevar Bush's mechanical differential analyser at MIT (1931), then electronic analogue computers on which aircraft and car suspensions were simulated by wiring integrators together. Henry Paynter at MIT introduced bond graphs around 1959 as a domain-neutral language for energy flow. Rudolf Kálmán's work around 1960 made state-space form the common language of control and system dynamics, and digital computers made simulating it routine. Hilding Elmqvist's Dymola language in 1978 and the Modelica language, whose first version appeared in 1997, let engineers write equations as physics rather than as assignment statements, and the FMI standard of 2010, from the European MODELISAR project, let models move between tools.
Common misconceptions
Misconception
"A more detailed model is always a better model." Detail costs parameters, and every parameter must be measured or guessed. A two-node motor model with well-measured parameters predicts better than a fifty-node model with guessed ones. Choose the simplest structure that captures the behaviour you need, then validate it.
Misconception
"The model fits the data, so it is validated." Agreement with the data used for fitting proves only that the fitting worked. Validation needs data the model has not seen, ideally exercising the behaviour you will rely on, and residuals that show no pattern.
Misconception
"Linear models are useless because real machines are nonlinear." Most machines operate near a design point, and around it a linearised model, like the header tank's, is accurate and gives you the whole toolkit of eigenvalues, frequency response and linear control. Where the nonlinearity matters (a tyre leaving the road, a valve fully open, an actuator at its limit), simulate the nonlinear model; the next lesson shows what an actuator's limit does to a control loop.
Exercises
Use m/s². Two exercises ask for Python functions; run them in the editor before submitting.
1. Modelling dynamic systems
Warm-upHumanIn the through–across analogy (velocity, voltage, temperature and pressure as across variables), which element of a water system plays the part of a mechanical spring?
2. Modelling dynamic systems
Warm-upHumanA 0.50 kg aluminium bracket ( J/(kg·K)) is small enough to be treated as one lump. It cools in still air with a convection coefficient W/(m²·K) over a surface area of 0.050 m². What is its thermal time constant, in minutes?
3. Modelling dynamic systems
CoreHumanA lorry designer extends the quarter-car model with the driver's seat: three masses (wheel, a quarter of the cab, and the seat with its driver), three springs (tyre, suspension, seat cushion) and two dampers (suspension and seat), joined in a vertical chain. How many state variables does its state-space model need?
4. Modelling dynamic systems
CoreHumanA model of a machine tool's spindle head has state matrix eigenvalues and (all in s⁻¹). Which description of its free response is right?
5. Modelling dynamic systems
CoreHumanA process tank of plan area 3.0 m² drains through a valve whose flow goes as . At its operating level of 2.5 m the outflow is 5.0 L/s. Linearise the valve about this point and find the time constant of small changes in level, in minutes.
6. Modelling dynamic systems
CoreComputationalWrite quarter_car_modes(ms, mu, ks, cs, kt) that builds the quarter-car state matrix from the lesson and returns its two modes as a list [(f1, zeta1), (f2, zeta2)], with frequencies in hertz, lowest first.
The starter has a modelling mistake. Run the tests to see it fail, then fix it.
7. Modelling dynamic systems
StretchComputationalA test engineer logs the temperature rise of a part after a step in heating and wants the gain and time constant of the model . Write fit_first_order(t, y) returning (K, tau) by least squares.
The starter uses the textbook shortcut: take the last sample as the final value and read off the time at which the curve reaches 63.2 per cent of it. Run the tests to see why that fails on real test logs, then replace it.
8. Modelling dynamic systems
CoreHumanYou will use a thermal model of a motor to decide whether a new duty cycle is safe. Which evidence best justifies trusting it for that?
Further reading and resources
- Modelica AssociationThe non-profit body behind the Modelica language for equation-based, multi-domain models, its free Modelica Standard Library, and the FMI standard.
- OpenModelicaAn open-source environment for writing and simulating Modelica models.
- Functional Mock-up Interface (FMI)The open standard for exchanging models between simulation tools and running them together in co-simulation.
- Python Control Systems LibraryOpen-source state-space and transfer-function tools in Python, for when you outgrow hand-written simulations.
- SciPy: scipy.linalg.expmA robust matrix exponential, the professional version of the one written by hand in this lesson.
- Analysis and Design of Engineering Systems · Henry M. Paynter · 1961MIT Press. The book that introduced bond graphs, a graphical language for energy flow across domains.
- On the general theory of control systems · Rudolf E. Kálmán · 1960Proceedings of the First IFAC Congress, Moscow. One of the papers that made state-space form the standard language of system dynamics.