Construction method and application of water inflow anomaly recognition model

By constructing an influent anomaly identification model and reconstructing and coupling MLP and CNN models, the timeliness and accuracy problems of influent anomaly identification in existing technologies are solved, enabling timely identification and early warning of influent anomalies in sewage treatment plants and supporting intelligent management of sewage treatment plants.

CN120873674APending Publication Date: 2025-10-31HUAZHONG UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510952489.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-10
Publication Date
2025-10-31

AI Technical Summary

Technical Problem

Existing technologies are insufficient for timely and accurate identification of influent anomalies in wastewater treatment plants, especially under complex operating conditions. Traditional threshold methods and existing intelligent identification models lack a linkage mechanism, resulting in high monitoring costs and insufficient timeliness, making it impossible to achieve intelligent and precise management.

Method used

A water quality-based influent anomaly identification model is constructed. By combining the correlation between influent and effluent COD, a multilayer perceptron (MLP) and convolutional neural network (CNN) model are used for reconstruction coupling to achieve linkage discrimination of influent anomalies. Anomaly identification is performed by combining threshold comparison.

Benefits of technology

It enables timely and accurate identification of influent anomalies in wastewater treatment plants, reduces monitoring costs, increases monitoring frequency and early warning capabilities, supports intelligent management of wastewater treatment plants, and can predict abnormal events 12-20 hours in advance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120873674A_ABST
    Figure CN120873674A_ABST
Patent Text Reader

Abstract

The invention belongs to the field of sewage treatment and water quality monitoring, and particularly relates to a construction method and application of a water inflow anomaly recognition model based on water quality. The water inflow anomaly recognition model comprises the steps of obtaining a historical data set; constructing a water inlet soft measurement MLP module and a water outlet prediction CNN module; performing reconstruction coupling on the water inlet soft measurement MLP module and the water outlet prediction CNN module to obtain a water inlet anomaly recognition model; the independent variables of the inflow water abnormity identification model are inflow water pH value, inflow water conductivity, inflow water dissolved oxygen and inflow water oxidation-reduction potential, and the dependent variable of the inflow water abnormity identification model is effluent chemical oxygen demand. According to the invention, the advantages of each model are fully exerted to improve the prediction precision and robustness; through verification, compared with a simple series model, the reconstruction coupling model provided by the invention can still keep good prediction performance even under the conditions of limited data samples and large volatility.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of wastewater treatment water quality monitoring, and more specifically, relates to a method for constructing and applying an influent anomaly identification model based on water quality. Background Technology

[0002] Integrated wastewater treatment plants typically collect mixed industrial and domestic wastewater, serving as final collection and treatment facilities before discharge and playing a crucial role in maintaining a stable aquatic environment. However, fluctuations or shock loads from industrial sources (such as surges in organic pollutants or toxic substances) can disrupt biological treatment processes and pose significant challenges to achieving wastewater treatment standards. Chemical oxygen demand (COD), a key water quality parameter reflecting the concentration of organic pollutants in water bodies, is a sensitive indicator of influent anomalies, a core indicator reflecting the organic pollution load in water bodies, and one of the core parameters highly monitored in operation and management. Traditional COD anomaly monitoring mainly relies on manual sampling and testing, and fixed thresholds based on operational experience; once the COD concentration exceeds a preset range, it indicates an exceedance of standards.

[0003] This influent threshold method, based on wastewater treatment plant design, is simple and direct, and is often used as the lower limit of influent water quality standards. However, because sampling is done daily, when there is a severe overload of influent due to the discharge of highly toxic, recalcitrant industrial wastewater, situations leading to substandard effluent treatment can frequently occur, even if the monitoring requirements of this threshold method are met. In other words, the threshold method cannot effectively identify abnormal influent water quality events.

[0004] In recent years, with the development of artificial intelligence technology and machine learning models, researchers have proposed various data-driven intelligent anomaly recognition models and algorithms, and have attempted to introduce predictive analytics and pattern recognition methods to improve recognition efficiency and accuracy. However, current research generally suffers from fragmented methods and a lack of unified systems. Furthermore, limitations in the hardware sensing layer result in a significant lack of available data for online monitoring, hindering the formation of a coherent system. Existing research can be broadly categorized into the following representative methods: Time-series prediction model-based methods, such as deep learning models like Long Short-Term Memory (LSTM) neural networks, are used to learn the time-series patterns of wastewater quality parameters and make short-term predictions of key indicators, aiming to identify anomalies through the deviation between predicted and measured values. This method can capture the time-series dependence of water quality indicators, improving prediction accuracy and sensitivity to anomaly changes. However, current applications are mostly limited to independent modeling and prediction of single parameters, lacking comprehensive analysis of the correlation between multiple key factors. Prediction results are often independent of the anomaly detection mechanism, and a complete linkage identification system has not been formed.

[0005] Prediction methods based on causal graph models: These methods utilize causal inference and causal graph techniques to construct multi-parameter correlation models of wastewater treatment plant influent quality, enabling joint prediction of key water quality indicators (such as COD and total nitrogen). By uncovering causal relationships between parameters, these methods improve the reliability and interpretability of influent water quality trend prediction. However, these causal prediction models primarily focus on trend forecasting of influent water quality, falling into the category of pure prediction. In practical applications, prediction models are often disconnected from anomaly detection; even if changes in indicators such as COD can be predicted in advance, there is a lack of mechanisms to use the prediction results for automatic anomaly early warning.

[0006] Anomaly detection methods based on statistical Gaussian models: Other studies employ statistical methods to model the distribution of water quality data under normal operating conditions, detecting anomalies by the degree of deviation from the distribution. For example, multivariate Gaussian distribution models combined with cross-validation are used to identify outliers in wastewater treatment process monitoring data to pinpoint abnormal time periods in dissolved oxygen (DO) meter readings. Statistical models are relatively sensitive to noise and outliers, and can quantify the confidence level of "anomalies" to a certain extent. However, such methods typically perform local anomaly detection on single sensors or single-parameter datasets, lacking a comprehensive assessment of the overall influent water quality. Furthermore, statistical models struggle to utilize massive historical time-series patterns, resulting in insufficient early warning capabilities for trend changes.

