1. Introduction
For intelligent wastewater treatment, water quality monitoring data collected from the Internet of Things (IoT) sensor network are used to establish a machine learning (ML) model. The model predicts the treatment performance to optimize the control process. Intelligent wastewater treatment can be improved by enhancing the predictive performance of the ML model and predicting the effluent quality. Operational control can also be enhanced through improvements in IoT monitoring technology, the expansion and filtering of monitoring data, and monitoring methods [
1,
2,
3]. Old wastewater treatment plants require digital transformation to gather high-quality data through IoT [
4,
5].
Models such as activated sludge models (ASMs) are developed based on the physical, chemical, and biological reaction mechanisms of wastewater treatment to simulate the treatment effectiveness using theoretical reaction rates and control conditions. ASMs are mathematical models that describe and predict the performance of activated sludge processes. Models have been developed into commercial software including WEST, GPS-X, and BioWin for the design and operational optimization of wastewater treatment. Such models supplement existing monitoring data supplied by wastewater plants to enhance the predictive performance of ML models.
Software based on ASMs is updated and expanded for plants to simulate water quality changes from pretreatment to effluent discharge in wastewater treatment plants. BioWin® is widely used due to its high flexibility and ease of operation [
6], with its latest version (BioWin 6.3) incorporating advanced treatment units such as membrane bioreactors (MBRs) and membrane aerated bioreactors (MABRs) for the virtualization of wastewater treatment [
7,
8]. Models based on theoretical principles provide results that are highly interpretable and predictable. However, the calibration and validation of kinetic and stoichiometric parameters (e.g., the yield coefficient and oxygen half-saturation constant) [
9] are necessary. When the property of the influent does not change and is stable, operational, kinetic, and stoichiometric parameters become reliable, and the models can effectively predict average and long-term trends in wastewater treatment units. Nevertheless, present models cannot handle unexpected, short-term, or sudden events.
ML models use data-driven approaches to produce new data by learning from historical data. The model development process involves data collection, data preprocessing, feature selection, model selection, model training, and model validation. Once development is completed, the model can be used to predict new data. Common programming languages such as Python, R, and MATLAB are used to build and train the ML model. The advantage of ML is that it can learn from large datasets and identify complex relationships. However, the quality and quantity of data impact the model outcome, and the interpretability of ML models is often limited. Thus, acquiring large amounts of high-quality data becomes a challenge when constructing effective models. This study was carried out to build an ML model. The effluent quality of the wastewater treatment plant predicted by an ML model was compared to the results from a mechanistic-ML (hybrid) model.
2. Methods
2.1. Yongkang Water Resource Recovery Center
The Yongkang Water Resource Recovery Center (YKWRRC) is located in Tainan. It processes domestic wastewater with a daily treatment capacity of approximately 15,000 to 20,000 m3 per day. YKWRRC is a modern wastewater treatment and water reclamation plant that has operated since 2023. Its reclaimed water is supplied to over ten high-tech companies, including TSMC. The facility employs MBR as the main wastewater treatment unit. Before treating wastewater in the MBR, a primary settling tank (PST) and a three-stage anoxic oxidation (AO) process are used. A portion of the MBR effluent undergoes reverse osmosis (RO) purification for reuse, while the remaining effluent is disinfected before being discharged into the environment.
2.2. Data Selection and Processing
To intelligently manage wastewater treatment processes and predict effluent water quality, we collected and processed sensor data, including the influent flow rate (m
3/h), pH, suspended solids (SS, mg/L), chemical oxygen demand (COD, mg/L), conductivity (μS/cm), and total organic carbon (TOC, mg/L) for the influent. Outflow parameters from the primary settling tank such as the pH, SS, COD, and ammonia nitrogen (NH₃-N, mg/L) for pretreatment were also obtained, along with the airflow rate for the AO operation. Additionally, data from the outflow of the MBR, including the pH, SS, and COD for the MBR, as well as the outflow from the disinfection unit, were also collected for the effluent. The collected data are illustrated in
Figure 1 and
Table 1.
The data were collected from January 2023 to August 2024, every hour. Considering that all sensors were in the warming phase during the first half of 2023, only the data from July 2023 to August 2024 were used. For data cleaning, erroneous data were removed. Subsequently, outliers in the remaining data with values exceeding three times the interquartile range (IQR) were replaced by the daily average. If the data in an entire day exceeded the threshold, then the value was substituted with the weekly average.
2.3. Development of BioWin
BioWin 6.2 was used to construct a mechanistic model of the three main treatment units at YKWRRC (PST → AO → MBR), as illustrated in
Figure 2. The mechanistic model processed a complete 14-month influent dataset as the input. After adjusting 20 parameters, including influent wastewater characteristics and kinetic and stoichiometric parameters [
6,
9], the mechanistic model calculated three effluent quality parameters for the MBR during the 14-month operational period: COD, pH, and SS. These three effluent quality parameters from the BioWin simulation of the MBR were used for the BioWin MBR.
2.4. ML Model
Before developing the ML model, the dataset, consisting of 14 months of data, was split into a training set of 12 months, a validation set of 1 month, and a test set of 1 month. To effectively utilize all IoT monitoring data, a multi-step machine learning (MSML) model was constructed after multiple trials and errors, as follows:
First, using influent and pretreatment data as inputs, the airflow rate of the AO process (ML AO operation) was predicted.
The parameters of the influent, the pretreatment results, and the results of the ML AO operation were used as inputs to predict the MBR performance (ML MBR).
The parameters of the influent, the pretreatment results, and the results of the ML AO operation and ML MBR were predicted for the effluent quality (ML Effluent).
The process of the ML models is represented in
Figure 3. Models 1 to 3 employed a CNN-LSTM architecture. Previous studies [
10,
11,
12,
13] indicated that the CNN-LSTM structure significantly outperforms single CNN, long short-term memory (LSTM), or recurrent neural network (RNN) models in multi-dimensional and nonlinear time series applications. CNN aids in identifying critical feature patterns in pollutants at specific moments, while LSTM forecasts future dynamic changes based on historical data, thereby providing accurate predictions of future water quality trends. These models are well suited for handling random fluctuations and periodic changes in water quality data, offering enhanced robustness and accuracy in predictions [
10,
11,
12].
COD is a standard effluent quality control parameter across all wastewater treatment plants in Taiwan, with a limit of 100 mg/L. Although ML Effluent included predicted values for COD, pH, and SS, the performance evaluation of this model focused on COD prediction (ML Effluent-COD).
2.5. Hybrid Model
As shown on
Figure 3, the construction method, data training, and architecture of the hybrid model were consistent with those of the MSML model. The only difference was that the BioWin MBR dataset was added to the Model 3. The predicted results generated after adding the BioWin MBR are referred to as hybrid effluent-COD in this study [
4].
2.6. Evaluation of Models
The mean absolute error (MAE) and Theil inequality coefficient (TIC) were calculated on the testing set and were used as evaluation metrics for model performance. Since the testing dataset represented the final month, the simulated values were compared with the observed values to explore the convergence effects of the model.
MAE is the average level of errors between the predicted and the actual values, while TIC considers the relative magnitude of the prediction errors. The formulas for these metrics are as follows:
where m
i represents the observed values, specifically the effluent-COD, while pi denotes the predicted values. The predictions from the machine learning model are referred to as ML effluent-COD, and the predictions from the hybrid model are termed the hybrid effluent-COD. N indicates the number of data points.
Smaller values for MAE and TIC indicate better model performance. Typically, a TIC value of less than or equal to 0.3 is acceptable [
14]. We compared the coefficient of variation (CV) between the observed and predicted values and calculated the Pearson correlation coefficient (R) to assess whether the range of variation and long-term trends of the predicted values aligned with those of the observed values.
where
and
represent the standard deviation and mean of the observed values or predicted values.
3. Results and Discussion
3.1. Performance of MSML Model with IoT Data
The comparison between the predicted and observed values of COD in the effluent is illustrated in
Figure 4. The MSML prediction results presented the range of variation in the observed values and exhibited an acceptable TIC value (TIC < 0.3). However, there was no correlation between the two values (R = −0.15). Better prediction results were obtained when the trends in influent flow aligned with those in effluent flow. Notably, the predicted values were significantly higher than the observed values, and the matching of peak and trough values in the time series and long-trend predictions were relatively correct. While the MAE for the predicted values was relatively low in Models I and II and gradually increased in Model III, the predictions did not correspond to long-term stability and did not converge.
3.2. Performance of MSML Model with BioWin Dataset
By incorporating IoT and BioWin datasets into the MSML model, this hybrid model improved predictions of TIC and MAE (
Table 2). As illustrated in
Figure 5 and
Figure 6, the matching of peak and trough values, as well as long-term trend predictions, became accurate. After integrating the BioWin dataset, although the predicted values exceeded the observed values, the MAE of Model III decreased, addressing the issue of non-convergence. The predicted values in the highlighted areas of the hybrid model, similarly to those of the MSML model, did not deviate significantly. Future research is necessary to explore whether there are variations in operational conditions and to feed these values into the mechanistic model to enhance the performance of the hybrid model. In contrast, the MSML model established solely with the IoT dataset did not improve performance, underscoring the advantages of the hybrid model.
4. Conclusions
We incorporated simulated data from the ML model into the existing dataset to establish the hybrid model. Although the evaluation metrics showed improvements, a significant enhancement in addressing convergence was enabled for the ML model with the IoT dataset. IoT data used for wastewater management often suffer from insufficient quantity, a lack of representativeness, poor stability, and difficulties in noise elimination. By leveraging the incorporation of the mechanistic and ML models, such problems can be addressed to improve performance.
Author Contributions
Conceptualization, C.-H.C.; methodology, C.-H.C. and N.-H.L.; software, J.-C.J. and M.C.; validation, C.-H.C. and N.-H.L.; formal analysis, J.-C.J. and N.-H.L.; investigation, J.-C.J. and N.-H.L.; resources, C.-H.C., M.C. and K.-C.C.; data curation, J.-C.J., N.-H.L. and K.-C.C.; writing—original draft preparation, J.-C.J.; writing—review and editing, C.-H.C. and N.-H.L.; visualization, C.-H.C. and J.-C.J.; supervision, C.-H.C., M.C., and K.-C.C.; project administration, M.C. and K.-C.C.; funding acquisition, C.-H.C. and M.C. All authors have read and agreed to the published version of the manuscript.
Funding
This research was funded by Tainan City Government Smart Development Center under the project titled “The Demonstration and Verification Project for the Promotion of 5G Smart Management in Municipal Wastewater Treatment Plant at Tainan City, Year 2024”.
Institutional Review Board Statement
Not applicable.
Informed Consent Statement
Not applicable.
Data Availability Statement
The data presented in this study are available on request from the corresponding author due to the author’s ongoing research and additional analysis.
Conflicts of Interest
Mo Chen was employed by the company (Two-Shoulder AI Co., Ltd.). The remaining authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.
References
- O’Brien, M.; Mack, J.; Lennox, B.; Lovett, D.; Wall, A. Model predictive control of an activated sludge process: A case study. Control Eng. Pract. 2011, 19, 54–61. [Google Scholar] [CrossRef]
- Wang, X.; Ratnaweera, H.; Holm, J.A.; Olsbu, V. Statistical monitoring and dynamic simulation of a wastewater treatment plant: A combined approach to achieve model predictive control. J. Environ. Manag. 2017, 193, 1–7. [Google Scholar] [CrossRef] [PubMed]
- Yaqub, M.; Asif, H.; Kim, S.; Lee, W. Modeling of a full-scale sewage treatment plant to predict the nutrient removal efficiency using a long short-term memory (LSTM) neural network. J. Water Process Eng. 2020, 37, 101388. [Google Scholar] [CrossRef]
- Mehrani, M.J.; Bagherzadeh, F.; Zheng, M.; Kowal, P.; Sobotka, D.; Mąkinia, J. Application of a hybrid mechanistic/machine learning model for prediction of nitrous oxide (N2O) production in a nitrifying sequencing batch reactor. Process Saf. Environ. Prot. 2022, 162, 1015–1024. [Google Scholar] [CrossRef]
- Sin, G.; Al, R. Activated sludge models at the crossroad of artificial intelligence—A perspective on advancing process modeling. npj Clean Water 2021, 4, 16. [Google Scholar] [CrossRef]
- Tolentino, A.C.; Cheng, H.-H.; Lin, C.-C.; Doma, B., Jr.; Whang, L.-M. Optimization of step-feed anoxic-oxic-membrane bioreactor (AO-MBR) with methanol addition for biological nitrogen removal in wastewater using BioWin and response surface methodology (RSM). E3S Web Conf. 2024, 514, 01002. [Google Scholar] [CrossRef]
- Elawwad, A.; Matta, M.; Abo-Zaid, M.; Abdel-Halim, H. Plant-wide modeling and optimization of a large-scale WWTP using BioWin’s ASDM model. J. Water Process Eng. 2019, 31, 100819. [Google Scholar] [CrossRef]
- Liwarska-Bizukojc, E.; Olejnik, D.; Biernacki, R.; Ledakowicz, S. Calibration of a complex activated sludge model for the full-scale wastewater treatment plant. Bioprocess Biosyst. Eng. 2011, 34, 659–670. [Google Scholar] [CrossRef] [PubMed]
- Liwarska-Bizukojc, E.; Biernacki, R. Identification of the most sensitive parameters in the activated sludge model implemented in BioWin software. Bioresour. Technol. 2010, 101, 7278–7285. [Google Scholar] [CrossRef]
- Barzegar, R.; Aalami, M.T.; Adamowski, J. Short-term water quality variable prediction using a hybrid CNN–LSTM deep learning model. Stoch. Environ. Res. Risk Assess. 2020, 34, 415–433. [Google Scholar] [CrossRef]
- Li, Y.; Kong, B.; Yu, W.; Zhu, X. An attention-based CNN-LSTM method for effluent wastewater quality prediction. Appl. Sci. 2023, 13, 7011. [Google Scholar] [CrossRef]
- Tan, W.; Zhang, J.; Wu, J.; Lan, H.; Liu, X.; Xiao, K.; Wang, L.; Lin, H.; Sun, G.; Guo, P. Application of CNN and long short-term memory network in water quality predicting. Intell. Autom. Soft Comput. 2022, 34, 1943–1958. [Google Scholar] [CrossRef]
- Wang, Z.; Man, Y.; Hu, Y.; Li, J.; Hong, M.; Cui, P. A deep learning based dynamic COD prediction model for urban sewage. Environ. Sci. Water Res. Technol. 2019, 5, 2210–2218. [Google Scholar] [CrossRef]
- Cao, J.; Yang, E.; Xu, C.; Zhang, T.; Xu, R.; Fu, B.; Feng, Q.; Fang, F.; Luo, J. Model-based strategy for nitrogen removal enhancement in full-scale wastewater treatment plants by GPS-X integrated with response surface methodology. Sci. Total Environ. 2021, 769, 144851. [Google Scholar] [CrossRef] [PubMed]
| Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).