A digital twin is a process model kept synchronised with live plant data and used to decide something. Most of the value comes not from the model but from the control layer built on it: model predictive control that anticipates load instead of reacting to it. On a wastewater works the demonstrable prize is 15–30% of aeration energy with tighter, not looser, consent compliance.
Model, shadow, twin: three different things sold under one name
Precision here saves money, because the three levels differ by an order of magnitude in cost and in what they can deliver.
| Level | Data link | Purpose | Typical use |
|---|---|---|---|
| Digital model | None — offline, manually updated | Design and scenario testing | Sizing an upgrade, testing a consent change |
| Digital shadow | One-way: plant → model | Monitoring, soft sensing, fault detection | Estimating an unmeasured variable; alarm on divergence |
| Digital twin | Two-way: plant ↔ model | Closed-loop optimisation and control | MPC of aeration, dosing or pumping |
Most delivered projects are shadows, and that is frequently the correct answer. A shadow that reliably estimates influent ammonia load two hours ahead is worth more than a nominal twin whose control outputs the operators have switched to manual. Ask what decision the system will change; if there is not one, a model is being bought as an artefact rather than as an instrument.
The underlying process model is usually an activated sludge model for biology, a hydraulic model for the network, or a data-driven surrogate for a specific relationship. The engineering question is which fidelity the control problem actually needs.
Why feedback control is not enough on these processes
Conventional PID control acts on error — it can only respond after the controlled variable has already moved. That is adequate when the process is fast relative to the disturbance. Water treatment processes routinely are not.
- Long dead time. Ammonia entering the works reaches the aeration outlet an hour or more later, so a DO controller reacting to measured ammonia is acting on a disturbance that entered the plant long ago.
- Severe non-linearity. Nitrification rate saturates in DO; a pH titration curve has a gain that varies by orders of magnitude across the neutral point; coagulation response is non-monotonic in dose.
- Constraints that matter. Blowers have minimum turndown, valves have limits, and the consent is a hard boundary. PID has no representation of a constraint; it only knows setpoint error.
- Strong coupling. Adjusting aeration changes nitrate, which changes denitrification, which changes alkalinity, which changes nitrification. Independent single-loop controllers fight each other.
Model predictive control: the formulation
MPC solves, at every control interval, a finite-horizon optimisation over future control moves, applies only the first move, then re-solves with fresh measurements. That receding horizon is what makes it robust to model error.
subject to x(k+1) = f(x(k),u(k),d(k)), umin ≤ u ≤ umax, ymin ≤ y ≤ ymax
Hp = prediction horizon, Hc = control horizon, Q = tracking weight, R = move-suppression weight, S = economic weight on the input (energy or chemical cost), d = measured disturbance.
Three features earn their place on a treatment plant. Constraints are handled explicitly, so the controller can be told that effluent ammonia must not exceed 2 mg/L and will treat it as a boundary rather than a target. Measured disturbances enter as feedforward, so an influent ammonia measurement acts before the effect appears. And the economic term lets the objective be stated honestly: minimise energy subject to compliance, rather than hold a DO setpoint that was chosen years ago.
Horizon selection is the main tuning decision: Hp should span the dominant dynamics plus the dead time — for aeration typically 2–6 hours — while Hc is much shorter, often 3–5 moves, to keep the optimisation tractable and the action smooth.
State estimation and soft sensors
MPC needs the current state, and treatment plants measure only a fraction of it. The gap is closed by estimation.
Update: K = P−HT(HP−HT + R)−1, x̂ = x̂− + K(z − h(x̂−))
The Kalman gain K weights model prediction against measurement according to their relative covariances Q and R. For the non-linear ASM equations an extended or unscented variant is used.
The same machinery produces soft sensors — estimates of variables that are expensive, slow or impossible to measure online:
- Influent load from flow, conductivity, UV absorbance and diurnal pattern, avoiding the cost and maintenance of an online COD analyser.
- Sludge blanket behaviour and settleability inferred from clarifier level and turbidity trends.
- Oxygen uptake rate derived from DO dynamics and air flow — one of the most useful process health indicators available, and it needs no additional instrument.
- Alpha factor tracked over time by comparing delivered air with computed oxygen demand, giving early warning of diffuser fouling.
Soft sensors have a specific failure mode that must be designed for: they are only valid within the regime in which they were fitted. A soft sensor calibrated on normal operation will report confidently and wrongly during an upset — exactly when it is needed most. Always pair one with a validity check and a graceful degradation to a fixed-value fallback.
Worked example: ammonia-based aeration control
Take a 100,000 PE works with total electrical consumption of about 25 kWh/PE·yr, so 2,500 MWh/yr, of which aeration is 55% = 1,375 MWh/yr. It currently runs a fixed DO setpoint of 2.0 mg/L around the clock.
- The waste. Ammonia load follows a strong diurnal pattern — typically a factor of two to three between the small-hours minimum and the late-morning peak. A fixed DO setpoint sized for the peak is therefore substantially over-aerating for most of the day, and over-aeration achieves nothing once effluent ammonia is already below consent.
- The control change. Cascade the DO setpoint from a measured effluent ammonia controller with feedforward from influent load, constrained to a floor of about 0.8 mg/L to protect nitrification and floc structure, and an effluent ammonia constraint set with margin below consent.
- The physics of the saving. Blower power scales with the air flow needed to meet AOTR, and AOTR falls as the DO setpoint rises: AOTR ∝ (βC∞ − CL). Dropping the average operating DO from 2.0 to 1.3 mg/L raises the driving force by roughly 8–10% at typical saturation values, and reducing the air delivered during the overnight trough adds considerably more.
- Result. A 20% aeration saving — conservative against the 15–30% range widely reported — is 275 MWh/yr. At 20 p/kWh that is £55,000/yr; at a grid factor of 0.20 kg CO2e/kWh, 55 tCO2e/yr.
- The second prize. Effluent ammonia variance typically falls, because the controller acts on load rather than on a fixed setpoint. Better compliance and lower energy is an unusual combination, and it is the reason this is the most reliably justified control project in the sector.
The underlying transfer physics is set out in our aeration and oxygen transfer guide.
Machine learning surrogates: where they help and where they fail
Data-driven models — neural networks, gradient boosting, Gaussian processes — can approximate a plant relationship without mechanistic structure. They are fast, which matters inside an optimisation loop, and they can capture effects no mechanistic model contains.
They also have failure modes that are specific and predictable:
- No extrapolation. A model trained on two years of normal operation has never seen a storm plus a toxic shock plus a blower failure. Its output in that region is unconstrained by physics and can be arbitrarily wrong while appearing confident.
- Correlation is not causation. A model may learn that high effluent ammonia coincides with high air flow — because the operators respond to ammonia by increasing air — and then recommend reducing air to reduce ammonia.
- Silent drift. Sensors foul and plants change. Performance degrades gradually with no error message unless drift detection is built in.
- Opacity under scrutiny. A regulator asking why the plant did what it did is entitled to an answer that references process reasoning.
Architecture, data quality and security
A deployed twin is an operational technology system, and it inherits the obligations of one.
- Data layer. Historian data at appropriate resolution, with quality flags. Most projects lose their first months to data cleaning: unflagged sensor faults, frozen values, unit inconsistencies, unrecorded manual interventions and clock drift between systems.
- Validation layer. Automatic reconciliation — flow balances, mass balances, redundant measurement cross-checks — before any datum reaches the model. A twin fed bad data produces bad decisions faster than a human would.
- Control layer. The optimiser writes setpoints, not outputs, to the PLC. Base regulatory control, interlocks and trips remain in the PLC and must remain capable of running the plant safely with the twin offline.
- Security. Water is critical national infrastructure and falls within the UK NIS Regulations. Any path from an external network into a control system is a regulated risk: one-way data diodes, segmented networks, no direct internet exposure of OT, and controlled change management.
- Human layer. Operators must be able to see why the controller is doing what it is doing, and to take manual control without a fight. A technically excellent controller that gets switched off delivers nothing.
The same predictive control ideas applied at network scale to reduce spills are discussed in our article on storm overflow spill reduction.
Where the value genuinely is — and where it is not
| Application | Typical benefit | Confidence |
|---|---|---|
| Aeration control (DO or ammonia based) | 15–30% aeration energy; lower effluent variance | High — widely demonstrated |
| Chemical dose optimisation (coagulant, polymer, carbon source) | 10–25% chemical use | High where feed quality is measured online |
| Pumping and network control | Energy shifted to cheap tariff periods; spill reduction | High — largely a scheduling problem |
| Early warning of process failure | Avoided consent breaches | Moderate — depends on instrument reliability |
| Predicting effluent quality days ahead | Often quoted, rarely actionable | Low — influent uncertainty dominates |
| Fully autonomous operation | Marketed; not credible on current instrumentation | Very low |
The pattern is consistent: value accrues where a fast, well-measured, frequently-repeated decision is currently made by a fixed rule. It evaporates where the limiting uncertainty is in the influent or in an unmeasured variable, because no model can predict what no instrument observes.
The cheapest credible entry point is almost always a shadow on the aeration system: instrument it properly, estimate the load, quantify the achievable saving against real data, and only then close the loop. Sites considering that step can discuss instrumentation and control strategy with an engineer.
Frequently asked questions
What is a digital twin in water treatment?
A process model kept synchronised with live plant data and connected back to the control system so it can change what the plant does. A model with no live data is a digital model, and a one-way live model used for monitoring is a digital shadow; both are useful, and most delivered projects are shadows.
How much energy can model predictive control save on aeration?
Typically 15 to 30 per cent of aeration energy, which is itself around half of a wastewater works electricity bill. On a 100,000 population equivalent works a 20 per cent saving is roughly 275 MWh and 55 tonnes of carbon dioxide equivalent a year.
Why not simply use PID control?
Because these processes have long dead times, strong non-linearity, hard constraints and heavy coupling between loops. PID acts only after an error appears and has no representation of a constraint, so it cannot exploit a measured disturbance or trade energy against a compliance boundary.
Are machine learning models safe to use for control?
Only within the operating region they were trained on, and only with physical limits enforced outside the learned model. Their characteristic failure is confident extrapolation during upsets, which is precisely when the plant most needs correct decisions, so hybrid mechanistic and data-driven structures are preferred.
What is a soft sensor?
An estimate of an unmeasured variable derived from a model plus available measurements, such as influent load inferred from flow, conductivity and UV absorbance. It saves instrument cost and maintenance but is valid only in the regime in which it was calibrated, so it needs a validity check and a safe fallback.
What usually stops these projects delivering?
Data quality and operator confidence. Unflagged sensor faults, frozen values and unit errors consume the early project, and a controller that operators do not understand or cannot easily override gets switched to manual, at which point the benefit is zero regardless of the mathematics.
Sources & further reading
- Olsson, G. et al., Instrumentation, Control and Automation in Wastewater Systems (IWA Publishing)
- Rawlings, J., Mayne, D. and Diehl, M., Model Predictive Control: Theory, Computation and Design
- Rieger, L. et al., Guidelines for Using Activated Sludge Models, IWA STR No. 22
- UK NCSC — guidance for operational technology and the NIS Regulations