[0007] In summary, existing technical solutions mostly involve localized modeling and lack a coordinated mechanism: they either focus on single-parameter prediction or concentrate on detecting a specific type of anomaly, making it difficult to form a holistic anomaly identification architecture with interconnected elements. Specifically, in the application of COD, a key indicator for influent, there is currently no systematic intelligent framework that tightly integrates multi-parameter time-series prediction with anomaly identification decisions, with COD at its core. Existing solutions have not yet achieved a comprehensive influent anomaly identification system driven by key indicators and linking prediction and identification at the overall framework level. This makes it difficult to grasp abnormal influent under complex operating conditions in a timely and accurate manner, resulting in high monitoring costs, insufficient timeliness, and an inability to achieve intelligent and precise management. Summary of the Invention

[0008] Given the aforementioned shortcomings, a new technical approach is urgently needed to integrate prediction models and anomaly detection mechanisms to leverage their respective advantages and achieve proactive intelligent identification of influent anomalies in wastewater treatment plants. This application focuses on key water quality parameters, reconstructing and coupling multiple modules and combining them with anomaly identification methods for influent anomaly identification. In this influent anomaly identification model, the correlation between influent and effluent COD and other water quality parameters is utilized to first perform long-term dynamic prediction of water quality, and then the prediction results are compared with thresholds to achieve linked discrimination of influent anomalies. This key indicator-driven coupled prediction and anomaly identification method is expected to overcome the limitations of current models being scattered and independent, establishing an intelligent influent anomaly identification system with systematic and structured prediction capabilities and identification mechanisms, thereby significantly improving the early warning and response capabilities of wastewater treatment plants to influent anomalies.

[0009] To achieve the above objectives, in a first aspect, this application provides a method for constructing an influent anomaly identification model based on key time-series parameters of water quality, comprising: Step A: Obtain historical datasets, which include multiple sets of continuously sampled historical data. Each set of historical data includes influent parameters and effluent chemical oxygen demand. The influent parameters include influent pH, influent conductivity, influent redox potential, influent dissolved oxygen, and influent chemical oxygen demand. Step C: Construct an influent soft measurement (MLP) module with influent pH, influent conductivity, influent oxidation-reduction potential, and influent dissolved oxygen as independent variables and influent chemical oxygen demand (COD) as dependent variable; simultaneously, construct an effluent prediction CNN module with influent parameters as independent variables and effluent COD as dependent variable. Step D: Reconstruct and couple the influent soft measurement MLP module with the effluent prediction CNN module to obtain an influent anomaly identification model; The independent variables of the influent anomaly identification model are influent pH, influent conductivity, influent dissolved oxygen, and influent redox potential, while the dependent variable is effluent chemical oxygen demand.

[0010] Preferably, the sampling interval is 30 min to 120 min.

[0011] Preferably, the historical dataset also includes the total hydraulic residence time; the historical dataset covers a time period of at least 30 to 50 times the total hydraulic residence time. Between step A and step C, step B is also included: combining the total hydraulic retention time, performing a correlation analysis on the influent chemical oxygen demand and the effluent chemical oxygen demand to obtain a set of influent parameters corresponding to each effluent chemical oxygen demand. In step C, the independent variable used to construct the effluent prediction CNN module is a set of influent parameters corresponding to the effluent chemical oxygen demand of the dependent variable.

[0012] As a further preferred option, the correlation analysis uses the Pearson correlation coefficient or the Spearman correlation coefficient.

[0013] Preferably, between step A and step C, the missing historical data is supplemented using interpolation.

[0014] Preferably, in step C, when constructing the influent soft sensing MLP module and the effluent prediction CNN module, the parameters are optimized using a grid search combined with a five-fold cross-validation method.

[0015] Preferably, when performing the reconfiguration coupling, R is used. 2 RMSE, MAE, and MAPE are used as evaluation indicators for optimization effectiveness.

[0016] Secondly, this application provides a water inflow anomaly identification model constructed by the above-mentioned construction method.

[0017] Thirdly, this application provides an application of the above-mentioned water inflow anomaly identification model.

[0018] Preferably, the application includes: inputting the influent parameters to be measured into the influent anomaly identification model to obtain the influent anomaly detection results; the influent parameters to be measured include the influent pH, influent conductivity, influent dissolved oxygen, and influent redox potential of the water body to be measured.

[0019] As a further preferred embodiment, the specific method for obtaining the abnormal influent result is as follows: compare the effluent chemical oxygen demand corresponding to the influent parameter to be tested with a threshold; if it exceeds the threshold, it is judged as abnormal.

[0020] Overall, the technical solutions conceived in this application have the following beneficial effects compared with the prior art: 1. This application employs two machine learning models (MLP and CNN) to construct an influent soft sensing MLP module and an effluent prediction CNN module, respectively, to achieve time-series prediction of effluent chemical oxygen demand (COD), fully leveraging the advantages of each model to improve prediction accuracy and robustness; the influent soft sensing MLP module is characterized by low cost and high timeliness, greatly solving the lack of hardware sensing layer in wastewater treatment plants, reducing monitoring costs, increasing monitoring frequency, and enabling rapid identification of influent anomalies in wastewater treatment plants; 2. The reconstructed coupled model formed by combining the influent soft sensing MLP module and the effluent prediction CNN module maintains good predictive performance even with limited and highly volatile data samples, compared to a simple cascaded model. Since the output results can be obtained directly after the data is input into the coupled model, the reconstructed coupling mechanism can significantly improve operational efficiency while offering superior performance compared to cascaded coupling. This enables timely and accurate early warning of abnormal influent in wastewater treatment plants, serving the intelligent and precise management of wastewater treatment plants. 3. This application uses effluent chemical oxygen demand (COD) as the key water quality parameter and integrates the influent soft measurement (MLP) module and the effluent prediction CNN module to construct a model. Verification shows that even when the effluent COD is within an acceptable range at the same time point, influent anomalies can still be identified, achieving timely and accurate identification of influent anomalies in wastewater treatment plants. Verification also shows that this application can predict influent anomalies 12-20 hours in advance (approximately equivalent to 1-2 total hydraulic retention times). 4. This application addresses the problems of time-consuming parameter detection and difficulty in timely detection of abnormal events in the prior art. It utilizes a model that couples the influent soft measurement (MLP) module and the effluent prediction (CNN) module to provide water quality prediction results. It can set the effluent discharge limit constructed by relevant national standards as a threshold to identify influent anomalies, realize early warning of sudden influent anomalies, and ensure the stable operation of sewage treatment plants and the compliance of effluent standards. 5. This application proposes a method and application for constructing an influent anomaly identification model by combining the analysis of influent parameters and effluent chemical oxygen demand with the operating parameters of the wastewater treatment plant (i.e., total hydraulic retention time). In the construction process, the correlation analysis results between effluent chemical oxygen demand and influent parameters are utilized to realize the organic coupling and linkage of the "prediction-identification" process. Attached Figure Description

