Catalog / Optimisation & Planning / OPT-024

Water & wastewater treatment optimisation (aeration, dosing, pump scheduling)

Use ML, model-predictive and reinforcement-learning control to cut energy and chemicals in wastewater plants and to schedule drinking-water pumps against energy prices while meeting effluent and supply limits.

Parts needed to run it yourselfOptimizationPrediction & time seriesVision

Wastewater plants are among the largest electricity consumers of a municipality, and aeration of the biological stage is typically the biggest single share. Drinking-water systems spend heavily on pumping. ML-based soft sensors, model-predictive control (MPC) and increasingly reinforcement learning (RL) adjust aeration, chemical dosing and pump schedules continuously, saving energy and chemicals while keeping effluent within permit limits and supply security intact.

Problem & value

  • Today: most plants run fixed dissolved-oxygen (DO) setpoints with PID loops, rule-of-thumb chemical dosing and fixed pump schedules. Operators over-aerate and over-dose for safety margin because load (rain events, industrial discharges, seasons) fluctuates and lab values arrive late.
  • AI value: forecast influent load, estimate hard-to-measure quantities (soft sensors for ammonium, nitrate, sludge state), and compute setpoints that trade off energy, chemicals and compliance. For water supply, schedule pumps and fill reservoirs in low-tariff windows.
  • Evidence: an NBER study of 164 French wastewater plants reports that digital process control improves performance (see sources [4]); the Xylem/EWE project at the Cuxhaven plant reports aeration-energy savings of over 26% (about 1.1 million kWh per year) with AI-based real-time control (vendor-reported; Xylem's English article states 30%) [5]. Vendor case figures are plant-specific and not guaranteed; baseline against your own plant.
  • Regulatory pull: the recast Urban Waste Water Treatment Directive (EU) 2024/3019 tightens nutrient and micropollutant requirements and sets an energy-neutrality target for the sector, which makes energy optimisation and monitoring a compliance topic, not only a cost topic [1].

Variants

  • Municipal wastewater (activated sludge): aeration/DO and ammonium-based control, nitrate recirculation, carbon source and phosphate precipitant dosing, sludge age.
  • Industrial wastewater: food, paper, chemicals; highly variable loads, higher value of load forecasting and pre-treatment control.
  • Drinking-water treatment: coagulant dosing from turbidity and raw-water quality, filter backwash timing, chlorination.
  • Distribution pumping and reservoirs: pump scheduling against day-ahead tariffs and demand forecasts; pressure management (leak detection itself: ANOM-013).
  • Sludge treatment: digester feeding and biogas/CHP use (couples to OPT-023, OPT-011).
  • Small plants / SMB operators: packaged cloud advisory without full MPC.
  • Private use: none relevant.

How it works

  1. sensors + SCADA historian + weather/price feeds
  2. data cleaning, sensor validation (drift, fouling, outliers)
  3. soft sensors & forecasts (influent load, NH4/NO3, effluent quality, demand)
  4. digital twin / process model (ASM-type biokinetics or hybrid ML)
  5. optimiser: MPC / RL / rule-hybrid (energy + chemicals + compliance penalty)
  6. safety layer: hard limits, rate limits, fallback to PID
  7. setpoints to SCADA/PLC (advisory or closed loop)
  8. operator dashboard, alarms, reporting
  • Soft sensors and forecasting: gradient boosting, LSTM/temporal models or time-series foundation models predict load and quality variables 1–48 h ahead.
  • Control: MPC on a calibrated process model remains the safest industrial choice. RL is trained in a simulator (e.g. benchmark simulation models BSM1/BSM2 or a plant-specific twin) and deployed with constraint layers; model-free RL directly on a live plant is rarely accepted.
  • Pump scheduling: mixed-integer optimisation over a reduced hydraulic model with demand forecast and tariff curve; ML surrogate models speed up hydraulic simulation (e.g. EPANET-based).
  • Human-in-the-loop: start in advisory mode; operators approve setpoint changes, can switch to manual, and a deterministic fallback keeps permit limits independent of the AI layer.

Data preparation

Needed: process data (flow, ammonium, nitrate, oxygen, energy) from SCADA and the historian, laboratory results (LIMS or Excel), weather and rainfall data, plant layout and permits, and maintenance logs. They sit in SCADA/historians, laboratory systems, Excel and paper operating logs.

Typical gaps: sensor drift and fouling, missing calibration records, different time resolution of online and lab data, handwritten operator logs, and data silos between operations and laboratory.

Preparation steps: (1) inventory and owners (PREP-001, PREP-004); (2) export historian and lab data into one table with consistent time stamps (PREP-005, PREP-011); (3) scan and digitise paper logs, ideally replace them by digital capture at source (PREP-006, PREP-008); (4) flag faulty sensor periods together with operators and label events such as storms (PREP-020, PREP-018); (5) define KPI and permit-limit definitions (PREP-012). Tools: pandas, a time-series database, simple data-quality dashboards.

Rough share of effort: 40-50 % of the project; sensor quality is usually the bottleneck. See GUIDE-003.

Implementation paths

Which path for whom

  • public: Path C, because municipal water and wastewater utilities run critical infrastructure with SCADA in isolated networks, so data should stay on-premises and open-source tools on HW1 (open solvers, small models) are enough for many plants; the same platform can serve several plants.
  • enterprise: Path B, because larger utilities and industrial operators integrate process data into an own data platform and use cloud APIs for forecasting, with vendor modules (Path A) for single functions such as aeration control.
  • developer: Path C, because open process-modelling and optimisation tools (e.g. Python, OR-Tools, open ASM models) allow full control and easy validation.

Path A — Buy (off-the-shelf)

  • Plant-control and optimisation vendors: Xylem (Sensus, Evoqua; Cuxhaven AI aeration project), Veolia (Kruger, Hubgrade; EU), Grundfos (pump intelligence, DK, EU), Siemens (Water process automation), ABB Ability, Emerson, Schneider Electric (EcoStruxure).
  • Specialists: Aquasuite / Aqua Computing (NL, EU), Aquatic Informatics (now Xylem), Optimatics (hydraulic optimisation) Verify current product names and EU data-hosting before selecting.
  • Choose A when: utility has limited data-science staff and a SCADA vendor already in place; require performance guarantees or shared-savings contracts and open interfaces (OPC UA).

Path B — Build on cloud APIs

  • Cloud ML and time-series: Azure Machine Learning / Fabric, AWS SageMaker, Google Vertex AI in EU regions; managed time-series stores (Azure Data Explorer, AWS Timestream).
  • Solvers: Gurobi, CPLEX, OR-Tools, HiGHS for pump scheduling; Pyomo/CasADi for MPC.
  • Connectivity: OPC UA / MQTT gateway from SCADA to an EU-region cloud, one-way where possible; control commands only via a vetted, firewalled gateway.
  • LLMs: optional for operator copilots (shift-log summaries, alarm explanation, report drafting); never in the closed control loop.
  • Choose B when: you have a data team and need custom logic across several plants.

Path C — Self-host (open source)

  • Modelling and simulation: WEST-class commercial tools aside, open options include BSM1/BSM2 benchmark simulation models, Python packages such as QSDsan, EPANET / WNTR for networks, and Pyomo, CasADi, do-mpc, OR-Tools, HiGHS for optimisation.
  • RL: Stable-Baselines3, Ray RLlib, Gymnasium environments wrapping the simulator.
  • Time series: scikit-learn, LightGBM, Darts, PyTorch; open time-series foundation models such as Chronos or TimesFM for load forecasts.
  • Stack: Node-RED / Apache StreamPipes, InfluxDB or TimescaleDB, Grafana, edge gateway.
  • Hardware: HW1 (industrial PC or CPU server) is enough; no LLM needed for the control path. Critical infrastructure favours on-premise deployment.

Path D — Custom training

Worth it when a plant or group of plants has years of historian data and a calibrated twin: train plant-specific soft sensors and RL/MPC policies, validated in the simulator and shadow mode. Needs 1–3 years of 1–15-minute sensor data with lab reference values and event labels (storms, maintenance).

State of the art (2026)

  • MPC and hybrid (mechanistic + ML) twins are the production workhorses; RL moves from papers on BSM benchmarks to pilots with safety shields, typically for aeration.
  • Foundation models for time series reduce the data needed for load and demand forecasts.
  • Digital twins combine process models with ML surrogates for faster what-if analysis.
  • Limits and failure modes: sensor fouling and drift (DO, ammonium probes) silently corrupt control; biology reacts slowly and non-linearly, so a bad setpoint can cause a permit exceedance hours later; rare events (storms, toxic shocks) are poorly represented in history; policies trained in a simulator transfer imperfectly; benchmark gains rarely equal field gains. Savings depend strongly on the baseline (well-tuned plants save less).

Shared resources & combinations

  • Same stack (time-series + optimization-solver + simulation): OPT-009 (manufacturing process parameters), OPT-038 (closed-loop plant control), OPT-007 (building energy), OPT-023 (district heating).
  • Energy coupling: OPT-011 (battery dispatch) and OPT-039 (power trading) for load shifting; biogas/CHP with OPT-023.
  • Adjacent: ANOM-013 (leak detection), PRED-033 (network failure prediction), PRED-007 (energy/load forecasting), HLTH-031 (wastewater surveillance data from the same plants).

Effort, cost & KPIs

  • Path A: 3–9 months including sensor upgrades and commissioning; subscription or shared-savings pricing.
  • Path B/C: 6–18 months for a first plant (twin calibration, shadow mode, safety case); later plants cheaper if the platform is reused.
  • Cost drivers: sensor quality and maintenance, SCADA integration, simulator calibration, operator training, cybersecurity.
  • KPIs: kWh per population equivalent (aeration share), chemical use per m3, effluent compliance rate and exceedances, time in advisory vs. closed loop, blower runtime, pumping cost per m3 (EUR), peak-load share, nitrous-oxide emissions.

People & change

Involve management and the plant manager first; operators and the laboratory staff are daily users and know sensor quirks, so bring them in from the data-preparation step. IT and the information-security officer are essential because plant control is critical infrastructure (GUIDE-013); data owners (SCADA, laboratory) and legal/compliance (discharge permits, KRITIS duties) join for the pilot design.

Works council: usually no, as the system works with process data. The works council or Personalrat should still be informed in good time under §90(1) no. 3 BetrVG as operators' work processes change, and §87(1) no. 6 applies if control actions are logged and evaluated per person. See GUIDE-004. Almost no personal data, so a DPIA is rarely needed; the DPO confirms (GUIDE-005).

AI literacy: train operators on model limits, drift and plausibility checks (GUIDE-006; AI Act Art. 4 requires measures supporting staff literacy). Start in advisory mode on one treatment line or plant as pilot group, compare recommendations with actual operation and expand only after a go/no-go (GUIDE-009). Typical concerns: permit violations, loss of operator know-how, and trust in the model. Address them with hard limits and alarms in the control system, operator approval of setpoint changes, and communicating that the tool supports, not replaces, operators (GUIDE-008).

Risks, regulation & compliance

  • EU AI Act: depends. AI safety components in the management and operation of critical digital infrastructure and of water, gas, heating and electricity supply are high-risk under Annex III (point 2). Systems that directly steer drinking-water supply as a safety component should be treated as high-risk; pure efficiency optimisation of wastewater aeration with a deterministic safety layer is more likely outside it, but classify case by case. No Art. 5 prohibited practice is involved.
  • NIS2 and CER: water operators are essential entities under NIS2 (Directive (EU) 2022/2555) and the CER Directive; require OT security, incident reporting and supply-chain controls [3].
  • Water law: Urban Waste Water Treatment Directive (recast) [1], national permit limits, Drinking Water Directive (EU) 2020/2184 for supply quality.
  • GDPR: process data is not personal; billing and smart-meter data in demand forecasting is, so aggregate or pseudonymise.
  • Operational risks: permit exceedance, cyber attack on control path, model drift. Mitigations: advisory mode first, hard limits and fallback to PID, shadow testing, drift monitoring, sensor-health checks, documented operator override, change management.

Getting started

  1. Baseline: energy by process stage, aeration share, chemical use, permit headroom, sensor health.
  2. Fix instrumentation first (DO, NH4/NO3 probes, flow meters) and make historian data accessible.
  3. Build load and effluent forecasts and a soft sensor; run them in shadow mode.
  4. Pilot an advisory aeration or dosing optimiser in one line/basin with operator approval.
  5. Move to closed loop with safety layer; extend to pumping and energy-price optimisation.

Sources

  1. Directive (EU) 2024/3019 on urban wastewater treatment (recast) — https://eur-lex.europa.eu/eli/dir/2024/3019/oj
  2. Regulation (EU) 2024/1689 (AI Act), Annex III — https://eur-lex.europa.eu/eli/reg/2024/1689/oj
  3. Directive (EU) 2022/2555 (NIS2) — https://eur-lex.europa.eu/eli/dir/2022/2555/oj
  4. NBER working papers on digital technology and wastewater plant performance — https://www.nber.org/papers
  5. Xylem — AI-based aeration control, EWE Cuxhaven (case study) — https://prod.xylem.com/siteassets/support/case-studies/case-studies-pdf/cs_cuxhaven_aia_webde.pdf
  6. Directive (EU) 2020/2184 Drinking Water Directive — https://eur-lex.europa.eu/eli/dir/2020/2184/oj
  7. WNTR / EPANET water network tools — https://github.com/USEPA/WNTR
  8. Benchmark Simulation Models (IWA BSM) — https://www.iwa-mia.org/benchmarking/