Advanced optimal dosing control based on multiple online sensor data is operational in several treatment facilities in Norway. The benefits of the dosing control system in maintaining stable phosphate/solids removal and saving coagulant usage are documented in the literature. The dosing algorithm is currently implemented in a programmable logic controller (PLC) connected to the treatment plant's Supervisory Control and Data Acquisition (SCADA) system. The PLC receives online sensor data from the plant's SCADA, calculates the optimal dosing values, and transmits optimal dosage values back to the SCADA system. The dosing algorithm is frequently updated to keep in sync with the process and equipment upgrades of the treatment plant and advances in control algorithm schemes. The upgrades include new regulatory feedback loops, structural changes to the dose equation, and the addition of conditional setpoints. Each maintenance and upgrade routine entails operational downtime where the dosing algorithm is set to a sub-optimal flow-proportional dose. This paper presents a non-intrusive Internet of Things (IoT) infrastructure to implement a predictive/forecast component to an existing dosing control algorithm. The benefits of the new cloud-based system in improving nutrient removal, increasing operational flexibility, and reducing maintenance downtime are presented in this work.

  • Hybrid predictive models forecast effluent quality up to 4 h in advance.

  • Control models developed in python can be deployed in real-time.

  • Integrating forecast models enhances dosing control algorithms.

Over 66% of wastewater treatment plants (WWTPs) in Norway employ chemical coagulation and flocculation, followed by sedimentation, as their primary treatment method (Berge & Onstad 2021). These processes necessitate a significant annual coagulant consumption of around 100,000 tons. Excessive use of coagulants and flocculants can increase operational costs without any discernible improvements in treatment efficiencies (Jiang 2015; Wang et al. 2021b). On the other hand, insufficient dosing of these chemicals can result in inadequate contaminant removal, potentially compromising the quality of the effluent and posing risk to public health (Sohrabi et al. 2018). Therefore, WWTPs often implement dosing control systems to ensure the optimal dosage of chemicals, which can reduce operating costs and minimize sludge production while simultaneously meeting the effluent discharge requirements set by the government (Ratnaweera & Fettig 2015). These measures align with the overarching global objective of achieving sustainable resource management and recovery.

Dosing control systems range from simple flow-proportional to complex multiparameter algorithms (Hahn et al. 2005). Conventional multiparameter dosing control systems employ real-time data from online physical sensors (such as pH, conductivity, ORP, suspended solids, and temperature) to calculate the optimal dosages (Huang & Liu 1996). Although the feed-forward dosing control model with a feedback correction described in (Liu & Ratnaweera 2016) has yielded satisfactory results, several inherent challenges encourage researchers and treatment plant operators to explore avenues for improvement.

A significant challenge arises from the high hydraulic retention time in the treatment process, leading to a delay of two to 5 h between inlet and outlet sensor readings. This high retention time entails that the feedback corrections calculated using the effluent water-quality sensors should be judiciously used in the dosing control algorithm. Grey-box dynamic models, previously employed to estimate effluent TP and COD values (Nair et al. 2020a), can be adapted to generate time-step ahead predictions and potentially offset the high process delay time. However, the complex forecast models developed using commonly used programming languages such as Python, Julia, MATLAB, must be transcribed to their respective PLC applications (using proprietary programming suites) for real-time deployment (Parrot & Venayagamoorthy 2008). This comprehensive process requires a substantial investment of man-hours for transcription, rigorous testing, and necessary modifications. Moreover, it comes with the added disadvantage of system downtime during the PLC application updates in the WWTP. Therefore, an alternative deployment architecture is necessary for a more convenient and faster deployment of forecast models in real-time.

Internet of Things (IoT) and cloud computing have gained widespread recognition and adoption in water and wastewater treatment industry (Torfs et al. 2022). Since the first appearance of the IoT in the early 2000s, internet-connected devices have seen exponential growth (Wang et al. 2021a). IoT systems can be combined with data analytics to deploy predictive algorithms for WWTP monitoring. A non-intrusive version of such infrastructure, used to deploy a soft sensor algorithm, was first tested on a pilot-scale (Nair et al. 2020b), followed by successful demonstrations in full-scale WWTP (Nair et al. 2022). A robust performance of the non-intrusive IoT infrastructure for algorithm deployment prompted us to explore the possibility of modifying the system to facilitate two-way communications with the PLC.

