A sewage treatment process water quality change accurate prediction method and system
By using multi-parameter water quality sensors and advanced prediction models, combined with long short-term memory networks and mechanistic models, accurate prediction of water quality changes during wastewater treatment has been achieved, solving the problems of lag and insufficient accuracy in water quality changes, and improving the operational efficiency and stability of wastewater treatment plants.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING SHUZHI EXPLORATION TECH CO LTD
- Filing Date
- 2026-02-11
- Publication Date
- 2026-06-12
AI Technical Summary
Existing wastewater treatment technologies suffer from lagging and insufficient accuracy in predicting water quality changes, making it difficult to achieve refined and intelligent operational goals. Furthermore, the lack of integrated intelligent early warning and decision support in these systems leads to low operational and management efficiency.
By collecting data in real time using multi-parameter water quality sensors, and combining long short-term memory networks and mechanistic models, a time series prediction model is constructed. Data cleaning and standardization are performed, and the prediction model is optimized using a multi-objective optimization algorithm. The prediction results and graded early warnings are displayed in real time.
It enables accurate prediction of water quality changes during wastewater treatment, improves the scientific nature and management efficiency of process adjustments, reduces operating costs, and enhances resilience and operational stability.
Smart Images

Figure CN122201486A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of wastewater treatment technology, and in particular to a method and system for accurately predicting water quality changes during wastewater treatment. Background Technology
[0002] With the continued acceleration of urbanization and the steady improvement of industrialization, the discharge of various types of domestic and industrial wastewater is showing a continuous upward trend, and the composition of wastewater is becoming increasingly complex and diverse. This places higher standards and more stringent requirements on the technological adaptability, treatment accuracy, and operational efficiency of the wastewater treatment industry. Traditional wastewater treatment processes rely heavily on the on-site manual experience of staff, supplemented by basic laboratory chemical analysis to determine water quality change patterns. This approach not only has long testing cycles, slow data feedback, and low overall control efficiency, but also makes it difficult to achieve real-time tracking and precise control of water quality indicators. It is no longer suitable for the refined and intelligent control requirements of the entire wastewater treatment process under modern environmental protection standards.
[0003] In the current wastewater treatment process, there are problems with the lag and insufficient accuracy in predicting water quality changes, making it difficult to provide forward-looking guidance for process adjustments. In addition, the adjustment of process parameters is highly dependent on human experience, which not only easily leads to high operating costs, but also makes it difficult to achieve scientific optimization of energy and reagent consumption.
[0004] Meanwhile, the system lacks an integrated intelligent early warning and decision support system, has weak resilience to shocks, and low operational management efficiency, all of which contribute to the difficulty in achieving the goal of refined and intelligent operation of sewage treatment.
[0005] Therefore, how to provide a method and system for accurately predicting water quality changes during wastewater treatment is an urgent problem to be solved. Summary of the Invention
[0006] This invention provides a method and system for accurately predicting water quality changes during wastewater treatment processes, in order to solve the problems mentioned above in the prior art.
[0007] According to a first aspect of the present invention, a method for accurately predicting water quality changes during wastewater treatment is provided.
[0008] In one embodiment, the method for accurately predicting water quality changes during wastewater treatment includes: Multi-parameter water quality sensors are used to collect multi-source water quality data on the wastewater treatment process in the target wastewater area in real time. Data cleaning and standardization were performed on multi-source water quality data to extract temporal and statistical features, and key input features were selected from the temporal and statistical features in conjunction with wastewater treatment processes. Based on long short-term memory networks, a time series prediction model is constructed, and the time series prediction model is used to capture the temporal dependence of water quality changes in the target wastewater area; a mechanism model is constructed based on wastewater treatment processes, and the parameters of the mechanism model are statically calibrated through an optimization mechanism. A water quality prediction model is constructed by deeply integrating a time series prediction model with a calibrated mechanistic model through a serial architecture. The water quality prediction model is then optimized using a multi-objective optimization algorithm. Key input features are input into the optimized water quality prediction model for processing to generate prediction results. The residuals in the prediction results are then learned and corrected to obtain corrected prediction results, thereby improving the prediction accuracy and reliability of the water quality prediction model. Based on the revised prediction results, the water quality prediction model should be retrained or incrementally updated periodically. The corrected prediction results are displayed in real time through a visualization interface, and the corrected prediction results are matched with the set tiered early warning thresholds to trigger the corresponding early warning signals, so as to realize multi-level early warning from prompt to emergency.
[0009] In one embodiment, the real-time acquisition of multi-source water quality data of the wastewater treatment process in the target wastewater area using a multi-parameter water quality sensor includes: The chemical oxygen demand (COD) sensor is pre-installed in the target wastewater area to monitor the organic matter content in the target wastewater area in real time; Ammonia nitrogen concentration in the target wastewater area is monitored in real time by pre-deploying ammonia nitrogen sensors. The phosphorus removal process is tracked in real time by using a total phosphorus sensor pre-installed in the target wastewater area. The pH level in the target wastewater area is monitored in real time by using pH sensors pre-distributed in the target wastewater area. By pre-installing turbidity sensors at the inlet and outlet of the solid-liquid separation in the target wastewater area, the removal effect of suspended solids and the clarity of the water at the inlet and outlet of the solid-liquid separation are evaluated in real time. Data from chemical oxygen demand (COD), ammonia nitrogen, total phosphorus, pH, and turbidity sensors are fused to obtain multi-source water quality data.
[0010] In one embodiment, the process of cleaning and standardizing multi-source water quality data, extracting temporal and statistical features, and selecting key input features from the temporal and statistical features in conjunction with wastewater treatment processes includes: Measurement data exceeding a preset threshold in multi-source water quality data are removed, and missing data in the removed multi-source water quality data are supplemented using linear interpolation to ensure data continuity. Multi-source water quality data with different dimensions and numerical ranges are standardized and converted into a unified numerical range to facilitate subsequent data analysis and modeling. Analyze the variation patterns of unified multi-source water quality data at different time scales and extract temporal features; Calculate the statistical characteristics of each water quality data point to reflect the stability and fluctuation of water quality; Based on the wastewater treatment process, key characteristic parameters closely related to water quality changes are selected from temporal and statistical characteristics.
[0011] In one embodiment, the construction of a time-series prediction model based on a long short-term memory network, and the use of this model to capture the temporal dependence of water quality changes within the target wastewater area; and the construction of a mechanistic model based on the wastewater treatment process, followed by static calibration of the model's parameters through an optimization mechanism, includes: The key feature parameters are divided into training sample sets according to the time step. The long short-term memory network architecture is trained using the training sample sets to iteratively learn the time series patterns and build a time series prediction model. Time series prediction models are used to capture the temporal dependence of water quality changes within the target wastewater area; Based on the activated sludge model, combined with historical operating data and laboratory analysis results, a mechanistic model is constructed. At least one algorithm, either genetic algorithm or particle swarm optimization algorithm, is dynamically selected to statically calibrate the parameters of the mechanistic model so that the mechanistic model closely reflects the actual process.
[0012] In one embodiment, dividing the key feature parameters into a training sample set according to the time step includes: Key feature parameters are transformed into a unified two-dimensional time series table through standardization and feature integration; A two-dimensional time series table is continuously truncated using a sliding window to construct a two-dimensional matrix sample; The two-dimensional matrix samples within each sample window are separated from the target parameter values at subsequent time steps and defined as input features and labels, respectively, to obtain a three-dimensional training sample set.
[0013] In one embodiment, the dynamic selection of at least one algorithm, either a genetic algorithm or a particle swarm optimization algorithm, to statically calibrate the parameters of the mechanism model so that the mechanism model closely approximates the actual process includes: Key parameters to be calibrated in the mechanistic model were screened, and historical operational data and laboratory analysis data were integrated as calibration benchmarks. An objective function was set with the goal of minimizing prediction error. Initialize the genetic algorithm or particle swarm optimization algorithm to generate an initial parameter population or an initial particle swarm within a preset value range; During the iterative optimization process, the initialized genetic algorithm or particle swarm optimization algorithm substitutes each set of candidate parameters into the mechanism model for forward calculation to obtain the prediction results, and evaluates the error between the prediction results and the calibration benchmark under the candidate parameters through the objective function to obtain the evaluation results. After initialization, the genetic algorithm or particle swarm optimization algorithm iteratively updates the state of the parameter population or particles based on the evaluation results, and finally searches for and outputs the optimal parameter combination that minimizes the prediction error of the mechanism model, so as to complete the calibration of the mechanism model to closely match the actual process.
[0014] In one embodiment, the optimization of the water quality prediction model using a multi-objective optimization algorithm, the processing of key input features using the optimized water quality prediction model to generate prediction results, and the learning and correction of residuals in the prediction results to obtain corrected prediction results, thereby improving the prediction accuracy and reliability of the water quality prediction model, includes: With the dual objectives of achieving the effluent quality compliance rate and minimizing energy consumption, at least one of the non-dominated sorting genetic algorithm or the improved gray wolf optimization algorithm is used to solve for the optimal operating parameters of the water quality prediction model, and the range of control parameters is dynamically adjusted to obtain the optimized water quality prediction model. The key input features are fed into the optimized water quality prediction model to calculate and output the prediction results of key water quality variables. The prediction results are compared with the actual measurements at the corresponding times to calculate the residual sequence. A structured dataset is constructed using the residual sequence as the target variable and the key input features and prediction results as input variables. Based on a structured dataset, at least one algorithm, either a long short-term memory network or a gradient boosting tree, is trained to obtain a residual correction model, thereby achieving accurate prediction of current and future residuals. The key input features and prediction results acquired in real time are input into the trained residual correction model to obtain the residual prediction value. The difference between the predicted result and the predicted value of the residual correction model is calculated to obtain the corrected prediction result.
[0015] In one embodiment, periodically retraining or incrementally updating the water quality prediction model based on the corrected prediction results includes: The accuracy, computational efficiency, and energy consumption reduction rate of the water quality prediction model were evaluated using mean square error, mean absolute percentage error, and coefficient of determination. Based on newly accumulated multi-source water quality data, the water quality prediction model is retrained regularly, and feature engineering of key input features is continuously optimized by combining sensitivity analysis.
[0016] In one embodiment, the step of displaying the corrected prediction results in real time through a visual interface and matching the corrected prediction results with a set tiered early warning threshold to trigger the corresponding early warning signal, thereby achieving a multi-level early warning system from alert to emergency response, includes: The corrected prediction results are input into the visualization interface, which generates and overlays a comparison chart of the future water quality change trend line and the actual measured value in real time, and provides the confidence interval of the prediction results to assess the reliability of the prediction results. By combining the prediction results with the national emission standard limits, the graded early warning thresholds are dynamically calculated and generated; When the corrected prediction results reach the different levels of graded early warning thresholds, the corresponding early warning response process is automatically triggered, which pushes prompt information, executes automatic process adjustment, and initiates emergency control commands.
[0017] According to a second aspect of the present invention, a system for accurately predicting water quality changes in a wastewater treatment process is provided.
[0018] In one embodiment, a system for accurately predicting water quality changes in a wastewater treatment process includes: The multi-source monitoring module is used to collect multi-source water quality data of the wastewater treatment process in the target wastewater area in real time through multi-parameter water quality sensors; The data processing module is used to clean and standardize multi-source water quality data, extract time features and statistical features, and select key input features from time features and statistical features in combination with wastewater treatment processes. The model building module is used to construct a time series prediction model based on a long short-term memory network, and to use the time series prediction model to capture the temporal dependence of water quality changes in the target wastewater area; it also constructs a mechanism model based on the wastewater treatment process, and uses an optimization mechanism to statically calibrate the parameters of the mechanism model. The model fusion prediction module is used to deeply fuse the time series prediction model with the calibrated mechanistic model through a serial architecture to construct a water quality prediction model. The water quality prediction model is then optimized using a multi-objective optimization algorithm. Key input features are input into the optimized water quality prediction model for processing to generate prediction results. The residuals in the prediction results are then learned and corrected to obtain corrected prediction results, thereby improving the prediction accuracy and reliability of the water quality prediction model. The iterative training module is used to periodically retrain or incrementally update the water quality prediction model based on the corrected prediction results. The data visualization module is used to display the corrected prediction results in real time through a visualization interface, and to match the corrected prediction results with the set graded early warning thresholds to trigger the corresponding early warning signals, so as to realize multi-level early warning from prompt to emergency.
[0019] According to a third aspect of the present invention, a computer device is provided.
[0020] In some embodiments, the computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the method described above.
[0021] According to a fourth aspect of the present invention, a computer-readable storage medium is provided.
[0022] In one embodiment, a computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the steps of the above method.
[0023] The technical solutions provided by the embodiments of the present invention may include the following beneficial effects: 1) This invention, through advanced prediction models and multi-source data fusion technology, can accurately predict the trend of water quality changes during the sewage treatment process in advance, providing sufficient time and scientific basis for the process adjustment and management decisions of sewage treatment plants, and effectively avoiding problems such as instability of the treatment system or excessive effluent quality caused by sudden changes in water quality.
[0024] 2) The process parameter optimization suggestions based on the prediction results of this invention can help operators rationally adjust process parameters such as aeration rate, reagent dosage, and sludge return flow, achieving precise control, improving treatment efficiency while reducing energy consumption and reagent costs. Statistics show that applying this system can reduce the operating costs of wastewater treatment plants, demonstrating significant economic benefits.
[0025] 3) The real-time alarm and early warning functions of this invention enable operators to promptly detect abnormal changes in water quality and potential risks, and take swift countermeasures, thereby enhancing the resilience and operational stability of the wastewater treatment system. Simultaneously, the intuitive visual interface and decision support functions simplify the operator's workflow, improve management efficiency and the scientific nature of decision-making, and promote the development of wastewater treatment plants towards intelligent and refined management.
[0026] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description
[0027] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0028] Figure 1 This is a flowchart illustrating a method for accurately predicting water quality changes in a wastewater treatment process, according to an exemplary embodiment. Figure 2This is a schematic diagram illustrating the principle of a precise prediction system for water quality changes in a wastewater treatment process, according to an exemplary embodiment. Figure 3 This is a schematic diagram of the structure of a computer device according to an exemplary embodiment. Detailed Implementation
[0029] The following description and accompanying drawings fully illustrate specific embodiments described herein to enable those skilled in the art to practice them. Some portions and features of certain embodiments may be included in or replace portions and features of other embodiments. The scope of the embodiments herein includes the entire scope of the claims and all available equivalents thereof. The various embodiments described herein are presented in a progressive manner, with each embodiment focusing on its differences from other embodiments; similar or identical parts between embodiments can be referred to interchangeably.
[0030] The modules in the apparatus or system of this application can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0031] Where there is no conflict, the embodiments and features in the embodiments of the present invention can be combined with each other.
[0032] Figure 1 An embodiment of the present invention is shown, which is a method for accurately predicting water quality changes in a wastewater treatment process.
[0033] In this optional embodiment, the method for accurately predicting water quality changes during wastewater treatment includes: Step S101: Collect multi-source water quality data of the wastewater treatment process in the target wastewater area in real time using a multi-parameter water quality sensor; In this optional embodiment, the real-time acquisition of multi-source water quality data of the wastewater treatment process in the target wastewater area using multi-parameter water quality sensors includes: The content of organic matter in the target wastewater area is monitored in real time by using chemical oxygen demand (COD) sensors pre-installed in the target wastewater area; The ammonia nitrogen (NH3-N) concentration in the target wastewater area is monitored in real time by pre-deploying ammonia nitrogen (NH3-N) sensors in the target wastewater area. The phosphorus removal process is tracked in real time by pre-installing a total phosphorus (TP) sensor in the phosphorus removal process in the target wastewater area. The pH level in the target wastewater area is monitored in real time by pre-distributing pH sensors. This parameter is one of the key parameters for water quality prediction. By pre-installing turbidity sensors at the inlet and outlet of the solid-liquid separation in the target wastewater area, the removal effect of suspended solids and the clarity of the water at the inlet and outlet of the solid-liquid separation are evaluated in real time. Data from chemical oxygen demand (COD), ammonia nitrogen, total phosphorus, pH, and turbidity sensors are fused to obtain multi-source water quality data.
[0034] Specifically, the following sensors are used: Chemical Oxygen Demand (COD) sensors: Installed at key points in the wastewater treatment process, such as the inlet and outlet of each treatment unit, to monitor the organic matter content in the wastewater in real time. Ammonia Nitrogen (AM) sensors: Similarly, placed at the inlet and biological treatment units, to monitor ammonia nitrogen concentration. Total Phosphorus (TP) sensors: Installed near biological and chemical phosphorus removal processes to track phosphorus removal. pH sensors: Widely distributed in various treatment units, measuring from 0-14 pH with an accuracy of ±0.1 pH. Changes in pH value have a significant impact on many biological and chemical reactions and are one of the key parameters for water quality prediction. Turbidity sensors: Installed at the inlet and outlet of solid-liquid separation units such as sedimentation tanks and filters to assess the removal efficiency of suspended solids and the clarity of the water.
[0035] The data acquisition unit connects to each water quality sensor and collects data from the sensors at set time intervals, such as every minute. It then performs preliminary data processing and verification to ensure the accuracy and integrity of the data. Wireless communication technologies such as 4G / 5G or NB-IoT are used.
[0036] Step S102: Perform data cleaning and standardization on multi-source water quality data, extract time features and statistical features, and select key input features from time features and statistical features in conjunction with wastewater treatment processes; In this optional embodiment, the step of cleaning and standardizing multi-source water quality data, extracting temporal and statistical features, and selecting key input features from the temporal and statistical features in conjunction with wastewater treatment processes includes: Measurement data exceeding a preset threshold in multi-source water quality data are removed, and missing data in the removed multi-source water quality data are supplemented using linear interpolation to ensure data continuity. Multi-source water quality data with different dimensions and numerical ranges are standardized and converted to a unified numerical range, such as [0,1], to facilitate subsequent data analysis and modeling. Analyze the variation patterns of unified multi-source water quality data at different time scales, such as hour, day, and week, and extract time features; Calculate the statistical characteristics of each water quality data point to reflect the stability and fluctuation of water quality; Based on the wastewater treatment process, key characteristic parameters closely related to water quality changes are selected from temporal and statistical characteristics.
[0037] Specifically, the collected data is cleaned to remove outliers, duplicates, and missing values. For example, by setting reasonable threshold ranges, measurement data that significantly exceeds the normal range is eliminated, while missing data is supplemented using methods such as linear interpolation to ensure data continuity. Water quality parameter data with different dimensions and numerical ranges are standardized to convert them to a unified numerical interval, such as [0,1], to facilitate subsequent data analysis and modeling.
[0038] This study analyzes the variation patterns of water quality parameters across different time scales, such as hours, days, and weeks, extracting temporal characteristics such as daily variation amplitude and weekly periodicity. For example, the discharge of certain industrial wastewater may exhibit a significant daily periodicity, with COD concentrations in the wastewater being higher during working hours and lower at night. Statistical characteristics such as the mean, variance, and standard deviation of each water quality parameter are calculated to reflect the stability and volatility of water quality. Simultaneously, based on knowledge of wastewater treatment processes, key characteristic parameters closely related to water quality changes, such as influent COD, ammonia nitrogen concentration, and temperature, are selected as input variables for the predictive model.
[0039] Step S103: Based on the Long Short-Term Memory network, construct a time series prediction model and use the time series prediction model to capture the temporal dependence of water quality changes in the target wastewater area; based on wastewater treatment processes, such as activated sludge models, construct a mechanism model and statically calibrate the parameters of the mechanism model through an optimization mechanism. In this optional embodiment, the step of constructing a time series prediction model based on a long short-term memory network and using the time series prediction model to capture the temporal dependence of water quality changes in the target wastewater area; and constructing a mechanistic model based on wastewater treatment processes, such as activated sludge models, and statically calibrating the parameters of the mechanistic model through an optimization mechanism includes: The key feature parameters are divided into training sample sets according to the time step. The long short-term memory network architecture is trained using the training sample sets to iteratively learn the time series patterns and build a time series prediction model. Time series prediction models are used to capture the temporal dependence of water quality changes within the target wastewater area; Based on the activated sludge model, such as the ASM series model, a mechanistic model is constructed by combining historical operating data and laboratory analysis results. At least one algorithm, either genetic algorithm or particle swarm optimization algorithm, is dynamically selected to statically calibrate the parameters of the mechanistic model so that the mechanistic model closely matches the actual process.
[0040] In this optional embodiment, dividing the key feature parameters into a training sample set according to the time step includes: Key feature parameters are transformed into a unified two-dimensional time series table through standardization and feature integration; A two-dimensional time series table is continuously truncated using a sliding window to construct a two-dimensional matrix sample; The two-dimensional matrix samples within each sample window are separated from the target parameter values at subsequent time steps and defined as input features and labels, respectively, to obtain a three-dimensional training sample set.
[0041] In this optional embodiment, the step of dynamically selecting at least one algorithm, either a genetic algorithm or a particle swarm optimization algorithm, to statically calibrate the parameters of the mechanistic model so that the mechanistic model closely approximates the actual process includes: Key parameters to be calibrated in the mechanistic model were screened, and historical operational data and laboratory analysis data were integrated as calibration benchmarks. An objective function was set with the goal of minimizing prediction error. Initialize the genetic algorithm or particle swarm optimization algorithm to generate an initial parameter population or initial particle swarm within a preset value range, i.e., based on the process mechanism and literature values; During the iterative optimization process, the initialized genetic algorithm or particle swarm optimization algorithm substitutes each set of candidate parameters into the mechanism model for forward calculation to obtain the prediction results, and evaluates the error between the prediction results and the calibration benchmark under the candidate parameters through the objective function to obtain the evaluation results. After initialization, the genetic algorithm or particle swarm optimization algorithm iteratively updates the state of the parameter population or particles based on the evaluation results, and finally searches for and outputs the optimal parameter combination that minimizes the prediction error of the mechanism model, so as to complete the calibration of the mechanism model to closely match the actual process.
[0042] Specifically, a time series prediction model is constructed using deep learning algorithms such as Long Short-Term Memory (LSTM). The core of LSTM in constructing a time series prediction model is to transform the time-dimensional dependencies into a learnable input-output mapping for the model. Each step has clear operational standards and logic, and the specific construction method can be broken down into six key steps: 1) Transform the time series data into a format that the model can input. The core of time series data is ordered data arranged chronologically. This requires three steps to transform the raw data into a sample-feature structure that LSTM can recognize. This transformation involves a three-dimensional tensor: the number of samples, the time step, and the number of features. The core of this process is achieved through the following three steps: Step 1: Data standardization and feature integration. After cleaning the original data from multiple sources, such as DO, flow rate, and temperature, the data is denoised, completed, and standardized, for example, normalized to [0,1] or standardized to mean 0 and variance 1 to eliminate dimensional differences. A two-dimensional table of timestamps and multiple feature variables is formed, that is, each row corresponds to a time point and each column corresponds to a feature, such as DO, flow rate, and temperature at time t1.
[0043] Step 2: Time series window segmentation and sample construction. A sliding window is used to extract continuous time series segments as samples. The window length and time step, for example, 5 acquisition cycles, are set according to the prediction requirements. For instance, to predict the 6th time step using data from the first 5 time steps, example: with a window length of 5, sample 1 contains all features of [t1, t2, t3, t4, t5], sample 2 contains all features of [t2, t3, t4, t5, t6], and so on. The continuous time series data is divided into N independent samples, each sample being a two-dimensional matrix of time step and feature number.
[0044] Step 3: Feature and Label Separation. For each sample, all feature variables within the window are used as the input features X of the LSTM; the target parameter at the next time step, such as the DO value at time t6, is used as the label y for that sample; this forms the input format required for LSTM training. The input features X are a three-dimensional tensor, for example: number of samples, time step, number of features; the label y is a one-dimensional array, for example: number of samples. The output is a sample-feature-label dataset that meets the LSTM input requirements and can be directly used for subsequent model training.
[0045] 2) Build the core network architecture of LSTM. The LSTM model captures the long-term and short-term dependencies of time series by stacking the input layer to the LSTM layer to the fully connected layer to the output layer. The design of each layer needs to be combined with the prediction task, such as single-step prediction / multi-step prediction, univariate / multivariate prediction to determine the parameters.
[0046] 3) Configure the core training parameters. During the compilation phase, the optimizer, loss function, and evaluation metrics need to be determined to ensure that the model can learn efficiently and measure the prediction effect.
[0047] 4) Iterative learning of time series patterns: During the training phase, the model learns the dependencies between time series data by iteratively feeding data into backpropagation and adjusting parameters. The core of this iterative process of feeding data into backpropagation and adjusting parameters is to optimize the model parameters through a prediction-error-parameter tuning loop. The specific steps are as follows: Forward propagation, for example: Feeding data: Input sample features into the model, which calculates through each layer of neurons, such as the gating mechanism of LSTM, and outputs predicted values, such as the predicted DO concentration. Using a loss function, such as MSE, compare the predicted values with the true labels, such as the actual DO concentration, to obtain the error value. Backpropagation from the output layer calculates the gradient of the error with respect to the weights and biases of each parameter, such as the chain rule, to determine the degree of influence of the parameters on the error. Using an optimizer, such as Adam or SGD, adjust the parameters based on the gradient, such as the gradient descent direction, with the step size controlled by the learning rate, to reduce the error. Repeatedly feeding in new batches of data to forward propagation to calculate the loss to backpropagation to update the parameters, until the loss converges, such as stabilizing at a low level, or reaching the maximum number of iterations.
[0048] 5) Verify the effect and adjust the parameters. After training, the generalization ability of the model needs to be verified on the test set, and the effect can be improved by optimization.
[0049] Step 1: Specific steps to verify the model's generalization ability: Input the untrained test set data, i.e., time-series features, into the trained model and output prediction results, such as predicted DO values and energy consumption. For regression tasks, such as water quality prediction: use mean squared error (MSE), mean absolute error (MAE), and coefficient of determination (R²) for evaluation. The closer R² is to 1, the better the generalization. If the error difference between the two is small, such as the test set MSE being only within 5% higher than the training set, it indicates strong generalization ability; a large difference may indicate overfitting. Plot a "true value - predicted value" comparison curve for the test set and observe the consistency of trends, such as whether the DO fluctuation trend matches.
[0050] Step 2: If generalization ability is poor, such as a sudden increase in test set error, adjust as follows: Increase regularization (L1 / L2 regularization); add a Dropout layer, such as dropout=0.2 in the hidden layer of an LSTM; use early stopping to terminate training when the validation set error increases; reduce the number of neurons in the hidden layer; shorten the time window length to reduce model complexity; decrease the learning rate, such as from 0.01 to 0.001; increase the batch size, and optimize through grid search / random search.
[0051] Step 3: Based on the training-validation-test principle and the dataset partitioning, the generalization ability is quantified through performance metrics, and the model is optimized by combining regularization, hyperparameter tuning and other techniques. This model has been widely used in time series prediction, such as in the field of LSTM applications.
[0052] 6) Deploy and continuously update the predictions: After evaluation, the model needs to be deployed to real-world scenarios and iterated upon based on new data. Utilizing historical water quality data sequences, the model learns the inherent patterns of water quality parameter changes over time to predict future trends. LSTM models are effective at handling time-series data with long-term dependencies and have good predictive capabilities for dynamic changes in water quality during wastewater treatment.
[0053] Combining the technological principles of wastewater treatment, such as the biological reaction process in the activated sludge process and the chemical reaction equilibrium in the chemical precipitation process, the following methods are employed: Activated sludge process: Utilizes aerobic microbial communities to decompose organic pollutants in wastewater into inorganic substances through adsorption and biodegradation. Simultaneously, microbial proliferation occurs, and the microbial community concentration is maintained through sludge sedimentation and reflux, achieving wastewater purification. Chemical precipitation process: Based on the solubility product rule, a precipitant is added to the wastewater, reacting chemically with dissolved pollutant ions to form insoluble precipitates, which are then removed through solid-liquid separation. A predictive model based on mass balance and reaction kinetics is established. By inputting current water quality parameters, sludge concentration, aeration rate, and other process parameters, the water quality changes in the next treatment unit are predicted. Combining the mechanistic model with a data-driven predictive model can improve the accuracy and reliability of predictions.
[0054] In wastewater treatment, combining mechanistic models with data-driven models is a core strategy for improving the accuracy and reliability of water quality change predictions. The specific steps are as follows: I. Water Quality Prediction Modeling Framework Design and Mechanism Model Construction: 1) Core Model Selection: Adopting activated sludge models recommended by the International Water Association (IWA), such as ASM2D. 2) Parameter Calibration: Utilizing historical operational data, such as influent flow rate, COD, ammonia nitrogen concentration, and laboratory analysis results, such as sludge activity parameters, the mechanism model parameters, such as the maximum specific growth rate μ, are calibrated using genetic algorithms or particle swarm optimization algorithms. max Half-saturation coefficient K s 3) Perform static calibration. Based on the calibrated ASM2D model, simulate the wastewater treatment process under different operating conditions to generate a batch dataset containing variables such as substrate concentration and dissolved oxygen, providing a basis for feature extraction.
[0055] The activated sludge model adopts an interpretable shallow architecture. The input layer corresponds to water quality parameters such as COD and BOD, and process parameters such as aeration intensity and oxygen content. There are two to three hidden layers with full connectivity between them, such as traceable weights. The output layer corresponds to predicted targets such as pollutant degradation rate and sludge concentration.
[0056] The dataset is divided into training / test / validation sets in a 7:2:1 ratio and normalized after preprocessing. Iterative mini-batch processing is employed, with real-time monitoring of the validation set loss and an early stopping strategy; the dataset terminates if the loss does not decrease for 10 consecutive iterations. Weight changes are recorded during iteration to ensure reproducibility. The learning rate is 0.001-0.01, batch size is 32 / 64, dropout rate is 0.2-0.3, and the number of iterations is 200-500. The loss function uses MSE regression / cross-entropy classification with a regularization coefficient of 0.0001. Accuracy is quantified using RMSE and R² (R² ≥ 0.85 is considered acceptable). Blind testing using actual processes is performed, and the model is compared to traditional models to output feature contributions, ensuring that the architecture, parameters, and performance are traceable and verifiable.
[0057] The general core steps, such as those applicable to genetic algorithms and particle swarm optimization, involve using optimization algorithms to search for the optimal parameter combination that minimizes the error between the mechanistic model output and historical operating data and laboratory analysis results. The steps are as follows: 1. Screen sensitive and difficult-to-measure parameters in the mechanistic model, such as the maximum specific growth rate and substrate degradation rate constant in activated sludge models. 2. Select historical operating data without anomalies, such as flow rate, DO, MLSS, and laboratory analysis data, such as effluent ammonia nitrogen and COD, as reference values. 3. Aim to minimize the error between the model's predicted values and the actual values, such as MSE and MAE.
[0058] An initial parameter population is randomly generated, where each individual corresponds to a set of parameters, with parameters within a reasonable range based on the process mechanism and literature values. A particle swarm is initialized, where each particle corresponds to a set of parameters, and initial positions (parameter values and velocities) are set. Each set of parameters is substituted into the mechanistic model to output predicted values, such as effluent quality and energy consumption. The fitness of each set of parameters is calculated using an objective function; the smaller the error, the higher the fitness. A new population is generated through selection (retaining superior individuals), crossover (parameter recombination), and mutation (randomly fine-tuning parameters). The particle velocities and positions (parameter values) are updated based on the individual optimal solutions and the global optimal solution.
[0059] II. Data-driven model design includes: 1) Feature engineering: extracting dynamic features from the simulation data of the mechanistic model. 2) Model selection: using Long Short-Term Memory (LSTM) networks or Convolutional Neural Networks (CNN) to capture non-linear relationships, and introducing an attention mechanism to enhance the weights of key time steps. 3) Dynamic update mechanism: fine-tuning the parameters of the data-driven model every 3 hours based on newly collected sensor data, such as real-time influent flow rate and dissolved oxygen concentration, to ensure that the model adapts to water quality fluctuations.
[0060] Step S104: The time series prediction model and the calibrated mechanism model are deeply integrated through a serial architecture to construct a water quality prediction model. The water quality prediction model is then optimized using a multi-objective optimization algorithm. Key input features are input into the optimized water quality prediction model for processing to generate prediction results. The residuals in the prediction results are then learned and corrected to obtain corrected prediction results, thereby improving the prediction accuracy and reliability of the water quality prediction model. In this optional embodiment, the optimization of the water quality prediction model using a multi-objective optimization algorithm, the input of key input features into the optimized water quality prediction model for processing, the generation of prediction results, and the learning and correction of residuals in the prediction results to obtain corrected prediction results, thereby improving the prediction accuracy and reliability of the water quality prediction model, includes: With the dual objectives of achieving effluent quality compliance rate and minimizing energy consumption, at least one of the following algorithms—Non-dominated sorting genetic algorithm (NSGA-II) or improved gray wolf optimization algorithm (IGWO)—is used to solve for the optimal operating parameters of the water quality prediction model, such as nitrification reflux ratio and aeration intensity. The range of control parameters is then dynamically adjusted to obtain the optimized water quality prediction model. The key input features are fed into the optimized water quality prediction model to calculate and output the prediction results of key water quality variables. The prediction results are compared with the actual measurements at the corresponding times to calculate the residual sequence. A structured dataset is constructed using the residual sequence as the target variable and the key input features and prediction results as input variables. Based on a structured dataset, at least one of the algorithms, namely Long Short-Term Memory Network (LSTM) or Gradient Boosting Tree (GBM), is trained to obtain a residual correction model, so as to achieve accurate prediction of current and future residuals. The key input features and prediction results acquired in real time are input into the trained residual correction model to obtain the residual prediction value. The difference between the predicted result and the predicted value of the residual correction model is calculated to obtain the corrected prediction result.
[0061] Specifically, the first approach is a cascaded water quality prediction model architecture: Key variables, such as baseline nitrate concentration, are predicted using the ASM2D model and used as one of the input features of the data-driven model. The residuals between the predicted values and actual measurements are learned using LSTM or Gradient Boosting Tree (GBM) models, thus constructing a residual correction model. For example, in N2O emission prediction, the water quality prediction model reduces the error by 30% compared to a pure mechanistic model.
[0062] The core approach involves four steps: calculating residuals, building a dataset, training the model, and applying corrections. The steps are as follows: First, subtract the actual measured value (historical operational / laboratory measured value) from the predicted value of the mechanistic model (e.g., predicted effluent ammonia nitrogen) to obtain the residual sequence. Residual = Predicted value - Measured value, or vice versa; a unified rule applies. Second, use the mechanistic model as input features (e.g., flow rate, dissolved oxygen, temperature) plus the mechanistic prediction value as input variables, and the residual as the target variable. Organize these into a table (e.g., using GBM) or a time series tensor (e.g., using LSTM), dividing the time into time steps and training / test sets.
[0063] Training the residual model: LSTM: trained with time-series input format, learning the variation of residuals over time and features; GBM: trained directly with tabular data, capturing the non-linear relationship between features and residuals; using the MSE / MAE of the residuals as the loss function to optimize model parameters. New data is input into the mechanistic model to obtain predicted values, and simultaneously input into the residual model to obtain residual predicted values. The final correction result = mechanistic predicted value - residual predicted value, thus offsetting the systematic error of the mechanistic model.
[0064] II. Multi-objective optimization algorithm: The optimization objectives are set with the effluent quality compliance rate, such as ammonia nitrogen ≤1.5mg / L and energy consumption minimization as dual objectives. Non-dominated sorting genetic algorithms, such as NSGA-II, or improved gray wolf optimization algorithms, such as IGWO, are used to solve for the optimal operating parameters, such as nitrification reflux ratio and aeration intensity.
[0065] The coding method of the multi-objective optimization algorithm is clearly defined, such as the real number coding corresponding to water quality parameters, non-dominated sorting levels, and crowding calculation logic. Redundant structures are simplified, and the core processes of initialization, non-dominated sorting, selection / crossover / mutation, and iterative update are clearly presented.
[0066] The initial population is sorted and screened, including samples related to water quality prediction and multi-objective fitness assessments, to meet objectives such as wastewater quality prediction error and stability. Genetic operations are then performed, followed by a termination decision. Key parameters such as population size, crossover probability, mutation probability, and number of iterations are determined, and their value ranges are labeled, reflecting the wastewater quality prediction scenario and the basis for their determination. The algorithm's effectiveness in error control and multi-objective balance is verified by comparing measured wastewater quality data with predicted data, clarifying verification indicators and judgment criteria. A dynamic control range is established, adjusting the control parameter range based on model prediction results. For example, when the influent load increases, the dissolved oxygen setpoint is increased from 2 mg / L to 2.5 mg / L, while limiting the energy consumption increase to no more than 15%.
[0067] III. Data Preprocessing and Real-time Application: 1) Sensor Data Calibration: Outlier detection is performed using quartile methods, such as IQR, and sliding window techniques to identify and replace outliers. For example, when the dissolved oxygen sensor reading exceeds the normal range (e.g., 0-6 mg / L), the median value is used instead. Monthly updates to the biokinetic parameters of the mechanistic model, such as filamentous bacteria abundance, are conducted through offline sedimentation column testing and microbial community analysis, such as 16S rRNA sequencing, to ensure the model matches the actual process.
[0068] 2) Real-time Prediction System Integration: Edge computing deployment, with edge servers deployed on-site at the wastewater treatment plant to process sensor data in real time, such as every 10 seconds. Lightweight models, such as TinyML, are used for rapid inference, reducing cloud communication latency. Visualization and early warning: Prediction results and process status are displayed through a digital twin platform. Thresholds are set to trigger early warnings, such as prompting to increase aeration when the predicted ammonia nitrogen value exceeds 1.2 mg / L, and generating operational suggestions, such as adjusting the internal recirculation ratio to 200%.
[0069] IV. Model Validation and Long-Term Maintenance: Multi-condition Validation: Extreme condition testing, verifying the model's robustness under extreme conditions such as heavy rain and low temperatures (<13℃). For example, the TVCSES20-2021 standard requires at least 90 days of field validation, including 30 days of extreme condition testing. Cross-system Generalization: Transferring the trained water quality prediction model to different wastewater treatment plants, such as SBR processes, and achieving rapid adaptation through parameter fine-tuning. For example, in a plug flow reactor in Australia, the water quality prediction model showed an N2O emission prediction error of <10% without calibration.
[0070] The core components of a well-trained water quality prediction model include: a mechanistic model, a fusion model of LSTM / GBM and multi-objective optimization algorithms. Foundation layer: Wastewater biochemical mechanism models, such as activated sludge models, provide support for physicochemical laws; Correction layer: LSTM / GBM residual model, to compensate for systematic errors in the mechanism model; Optimization layer: NSGA-II / IGWO algorithm, outputs optimal parameters for water quality, energy consumption, and equipment balance.
[0071] Step S105: Based on the corrected prediction results, the water quality prediction model is retrained or incrementally updated periodically, such as quarterly. In this optional embodiment, the step of periodically, such as quarterly, retraining or incrementally updating the water quality prediction model based on the corrected prediction results includes: The mean square error (MSE), mean absolute percentage error (MAPE), and coefficient of determination (R²) are used to assess the prediction accuracy, computational efficiency, and energy consumption reduction rate of the water quality prediction model. Based on newly accumulated multi-source water quality data, the water quality prediction model is retrained regularly, and feature engineering of key input features is continuously optimized by combining sensitivity analysis.
[0072] Specifically, the genetic algorithm / particle swarm optimization is first used to optimize the mechanism parameters in combination with historical data from the source plant; the residuals are calculated and the correction model is trained: the residuals between the predicted values and the measured values of the mechanism model are used to train LSTM / GBM; the mechanism model and the residual correction model are used as the prediction core, and a multi-objective optimization algorithm is connected to train the mapping relationship between the input features and the optimal operating parameters.
[0073] The prediction accuracy is evaluated using mean squared error, mean absolute percentage error, and limit error rate. Simultaneously, the computational efficiency of the model, such as prediction time and energy consumption reduction rate, is calculated. The water quality prediction model is retrained quarterly based on newly accumulated data, and sensitivity analysis, such as dual sensitivity analysis, is used to identify key input variables and optimize the feature engineering process. A two-stage strategy of steady-state optimization and real-time adjustment is proposed. First, the optimal parameter range is determined through a mechanistic model, and then data-driven model dynamic fine-tuning is used to balance computational efficiency and prediction accuracy.
[0074] Water quality prediction models retain the interpretability of mechanistic models by using biokinetic parameters, such as Thiotris abundance, to explain prediction results, thus enhancing engineers' confidence in the model. Through the steps and methods described above, water quality prediction models can significantly improve the accuracy and reliability of water quality predictions, providing a scientific basis for precise control and energy conservation in wastewater treatment plants.
[0075] Step S106: Display the corrected prediction results in real time through a visualization interface, and match the corrected prediction results with the set graded early warning thresholds to trigger the corresponding early warning signals, so as to realize multi-level early warning from prompt to emergency.
[0076] In this optional embodiment, the step of displaying the corrected prediction results in real time through a visual interface and matching the corrected prediction results with the set tiered early warning thresholds to trigger the corresponding early warning signal, thereby achieving multi-level early warning from alert to emergency response, includes: The corrected prediction results are input into the visualization interface, which generates and overlays a comparison chart of the future water quality change trend line and the actual measured value in real time, and provides the confidence interval of the prediction results to assess the reliability of the prediction results. By combining the prediction results with the national emission standard limits, the graded early warning thresholds are dynamically calculated and generated; When the corrected prediction results reach the different levels of graded early warning thresholds, the corresponding early warning response process is automatically triggered, which pushes prompt information, executes automatic process adjustment, and initiates emergency control commands.
[0077] Specifically, the system uses intuitive charts, such as line graphs, bar charts, and scatter plots, to display the current measured values and historical trends of various water quality parameters in real time, allowing operators to quickly understand the operational status of the wastewater treatment system. The predicted water quality trend lines are overlaid on the visualization interface, using different colors or line types to distinguish between actual and predicted values, intuitively showing future water quality changes. Simultaneously, confidence intervals or uncertainty analyses of the prediction results are provided to help operators assess the reliability of the predictions.
[0078] Decisions should be made regarding reasonable alarm thresholds. For example, the alarm thresholds set during the process are generally smaller than the thresholds specified in the process card. When it is predicted that water quality parameters may exceed the set control range or abnormal fluctuations occur, alarm information should be promptly sent to the operators, such as through sound, pop-up windows, or text messages, so that corresponding emergency measures can be taken to prevent water quality deterioration or loss of control of the treatment system.
[0079] According to the "Discharge Standard of Pollutants for Municipal Wastewater Treatment Plants" (GB 18918-2002), the main indicator limits of Class A standard (the most stringent) are set. Alarm thresholds (superior to standard specifications) are dynamically selected by comparing with prediction results; a three-level early warning strategy is implemented. Level 1 Warning (Alert): When the indicator is close to the standard value, such as ammonia nitrogen 4.5 mg / L, only an APP notification will be sent; Level 2 warning (response level): When the indicator reaches the threshold, such as ammonia nitrogen 5mg / L, it triggers SMS and automatic adjustment of aeration rate; Level 3 Warning (Emergency Level): If indicators are severely exceeded, such as ammonia nitrogen > 5.5 mg / L, shut off the outlet valve and activate the emergency plan.
[0080] Fuzzy logic application: Convert absolute thresholds into fuzzy membership degrees. For example, the membership degree of pH values between 6.5 and 7.5 is 1, and values outside this range are linearly decayed to avoid triggering alarms due to small fluctuations.
[0081] Figure 2 An embodiment of a precise prediction system for water quality changes in a wastewater treatment process according to the present invention is shown.
[0082] In this optional embodiment, a precise prediction system for water quality changes during wastewater treatment includes: The multi-source monitoring module 201 is used to collect multi-source water quality data of the sewage treatment process in the target sewage area in real time through multi-parameter water quality sensors; The data processing module 202 is used to perform data cleaning and standardization on multi-source water quality data, extract time features and statistical features, and select key input features from time features and statistical features in combination with wastewater treatment process. The model building module 203 is used to build a time series prediction model based on a long short-term memory network, and to use the time series prediction model to capture the temporal dependence of water quality changes in the target wastewater area; to build a mechanism model based on the wastewater treatment process, and to statically calibrate the parameters of the mechanism model through an optimization mechanism; The model fusion prediction module 204 is used to deeply fuse the time series prediction model with the calibrated mechanism model through a serial architecture to construct a water quality prediction model, and optimize the water quality prediction model through a multi-objective optimization algorithm; input key input features into the optimized water quality prediction model for processing to generate prediction results, and learn and correct the residuals in the prediction results to obtain corrected prediction results, so as to improve the prediction accuracy and reliability of the water quality prediction model. The iterative training module 205 is used to periodically retrain or incrementally update the water quality prediction model based on the corrected prediction results. The data visualization module 206 is used to display the corrected prediction results in real time through a visualization interface, and to match the corrected prediction results with the set graded early warning thresholds to trigger the corresponding early warning signals, so as to realize multi-level early warning from prompt to emergency.
[0083] To facilitate understanding of the above technical solutions of the present invention, the following further describes the above technical solutions of the present invention from the perspectives of architecture and principle, as follows: Multi-parameter sensors collect various water quality data in real time during the wastewater treatment process. The collected data is cleaned and standardized to remove noise and outliers, ensuring data quality. Temporal and statistical features are extracted from the preprocessed data, and key feature parameters are selected as inputs to the prediction model. The water quality prediction model uses historical data to train both the time-series prediction model and the mechanism-based water quality prediction model, optimizing the parameters and improving prediction accuracy. During system operation, based on the real-time collected water quality data and the trained prediction model, the system predicts water quality trends over a future period. The prediction results are displayed intuitively to operators through a visual interface, and the system also provides process parameter optimization suggestions and alarm warnings to assist operators in decision-making and management.
[0084] In summary, this invention aims to achieve accurate prediction of water quality changes by real-time monitoring, analysis, and modeling of water quality data during wastewater treatment. By predicting water quality trends in advance, a scientific basis can be provided for the operation and management of wastewater treatment plants, optimizing process parameters, improving treatment efficiency, reducing operating costs, and ensuring stable compliance of effluent quality. This accurate water quality prediction system for wastewater treatment processes is applicable to various urban and industrial wastewater treatment plants, such as those in the chemical, pharmaceutical, food processing, and dyeing industries, as well as wastewater treatment research institutions and water environment monitoring departments. Whether it is a large-scale integrated wastewater treatment plant or a small, decentralized wastewater treatment facility, this system can provide accurate water quality prediction services, helping the wastewater treatment industry achieve efficient, stable, and economical operation goals, and ensuring the safety and sustainable development of the water environment.
[0085] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 3 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores static and dynamic information data. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements the steps in the above method embodiments.
[0086] Those skilled in the art will understand that Figure 3 The structure shown is merely a block diagram of a portion of the structure related to the present invention and does not constitute a limitation on the computer device to which the present invention is applied. A specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0087] In addition, the present invention also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0088] In addition, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the above method embodiments.
[0089] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media used in the embodiments provided by this invention can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0090] This invention is not limited to the structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this invention is limited only by the appended claims.
Claims
1. A method for accurately predicting water quality changes during wastewater treatment, characterized in that, include: Multi-parameter water quality sensors are used to collect multi-source water quality data on the wastewater treatment process in the target wastewater area in real time. Data cleaning and standardization were performed on multi-source water quality data to extract temporal and statistical features, and key input features were selected from the temporal and statistical features in conjunction with wastewater treatment processes. Based on long short-term memory networks, a time series prediction model is constructed, and the time series prediction model is used to capture the temporal dependence of water quality changes in the target wastewater area; a mechanism model is constructed based on wastewater treatment processes, and the parameters of the mechanism model are statically calibrated through an optimization mechanism. A water quality prediction model is constructed by deeply integrating a time series prediction model with a calibrated mechanistic model through a serial architecture. The water quality prediction model is then optimized using a multi-objective optimization algorithm. Key input features are input into the optimized water quality prediction model for processing to generate prediction results. The residuals in the prediction results are then learned and corrected to obtain corrected prediction results, thereby improving the prediction accuracy and reliability of the water quality prediction model. Based on the revised prediction results, the water quality prediction model should be retrained or incrementally updated periodically. The corrected prediction results are displayed in real time through a visualization interface, and the corrected prediction results are matched with the set tiered early warning thresholds to trigger the corresponding early warning signals, so as to realize multi-level early warning from prompt to emergency.
2. The method for accurately predicting water quality changes in a wastewater treatment process according to claim 1, characterized in that, The real-time acquisition of multi-source water quality data from the wastewater treatment process in the target wastewater area using multi-parameter water quality sensors includes: The chemical oxygen demand (COD) sensor is pre-installed in the target wastewater area to monitor the organic matter content in the target wastewater area in real time; Ammonia nitrogen concentration in the target wastewater area is monitored in real time by pre-deploying ammonia nitrogen sensors. The phosphorus removal process is tracked in real time by using a total phosphorus sensor pre-installed in the target wastewater area. The pH level in the target wastewater area is monitored in real time by using pH sensors pre-distributed in the target wastewater area. By pre-installing turbidity sensors at the inlet and outlet of the solid-liquid separation in the target wastewater area, the removal effect of suspended solids and the clarity of the water at the inlet and outlet of the solid-liquid separation are evaluated in real time. Data from chemical oxygen demand (COD), ammonia nitrogen, total phosphorus, pH, and turbidity sensors are fused to obtain multi-source water quality data.
3. The method for accurately predicting water quality changes in a wastewater treatment process according to claim 1, characterized in that, The process of cleaning and standardizing multi-source water quality data, extracting temporal and statistical features, and selecting key input features from these features in conjunction with wastewater treatment processes includes: Measurement data exceeding a preset threshold in multi-source water quality data are removed, and missing data in the removed multi-source water quality data are supplemented using linear interpolation to ensure data continuity. Multi-source water quality data with different dimensions and numerical ranges are standardized and converted into a unified numerical range to facilitate subsequent data analysis and modeling. Analyze the variation patterns of unified multi-source water quality data at different time scales and extract temporal features; Calculate the statistical characteristics of each water quality data point to reflect the stability and fluctuation of water quality; Based on the wastewater treatment process, key characteristic parameters closely related to water quality changes are selected from temporal and statistical characteristics.
4. The method for accurately predicting water quality changes in a wastewater treatment process according to claim 1, characterized in that, The method is to construct a time series prediction model based on a long short-term memory network and use the time series prediction model to capture the temporal dependence of water quality changes in the target wastewater area. A mechanistic model was constructed based on the wastewater treatment process, and the parameters of the mechanistic model were statically calibrated through an optimization mechanism, including: The key feature parameters are divided into training sample sets according to the time step. The long short-term memory network architecture is trained using the training sample sets to iteratively learn the time series patterns and build a time series prediction model. Time series prediction models are used to capture the temporal dependence of water quality changes within the target wastewater area; Based on the activated sludge model, combined with historical operating data and laboratory analysis results, a mechanistic model is constructed. At least one algorithm, either genetic algorithm or particle swarm optimization algorithm, is dynamically selected to statically calibrate the parameters of the mechanistic model so that the mechanistic model closely reflects the actual process.
5. The method for accurately predicting water quality changes in a wastewater treatment process according to claim 4, characterized in that, The step of dividing the key feature parameters into training sample sets according to the time step includes: Key feature parameters are transformed into a unified two-dimensional time series table through standardization and feature integration; A two-dimensional time series table is continuously truncated using a sliding window to construct a two-dimensional matrix sample; The two-dimensional matrix samples within each sample window are separated from the target parameter values at subsequent time steps and defined as input features and labels, respectively, to obtain a three-dimensional training sample set.
6. The method for accurately predicting water quality changes in a wastewater treatment process according to claim 4, characterized in that, The step of dynamically selecting at least one of the genetic algorithm or particle swarm optimization algorithm to perform static calibration on the parameters of the mechanism model, so as to make the mechanism model closely resemble the actual process, includes: Key parameters to be calibrated in the mechanistic model were screened, and historical operational data and laboratory analysis data were integrated as calibration benchmarks. An objective function was set with the goal of minimizing prediction error. Initialize the genetic algorithm or particle swarm optimization algorithm to generate an initial parameter population or an initial particle swarm within a preset value range; During the iterative optimization process, the initialized genetic algorithm or particle swarm optimization algorithm substitutes each set of candidate parameters into the mechanism model for forward calculation to obtain the prediction results, and evaluates the error between the prediction results and the calibration benchmark under the candidate parameters through the objective function to obtain the evaluation results. After initialization, the genetic algorithm or particle swarm optimization algorithm iteratively updates the state of the parameter population or particles based on the evaluation results, and finally searches for and outputs the optimal parameter combination that minimizes the prediction error of the mechanism model, so as to complete the calibration of the mechanism model to closely match the actual process.
7. The method for accurately predicting water quality changes in a wastewater treatment process according to claim 1, characterized in that, The process of optimizing the water quality prediction model using a multi-objective optimization algorithm, inputting key input features into the optimized water quality prediction model for processing, generating prediction results, and learning and correcting the residuals in the prediction results to obtain corrected prediction results, thereby improving the prediction accuracy and reliability of the water quality prediction model, includes: With the dual objectives of achieving the effluent quality compliance rate and minimizing energy consumption, at least one of the non-dominated sorting genetic algorithm or the improved gray wolf optimization algorithm is used to solve for the optimal operating parameters of the water quality prediction model, and the range of control parameters is dynamically adjusted to obtain the optimized water quality prediction model. The key input features are fed into the optimized water quality prediction model to calculate and output the prediction results of key water quality variables. The prediction results are compared with the actual measurements at the corresponding times to calculate the residual sequence. A structured dataset is constructed using the residual sequence as the target variable and the key input features and prediction results as input variables. Based on a structured dataset, at least one algorithm, either a long short-term memory network or a gradient boosting tree, is trained to obtain a residual correction model, thereby achieving accurate prediction of current and future residuals. The key input features and prediction results acquired in real time are input into the trained residual correction model to obtain the residual prediction value. The difference between the predicted result and the predicted value of the residual correction model is calculated to obtain the corrected prediction result.
8. The method for accurately predicting water quality changes in a wastewater treatment process according to claim 1, characterized in that, The step of periodically retraining or incrementally updating the water quality prediction model based on the corrected prediction results includes: The accuracy, computational efficiency, and energy consumption reduction rate of the water quality prediction model were evaluated using mean square error, mean absolute percentage error, and coefficient of determination. Based on newly accumulated multi-source water quality data, the water quality prediction model is retrained regularly, and feature engineering of key input features is continuously optimized by combining sensitivity analysis.
9. The method for accurately predicting water quality changes in a wastewater treatment process according to claim 1, characterized in that, The process of displaying the corrected prediction results in real time through a visual interface and matching the corrected prediction results with the set tiered early warning thresholds to trigger corresponding early warning signals, thereby achieving multi-level early warning from alert to emergency response, includes: The corrected prediction results are input into the visualization interface, which generates and overlays a comparison chart of the future water quality change trend line and the actual measured value in real time, and provides the confidence interval of the prediction results to assess the reliability of the prediction results. By combining the prediction results with the national emission standard limits, the graded early warning thresholds are dynamically calculated and generated; When the corrected prediction results reach the different levels of graded early warning thresholds, the corresponding early warning response process is automatically triggered, which pushes prompt information, executes automatic process adjustment, and initiates emergency control commands.
10. A precise prediction system for water quality changes during wastewater treatment, characterized in that, include: The multi-source monitoring module is used to collect multi-source water quality data of the wastewater treatment process in the target wastewater area in real time through multi-parameter water quality sensors; The data processing module is used to clean and standardize multi-source water quality data, extract time features and statistical features, and select key input features from time features and statistical features in combination with wastewater treatment processes. The model building module is used to construct a time series prediction model based on a long short-term memory network, and to use the time series prediction model to capture the temporal dependence of water quality changes in the target wastewater area; it also constructs a mechanism model based on the wastewater treatment process, and uses an optimization mechanism to statically calibrate the parameters of the mechanism model. The model fusion prediction module is used to deeply fuse the time series prediction model with the calibrated mechanistic model through a serial architecture to construct a water quality prediction model. The water quality prediction model is then optimized using a multi-objective optimization algorithm. Key input features are input into the optimized water quality prediction model for processing to generate prediction results. The residuals in the prediction results are then learned and corrected to obtain corrected prediction results, thereby improving the prediction accuracy and reliability of the water quality prediction model. The iterative training module is used to periodically retrain or incrementally update the water quality prediction model based on the corrected prediction results. The data visualization module is used to display the corrected prediction results in real time through a visualization interface, and to match the corrected prediction results with the set graded early warning thresholds to trigger the corresponding early warning signals, so as to realize multi-level early warning from prompt to emergency.