Transforming Prediction into Decision: Leveraging Transformer-Long Short-Term Memory Networks and Automatic Control for Enhanced Water Treatment Efficiency and Sustainability

Cheng Qiu, Qingchuan Li, Jing Jiang, Nusret Tan, Jieping Wu, Mingxi Wang, Qiang‐Lin Li, Qianglin LiSensors 2025 · DOI

TL;DR

This paper introduces a novel Transformer-LSTM network model for accurately predicting ammonia nitrogen (NH₃-N) levels in wastewater treatment. By integrating this predictive model with an automated control system, the researchers achieved a significant 26.9% reduction in energy and time consumption for sequencing batch reactors (SBRs), leading to more efficient and sustainable water treatment.

What Problem Does This Paper Address?

Accurately monitoring and predicting ammonia nitrogen (NH₃-N) concentration is crucial for the efficiency and environmental compliance of wastewater treatment plants, particularly those using sequencing batch reactors (SBRs). NH₃-N is a key indicator of treatment effectiveness, but its concentration dynamics are complex and difficult to measure in real-time due to the scarcity of direct measurements and the high cost of continuous monitoring. Traditional SBR operations rely on fixed processing cycles, which can be inefficient, leading to unnecessary energy consumption and longer treatment times. This paper aims to bridge this gap by developing a highly accurate predictive model for NH₃-N and integrating it into an automated control system to optimize SBR operations.

Methods

The core innovation of this work is the development of a Transformer-LSTM network. This hybrid architecture combines the strengths of two powerful deep learning models:

  • Transformer Encoder: Excels at capturing long-range dependencies and global context within the data by using a self-attention mechanism. This allows it to understand relationships across the entire time series of input variables.
  • LSTM Decoder: Is adept at modeling sequential patterns and temporal dependencies, which are inherent in the cyclical nature of SBR processes.

This combination allows the model to effectively learn from historical data and make accurate predictions. A key aspect of their methodology is the strategic selection of input variables. Beyond traditional water quality indicators, they incorporated dissolved oxygen (DO), electrical conductivity (EC), and oxidation-reduction potential (ORP), along with their rates of change and cumulative values. This provides a richer dataset for the model. The Transformer-LSTM model's predictions are then fed into an automatic control algorithm that dynamically adjusts the SBR's operational stages (fill, oxidation/agitation, settlement, discharge) to maintain NH₃-N levels below a specified emission standard (5 mg/L).

Datasets

The study utilized data collected from 40 treatment cycles of a real-world SBR system treating wastewater from a residential area. These cycles were divided into training (70%) and testing (30%) datasets. The paper does not introduce a new benchmark dataset but rather uses real-world operational data from an SBR.

Key Insights and Ideas

  • Hybrid Model Synergy: The combination of Transformer and LSTM architectures proves highly effective. The Transformer's ability to grasp global context complements the LSTM's strength in sequential data, leading to superior prediction accuracy compared to using either model alone.
  • Feature Engineering Matters: Including not just raw sensor data (DO, EC, ORP) but also their rates of change and cumulative values significantly enhances the predictive power for NH₃-N. This suggests that understanding the dynamics and accumulation of these parameters is as important as their instantaneous values.
  • Prediction Enables Optimization: The ability to accurately predict NH₃-N in near real-time allows for dynamic control of the SBR process. This moves away from rigid, fixed-cycle operations towards adaptive management, which is key to efficiency gains.
  • Closed-Loop Control is Key: The integration of predictive modeling with automated actuators creates a closed-loop system that can actively manage treatment processes, ensuring compliance while minimizing resource use.

Key Results

  • Superior Prediction Accuracy: The Transformer-LSTM model achieved a high R² of 0.9255, with a lower RMSE of 2.6306 and MAE of 2.0430 compared to other tested models like LSTM, GRU, Transformer, and RNN.
  • Significant Efficiency Gains: The integrated system demonstrated a 26.9% reduction in energy or time consumption compared to traditional fixed-cycle SBR operations. This was achieved by dynamically adjusting the biochemical reaction time based on predicted NH₃-N levels.
  • Compliance Assurance: The automated control system successfully maintained effluent NH₃-N levels below the national emission standard of 5 mg/L.

Limitations and Future Work

  • Generalizability: While the model performed well on the tested SBR system, its adaptability to other treatment modalities (e.g., anaerobic-anoxic-oxic) or different types of wastewater requires further investigation.
  • Hyperparameter Optimization: The authors plan to conduct a more comprehensive investigation into hyperparameter optimization for the Transformer-LSTM architecture, exploring techniques like grid search, random search, and Bayesian optimization to further refine model performance.
  • Expanded Data Sources: Future work will explore incorporating spectral water quality data and validating the model across multi-plant scenarios to enhance its robustness and applicability.
  • Interpretability: While the model shows high accuracy, further work could focus on enhancing the interpretability of the hybrid model to provide deeper insights into the complex relationships it learns.

Summary updated

Abstract

The study addresses the critical issue of accurately predicting ammonia nitrogen (NH<sub>3</sub>-N) concentration in a sequencing batch reactor (SBR) system, achieving reduced consumption through automatic control technology. NH<sub>3</sub>-N concentration serves as a key indicator of treatment efficiency and environmental impact; however, its complex dynamics and the scarcity of measurements pose significant challenges for accurate prediction. To tackle this problem, an innovative Transformer-long short-term memory (Transformer-LSTM) network model was proposed, which effectively integrates the strengths of both Transformer and LSTM architectures. The Transformer component excels at capturing long-range dependencies, while the LSTM component is adept at modeling sequential patterns. The innovation of the proposed methodology resides in the incorporation of dissolved oxygen (DO), electrical conductivity (EC), and oxidation-reduction potential (ORP) as input variables, along with their respective rate of change and cumulative value. This strategic selection of input features enhances the traditional utilization of water quality indicators and offers a more comprehensive dataset for prediction, ultimately improving model accuracy and reliability. Experimental validation on NH<sub>3</sub>-N datasets from the SBR system reveals that the proposed model significantly outperforms existing advanced methods in terms of root mean squared error (RMSE), mean absolute error (MAE), and coefficient of determination (R<sup>2</sup>). Furthermore, by integrating real-time sensor data with the Transformer-LSTM network and automatic control, substantial improvements in water treatment processes were achieved, resulting in a 26.9% reduction in energy or time consumption compared with traditional fixed processing cycles. This methodology provides an accurate and reliable tool for predicting NH<sub>3</sub>-N concentrations, contributing significantly to the sustainability of water treatment and ensuring compliance with emission standards.
BibTeX
@inproceedings{qiu2025transforming,
  author = {Cheng Qiu and Qingchuan Li and Jing Jiang and Nusret Tan and Jieping Wu and Mingxi Wang and Qiang‐Lin Li and Qianglin Li and Qianglin Li},
  title = {{Transforming Prediction into Decision: Leveraging Transformer-Long Short-Term Memory Networks and Automatic Control for Enhanced Water Treatment Efficiency and Sustainability}},
  booktitle = {Sensors},
  year = {2025},
  doi = {10.3390/s25061652},
}
Figure