[0021] Figure 1 This is a flowchart of the method for constructing the new sequence to be interpolated in Comparative Example 1 and Embodiment 1 of this application; Figure 2 This application presents the correlation analysis results of influent and effluent COD between Comparative Example 1 and Example 1. Figure 3 This is a flowchart illustrating the reconfiguration coupling method provided in Embodiment 1 of this application; Figure 4 This is the criterion for judging the water inlet abnormalities in Comparative Example 1 and Example 1 provided in this application; Figure 5 This is a flowchart illustrating the series coupling method provided in Comparative Example 1 of this application; Figure 6a This is the effluent COD prediction effect of Comparative Example 1 provided in this application; Figure 6b This is the effect of water inlet anomaly identification provided in Comparative Example 1 of this application; Figure 7a This is the effluent COD prediction effect of Example 1 provided in this application; Figure 7b This demonstrates the effectiveness of abnormal water ingress identification in Embodiment 1 provided in this application. Figure 8 This is a schematic diagram showing the connection between neurons in the convolutional layer of a convolutional neural network (CNN) and the local receptive field region. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0023] Step A1: Obtain multiple sets of historical data continuously sampled every 30 min to 120 min from the wastewater treatment plant, as well as the total hydraulic retention time of the wastewater treatment plant, and construct a historical dataset; the historical dataset covers a time period of at least 50 times the total hydraulic retention time; Each set of historical data includes influent parameters and effluent chemical oxygen demand (COD). out ); The influent parameters include influent pH. in ), influent conductivity (EC) in ), Influent Oxidation-Reduction Potential (ORP) in ), influent dissolved oxygen (DO) in ) and influent chemical oxygen demand (COD) in ); Step A2: After sorting the multiple sets of historical data, data preprocessing is performed. The purpose of data preprocessing is to enhance data usability and compliance, mainly including missing value handling, smoothing and denoising, and data standardization. Missing values ​​are handled using the interpolate module built into the SciPy library, which includes pad, zero, quadratic, piecewise_polynomial, akima, from_derivatives, time, nearest, slinear, cubic, pchip, and cubicspline interpolation methods. The arithmetic mean of the 12 interpolations is taken as the final interpolation result. Smoothing and denoising are necessary measures to avoid excessive data fluctuations and overfitting of the model caused by noise. The smoothing and denoising method used in this invention is the Savitzky-Golay (SG) filtering method. Data standardization is performed using the standard deviation standardization method, the principle of which is as follows:

[0024] in, The data is standardized. This is the original data. The average value of the characteristic sequence. denoted as the standard deviation of the characteristic sequence.