This work presents a non-intrusive IoT infrastructure that could be used to deploy complex forecast models to enhance the dosing control system. A full-scale WWTP located in Norway served as the testbed to evaluate this new IoT infrastructure and the supervisory add-on to the existing dosing control system. The changes in plant performance both in terms of the number of operational downtimes caused due to model updates and the improvement in treatment efficiencies due to the new forecast-based algorithm were assessed.

Treatment process and control system

The municipal WWTP located in the Norwegian town of Vestby was used as a test site to evaluate the new IoT infrastructure and the forecast model add-on to the control algorithm. The WWTP has a treatment capacity of 29,000 population equivalents (p.e.) and uses chemical coagulation as its primary method for eliminating phosphates as well as suspended and colloidal particles from municipal wastewater.

The treatment process starts with screen filters, where large particles are removed from raw sewage, entering the WWTP from the central pump station. The wastewater then proceeds to the sand traps, where heavier particles are separated and subsequently eliminated through sedimentation at the tank's base. Following the removal of mechanically separable larger particles, the wastewater advances to the chemical treatment stages. Within this stage, a pre-polymerised aluminium-based pre-polymerised coagulant is introduced into the wastewater, leading to the coagulation of suspended solids and soluble phosphate, resulting in the formation of larger flocs. In the final stage within the flocculation basin, an organic polymer is introduced to further enhance particle aggregation. Wastewater achieving sufficient floc development is then directed to six rectangular sedimentation tanks, providing an ample residence time for the flocs (sludge) to settle at the tank's bottom. Subsequently, the treated wastewater flows over weirs into the effluent channel, while the sludge is extracted from the bottom of the sedimentation tank. A detailed layout of the treatment plant, complete with flow directions and distribution, sensor locations, and dosing points, can be found in Nair et al. (2022).

The treatment plant is equipped with a real-time monitoring system that measures parameters such as flow rate, pH levels, Redox potential, conductivity, and suspended solids at various points along the treatment process. In addition to the online physical sensors, software sensors are also deployed to estimate total phosphorus (TP) and chemical oxygen demand (COD) levels in both the raw and treated wastewater channels (Nair et al. 2022). To optimize the dosage of coagulant and flocculant in wastewater, an Advanced Dosing Control (ADoC) system provided by DOSCON has been integrated into the WWTP's SCADA. Figure 1 illustrates a simplified process flow diagram of the WWTP, alongside the data-flow schematic linking WWTP's SCADA and ADoC, as well as the interactions between different sub-modules within ADoC.
Figure 1

Process flow diagram of WWTPs.

Figure 1

Process flow diagram of WWTPs.

Close modal

Real-time data communication between the plant's SCADA system and ADoC is a fundamental aspect of the operational framework. In this setup, the ADoC system receives sensor data in real-time from the WWTP̀s SCADA, and subsequently, optimal dosage values are relayed back to the SCADA which in turn steers the dosing pumps. The communication configuration, the model equations for dose calculations, feedback correctors, and fail-safe algorithms are programmed using the proprietary programming language offered by Beijer Electronics. To facilitate remote data management and accessibility, a dedicated data module is appended providing connectivity to the ADoC system. Online data, received by the ADoC, is logged in the remote database offered by DOSCON. This data can be accessed through the DOSMON monitoring suite, enhancing the overall monitoring and control capabilities of the system.

Forecast model and algorithm modification

The hybrid model with n-order removal kinetics, presented in (Nair et al. 2022), was used as a basis to develop the time-step ahead forecast. The model structure is presented in Equations (1) and (2).
formula
(1)
formula
(2)

In Equation (1), is the model predicted values of COD and TP at time instance and is the time frequency. V is the holdup volume of the treatment plant, is the inlet TP/COD concentrations, is the flow rate, and is the removal rate value at time instance t. The removal rate is calculated using a data-driven model where the pH in the flocculation basin ), coagulant dosage , and flocculant dosage ) are model inputs. The models were implemented in Python and were calibrated using real-time data from physical and soft sensors, deployed in the treatment plant. The batch calibration method discussed in Marsili-Libelli et al. (2001) was used to fit the treatment plant data to the model and obtain the model calibration parameters.

Proposed architecture

