Method for predicting effluent quality of sewage plant based on neural network model
By employing a neural network model in wastewater treatment plants and optimizing weights based on process topology diagrams and backpropagation algorithms, the challenge of predicting effluent water quality in multi-source, multi-line wastewater treatment plants was solved, achieving high-precision effluent water quality prediction.
Patent Information
- Application Number
- CN202511178234.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-21
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2045-08-21
AI Technical Summary
Existing wastewater treatment plant effluent quality prediction algorithms are insufficient for achieving high-precision predictions for wastewater treatment plants with multiple influent sources and multiple treatment lines, especially for wastewater treatment plants with complex structures during upgrading and renovation.
A neural network-based approach is adopted. By determining the process topology of the wastewater treatment plant, a trainable weight matrix is used to perform linear transformation and activation function processing on the node data. The model weights are then optimized through backpropagation algorithm to achieve high-precision prediction of the effluent quality of the wastewater treatment plant.
It achieves high-precision effluent water quality prediction based on the actual physical architecture of sewage treatment plants, avoiding the drawbacks of traditional black-box models that ignore the laws of the actual physical world, and improving the accuracy of prediction.
Smart Images

Figure CN120673892B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of water quality prediction, and in particular to a method for predicting the effluent quality of wastewater treatment plants based on a neural network model. Background Technology
[0002] Multi-source influent and multi-line treatment wastewater treatment plants refer to wastewater treatment plants with more than one influent and more than one treatment line. Finally, multiple treatment lines converge into a deep treatment unit to complete deep treatment before unified discharge. Such wastewater treatment plants are very common in the context of upgrading and renovation. Due to their more complex structure compared to conventional wastewater treatment plants, it is more difficult to predict their effluent quality.
[0003] Existing wastewater treatment plant effluent quality prediction algorithms are often based on mechanistic models or big data-driven models, making it difficult to achieve the prediction target of effluent quality from wastewater treatment plants with multiple influent sources and multiple treatment lines. Summary of the Invention
[0004] The embodiments of this application provide a method for predicting the effluent quality of wastewater treatment plants based on a neural network model, including:
[0005] The process topology diagram of the wastewater treatment plant is determined. The process topology diagram includes multiple nodes and multiple first directed edges connecting each node. The wastewater treatment plant includes an inlet, a treatment unit, and an upgrading and renovation unit. The multiple nodes include the first node corresponding to the inlet, the middle node corresponding to the treatment unit, and the end node corresponding to the upgrading and renovation unit. The first directed edges are used to indicate the actual water flow direction between each node.
[0006] 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. The window length is a first preset duration, and the sliding step size is a second preset duration.
[0007] The trainable weight matrix based on the neural network model performs a linear transformation on the data in each time window of the first node according to the corresponding first directed edge, and then applies an activation function to the transformed data. The trainable weight matrix includes the weights of the first directed edge and the weights of the second directed edge, with the second directed edge pointing from the end node to the predicted value of the neural network model.
[0008] The data processed by the activation function in each time window of the first node is aggregated with the data in each time window of the corresponding intermediate node, and a linear transformation is performed according to the corresponding first directed edge. The data after the linear transformation is then processed by the activation function.
[0009] 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 then linearly transformed according to the corresponding second directed edge. The data after linear transformation is then processed by the activation function, and the result is the predicted value of the neural network model.
[0010] Based on the deviation between the predicted and actual values, 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 wastewater treatment plant is predicted.
[0012] According to the method for predicting the effluent quality of wastewater treatment plants based on a neural network model in this application, since its neural network model is determined based on the actual physical architecture of the wastewater treatment plant (e.g., inlet, treatment unit, and upgrading unit), it avoids the drawbacks of traditional black box models that ignore the laws of the actual physical world, and achieves high-precision effluent quality prediction.
[0013] In some embodiments, the step of optimizing the trainable weight matrix to determine the neural network model based on the deviation between the predicted and actual values includes:
[0014] Based on the loss function, determine the deviation between the predicted value and the actual value;
[0015] Based on the backpropagation algorithm, the gradient of the loss function with respect to each weight of the trainable weight matrix of the neural network model is determined.
[0016] Each weight is updated based on the gradient of each determined weight to optimize the trainable weight matrix and determine the neural network model.
[0017] In some embodiments, 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 based on the backpropagation algorithm includes:
[0018] Based on the backpropagation 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, the step of updating each weight based on the determined gradient of each weight to optimize the trainable weight matrix and determine the neural network model includes:
[0020] Based on the learning rate, the gradient of each determined weight, and the gradient of the bias, each weight and bias are updated to optimize the trainable weight matrix and bias, thus determining the neural network model.
[0021] In some embodiments, the learning rate is 0.001.
[0022] In some embodiments, the loss function is the mean squared error loss function.
[0023] In some embodiments, the wastewater treatment plant includes multiple inlets, with each initial node corresponding to each inlet; and / or, the wastewater treatment plant includes multiple treatment units, with each intermediate node corresponding to each treatment unit.
[0024] In some embodiments, the time-series data of the first 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 rate, 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 last node includes carbon source dosage.
[0025] In some embodiments, the step of dividing the time-series data of each node into time windows and inputting the data within each time window of each node into the neural network model includes:
[0026] The time series data of each node is divided into time windows. The data within each time window of each node is normalized by Z-Score. The normalized data within each time window of each node is then input into the neural network model.
[0027] In some embodiments, aggregation is splicing, and / or the activation function is a ReLU activation function, and / or the second preset duration is 1 hour. Attached Figure Description
[0028] Figure 1 A flowchart illustrating a method for predicting wastewater effluent quality based on a neural network model according to some embodiments of this application is shown.
[0029] Figure 2 A schematic diagram illustrating a process topology provided according to some embodiments of this application;
[0030] Figure 3 A flowchart illustrating the determination of a neural network model according to some embodiments of this application is shown. Detailed Implementation
[0031] The following specific embodiments illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. Although the description of the present invention is presented in conjunction with preferred embodiments, this does not mean that the features of the invention are limited to these embodiments. On the contrary, the purpose of describing the invention in conjunction with embodiments is to cover other options or modifications that may be derived based on the claims of the present invention. To provide a deep understanding of the invention, many specific details will be included in the following description. The invention may also be implemented without using these details. Furthermore, to avoid confusion or obscuring the focus of the invention, some specific details will be omitted in the description. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of the present invention can be combined with each other.
[0032] It should be noted that in this specification, similar reference numerals and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0033] The specific embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0034] Figure 1 A flowchart illustrating a method for predicting wastewater treatment plant effluent quality based on a neural network model, according to some embodiments of this application, is shown. (Reference) Figure 1 The method for predicting the effluent quality of wastewater treatment plants includes the following steps:
[0035] Step S1: Determine the process topology of the wastewater treatment plant.
[0036] In some embodiments, a wastewater treatment plant may include an inlet, a treatment unit, and an upgrading / renovation unit. The process topology diagram includes multiple nodes and multiple first directed edges connecting the nodes. The multiple nodes include a starting node corresponding to the inlet, intermediate nodes corresponding to the treatment unit, and an ending node corresponding to the upgrading / renovation unit. The first directed edges are used to indicate the actual flow direction between the nodes.
[0037] Figure 2 A schematic diagram illustrating a process topology provided according to some embodiments of this application is shown. For example... Figure 2As shown, there are two inlets, corresponding to two initial nodes (node 1 and node 4); two treatment units, corresponding to two intermediate nodes (node 2 and node 5); and one upgrading unit, corresponding to the final node (node 3). The first directed edge indicates the actual water 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 edge points from nodes 2 and 5 to node 3.
[0038] It should be noted that, Figure 2 The diagram only shows a wastewater treatment plant with two inlets, two treatment units, and one upgrading unit. However, depending on the actual situation, a wastewater treatment plant may include multiple inlets (more than two) and multiple treatment units (more than two). Each initial node corresponds to each inlet, and each intermediate node corresponds to each treatment unit. There is no limit to the number of initial, intermediate, and final nodes. Those skilled in the art can determine the corresponding process topology diagram based on the actual situation of the wastewater treatment plant.
[0039] Step S2: Divide the time series data of each node into time windows, and input the data of each node within each time window into the neural network model.
[0040] The window length is a first preset duration (e.g., T hours, where T can be 24 hours), and the sliding step size is a second preset duration (e.g., 1 hour).
[0041] For example, the time-series data of the first node includes: Chemical Oxygen Demand (COD), Ammonia Nitrogen (COD), etc. The time series data for intermediate nodes include one or more of the following: aeration rate, polyaluminum chloride (PAC) dosage, carbon source dosage, dissolved oxygen (DO), and mixed liquor suspended solids concentration (MLSS); and / or the time series data for terminal nodes include: carbon source dosage.
[0042] Step S3: Based on the trainable weight matrix of the neural network model, perform a linear transformation on the data in each time window of the first node according to the corresponding first directed edge, and then process the data after the linear transformation with an activation function.
[0043] The trainable weight matrix includes the weights of the first directed edge and the weights 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 (As shown, node 3 points to the output value). In some embodiments, the activation function can be a ReLU activation function.
[0044] For example, such as Figure 2 As shown, for each time window of the first node (node 1), the data X1 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 transformed data is then processed by an activation function. Similarly, for each time window of the first node (node 4), the data X4 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 transformed data is then processed by an activation function.
[0045] For example, the data X1 within each time window of the first node (node 1) is a b-row, 5-column (b×5) matrix; b rows represent the number of each data type within the time window; 5 columns represent the 5 data types, namely Chemical Oxygen Demand (COD), Ammonia Nitrogen (COD), and Sodium Nitrogen (NOx). The data includes total nitrogen (TN), total phosphorus (TP), and flow rate; after linear transformation and activation function processing, the result is a b-row, 1-column (b×1) matrix. Similarly, the data X4 within each time window of the first node (node 4) is a b-row, 5-column (b×5) matrix; b rows represent the number of b data types within each time window; 5 columns represent the 5 data types, namely chemical oxygen demand (COD), ammonia nitrogen (TP), total nitrogen (TP), total phosphorus (TP), total nitrogen ... The total nitrogen (TN), total phosphorus (TP), and flow rate are calculated; after linear transformation and activation function processing, the result is a b-row, 1-column (b×1) matrix.
[0046] Step S4: Aggregate the data processed by the activation function in each time window of the first node with the data in each time window of the corresponding intermediate node, perform a linear transformation according to the corresponding first directed edge, and then process the data with the activation function after the linear transformation.
[0047] In some embodiments, aggregation is performed by splicing. For example, the data X2 within each time window of the intermediate node (node 2) comprises a b-row, 3-column (b×3) matrix; the b rows represent the number of each data type within the time window being b; the 3 columns represent the three data types: dosage, aeration rate, and MLSS. The data X5 within each time window of the intermediate node (node 5) comprises a b-row, 3-column (b×3) matrix.
[0048] For example, the data processed by the activation function in each time window of the first node (node 1) (b rows, 1 column) is concatenated with the data in each time window of the middle node (node 2) (b rows, 3 columns) to form a b rows, 4 columns (b×4) matrix. A linear transformation is then performed according to the weights of the corresponding first directed edge 2→3, and the transformed data is then processed with an activation function, resulting in a b rows, 1 column (b×1) matrix. Similarly, the data processed by the activation function in each time window of the first node (node 4) (b rows, 1 column) is concatenated with the data in each time window of the middle node (node 5) (b rows, 3 columns) to form a b rows, 4 columns (b×4) matrix. A linear transformation is then performed according to the weights of the corresponding first directed edge 4→5, and the transformed data is then processed with an activation function, resulting in a b rows, 1 column (b×1) matrix.
[0049] Step S5: 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 a linear transformation according to the corresponding second directed edge, and then process the data after the linear transformation with the activation function. The result is the predicted value of the neural network model.
[0050] For example, the data X3 in each time window of the end node (node 3) includes a matrix of b rows and 1 column (b×3); b rows represent the number of each data type in the time window is b; 1 column represents the number of data types, namely 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 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). This matrix (b×3) is then linearly transformed according to the edge weight of the corresponding second directed edge 3 → output value, and the linearly transformed data is processed by the activation function. 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 and actual values, optimize the trainable weight matrix to determine the neural network model.
[0053] Step S7: Based on the determined neural network model, predict the effluent quality of the wastewater treatment plant.
[0054] For example, the neural network model determined by the latest data collected by each node within the time window can be used to predict the effluent quality of the wastewater treatment plant at future times. In some embodiments, the predicted indicators for effluent quality include chemical oxygen demand (COD) and ammonia nitrogen (COD). Total nitrogen (TN) and total phosphorus (TP) were predicted independently using separate channels.
[0055] According to the method for predicting the effluent quality of wastewater treatment plants based on a neural network model in this application, since the neural network model is determined based on the actual physical architecture of the wastewater treatment plant (e.g., inlet, treatment unit, and upgrading unit), it avoids the drawbacks of traditional black box models that ignore the laws of the actual physical world, and achieves high-precision effluent quality prediction.
[0056] In some embodiments, step S6 involves optimizing the trainable weight matrix based on the deviation between the predicted and actual values to determine the neural network model, referencing... Figure 3 It includes 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 the mean squared error loss function.
[0059] (1);
[0060] In formula (1), L represents the mean squared error loss function; (i) These are measured values; (i) N represents the predicted value; N represents the number of samples; and K represents the number of predictive indicators (the number of data types to be predicted).
[0061] By squaring the error, significant errors are amplified, forcing the model to prioritize correcting major biases.
[0062] Step S62: Based on the backpropagation algorithm, determine the gradient of the loss function with respect to each weight of the trainable weight matrix of the neural network model.
[0063] Step S63: Based on the gradient of each determined weight, update each weight to optimize the trainable weight matrix and determine the neural network model.
[0064] In some embodiments, step S62, based on the backpropagation algorithm, determines the gradient of the loss function with respect to each weight of the trainable weight matrix of the neural network model, including the following steps:
[0065] Based on the backpropagation 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, updating each weight based on the determined gradient of each weight to optimize the trainable weight matrix and determine the neural network model includes the following steps:
[0067] Based on the learning rate, the gradient of each determined weight, and the gradient of the bias, each weight and bias are updated to optimize the trainable weight matrix and bias, thus determining the neural network model.
[0068] In some embodiments, the learning rate is 0.001.
[0069] In some embodiments, step S2, which involves dividing the time-series data of each node into time windows and inputting the data within 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 within each time window of each node is normalized by Z-Score. The normalized data within each time window of each node is then input into the neural network model.
[0071] In some embodiments, when aggregation (e.g., splicing) is implemented between two nodes (e.g., node 1 and node 2, node 2 and node 3, node 4 and node 5, node 5 and node 3), aggregation weights are also considered. For example, the initial aggregation weight can be determined based on the inlet flow rate ratio. For instance, when node 1 and node 2 are aggregated, the initial aggregation weight is the inlet flow rate ratio of node 1 and node 2. Specific optimization can be achieved by referring to the trainable weight matrix described above, and will not be elaborated further here.
[0072] For example, when aggregating nodes 1 and 2, the data (b rows and 1 column) processed by the activation function in each time window of the first node (node 1) is first calculated based on the corresponding aggregation weight, and then concatenated with the data (b rows and 3 columns) in each time window of the middle node (node 2) to form a matrix of b rows and 4 columns (b×4). The aggregation of other nodes is similar to the above, and will not be described in detail here.
[0073] Although this application has been illustrated and described with reference to certain preferred embodiments thereof, those skilled in the art should understand that various changes in form and detail may be made thereto without departing from the spirit and scope of this application.
Claims
1. A method for predicting the effluent quality of wastewater treatment plants based on a neural network model, characterized in that, include: The process topology diagram of the wastewater treatment plant is determined, wherein the process topology diagram includes multiple nodes and multiple first directed edges connecting each node, the wastewater treatment plant includes an inlet, a treatment unit and an upgrading and renovation unit, the multiple nodes include a first node corresponding to the inlet, an intermediate node corresponding to the treatment unit and a last node corresponding to the upgrading and renovation unit, and the first directed edges are used to indicate the actual water flow direction between each node; 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. The window length is a first preset duration, and the sliding step size is a second preset duration. Based on the trainable weight matrix of the neural network model, the data in each time window of the first end node is linearly transformed according to the corresponding first directed edge, and the data after linear transformation is processed by an activation function. 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 end node to the predicted value of the neural network model. The data processed by the activation function in each time window of the first node is aggregated with the data in each time window of the corresponding intermediate node, and a linear transformation is performed according to the corresponding first directed edge. The data after the linear transformation is then processed by the activation function. 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 a linear transformation is performed according to the corresponding second directed edge. The data after the linear transformation is then processed by the activation function, and the result is the predicted value of the neural network model. Based on the deviation between the predicted and actual values, the trainable weight matrix is optimized to determine the neural network model. Based on the determined neural network model, the effluent quality of the wastewater treatment plant is predicted.
2. The method for predicting wastewater quality from wastewater treatment plants 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 and actual values to determine the neural network model includes: Based on the loss function, the deviation between the predicted value and the actual value is determined; Based on the backpropagation algorithm, the gradient of the loss function with respect to each weight of the trainable weight matrix of the neural network model is determined; Based on the gradient of each determined weight, each weight is updated to optimize the trainable weight matrix and determine the neural network model.
3. The method for predicting wastewater quality from wastewater treatment plants based on a neural network model according to claim 2, characterized in that, 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 based on the backpropagation algorithm includes: Based on the backpropagation 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 wastewater quality from wastewater treatment plants 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 determine the neural network model includes: Based on the learning rate, the gradient of each determined weight, and the gradient of the bias, each weight and bias are updated to optimize the trainable weight matrix and bias, thereby determining the neural network model.
5. The method for predicting wastewater quality from wastewater treatment plants based on a neural network model according to claim 4, characterized in that, The learning rate is 0.
001.
6. The method for predicting wastewater quality from wastewater treatment plants based on a neural network model according to claim 2, characterized in that, The loss function is the mean squared error loss function.
7. The method for predicting wastewater quality from wastewater treatment plants based on a neural network model according to claim 1, characterized in that, The wastewater treatment plant includes multiple inlets, with each initial node corresponding to each inlet; and / or, the wastewater treatment plant includes multiple treatment units, with each intermediate node corresponding to each treatment unit.
8. The method for predicting wastewater quality from wastewater treatment plants based on a neural network model according to claim 1, characterized in that, The time-series data of the first node includes one or more of the following: 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 the following: aeration rate, polyaluminum chloride dosage, carbon source dosage, dissolved oxygen, and mixed liquor suspended solids concentration; and / or, the time-series data of the last node includes: carbon source dosage.
9. The method for predicting wastewater quality from wastewater treatment plants 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 within 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 within each time window of each node is normalized by Z-Score. The normalized data within each time window of each node is then input into the neural network model.
10. The method for predicting wastewater quality from wastewater treatment plants 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 duration 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