[0025] Step B: Due to the significant time lag effect between the influent and effluent of the wastewater treatment plant, Pearson or Spearman correlation analysis is performed on the influent and effluent chemical oxygen demand (COD) in historical monitoring data, taking into account the total hydraulic retention time of the wastewater treatment plant, to clarify this time lag relationship. Specifically, for the effluent COD value at a specific moment, the influent parameters affecting the result usually exist within a time window before that effluent moment. By adjusting the time offset (i.e., lag time T) of the influent data relative to the effluent data and calculating the Pearson or Spearman correlation coefficients for different T values, the curve of the correlation coefficient changing with the lag time can be obtained. This curve can further determine a reasonable time lag interval. The starting point of this interval is when the correlation coefficient reaches its maximum value, and the ending point corresponds to the moment when the correlation coefficient drops significantly to the statistically uncorrelated level (or close to zero). Step C1: Based on step B, the effluent chemical oxygen demand is recombined with the relevant influent parameters to obtain a new historical dataset; The historical data sets are sorted in ascending order of chemical oxygen demand (COD) in the effluent. Based on this, historical data are extracted at equal intervals in a fixed ratio (e.g., training set: test set = 3:1) to construct a test set. The remaining historical data that are not extracted are used as the training set. This partitioning method can effectively avoid sample distribution bias that may be caused by random partitioning and ensure the representativeness of the training set and test set in terms of key parameter distribution. The training and test sets used to build the influent soft sensing (MLP) module should include the following parameters: the independent variable is the influent pH (pH). in EC (EC) in ), ORP (ORP in ), DO (DO) in The dependent variable is COD (COD) in The training and test sets for the CNN module used for effluent prediction should include the following parameters: the independent variable is the influent pH (pH). in EC (EC) in ), ORP (ORP in ), DO (DO) in COD (COD) in The dependent variable is effluent COD (COD). out ); Step C2: Based on the training set data of the influent soft measurement MLP module, the hyperparameters of the MLP algorithm are adjusted by using grid search combined with five-fold cross-validation to find the optimal parameter combination and construct the influent soft measurement MLP module for key water quality parameters. The intake soft sensing MLP module is built on the PyCharm integrated development environment and uses Python as the programming language. The module uses the MLP algorithm as its core, trains the model using a corresponding training set, and adjusts its hyperparameters using grid search combined with five-fold cross-validation to achieve a goodness of fit (R²). 2 The root mean square error (RMSE), mean absolute error (MAE), and mean absolute percentage error (MAPE) were used as evaluation metrics to find the optimal parameter combination. Among the parameter combinations, the impact of four key hyperparameters—number of layers (n_layer), activation function, number of training epochs, and learning rate—on model performance was explored. First, the impact on the model was investigated by controlling the variation of individual parameters. The value ranges and intervals for each parameter were as follows: n_layer ranged from 1 to 5, with an interval of 1; the activation functions were tanh, relu, and logistic; the epochs ranged from 50 to 250, with an interval of 10; and the learning rate ranged from 0.001 to 0.01, with an interval of 0.001. After determining the approximate range of the optimal parameters, the interaction effects between the four parameters were considered. A grid search combined with five-fold cross-validation was used to comprehensively adjust the four parameters. Finally, R0 was used as the optimal parameter value. 2 RMSE, MAE, and MAPE are used as evaluation indicators for optimization performance. The optimal combination of parameters that maintains high fit while minimizing error is sought, and these are used as parameters for the soft sensing module to construct the influent soft sensing MLP module. Among these, R... 2 The definitions of RMSE, MAE, and MAPE are as follows: goodness of fit ( The value () represents the goodness of fit of the regression equation to the measured values. A value less than or equal to 1 indicates a better fit; the closer the value is to 1, the better the fit. Its definition is as follows:

[0026] in: —Measured value; —Predicted value; --average value.

[0027] Root Mean Squared Error The square root error (SFO) represents the mean square error between the predicted and measured values. It is greatly affected by outliers and penalizes larger errors more severely. 0 indicates a perfect fit. Its definition is as follows:

[0028] in: —Sample size; —Measured value; —Predicted value.

[0029] Mean Absolute Error The mean absolute error between the predicted and measured values ​​is represented by ( ). Compared to RMSE, it is more sensitive to smaller errors. 0 indicates a perfect fit. Its definition is as follows:

[0030] in: —Sample size; —Measured value; —Predicted value.

[0031] Mean Absolute Percentage Error The mean absolute error (MAE) represents the percentage deviation from the measured value. Its value is not affected by outliers. It cannot be used when the measured value is 0. Its definition is as follows:

[0032] in: —Sample size; —Measured value; —Predicted value.

[0033] Step C3: Based on the training set data of the effluent prediction CNN module, the hyperparameters of the CNN algorithm are adjusted by using grid search combined with five-fold cross-validation to find the optimal parameter combination and construct an effluent prediction module for key water quality parameters. The water outflow prediction CNN module is built using the PyCharm integrated development environment and Python as the programming language. The module uses the CNN algorithm as its core, trains the model on a suitable training set, and adjusts its hyperparameters using grid search combined with five-fold cross-validation. R...2 RMSE, MAE, and MAPE were used as evaluation metrics to find the optimal parameter combination. Among the parameter combinations, the impact of five key hyperparameters on model performance was explored: number of layers (n_layer), activation function, number of training epochs, kernel size, and learning rate. First, the impact on the model was investigated by controlling the variation of individual parameters. The value ranges and intervals for each parameter were as follows: n_layer ranged from 1 to 5, with an interval of 1; activation functions were tanh, relu, and logistic; epochs ranged from 50 to 290, with an interval of 10; kernel sizes were 1*1, 3*3, and 5*5; and learning rate ranged from 0.0001 to 0.001, with an interval of 0.0001. After determining the approximate range of the optimal parameters, the interaction effects among the five parameters were considered. A grid search combined with five-fold cross-validation was used to comprehensively adjust the five parameters. Finally, R0 was used as the benchmark. 2 RMSE, MAE, and MAPE are used as evaluation indicators for optimization performance. The optimal combination of parameters is sought to maintain high fit while minimizing error, thereby constructing a water prediction CNN module.

[0034] Step D: Reconstruct and couple the influent soft measurement MLP module in step C2 with the effluent prediction CNN module in step C3 to build an influent anomaly identification model; The water ingress soft measurement MLP module with fixed hidden layers and the water outgress prediction CNN module with fixed convolutional layers are coupled together. At the same time, the remaining parameters of the water ingress soft measurement MLP module and the water outgress prediction CNN module, such as the learning rate and the number of training epochs, are adjusted to minimize the error of the entire water ingress anomaly recognition model. Specifically, a grid search combined with five-fold cross-validation was used to optimize it, and finally R was used. 2 RMSE, MAE, and MAPE are used as evaluation indicators for optimization effect. The optimal combination of parameters that can maintain high fit and minimize error is sought and used as parameters for coupling model to construct water inflow anomaly identification model.

[0035] Step E: Input the influent parameters to be measured into the influent anomaly identification model to obtain the corresponding effluent chemical oxygen demand, and compare it with the set threshold. If it exceeds the threshold, it is judged as an anomaly. The parameters to be measured for the influent include the pH, conductivity, dissolved oxygen, and redox potential of the influent. Specifically, the influent parameters to be measured and the corresponding effluent chemical oxygen demand are determined based on the time lag relationship obtained in step B. For example, if the influent chemical oxygen demand related to the effluent chemical oxygen demand is determined in step B, it is the influent chemical oxygen demand 12 to 20 hours before effluent discharge. In this step, it is necessary to collect the influent parameters to be measured for at least an 8-hour time interval to predict the effluent chemical oxygen demand 20 hours after the first collection of influent parameters. The threshold can be set according to local standards or those of the wastewater treatment plant. For example, taking the Class A standard of the national "Discharge Standard of Pollutants for Urban Wastewater Treatment Plants" (GB 18918-2002) as an example, the threshold can be set to 50 mg / L (i.e., COD). out (≤50mg / L), when the concentration exceeds this standard, it is judged as an abnormal influent.

[0036] This application employs a reconstructed coupling approach, enabling the influent anomaly identification model to more fully fit the nonlinear and time-varying characteristics of the wastewater treatment process. In the reconstructed coupling model, gradient backpropagation simultaneously adjusts the parameters of the influent soft sensing MLP module and the effluent prediction CNN module through the coupling structure, minimizing the overall system error. In this way, the influent soft sensing MLP module does not solely pursue soft sensing accuracy but collaborates with the effluent prediction CNN module to optimize the final effluent prediction loss. The influent soft sensing MLP module learns the most useful and stable feature representations for the effluent prediction CNN module (i.e., ignoring interference terms and highlighting key patterns), while the effluent prediction CNN module learns to effectively utilize the features provided by the influent soft sensing MLP module without excessively amplifying the noise. Through this combined effect, the two models achieve optimal coordination, thereby improving the overall model accuracy.

[0037] MLP models can extract nonlinear combinations of parameters (i.e., predicting influent COD using easily measurable influent water quality parameters), while CNN models excel at capturing local spatiotemporal patterns or sequence structure features (i.e., using parameters from 12-20 hours before effluent as input sequences to predict effluent COD). This modular fusion is equivalent to the idea of ​​model ensemble, reducing the bias and variance of a single model by combining the predictions of multiple sub-models. Research has shown that modular neural networks have stronger robustness and fault tolerance when handling complex sub-tasks. Each module focuses on feature extraction from different aspects, reducing interference between them and enabling the model to more precisely characterize data patterns, thus maintaining robust performance even under highly fluctuating data.

[0038] The embodiments of this application are implemented based on the technical solution of this application, and detailed implementation methods and processes are given. However, the protection scope of this application is not limited to the following embodiments. The process parameters in the following embodiments that do not specify specific conditions are generally based on conventional conditions.

[0039] The endpoints and any values ​​of the ranges disclosed in this application are not limited to the precise ranges or values, and these ranges or values ​​should be understood to include values ​​close to these ranges or values. For numerical ranges, the endpoint values ​​of the various ranges, the endpoint values ​​of the various ranges and individual point values, and individual point values ​​can be combined with each other to obtain one or more new numerical ranges, which should be considered as specifically disclosed in this application.

[0040] The embodiments of this application are described below with reference to the accompanying drawings.

[0041] The process parameters in the following examples, unless otherwise specified, are generally performed under conventional conditions.

[0042] Example 1 Step A1: Obtain multiple sets of historical data from the wastewater treatment plant, collected continuously every hour, as well as the design hydraulic retention time of the wastewater treatment plant; Specifically, the historical data used in Example 1 of this application were all collected from a combined industrial wastewater and domestic sewage treatment plant in Hubei Province from 10:00 AM on March 24, 2025 to 9:00 AM on April 18, 2025, with data collected every hour, totaling 24 * 25 days = 600 sets of data. The biochemical treatment process of this sewage treatment plant is AAO, and the influent consists of 70% domestic sewage and 30% industrial wastewater. An automatic sampler was installed at both the influent and effluent points of the sewage treatment plant, with a sampling interval of 1 hour. Water samples were extracted and stored in clean plastic sample bottles at 4°C. Water quality parameters were measured every 24 hours. The historical data specifically included: influent pH. in ), influent conductivity (EC) in ), Influent Oxidation-Reduction Potential (ORP) in ), influent dissolved oxygen (DO) in ), influent chemical oxygen demand (COD) in ), effluent chemical oxygen demand (COD) out ).