The proposed IoT architectural framework consists of two primary deployment layers: the physical Programmable Logic Controller (PLC) layer, which includes the existing dosing control algorithm modules, illustrated in Figure 1, and the supervisory cloud layer. Within the cloud layer, advanced machine learning models, defined by Equations (1) and (2) and implemented in Python, are deployed. The layout of this new IoT infrastructure, along with its various sub-modules within each layer, is presented in Figure 2.
Figure 2

Layers, sub-modules, and data-flow diagram of the proposed IoT architecture (new sub-modules are marked in grey while the older sub-modules are in white).

Figure 2

Layers, sub-modules, and data-flow diagram of the proposed IoT architecture (new sub-modules are marked in grey while the older sub-modules are in white).

Close modal

Within the PLC layer of the updated IoT infrastructure, a new gain-adjusting sub-module has been introduced. This addition complements the three existing data-processing modules from the previous system (as shown in Figure 1). The cloud layer encompasses three distinct sub-sections (Figure 2). The first sub-section hosts a database module equipped with a PostgreSQL server, operating as a real-time data repository. Following that, the second sub-section features a forecast module, scripted in Python. This Python script retrieves the latest data from the repository and generates predictions for effluent water-quality parameters at future time steps. The output of the forecast module is subsequently utilized in the third sub-module, which encompasses the optimizer. This optimizer determines optimal control moves of the coagulant and flocculant dosages for a future time horizon. These control moves are then transmitted to the PLC, which reconciles the cloud-base dose calculations with the values, calculated by the base algorithm in the PLC in the gain adjuster module.

To handle data requests, originating from the PLC, and route them to the remote database, the cloud infrastructure incorporates a data queuing service. Additionally, an extra communication layer has been integrated to the existing PLC application. This communication layer consists of a MQTT client service that can send data (publish) and receive real-time updates (subscribe) from the data server (with an MQTT broker) installed in the cloud infrastructure.

Evaluation criteria

The new architectural framework was implemented at the WWTP, and the results were monitored over a 3-month period. Two distinct evaluation criteria were used to assess the performance of the new IoT infrastructure and the forecast model-based control algorithm.

Number of effluent violations

The WWTP is subject to regulatory requirements, mandating a TP removal efficiency of over 90%. Typically, the operators maintain removal rates at approximately 92.5%, allowing for a safety margin of ±2.5%. To monitor the daily removal rate at the WWTP, a carousel sampler is installed at both the influent and effluent lines. Samples are automatically collected at regular intervals, and TP values are measured in the laboratory every day using the standard methods described in Standard Methods (2012), during the test period. The daily measurements of influent and effluent TP concentration serve as reliable performance indicators for our ADoC system. Optimal coagulant dosage results in a removal rate between 90 and 95%, while values below 90% or above 95% can indicate potential underdosing or overdosing scenarios.

Operational downtimes

DOSCON maintains comprehensive logs of both planned and unplanned maintenance interventions on the ADoC. Planned upgrades encompass a range of activities, including version updates, algorithm calibration, the introduction of new conditional loops, SCADA system overhauls, changes in sensor types, and sensor calibration. During the upgrade, the dosing control system switches over to sub-optimal flow-proportional control. The number of interventions and values of operational downtime are recorded in the company's operational management system. A thorough comparison of the number of interventions and the total hours of operational downtime both before and after the implementation of our new IoT-based infrastructure were conducted to quantify the change.

Performance of forecast model

The model presented in Equations (1) and (2) can be used to generate time-step ahead predictions for the values of COD and phosphorus in the effluent wastewater. The estimated values for four different time slots, t= 30 min, 1 h, 2 h, and 8 h were recorded and compared to the real values logged with the corresponding timestamp to assess the prediction accuracy. Figure 3 presents a comparison between effluent TP values and their corresponding time-step ahead predictions for the different time periods.
Figure 3

Time ahead forecast versus real values for t= 30 min, t= 1 h, t= 4 h, and t= 8 h.

Figure 3

Time ahead forecast versus real values for t= 30 min, t= 1 h, t= 4 h, and t= 8 h.

Close modal

The plots in Figure 3 show that the forecast accuracy shows a discernible decline as the forecast horizon increases. For t= 30 min, the model predicted versus actual values showed a correlation coefficient of R2 = 0.98, which subsequently dropped to 0.95 and 0.921 for a forecast horizon of 1 and 4 h, respectively. The prediction accuracy drops drastically to about 0.67 for a time horizon of 8 h. Because the total residence time for the entire treatment line varies between 2 and 4 h, it would be safe to use the time-step ahead forecast values in the optimal dose calculations without compromising on the optimal dose calculation.

