Method for predicting effluent quality of sewage plant based on neural network model
Through a method based on a neural network model, combined with the sewage treatment plant process topology map and time window processing, the trainable weight matrix is optimized, which solves the difficult problem of effluent water quality prediction for multi-source and multi-line sewage treatment plants and achieves high-precision water quality prediction.
Patent Information
- Application Number
- CN202511178234.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-21
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2045-08-21
AI Technical Summary
The existing sewage treatment plant effluent water quality prediction algorithm is difficult to achieve high-precision prediction of sewage treatment plants with multiple sources of water and multiple treatment lines, especially the prediction of effluent water quality after multiple treatment lines converge.
A method based on a neural network model is adopted to determine the process topology of the sewage treatment plant, divide the time window, and use a trainable weight matrix to perform data transformation and activation function processing. Combined with the back propagation algorithm to optimize the model weights, high-precision prediction of the sewage treatment plant effluent water quality is achieved.
It achieves high-precision effluent water quality prediction based on the actual physical architecture of the sewage treatment plant, avoids the drawbacks of traditional black box models that ignore actual physical laws, and improves prediction accuracy.
Smart Images

Figure CN120673892A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of water quality prediction, and in particular to a method for predicting the effluent quality of a sewage treatment plant based on a neural network model. Background Art
[0002] A multi-source water inlet and multi-line treatment sewage plant refers to a sewage plant with more than one water inlet and more than one treatment line. Finally, multiple treatment lines will converge into a deep treatment unit to complete deep treatment and then discharge uniformly. This type of sewage plant is very common in the context of upgrading and transformation. Because its structure is more complex than that of a conventional sewage plant, it is more difficult to predict its effluent water quality.
[0003] Existing sewage treatment plant effluent water quality prediction algorithms are often based on mechanism models or big data driven models, which makes it difficult to achieve the goal of predicting the effluent water quality of sewage treatment plants with multiple sources of water and multiple treatment lines. Summary of the Invention
[0004] The embodiments of the present application provide a method for predicting the effluent quality of a sewage treatment plant based on a neural network model, comprising:
[0005] Determine a process topology diagram of the sewage treatment plant, wherein the process topology diagram includes a plurality of nodes and a plurality of first directed edges connecting the nodes, the sewage treatment plant includes a water inlet, a treatment unit, and an upgrading and transformation unit, the plurality of nodes include a head node corresponding to the water inlet, an intermediate node corresponding to the treatment unit, and a terminal node corresponding to the upgrading and transformation unit, and the first directed edges are used to indicate actual water flow directions between the nodes;
[0006] Divide the time series data of each node into time windows, and input the data in each time window of each node into the neural network model, wherein the window length is a first preset time length and the sliding step length is a second preset time length;
[0007] Based on a trainable weight matrix of the neural network model, a linear transformation is performed on the data in each time window of the head-end node according to the corresponding first directed edge, and an activation function is performed on the linearly transformed data, wherein the trainable weight matrix includes the weight of the first directed edge and the weight of the second directed edge, and the second directed edge points from the terminal node to the predicted value of the neural network model;
[0008] Aggregate the data processed by the activation function in each time window of the head-end node with the data in each time window of the corresponding intermediate node, perform linear transformation according to the corresponding first directed edge, and perform activation function processing on the data after the linear transformation;
[0009] Aggregate the data processed by the activation function in each time window of the intermediate node with the data in each time window of the corresponding terminal node, perform linear transformation according to the corresponding second directed edge, and perform activation function processing on the linearly transformed data. The result is the predicted value of the neural network model;
[0010] Based on the deviation between the predicted value and the actual value, the trainable weight matrix is optimized to determine the neural network model;
[0011] Based on the determined neural network model, the effluent quality of the sewage treatment plant is predicted.
[0012] According to the neural network model-based prediction method for sewage treatment plant effluent quality of the present application, since its neural network model is determined based on the actual physical structure of the sewage treatment plant (such as the water inlet, treatment unit and upgrading unit), it avoids the disadvantages of traditional black box models that ignore the laws of the actual physical world and achieves high-precision effluent water quality prediction.
[0013] In some embodiments, the step of optimizing the trainable weight matrix based on the deviation between the predicted value and the actual value to determine the neural network model includes:
[0014] Based on the loss function, determine the deviation between the predicted value and the actual value;
[0015] Determine the gradient of the loss function with respect to each weight of the trainable weight matrix of the neural network model based on a back-propagation algorithm;
[0016] Based on the determined gradient of each weight, each weight is updated to optimize the trainable weight matrix and determine the neural network model.
[0017] In some embodiments, based on a back-propagation algorithm, the step of determining the gradient of the loss function with respect to each weight of the trainable weight matrix of the neural network model comprises:
[0018] Based on the back-propagation algorithm, the gradient of the loss function with respect to each weight of the trainable weight matrix of the neural network model and the gradient with respect to the bias of the neural network model are determined.
[0019] In some embodiments, based on the determined gradient of each weight, updating each weight to optimize the trainable weight matrix, the step of determining the neural network model includes:
[0020] Based on the learning rate, the determined gradient of each weight, and the gradient of the bias, each weight and bias is updated to optimize the trainable weight matrix and the bias, and determine the neural network model.
[0021] In some embodiments, the learning rate is 0.001.
[0022] In some embodiments, the loss function is a mean square error loss function.
[0023] In some embodiments, the sewage treatment plant includes multiple water inlets, and each headend node corresponds to each water inlet; and / or, the sewage treatment plant includes multiple treatment units, and each intermediate node corresponds to each treatment unit.
[0024] In some embodiments, the time series data of the head node includes: one or more of chemical oxygen demand (COD), ammonia nitrogen, total nitrogen, total phosphorus and flow rate; and / or, the time series data of the intermediate node includes: one or more of aeration volume, polyaluminum chloride (PAC) dosage, carbon source dosage, dissolved oxygen (DO) and mixed liquor suspended solids concentration (MLSS); and / or, the time series data of the end node includes: carbon source dosage.
[0025] In some embodiments, the steps of dividing the time series data of each node into time windows and inputting the data in each time window of each node into the neural network model include:
[0026] The time series data of each node is divided into time windows, the data in each time window of each node is Z-Score normalized, and the normalized data in each time window of each node is input into the neural network model.
[0027] In some embodiments, the aggregation is splicing, and / or the activation function is a ReLU activation function, and / or the second preset time length is 1 hour. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 A flowchart showing a method for predicting effluent quality of a sewage treatment plant based on a neural network model according to some embodiments of the present application is shown;
[0029] Figure 2 A schematic diagram showing a process topology diagram provided according to some embodiments of the present application;
[0030] Figure 3 A flowchart for determining a neural network model according to some embodiments of the present application is shown. DETAILED DESCRIPTION
[0031] The following is an explanation of the embodiments of the present invention by specific specific examples. Those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. Although the description of the present invention will be introduced in conjunction with the preferred embodiment, this does not mean that the features of this invention are limited to this embodiment. On the contrary, the purpose of introducing the invention in conjunction with the embodiment is to cover other options or modifications that may be extended based on the claims of the present invention. In order to provide a deep understanding of the present invention, the following description will contain many specific details. The present invention can also be implemented without using these details. In addition, in order to avoid confusion or blurring the focus of the present invention, some specific details will be omitted in the description. It should be noted that the embodiments of the present invention and the features in the embodiments can be combined with each other without conflict.
[0032] It should be noted that in this specification, similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not need to be further defined or explained in subsequent drawings.
[0033] The specific implementation of the present application will be described in detail below with reference to the accompanying drawings.
[0034] Figure 1 A flowchart of a method for predicting the effluent quality of a sewage treatment plant based on a neural network model according to some embodiments of the present application is shown. Figure 1 ,The prediction method of sewage treatment plant effluent quality includes the following steps:
[0035] Step S1, determining the process topology of the sewage treatment plant.
[0036] In some embodiments, a sewage treatment plant may include an inlet, treatment units, and upgrading units. The process topology diagram includes multiple nodes and multiple first directed edges connecting each node. The multiple nodes include a head node corresponding to the inlet, intermediate nodes corresponding to the treatment units, and terminal nodes corresponding to the upgrading units. The first directed edges are used to indicate the actual direction of water flow between the nodes.
[0037] Figure 2 Schematic diagram showing a process topology diagram provided according to some embodiments of the present application. Figure 2As shown, there are two water inlets, corresponding to the two headend nodes (node 1 and node 4); two treatment units, corresponding to the two intermediate nodes (node 2 and node 5); and one upgrading unit, corresponding to the terminal node (node 3). The first directed edge indicates the actual flow direction between nodes. For example, if water flows from node 1 to node 2, the first directed edge points from node 1 to node 2; if water flows from node 4 to node 5, the first directed edge points from node 4 to node 5; and if water flows from nodes 2 and 5 to node 3, the first directed edges point from node 2 and node 5 to node 3, respectively.
[0038] It should be noted that Figure 2 Only the case where the sewage treatment plant includes two water inlets, two treatment units and one upgrading and transformation unit is shown. According to actual conditions, the sewage treatment plant may include multiple water inlets (greater than two) and multiple treatment units (greater than two). Each head-end node corresponds to each water inlet, and each intermediate node corresponds to each treatment unit. There is no limit on the number of head-end nodes, intermediate nodes and tail-end nodes. Those skilled in the art can determine the corresponding process topology diagram based on the actual conditions of the sewage treatment plant.
[0039] In step S2, the time series data of each node is divided into time windows, and the data in each time window of each node is input into the neural network model.
[0040] The window length is a first preset time length (for example, T hours, where T may be 24 hours), and the sliding step length is a second preset time length (for example, 1 hour).
[0041] For example, the time series data of the head-end node include: chemical oxygen demand (COD), ammonia nitrogen ( ), one or more of total nitrogen (TN), total phosphorus (TP) and flow rate; and / or, the time series data of the intermediate node include: one or more of aeration volume, polyaluminum chloride (PAC) dosage, carbon source dosage, dissolved oxygen (DO) and mixed liquor suspended solids concentration (MLSS); and / or, the time series data of the terminal node include: carbon source dosage.
[0042] Step S3: Based on the trainable weight matrix of the neural network model, linear transformation is performed on the data in each time window of the head-end node according to the corresponding first directed edge, and activation function processing is performed on the linearly transformed data.
[0043] The trainable weight matrix includes the weight of the first directed edge and the weight of the second directed edge, where the second directed edge points from the terminal node to the predicted value of the neural network model (e.g. Figure 2 Node 3 is shown pointing to the output value. In some embodiments, the activation function may be a ReLU activation function.
[0044] For example, if Figure 2 As shown in the figure, the data X1 within each time window of the head-end node (node 1) is linearly transformed according to the edge weight of the corresponding first directed edge 1→2 (i.e., node 1 points to node 2), and the activation function is applied to the data after the linear transformation. Similarly, the data X4 within each time window of the head-end node (node 4) is linearly transformed according to the edge weight of the corresponding first directed edge 4→5 (i.e., node 4 points to node 5), and the activation function is applied to the data after the linear transformation.
[0045] For example, the data X1 in each time window of the head node (node 1) is a matrix with b rows and 5 columns (b×5); b rows represent the number of each data type in the time window is b; 5 columns represent 5 data types, namely chemical oxygen demand (COD), ammonia nitrogen ( ), total nitrogen (TN), total phosphorus (TP) and flow; after linear transformation and activation function processing, the result is a matrix with b rows and 1 column (b×1). Similarly, the data X4 in each time window of the head node (node 4) is a matrix with b rows and 5 columns (b×5); b rows represent the number of each data type in the time window is b; 5 columns represent 5 data types, namely chemical oxygen demand (COD), ammonia nitrogen ( ), total nitrogen (TN), total phosphorus (TP) and flow; after linear transformation and activation function processing, the result is a matrix with b rows and 1 column (b×1).
[0046] Step S4: Aggregate the data processed by the activation function in each time window of the head-end node with the data in each time window of the corresponding intermediate node, perform linear transformation according to the corresponding first directed edge, and perform activation function processing on the data after linear transformation.
[0047] In some embodiments, aggregation is performed as concatenation. For example, the data X2 within each time window of an intermediate node (node 2) comprises a matrix with b rows and 3 columns (b × 3). The b rows represent the number of each data type within the time window, which is b; the 3 columns represent the 3 data types, namely, dosage, aeration rate, and MLSS. The data X5 within each time window of an intermediate node (node 5) comprises a matrix with b rows and 3 columns (b × 3).
[0048] For example, the activation function-processed data (b rows, 1 column) within each time window of the source node (node 1) is concatenated with the data (b rows, 3 columns) within each time window of the intermediate node (node 2), forming a b-row, 4-column (b×4) matrix. A linear transformation is then performed according to the edge weight of the corresponding first directed edge 2→3, and the activation function is applied to the transformed data. The result is a b-row, 1-column (b×1) matrix. Similarly, the activation function-processed data (b rows, 1 column) within each time window of the source node (node 4) is concatenated with the data (b rows, 3 columns) within each time window of the intermediate node (node 5), forming a b-row, 4-column (b×4) matrix. A linear transformation is then performed according to the edge weight of the corresponding first directed edge 4→5, and the activation function is applied to the transformed data. The result is a b-row, 1-column (b×1) matrix.
[0049] In step S5, the data processed by the activation function in each time window of the intermediate node is aggregated with the data in each time window of the corresponding terminal node, and linear transformation is performed according to the corresponding second directed edge, and the activation function is processed on the linearly transformed data. The result is the predicted value of the neural network model.
[0050] Exemplarily, the data X3 in each time window of the terminal node (node 3) includes a matrix of b rows and 1 column (b×3); b rows represent that the number of each data type in the time window is b; 1 column represents that there is 1 data type, that is, the carbon source dosage.
[0051] For example, the data processed by the activation function in each time window of the intermediate node (node 2) (b rows and 1 column) and the data processed by the activation function in each time window of the intermediate node (node 5) (b rows and 1 column) are respectively concatenated with the data in each time window of the corresponding terminal node (node 3) (b rows and 1 column) to form a matrix of b rows and 3 columns (b×3). The matrix (b×3) is linearly transformed according to the edge weight of the corresponding second directed edge 3→output value, and the activation function is processed on the linearly transformed data. The result is a matrix of b rows and 1 column (b×1), which is the predicted value of the neural network model.
[0052] Step S6: Based on the deviation between the predicted value and the actual value, the trainable weight matrix is optimized to determine the neural network model.
[0053] Step S7: predicting the effluent quality of the sewage treatment plant based on the determined neural network model.
[0054] For example, the neural network model determined by the data input value within the latest time window collected by each node can be used to predict the effluent water quality of the sewage treatment plant at a future time. In some embodiments, the prediction indicators of effluent water quality include chemical oxygen demand (COD), ammonia nitrogen ( ), total nitrogen (TN) and total phosphorus (TP), using channel-by-channel independent prediction.
[0055] According to the neural network model-based prediction method for sewage treatment plant effluent quality in this application, since its neural network model is determined based on the actual physical structure of the sewage treatment plant (such as the water inlet, treatment unit and upgrading unit), it avoids the disadvantages of traditional black box models that ignore the laws of the actual physical world and achieves high-precision effluent water quality prediction.
[0056] In some embodiments, step S6, based on the deviation between the predicted value and the actual value, optimize the trainable weight matrix to determine the neural network model, reference Figure 3 , including the following steps:
[0057] Step S61: Determine the deviation between the predicted value and the actual value based on the loss function.
[0058] In some embodiments, the loss function is a mean square error loss function.
[0059] (1);
[0060] In formula (1), L represents the mean square error loss function; (i) is the measured value; (i) is the predicted value; N is the number of samples; K is the number of prediction indicators (the number of predicted data types).
[0061] Significant errors are amplified by the squaring operation, forcing the model to prioritize correcting major deviations.
[0062] Step S62: Determine the gradient of the loss function relative to each weight of the trainable weight matrix of the neural network model based on the back propagation algorithm.
[0063] Step S63: Based on the determined gradient of each weight, update each weight to optimize the trainable weight matrix and determine the neural network model.
[0064] In some embodiments, step S62, determining the gradient of the loss function relative to each weight of the trainable weight matrix of the neural network model based on a back-propagation algorithm, includes the following steps:
[0065] Based on the back-propagation algorithm, the gradient of the loss function with respect to each weight of the trainable weight matrix of the neural network model and the gradient with respect to the bias of the neural network model are determined.
[0066] In some embodiments, step S63, based on the determined gradient of each weight, updating each weight to optimize the trainable weight matrix, determines that the neural network model includes the following steps:
[0067] Based on the learning rate, the determined gradient of each weight, and the gradient of the bias, each weight and bias is updated to optimize the trainable weight matrix and the bias, and determine the neural network model.
[0068] In some embodiments, the learning rate is 0.001.
[0069] In some embodiments, step S2, dividing the time series data of each node into time windows and inputting the data in each time window of each node into the neural network model, includes:
[0070] The time series data of each node is divided into time windows, the data in each time window of each node is Z-Score normalized, and the normalized data in each time window of each node is input into the neural network model.
[0071] In some embodiments, when implementing aggregation (e.g., splicing) between two nodes (e.g., node 1 and node 2, node 2 and node 3, node 4 and node 5, and node 5 and node 3), an aggregation weight is also considered. For example, the aggregation weight can be determined based on the proportion of water inlet flow. For example, when nodes 1 and 2 are aggregated, the initial aggregation weight is the proportion of water inlet flow between nodes 1 and 2. For details, reference can be made to the aforementioned trainable weight matrix for optimization, and no further details are given here.
[0072] For example, when aggregating nodes 1 and 2, the activation function-processed data (b rows, 1 column) from the head node (node 1) within each time window is first calculated based on the corresponding aggregation weights and then concatenated with the data (b rows, 3 columns) from each time window of the intermediate node (node 2), forming a matrix with b rows and 4 columns (b × 4). The aggregation of other nodes is similar and will not be repeated here.
[0073] Although the present application has been shown and described with reference to certain preferred embodiments thereof, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the application.
Claims
1. A method for predicting the effluent quality of a sewage treatment plant based on a neural network model, characterized in that: include: Determine a process topology diagram of the sewage treatment plant, wherein the process topology diagram includes a plurality of nodes and a plurality of first directed edges connecting the nodes, the sewage treatment plant includes a water inlet, a treatment unit, and an upgrading unit, the plurality of nodes include a head node corresponding to the water inlet, an intermediate node corresponding to the treatment unit, and a terminal node corresponding to the upgrading unit, and the first directed edges are used to indicate actual water flow directions between the nodes; Divide the time series data of each node into time windows, and input the data in each time window of each node into the neural network model, wherein the window length is a first preset time length and the sliding step length is a second preset time length; Based on a trainable weight matrix of the neural network model, linearly transform the data in each time window of the head-end node according to the corresponding first directed edge, and perform activation function processing on the linearly transformed data, wherein the trainable weight matrix includes the weight of the first directed edge and the weight of the second directed edge, and the second directed edge points from the terminal node to the predicted value of the neural network model; Aggregating the data processed by the activation function in each time window of the head-end node with the data in each time window of the corresponding intermediate node, performing linear transformation according to the corresponding first directed edge, and performing activation function processing on the data after the linear transformation; Aggregating the data processed by the activation function in each time window of the intermediate node with the data in each time window of the corresponding terminal node, performing a linear transformation according to the corresponding second directed edge, and performing activation function processing on the linearly transformed data, the result of which is the predicted value of the neural network model; Optimizing the trainable weight matrix based on the deviation between the predicted value and the actual value to determine the neural network model; Based on the determined neural network model, the effluent water quality of the sewage treatment plant is predicted.
2. The method for predicting the effluent quality of a sewage treatment plant based on a neural network model according to claim 1, characterized in that: The step of optimizing the trainable weight matrix based on the deviation between the predicted value and the actual value to determine the neural network model includes: Determining the deviation between the predicted value and the actual value based on the loss function; Determining, based on a back-propagation algorithm, the gradient of the loss function with respect to each weight of a trainable weight matrix of the neural network model; Based on the determined gradient of each weight, each weight is updated to optimize the trainable weight matrix and determine the neural network model.
3. The method for predicting the effluent quality of a sewage treatment plant based on a neural network model according to claim 2, characterized in that: The step of determining the gradient of the loss function relative to each weight of the trainable weight matrix of the neural network model based on the back propagation algorithm includes: Based on a back-propagation algorithm, the gradient of the loss function with respect to each weight of the trainable weight matrix of the neural network model and the gradient with respect to the bias of the neural network model are determined.
4. The method for predicting the effluent quality of a sewage treatment plant based on a neural network model according to claim 3, characterized in that: The step of updating each weight based on the determined gradient of each weight to optimize the trainable weight matrix and determining the neural network model includes: Based on the learning rate, the determined gradient of each weight, and the determined gradient of the bias, each weight and bias is updated to optimize the trainable weight matrix and the bias, thereby determining the neural network model.
5. The method for predicting the effluent quality of a sewage treatment plant based on a neural network model according to claim 4, characterized in that: The learning rate is 0.
001.
6. The method for predicting the effluent quality of a sewage treatment plant based on a neural network model according to claim 2, characterized in that: The loss function is a mean square error loss function.
7. The method for predicting effluent quality of a sewage treatment plant based on a neural network model according to claim 1, characterized in that: The sewage treatment plant includes multiple water inlets, and each head end node corresponds to each water inlet; and / or, the sewage treatment plant includes multiple treatment units, and each intermediate node corresponds to each treatment unit.
8. The method for predicting effluent quality of a sewage treatment plant based on a neural network model according to claim 1, characterized in that: The time series data of the head node includes: one or more of chemical oxygen demand, ammonia nitrogen, total nitrogen, total phosphorus and flow rate; and / or, the time series data of the intermediate node includes: one or more of aeration volume, polyaluminum chloride dosage, carbon source dosage, dissolved oxygen and mixed liquid suspended solids concentration; and / or, the time series data of the terminal node includes: carbon source dosage.
9. The method for predicting effluent quality of a sewage treatment plant based on a neural network model according to claim 1, characterized in that: The step of dividing the time series data of each node into time windows and inputting the data in each time window of each node into the neural network model includes: The time series data of each node is divided into time windows, the data in each time window of each node is Z-Score normalized, and the normalized data in each time window of each node is input into the neural network model.
10. The method for predicting effluent quality of a sewage treatment plant based on a neural network model according to claim 1, characterized in that: The aggregation is splicing, and / or the activation function is a ReLU activation function, and / or the second preset time length is 1 hour.
Citation Information
Patent Citations
Intelligent intercepting well monitoring system and monitoring method based on deep learning
CN113931270A
Water quality index prediction method based on mixed space-time diagram convolutional neural network
CN117874618A
Method and system for automatically obtaining sewage collection range
CN118586900A
Outlet water quality parameter prediction method and device based on full-connection neural network model
CN119514787A
System and method for an artificial intelligence engine forecasting water quality
US20220343194A1