[0043] Step A2: Arrange the above-mentioned historical data into a time series and construct a historical dataset. Simultaneously, based on the wastewater treatment plant's design scheme, determine the design hydraulic time for the biological treatment section to be 12 hours. Missing values ​​were interpolated using the pad, zero, quadratic, piecewise_polynomial, akima, from_derivatives, time, nearest, slinear, cubic, pchip, and cubicspline interpolation methods built into the interpolate module in the SciPy library. The arithmetic mean of these 12 interpolations was taken as the final interpolation result. Furthermore, to improve the effective utilization of real data during interpolation and minimize missing values ​​in word fitting, this study constructed time series containing missing values ​​using the following method: data from the same time point on different dates were extracted to form new time series, resulting in 24 new interpolation sequences with one missing value. The interpolated data underwent SG filtering for smoothing, denoising, and standard deviation standardization to improve data integrity and usability. Figure 1 As shown. That is, in order to reduce missing values ​​in a single fitting process, the original sequences within different dates (Day t) (sampled at 1-hour intervals, so there are 24 sets of data) are combined into a new sequence by taking the sequence values ​​at the same time from 0:00, 1:00, 2:00 to 23:00, resulting in 24 new sequences with 1 missing value, and then interpolation is performed on the new sequences.

[0044] Step B: Because the influent and effluent of a wastewater treatment plant have a certain time lag, it is necessary to analyze the temporal correlation between historical parameters. The temporal correlation of key water quality parameters is determined based on the correlation analysis between influent and effluent COD, combined with the wastewater treatment plant's operating parameters (design hydraulic retention time). Pearson and Spearman correlation analyses are performed between influent and effluent COD, such as... Figure 2 The display shows the influent COD and the effluent chemical oxygen demand (COD) at different times. out The results of Pearson and Spearman correlation analyses showed that both correlation coefficients indicated that the influent chemical oxygen demand (COD) was high. in ) and the chemical oxygen demand (COD) of the effluent after 12 hours out The correlation was highest at 20 hours, but dropped to almost zero after 20 hours. This can be attributed to the influent chemical oxygen demand (COD) 20-12 hours before effluent discharge. in ( ) is an important characteristic that affects the prediction of COD in effluent; for example, the influent COD from AM00:00 to 8:00 will affect the effluent COD at PM8:00.