Process improvements after forecast algorithm deployment

The new dosing algorithm was deployed on 28.02.2023, and its performance was monitored for a 3-month period. Figure 4 illustrates the TP removal percentage over a span of 6 months. This period includes the first 3 months (from 04.12.2023 to 28.02.2023) before the new system's introduction. It is followed by the subsequent 3 months (from 28.02.2023 to 31.06.2023), during which feedback corrections from the forecast model were incorporated into the dosing algorithm.
Figure 4

TP removal during the evaluation period.

Figure 4

TP removal during the evaluation period.

Close modal

The plots in Figure 4 and the quantitative comparisons in Table 1 demonstrate that the TP removal values for the new dosing control algorithm are closer to the ideal (set-point) removal rate of 92.5%, showing a mean absolute error (MAE) of 1.03. In contrast, the algorithm without the forecast model exhibited an MAE value of 3.57. Moreover, the new algorithm not only exhibits lower deviation from the ideal removal value but also demonstrates fewer limit violations. While the previous algorithm crossed the upper and lower limits of 90 and 95% on five different occasions over the initial three-month period, the new algorithm showed no limit violations during the assessment period. This performance improvement can be attributed to the proactive component of the dosing control algorithm, which rapidly adjusts its optimal dose values as the forecasted TP removal values approach the predefined limits.

Table 1

Performance indicators for old versus new dosing control algorithms

Performance indicatorsBefore forecast correctorAfter forecast corrector
Average TP removal (%) 93.7 92.5 
Mean absolute error 3.57 1.03 
No. limit violation 
Performance indicatorsBefore forecast correctorAfter forecast corrector
Average TP removal (%) 93.7 92.5 
Mean absolute error 3.57 1.03 
No. limit violation 

It is also important to highlight that the TP removal rate shown in Figure 4 and the quantitative parameters presented in Table 1 pertain to days with dry weather conditions, where the total inflow is less than 9,000 m3/day. This correction is made to account for the challenges posed by rainy weather, which can lead to sewer overflows and extremely low TP concentrations in the raw wastewater, making it difficult to maintain a TP removal rate above 90% even if the dosing pumps are operating at maximum capacity. Therefore, in scenarios of extremely high flow where the inflow is greater than 9,000 m3/day, optimizing the dose alone may not be sufficient to meet the treatment requirements. To avoid any impact caused by the plant's process capacity limitations, we have excluded these high flow conditions from our dosing control comparison. Furthermore, conducting a quantitative comparison under similar operating conditions provides a reasonable basis for comparing the performance of two different control algorithms.

Reduction in operational downtime

The number of manual interventions and the corresponding operational downtime time (denoted as the hours where the dosing control system was switched to the sub-optimal flow-proportional algorithm) is presented in Figure 5.
Figure 5

Number of interventions and the recorded operational downtime during the evaluation period.

Figure 5

Number of interventions and the recorded operational downtime during the evaluation period.

Close modal

Figure 5 shows that manual interventions have increased after deploying the new IoT infrastructure. These interventions are due to activities such as changes in model types, adding new predictors to the forecast algorithms, tuning the weights of the optimizer, and adjusting the reconciliation factors in the PLC. These actions were conducted during the initial days of the algorithm deployment to fine-tune the system and obtain the ideal parameters pertaining to the forecast algorithm and the optimizer. It could also be observed that despite the increase in the number of manual interventions, there has been no increase in operational downtime. This is primarily because most of the modifications were conducted in the cloud layer, during which the core algorithm running in the PLC was unaltered, resulting in no operational downtime during code modification. This new approach allowed us to alter the supervisory dosing control algorithm on the go without pausing the existing algorithm already deployed in the PLC. This dual-layered approach also incorporates an additional layer of security, preventing a complete failure of the ADoC during possible internet outages. In such situations, even if the PLC's gain-adjusting module does not receive the signal from the MQTT broker, the PLC reverts itself to the base algorithm rather than completely shutting down the ADoC.

