Residual Chlorine PI Control: Constraint-Aware Tuning in EPANET

Short answer: A 2026 PLOS ONE simulation study gave each monitored node of a 24-junction EPANET drinking water network its own PI controller, tuned with the SIMC rules from a node-specific ARX model that was identified on one experiment and validated on a separate one. [1] With the chlorine command limited to 0.3 to 1.8 mg/L, a one-sample actuation delay and conditional-integration anti-windup, the PI-SIMC design stayed finite, nondivergent and unsaturated at all 22 nodes when it was returned to EPANET without retuning, with median IAE of 0.203 mg·h/L and a median 98.4% of time within ±0.05 mg/L of the setpoint. [1] Setpoint weighting cut nominal overshoot from 5.89% to 1.43%, and a Smith predictor lowered error at 15 of 22 nodes but raised it at seven. [1] All of the evidence is from simulation.
What the 2026 study did
Andersson Duarte Cárdenas, Carlos A. Martínez and Carlos Robles-Algarín (Universidad del Magdalena, Colombia) published "Constraint-aware PI control of residual chlorine in a drinking water distribution network: Data-driven modeling, robustness analysis, and direct EPANET validation" in PLOS ONE, volume 21, issue 11, article e0359379, on 23 November 2026. [1] The authors state that the contribution is the integration and validation workflow, not a new PI structure. [1]
- Network. A 24-junction EPANET model derived from the Concepción 3 sector of Santa Marta, Colombia, with 28 pipes, a reservoir and a pump. Node P23 is the chlorine injection point and P1 to P22 are the controlled outputs, giving 22 single-input single-output paths. Bulk and wall decay used fixed first-order coefficients (Kb = -0.878 per day, Kw = -0.37 m per day). [1]
- Experiments. Two independent multilevel EPANET runs at 60 s sampling after a 48 h warm-up: 7 days (10,080 samples, 6 levels from 0.3 to 1.8 mg/L, dwell times of 1 to 4 h) for identification and 5 days (7,200 samples, 7 levels, dwell times of 1.5 to 5 h) for external validation. [1]
- Models. For each node, 1,080 ARX structures were screened on identification data only. The most parsimonious structure within 1% of the best free-run RMSE was refitted and frozen before external validation. [1]
- Controllers. PI-SIMC was tuned from each model's steady-state gain, dominant time constant and total delay. Three benchmarks kept the PI core: PI2-SIMC (setpoint weighting), Smith-PI2 (a Smith predictor plus a tuning change) and Smith-PI2-matched (the Smith predictor only, with PI2-SIMC tuning). [1]
- Constraints. Every configuration limited the commanded P23 concentration to 0.3 to 1.8 mg/L, included a one-sample command to actuator delay and used conditional-integration anti-windup. [1]
- Test case. A 30 h run with a setpoint step from 0.6 to 0.8 mg/L at hour 4 and a -0.05 mg/L output disturbance from hour 16 to hour 18. The authors note these values are a computational test, not a regulatory target. [1]
- Robustness. 200 paired scenarios per node and controller, each combining a plant gain multiplier from 0.85 to 1.15, a delay offset within ±20%, actuator bias up to ±0.03 mg/L, measurement noise with a standard deviation of 0.005 mg/L and a random block of the models' external-validation residuals: 13,200 primary runs plus 4,400 matched-tuning runs. [1]
- Direct EPANET validation. The frozen controllers were connected back to EPANET 2.2 without retuning: PI-SIMC at all 22 nodes and the other three designs at six representative nodes. PI-SIMC was then rerun with bulk and wall decay changed by ±20% and all demands by ±10%, one factor at a time. [1]
The data, code, frozen models, controller parameters and figure scripts are published on Zenodo (DOI 10.5281/zenodo.22132264). [1]
Reported results
| Test | Reported result |
|---|---|
| Identified models | 22 of 22 stable with positive gain; gains 0.660 to 0.987; delays 1 to 95 min; median external fit 88.18% (range 60.23 to 95.33%); median external RMSE 0.0541 mg/L [1] |
| PI-SIMC tunings | Proportional gains 0.215 to 0.955; integral times 0.01 to 1.08 h [1] |
| Monte Carlo, PI-SIMC | All runs finite; median IAE 0.682 mg·h/L, RMSE 0.060 mg/L, 85.4% of time within ±0.05 mg/L, zero median saturation at every node [1] |
| Setpoint weighting (PI2-SIMC) | Nominal overshoot 5.89% down to 1.43% for a median IAE cost of about 1.6% [1] |
| Smith predictor with matched tuning | Lower median IAE at 15 of 22 nodes, higher at 7 [1] |
| Original Smith-PI2 | About 2.6 times the control variation of PI-SIMC; oscillatory direct EPANET responses at P12 and P6 [1] |
| Direct EPANET, PI-SIMC at 22 nodes | All finite, nondivergent and unsaturated; median IAE 0.203 mg·h/L, RMSE 0.0208 mg/L, 98.4% within band; weakest node P1 (IAE 1.445 mg·h/L, 60.7% within band), then P17 (76.6%) [1] |
| Physical sensitivity, 132 cases | All finite and unsaturated; largest node IAE change 3.7% to 8.9% for decay changes and 11.3% to 16.6% for demand changes [1] |
IAE is the integral of absolute error. The authors caution that the direct EPANET and Monte Carlo figures are not directly comparable, because the direct test is deterministic and leaves out the gain, delay, bias, noise and residual disturbances used in the stress study. [1]
What this means for tuning your own loop
The study is about chlorine, but the workflow carries over to any loop with transport delay and an actuator limit. Points worth copying:
- Tune each path, not the network. Delays from 1 to 95 min in one small network mean a single gain set does not fit every node.
- Freeze the model before you validate it. Selecting the model on identification data only, then judging it on a separate run, keeps the validation honest.
- Put the limits in the tuning simulation. Actuator range, actuation delay and anti-windup belong in the loop you tune, not in a check added afterward. For more on delay and windup, see PID tuning with transport delay.
- Change one thing at a time. The matched Smith ablation showed that much of the original Smith design's extra control activity came from its retuning, not from the predictor.
- Report the worst node, not only the median. P1 and P17, the two lowest-fit models, also had the weakest direct EPANET tracking.
When different operating points need different gains, see PID gain scheduling and multi-loop verification. If a loop already oscillates, start with troubleshooting PID oscillations.
Limits
- All results are from simulation; there is no pilot or field test. [1]
- Each SISO loop regulates one node from P23 and cannot guarantee residual targets at other nodes at the same time. The authors present it as a baseline, not a replacement for multivariable control. [1]
- The uncertainty ranges are stress-test bounds, not distributions estimated from field data, so the reported fractions are not real-world failure probabilities. [1]
- A qualified engineer still has to review any controller before it runs on a real network.
Key takeaways
- One SIMC PI loop per node, tuned on a frozen ARX model with explicit limits and anti-windup, stayed finite and unsaturated at all 22 nodes in direct EPANET tests. [1]
- Setpoint weighting traded a 1.6% median IAE cost for much lower overshoot. [1]
- Smith prediction helped at most nodes but not all, so test it node by node. [1]
- The workflow, data and code are public, which makes the result reproducible. [1]
Frequently asked questions
What did the residual chlorine PI control study find?
In a simulated 24-junction EPANET network, a SIMC-tuned PI controller for each of 22 nodes, with a 0.3 to 1.8 mg/L dosing limit, a one-sample actuation delay and anti-windup, stayed finite and unsaturated at every node when returned to EPANET without retuning, with median IAE of 0.203 mg·h/L and 98.4% median time within ±0.05 mg/L. [1]
How did the study handle integral windup and constraints?
All controller configurations limited the commanded chlorine concentration at the injection node to 0.3 to 1.8 mg/L, included a one-sample command to actuator delay and used conditional-integration anti-windup. [1]
Does a Smith predictor help residual chlorine control?
Sometimes. With tuning held identical, adding a Smith predictor lowered median IAE at 15 of 22 nodes and raised it at seven, so the authors support using it only after node-specific validation. [1]
Has this controller been tested on a real network?
No. The study is simulation only. The authors name joint multi-output control under varying demand and reaction parameters, then a pilot or field study, as the next steps. [1]
Sources
- Duarte Cárdenas, A., Martínez, C. A., and Robles-Algarín, C. "Constraint-aware PI control of residual chlorine in a drinking water distribution network: Data-driven modeling, robustness analysis, and direct EPANET validation." PLOS ONE 21, no. 11 (2026): e0359379. https://doi.org/10.1371/journal.pone.0359379
If you have a model or IO data for one of your own loops, LabCD's guided workflow lets you tune and test a controller on your first model for free, with a qualified engineer approving every controller.
Want to try this on your own plant model?
Try LabCD free with your first model