[0045] Step C1: Preprocess the raw dataset and bind the corresponding historical data into a group based on the effluent chemical oxygen demand (COD). out The samples are sorted in ascending order. Based on this, samples are drawn at fixed intervals of 3:1 (training set:test set = 3:1) to construct the test set. The remaining samples not drawn serve as the training set. The training and test sets for the influent soft sensing module are constructed, including the following influent parameters: influent pH... in ), influent conductivity (EC) in ), Influent Oxidation-Reduction Potential (ORP) in ), influent dissolved oxygen (DO) in ), influent chemical oxygen demand (COD) in ); Construct training and testing sets for the effluent prediction module, which include the following water quality parameters: effluent chemical oxygen demand (COD) at time T. out ) and the pH of the influent from (T-20) to (T-12) hours. in ), influent conductivity (EC) in ), Influent Oxidation-Reduction Potential (ORP) in ), influent dissolved oxygen (DO) in ), influent chemical oxygen demand (COD) in ); T represents any moment in the sampling of historical data; Step C2: Based on the training set data of the influent soft measurement module, using the multilayer perceptron (MLP) algorithm as the core, the hyperparameters are adjusted by combining grid search with five-fold cross-validation to find the optimal parameter combination and construct the influent soft measurement MLP module for key water quality parameters. Step C3: Based on the training set data of the effluent prediction module, using the Convolutional Neural Network (CNN) algorithm as the core, the hyperparameters are adjusted by combining grid search with five-fold cross-validation to find the optimal parameter combination and construct the effluent prediction CNN module for key water quality parameters. Step D: Based on the PyCharm integrated development environment, a soft measurement module for influent is built using Python as the programming language. The soft measurement module for influent is reconstructed and coupled with the CNN module for effluent prediction to build a multi-module fusion prediction model.

[0046] Figure 3 This demonstrates the coupling method for soft sensing and water inflow prediction modules. Specifically, it couples an MLP model with fixed hidden layers and a CNN model with fixed convolutional layers to obtain a water inflow anomaly identification model. The remaining hyperparameters, learning_rate (range 0.0001~0.001, interval 0.0001) and epochs (range 100~200, interval 10), are optimized using a grid search combined with five-fold cross-validation. Finally, R...2 RMSE, MAE, and MAPE are used as evaluation metrics for optimization performance. The optimal combination of parameters that maintains high fit while minimizing error is sought, and these parameters are used as the parameters for the coupled model to construct a multi-module fusion prediction model. Simultaneously, the parameters of the MLP and CNN are adjusted to minimize the error of the entire influent anomaly identification model. In this embodiment, after optimization, the influent soft sensing MLP model has 2 hidden layers, and the effluent prediction CNN model has 3 convolutional layers.

[0047] The optimized learning_rate is 0.0005, and epochs are 190. Under this parameter combination, the R-value of the multi-module fusion prediction model is [value missing]. 2 =0.822; RMSE=2.53; MAE=2.08; MAPE=4.91%.

[0048] Step E: Use the influent anomaly identification model to determine whether there are any abnormalities in the water quality.

[0049] Based on this, and according to the Class A standard of the National Standard for Pollutant Discharge from Municipal Wastewater Treatment Plants (GB 18918-2002) which limits effluent COD to 50 mg / L (i.e., CODout ≤ 50 mg / L), combined with the mean prediction error (MAE) of 1.94 mg / L from the effluent prediction module, the predicted range for the actual effluent COD can be considered as follows: 50 -1.94 ≤COD out ≤50 +1.94 Specifically: a predicted COD value greater than or equal to 51.94 mg / L is considered abnormal (exceeding the standard); a predicted COD value between 48.06 mg / L and 51.94 mg / L is considered a deviation (risk of exceeding the standard); and a predicted COD value less than 48.06 mg / L is considered normal (no risk). Figure 4 As shown, err represents the model prediction error.

[0050] Specifically, its input parameters are time points T-20 and T-12 (i.e., COD at time T). out The pH value of the influent (12-20 hours prior to the corresponding time point) in ), influent conductivity (EC) in ), Influent Oxidation-Reduction Potential (ORP) in ) and influent dissolved oxygen (DO) in The output parameter is the chemical oxygen demand (COD) of the effluent at time T. out This allows for the determination of whether any abnormalities exist, particularly when predicting the chemical oxygen demand (COD) of the effluent. out If the concentration exceeds 48.06 mg / L, the influent is considered abnormal. Figure 3 As shown.

[0051] Comparative Example 1 The same steps as in Embodiment 1 are repeated, except that in step D, the influent soft sensing (MLP) module and the effluent prediction (CNN) module are coupled in series to construct a multi-module fusion prediction model. Figure 5 This demonstrates a series coupling method, where two modules are directly connected in series. The process is divided into two parts. The first part uses an easily measurable parameter as input, namely the influent pH level. in ), influent conductivity (EC) in ), Influent Oxidation-Reduction Potential (ORP) in ) and influent dissolved oxygen (DO) in The first process outputs the predicted influent COD value via the influent soft measurement (MLP) module; the second process takes the influent COD value from the first process as input and outputs the predicted effluent COD value via the effluent prediction module.

[0052] The optimized parameter combination is: n_layer=2; activation function is ReLU; epochs=110; learning_rate=0.005. Under this parameter combination, the R-value of the influent soft sensing module is... 2 =0.834; RMSE=15.46; MAE=11.67; MAPE=8.11%.

[0053] Based on the PyCharm integrated development environment, a water outflow prediction module was built using Python as the programming language. Its core is a CNN algorithm, and the optimized parameter combination is: n_layer=3; ReLU activation function; epochs=190; learning_rate=0.0008; and a 3*3 kernel size. Under this parameter combination, the water outflow prediction module achieves high R... 2 =0.834; RMSE=2.44; MAE=1.94; MAPE=4.54%.