The hybrid forecast models presented in this work demonstrate a capacity to predict effluent water-quality parameters with a reasonable level of accuracy. Consequently, these forecasted effluent TP values, for a time horizon of up to 4 h, can be used as a predictive component in the dosing control algorithm. The forecast models that provide time-step ahead TP values and the supervisory dosing algorithms that provide optical control moves can be implemented in the dual-layered IoT infrastructure presented in this study. The novel forecast-based dosing control algorithm yields significant performance improvements compared to its predecessor. It excels in maintaining TP removal close to the desired set-point value while simultaneously reducing the number of limit violations. Furthermore, adopting a dual-layered IoT strategy introduces sufficient levels of flexibility to adapt the control algorithm without incurring operational downtime. This new system also takes into account practical considerations, such as potential internet connectivity loss. The ADoC seamlessly reverts to the base control in such cases, ensuring robust and uninterrupted system performance.

The authors wish to acknowledge the encouraging discussions and logistical assistance from Geir Simensen and Rune Larsen at the Sondre Follo WWTP, Vestby, Norway.

All relevant data are included in the paper or its Supplementary Information.

The authors declare there is no conflict.

Berge
G.
&
Onstad
M. E.
2021
Kommunale Avløp 2021 (Municipal Sewage 2021)
.
Report From Statistisk Sentralbyrå (SSB, 2021), ISSN 1892-7513
.
Hahn
H.
,
Hoffman
E.
&
Odegaard
H.
2005
Chemical Water and Wastewater Treatment VIII
.
IWA Publishing
,
London, United Kingdom
.
Jiang
J. Q.
2015
The role of coagulation in water treatment. Nanotechnology
.
Separation Engineering
8
,
36
44
.
Marsili-Libelli
S.
,
Ratini
P.
,
Spagni
A.
&
Bortone
G.
2001
Implementation, study and calibration of a modified ASM2d for the simulation of SBR processes
.
Water Science and Technology
43
(
3
),
69
76
.
Nair
A. M.
,
Gonzalez-Silva
B. M.
,
Haugen
F. A.
,
Ratnaweera
H.
&
Østerhus
S. W.
2020a
Real-time monitoring of enhanced biological phosphorus removal in a multistage EBPR-MBBR using a soft-sensor for phosphates
.
Journal of Water Process Engineering
37
,
101494
.
Parrot
C.
&
Venayagamoorthy
G. K.
2008
Real-time implementation of intelligent modeling and control techniques on a PLC platform
. In:
2008 IEEE Industry Applications Society Annual Meeting.
Edmonton, AB, Canada, IEEE
, pp.
1
7
.
doi: 10.1109/08IAS.2008.164
.
Standard Methods for the Examination of Water and Wastewater
2012
23rd edn,
American Public Health Association/American Water Works Association/Water Environment Federation
,
Washington DC, USA
.
Sohrabi
Y.
,
Rahimi
S.
,
Nafez
A.
,
Mirzaei
N.
,
Bagheri
A.
,
Ghadiri
K.
,
Rezaei
S.
&
Charganeh
S. S.
2018
Chemical coagulation efficiency in removal of water turbidity
.
International Journal of Pharmaceutical Research
10
,
188
194
.
Torfs
E.
,
Nicolaï
N.
,
Daneshgar
S.
,
Copp
J. B.
,
Haimi
H.
,
Ikumi
D.
,
Johnson
B.
,
Plosz
B. B.
,
Snowling
S.
,
Townley
L. R.
,
Valverde-Pérez
B.
,
Vanrolleghem
P. A.
,
Vezzaro
L.
&
Nopens
I.
2022
The transition of WRRF models to digital twin applications
.
Water Science and Technology
85
(
10
),
2840
2853
.
Wang
J.
,
Lim
M. K.
,
Wang
C.
&
Tseng
M. L.
2021a
The evolution of the Internet of Things (IoT) over the past 20 years
.
Computers & Industrial Engineering
155
,
107174
.
Wang
K. J.
,
Wang
P. S.
&
Nguyen
H. P.
2021b
A data-driven optimization model for coagulant dosage decision in industrial wastewater treatment
.
Computers & Chemical Engineering
152
,
107383
.
This is an Open Access article distributed under the terms of the Creative Commons Attribution Licence (CC BY 4.0), which permits copying, adaptation and redistribution, provided the original work is properly cited (http://creativecommons.org/licenses/by/4.0/).