[0054] Comparative Example 2 According to the national standard "Discharge Standard of Pollutants for Municipal Wastewater Treatment Plants" (GB 18918-2002), a municipal wastewater treatment plant is defined as "...centralized wastewater treatment plants of various sizes and types (including various industrial parks, development zones, industrial clusters, etc.)". Therefore, the integrated wastewater treatment plant involved in this patent meets this definition and should comply with this standard. Furthermore, the "Discharge Standard of Pollutants for Municipal Wastewater Treatment Plants" clearly stipulates that "industrial wastewater and hospital wastewater discharged into municipal wastewater treatment plants should meet the indirect emission limits of the "Integrated Wastewater Discharge Standard" (GB 8978-1996) and relevant industry national pollutant emission standards, or the corresponding local standards." The "Integrated Wastewater Discharge Standard" (GB 8978-1996) explicitly states that "wastewater discharged into urban drainage systems equipped with secondary wastewater treatment plants shall comply with the tertiary standard," where the tertiary standard stipulates a COD emission limit of 500 mg / L for other wastewater discharge units. That is, the influent water quality requirement for this integrated wastewater treatment plant is COD ≤ 500 mg / L. Based on this range, all influent COD meets this standard. In other words, under this threshold standard, all incoming water meets the standard.

[0055] Experimental results verification Based on the dataset of the water ingress anomaly detection model, the performance of Example 1 and the comparative example was evaluated using accuracy and precision as evaluation metrics. The performance of the water ingress anomaly detection model was evaluated using accuracy, precision, false negative rate, recall, false positive rate, and F1 score as evaluation metrics. The definitions of each parameter are as follows: ①Accuracy ( )definition:

[0056] in: —True Positives: The number of predicted positive examples that were actually positive examples; —True Negatives: The number of cases that were predicted to be negative but were actually negative. —False Positives: The number of instances that were predicted to be positive but were actually negative. — False Negatives: The number of instances that were predicted to be negative but were actually positive.

[0057] The criterion for judging actual positive examples is the actual COD detected at any time point 12-20 hours after the current time. outThe value is greater than 50 mg / L; otherwise, it is judged as a negative example. In this embodiment, there are 96 actual positive examples (abnormal water quality) and 504 actual negative examples (normal water quality).

[0058] The predicted positive examples are based on the model's effluent chemical oxygen demand (COD). out The prediction of COD at any point in time 12-20 hours after the current time is determined by whether it exceeds the limit. out If the value is greater than 48.06 mg / L, it is considered a positive prediction; otherwise, it is considered a negative prediction.

[0059] ②Accuracy ( )definition:

[0060] in: —True Positives: The number of predicted positive examples that were actually positive examples; — False Positives: The number of instances that were predicted to be positive but were actually negative.

[0061] ③ False Negative Rate )definition:

[0062] in: —True Positives: The number of predicted positive examples that were actually positive examples; — False Negatives: The number of instances that were predicted to be negative but were actually positive.

[0063] ④ Recall rate ( )definition:

[0064] in: —True Positives: The number of predicted positive examples that were actually positive examples; — False Negatives: The number of instances that were predicted to be negative but were actually positive.

[0065] ⑤ False Positive Rate )definition:

[0066] in: —False Positives: The number of instances that were predicted to be positive but were actually negative. —True Negatives: The number of cases that were predicted to be negative but were actually negative.

[0067] ⑥F1 score ( )definition:

[0068] in: —Accuracy; —Recall rate.

[0069] The prediction results for Example 1 and Comparative Example 1 are shown in Figures 6 and 7, respectively. Figure 6a , Figure 7a In this context, "true" refers to the actual COD value, i.e., the measured COD value. "Predicted" refers to the COD value predicted by the model. Figure 6b , Figure 7b In this context, "normal" refers to the normal COD value, "correct" means the model prediction is correct, "unidentified" means not identified, and "error" means incorrect identification.

[0070] from Figure 6a , 7a It can be calculated that the anomaly detection accuracy of the water inflow anomaly identification model under the module reconstruction coupling method in Example 1 is 95.0%, while the anomaly detection accuracy of the water inflow anomaly identification model under the module series coupling method in Comparative Example 1 is 90.3%. Figure 6b , 7b The calculations show that the model precision of Example 1 is 87.2%, the false negative rate is 7.80%, the recall rate is 92.20%, the false positive rate is 4.14%, and the F1 score is 89.63; while the model precision of Comparative Example 1 is 76.1%, the false negative rate is 14.18%, the recall rate is 85.82%, the false positive rate is 8.28%, and the F1 score is 80.67.

[0071] Comparative Example 2 met the standard for COD in all influent samples. In other words, Comparative Example 2 had only negative examples and no positive examples. According to the above standard, Comparative Example 2 had an accuracy of 84%, a false negative rate of 100%, a recall rate of 0%, a false positive rate of 0%, and an F1 score of 0.

[0072] In summary, the model in Example 1 performs significantly better than the cascade coupling in Comparative Example 1 and the conventional detection method in Comparative Example 2.

[0073] Furthermore, according to the COD determination method specified in the "Integrated Wastewater Discharge Standard" (GB 8978-1996), namely the "Determination of Chemical Oxygen Demand in Water - Dichromate Method" (HJ 828—2017, which has replaced GB 11914-89 as the current standard), a digestion time of 2 hours is required. Therefore, the total measurement time is often at least 2 hours. If the anomaly identification method involved in the embodiments of this application is used, the acquisition time of easily measurable water quality parameters based on the electrode method is within 1 minute. Therefore, the identification method involved in this application can effectively reduce the identification time.

[0074] The difference between Example 1 and Comparative Example 1 may be because the coupled model can enhance feature representation and improve generalization performance by integrating the advantages of different modules; this module fusion can reduce the bias and variance of a single model by combining the predictions of multiple sub-models. Modular neural networks have stronger robustness and fault tolerance when dealing with complex sub-tasks. Each module focuses on different aspects of feature extraction, reducing interference between them, enabling the model to more finely characterize data patterns, thus maintaining robust performance even under highly volatile data.

[0075] Among them, the local receptive field and parameter sharing mechanism of CNN models can effectively combat data perturbation.

[0076] CNN networks, with their structure of local receptive fields and parameter sharing, help models combat input perturbations and improve generalization ability in environments with limited data and high noise. For example... Figure 8 As shown, each neuron (blue) in a convolutional layer of a CNN is connected to only one local receptive field region (red) in the input.

[0077] This local connectivity means that individual neurons are not affected by noise independent of the entire input space. Tiny perturbations in local regions of the input only affect the convolutional output within the corresponding receptive field, unlike in fully connected networks where perturbations propagate across all outputs. Mathematically, let the input signal... convolution kernel weights in( Then the convolution output can be represented as Each output Only depends on length The local segments ensure that small fluctuations in the input in a local area are not amplified globally.

[0078] Meanwhile, the convolutional layer employs a parameter-sharing mechanism, meaning that the same set of kernel parameters is applied to scan the input at different locations. This significantly reduces the number of free parameters in the model, effectively acting as implicit regularization. For example, for a length of... The input, the convolution kernel only has Each set of independent weights is required. If a fully connected layer is used to connect a local window of the same size to the output position, then each position of the window requires a separate set of weights, totaling approximately [number missing]. There are 100 parameters. CNNs, through weight sharing, reduce the parameter size from 100 to 1000. Reduced to This significantly reduces model complexity. Fewer parameters mean that the model's fitting ability is controlled, making it less likely to overfit to random noise patterns in a limited sample, thereby improving the model's robustness to disturbances in small sample and highly fluctuating data.

[0079] The MLP and CNN reconstruction coupling structure in this application achieves good generalization performance even with limited data through a hierarchical feature extraction mechanism. Hierarchical feature extraction refers to the model refining abstract features of data through multiple levels: the MLP model extracts low-level local patterns at shallow levels, while the CNN model gradually combines them at deeper levels to form higher-level abstract features. This layer-by-layer abstraction representation learning enables the model to grasp the core structure and patterns of the data, while gradually filtering out high-frequency noise or irrelevant variations.

[0080] Reconstructing the coupling design helps improve model stability and optimize error propagation paths. First, module decoupling reduces the difficulty of single-stage mapping. The serial coupling model in Comparative Example 1 works as follows: the MLP model maps the original influent signal to an intermediate representation (a soft measurement of COD concentration), and the CNN then predicts the effluent COD value based on this soft measurement and time-series relationship. In contrast, the reconstructed coupling model omits this intermediate process, or rather, combines it into one, making the function of each sub-module simpler and smoother, thus avoiding overly steep and complex mapping relationships. This design effectively limits the accumulation and amplification of errors between modules: the coupling model simultaneously performs filtering and smoothing functions, transforming the violent fluctuations or noise in the original signal into more stable features, equivalent to task-related denoising and reconstruction of the original data, reducing the impact of high-frequency disturbances on the final output.

[0081] From the perspective of error propagation, the coupled model also exhibits better fault tolerance and stability. In reconstructing the coupled model, gradient backpropagation adjusts the parameters of both the MLP and CNN simultaneously through the coupling structure, minimizing the overall system error. In this way, the MLP does not solely pursue soft measurement accuracy but works in conjunction with the CNN to optimize the loss for the final water emission prediction. As a result, the MLP learns the most useful and stable feature representations for the CNN (i.e., ignoring noise and highlighting key patterns), while the CNN learns to effectively utilize the features provided by the MLP without excessively amplifying noise. This combined effect allows the two models to achieve optimal cooperation, thereby improving the overall model accuracy.

[0082] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for constructing a water inflow anomaly identification model, characterized in that, include: Step A: Obtain historical datasets, which include multiple sets of continuously sampled historical data. Each set of historical data includes influent parameters and effluent chemical oxygen demand. The influent parameters include influent pH, influent conductivity, influent redox potential, influent dissolved oxygen, and influent chemical oxygen demand; Step C: Construct an influent soft measurement (MLP) module with influent pH, influent conductivity, influent oxidation-reduction potential, and influent dissolved oxygen as independent variables and influent chemical oxygen demand (COD) as dependent variable; simultaneously, construct an effluent prediction CNN module with influent parameters as independent variables and effluent COD as dependent variable. Step D: Reconstruct and couple the influent soft measurement MLP module with the effluent prediction CNN module to obtain an influent anomaly identification model; The independent variables of the influent anomaly identification model are influent pH, influent conductivity, influent dissolved oxygen, and influent redox potential, and the dependent variable is effluent chemical oxygen demand.

2. The construction method as described in claim 1, characterized in that, The historical dataset also includes the total hydraulic residence time; the historical dataset covers a time period of at least 30 to 50 times the total hydraulic residence time. Between step A and step C, step B is also included: combining the total hydraulic retention time, performing a correlation analysis on the influent chemical oxygen demand and the effluent chemical oxygen demand to obtain a set of influent parameters corresponding to each effluent chemical oxygen demand; In step C, the independent variable used to construct the effluent prediction CNN module is a set of influent parameters corresponding to the effluent chemical oxygen demand of the dependent variable.

3. The construction method as described in claim 2, characterized in that, The correlation analysis used either the Pearson correlation coefficient or the Spearman correlation coefficient.

4. The construction method as described in claim 1, characterized in that, Between step A and step C, the method further includes: supplementing missing historical data using interpolation.

5. The construction method as described in claim 1, characterized in that, In step C, when constructing the influent soft sensing (MLP) module and the effluent prediction (CNN) module, parameter optimization is performed using a grid search combined with a five-fold cross-validation method.

6. The construction method as described in claim 1, characterized in that, When performing the reconfiguration coupling in step D, R is used. 2 RMSE, MAE, and MAPE are used as evaluation indicators for optimization effectiveness.

7. The water inflow anomaly identification model constructed by the construction method described in any one of claims 1-6.

8. Application of the water inflow anomaly identification model as described in claim 7.

9. The application as described in claim 8, characterized in that, include: The parameters to be measured in the influent are input into the influent anomaly identification model to obtain the influent anomaly detection results; the parameters to be measured in the influent include the influent pH, influent conductivity, influent dissolved oxygen, and influent redox potential.

10. The application as described in claim 9, characterized in that, The specific method for obtaining the abnormal influent result is as follows: compare the chemical oxygen demand of the effluent corresponding to the influent parameter to be tested with a threshold; if it exceeds the threshold, it is judged as abnormal.