A method for predicting water quality in drainage network based on long short-term memory step sequence

By adopting a method based on long and short-term memory step sequence in the water quality prediction of urban drainage pipeline networks, a step prediction framework for water quality sequences of drainage pipeline networks containing m models is solved, and a more efficient water quality prediction is achieved.

CN118298963BActive Publication Date: 2025-03-14YANGTZE ECOLOGY & ENVIRONMENT CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410329175.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-21
Publication Date
2025-03-14
Estimated Expiration
2044-03-21

AI Technical Summary

Technical Problem

The prior art has problems with information leakage caused by data decomposition in the water quality prediction of urban drainage pipelines, and traditional methods fail to effectively encode the water inlet information of sewage plants, affecting the prediction accuracy.

Method used

The water quality prediction method of drainage pipeline network based on long and short-term memory step sequences is adopted. By constructing a step prediction framework for drainage pipeline network water quality sequences containing m models, combining factors such as land area, drainage pipeline diameter, social indicators and water volume indicators, multi-step advance water quality prediction is carried out.

Benefits of technology

The accuracy of water quality prediction of drainage pipe network has been improved, especially in multi-step advance prediction, which reduces information leakage problems and more accurately reflects the water quality changes of drainage pipe network.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118298963B_ABST
    Figure CN118298963B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for predicting water quality of a drainage network based on a long short-term memory step sequence, comprising the following steps: (1) preparing drainage network water quality prediction input data and output data, and preprocessing the data; (2) constructing a drainage network water quality prediction model based on a long short-term memory step sequence, and predicting the water quality of an urban drainage network; (3) training and testing the model, and setting model parameters to ensure that the model can accurately simulate the water quality change process of the drainage network; (4) simulating the water quality change process of the drainage network, and evaluating the prediction performance of the model; the present invention can be used for predicting the water quality of an urban drainage network, improving the prediction accuracy of the water quality of the drainage network, and is of great significance for improving the urban water environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of drainage network water quality prediction methods, in particular to a drainage network water quality prediction method based on long-short term memory step sequence. Background Art

[0002] The continued acceleration of urbanization and industrialization has led to increasingly serious urban water pollution problems, which has seriously restricted the sustainable development of urban society and economy. In recent years, urban managers have invested a lot of manpower and material resources to control and improve the urban water environment. However, the problem of urban water pollution still exists. Point source pollution in urban drainage networks is irregular, scattered and hidden, and difficult to control. In order to better solve the problem of urban water pollution, it is necessary to control and manage the water quality of the drainage network from the source. Therefore, accurate assessment of the water quality of the sewage network and the ability to predict its future changes will provide a way to control urban water pollution.

[0003] The assessment and prediction of drainage network water quality must track key water quality indicators such as pH, conductivity, temperature, biological oxygen demand (BOD5), chemical oxygen demand, ammonium ion nitrogen (NH4 + -N), total nitrogen (TN), total phosphorus (TP), etc. Some of these indicators, such as pH and conductivity, can be detected in real time through online monitoring equipment. However, collecting and measuring some key water quality indicators of the drainage network, such as BOD5, COD, NH4 + -N, TN and TP, which require a lot of time and effort. The time requirements associated with sampling and testing are a disadvantage in predicting and managing water quality in sewage networks.

[0004] In recent years, many researchers have established models for predicting water quality. These models can be divided into two categories: theoretical water quality prediction models and data-driven water quality prediction models. Theoretical water quality models predict water quality indicators based on drainage network systems and water cycle simulations. However, many theoretical water quality models require not only a large number of physical and topographic parameters, but also a large amount of computing resources. For example, the theoretical water quality model used to simulate the spatiotemporal changes in river water quality not only requires the establishment of a series of hypothetical equations to simulate physical and biochemical processes, but also requires the construction of complex hydrodynamic models. The theoretical water quality model of the drainage network system used for drainage network water level prediction requires the input of information from each part of the drainage network in turn. The model building process is very repetitive and takes a lot of time. If the input data information is incorrect, it is difficult to identify and judge the corresponding drainage network information. Especially when simulating the water level changes of the drainage network at the entire city level, the model building and simulation process will become extremely complex and slow. Obviously, the use of data-driven methods to simulate the water quality changes of the drainage network has better application prospects.

[0005] Deep learning is used to predict some key water qualities in drainage networks (such as chemical oxygen demand and biochemical oxygen demand). Only by inputting some key indicators of sewage (such as temperature, pH value and conductivity), the water quality prediction results of the drainage network can be accurately obtained. In addition, the decomposition integration model combining data decomposition and deep learning algorithms has also achieved remarkable prediction performance. For example, compared with a single long short-term memory network, the prediction performance of the comprehensive model combining modal experience decomposition and long short-term memory network is better. However, these integrated models usually need to decompose the complex prediction sequence first, then model and predict the relatively simple subsequences, and finally integrate the results of the subsequences to obtain the prediction results. This can reduce the learning difficulty of the model and thus improve the prediction accuracy.

[0006] Although decomposition integration models ostensibly improve prediction accuracy, the one-time decomposition of data often leads to information leakage problems. Information leakage refers to the fact that the decomposition results of data at a specific time are affected by subsequent data that are available after that time. Therefore, information leakage may make the model have falsely high accuracy, but it cannot work in practical application scenarios because future information is no longer available at this time. In the field of hydrology, methods based on long short-term memory networks have shown good performance. For example, long short-term memory networks are used to simulate and predict the water level of the overflow structure of the combined sewer network and predict the groundwater level in areas where hydrogeological data are difficult to obtain. However, traditional methods based on long short-term memory networks do not use the sewage plant inlet encoding as input data, and do not obtain the following important information in the input data: (a) the sequence information of the drainage network water quality sequence; (b) the previous drainage network water quality containing partially compressed information of all factors that affect the predicted drainage network water quality. The compressed information mainly includes all possible influencing factors that affect the drainage network water quality, such as land area, sewer diameter, social indicators (population), water quantity indicators (drinking water supply (DWS), sewage flow, flow velocity (V) and liquid level), etc. The term “compression” refers to the low-dimensional results obtained from high-dimensional factors, which contain information about these factors. In addition, the sequence-to-sequence model does not consider the following situation in practice: the water quality of the drainage network on day j is not affected by the operation status of the drainage network after day j. Summary of the invention

[0007] The purpose of the present invention is to overcome the above-mentioned shortcomings and provide a drainage network water quality prediction method based on long-short-term memory step sequence, which is used for urban drainage network water quality prediction, improves the prediction accuracy of drainage network water quality, and improves the urban water environment.

[0008] In order to solve the above technical problems, the technical solution adopted by the present invention is: a drainage network water quality prediction method based on long-short term memory step sequence, comprising the following steps:

[0009] (1) Prepare the input and output data for drainage network water quality prediction and preprocess the data;

[0010] (2) Construct a drainage network water quality prediction model based on long-short-term memory step sequence to predict the water quality of the urban drainage network;

[0011] (3) Train and test the model and set the model parameters to ensure that the model can accurately simulate the water quality changes in the drainage network;

[0012] (4) Simulate the water quality changes in the drainage network and evaluate the predictive performance of the model.

[0013] Furthermore, the step (1) is specifically as follows:

[0014] (1.1) The main influencing factors and decision variables for drainage network water quality prediction are selected. The influencing factors mainly include: land area, drainage pipe diameter, social indicators, water volume indicators, sewage flow, flow rate and liquid level. The output of the prediction model selects variables that can reflect the characteristics of drainage network water quality changes, including: pH, temperature, conductivity, suspended solids, BOD5, COD, NH4 + -N, TN and TP;

[0015] (1.2) According to the data type of the input quantity of the prediction model, the input quantity is divided into numerical influencing factors and non-numerical influencing factors; for numerical influencing factors, all types of input data are standardized and then used as the input data of the prediction model; for non-numerical influencing factors, each input variable is converted into a corresponding numerical value according to the actual attributes of the influencing factor, and then used as the input data of the prediction model;

[0016] (1.3) After collecting all the input data and output data of the drainage network water quality prediction model, the data quality is checked and the missing data and erroneous data in the input data and output data are replaced using a sliding time window to ensure that the quality of the input data and output data of the prediction model meets the prediction requirements.

[0017] Furthermore, the step (2) is specifically as follows:

[0018] (2.1) Construct a drainage network water quality sequence step prediction framework based on long short-term memory network, which contains m models to achieve m-step drainage network water quality prediction;

[0019] (2.2) Use the first model in the step-by-step prediction framework for the water quality sequence of the drainage pipe network to predict the water quality of the drainage pipe network one step ahead, and use it as the input for the prediction models of the water quality of the drainage pipe network two steps ahead, three steps ahead, …, m steps ahead (i.e., the second, third, …, mth models in the step-by-step prediction framework for the water quality sequence of the drainage pipe network);

[0020] (2.3) Use the ith (1 < i < m) model in the step-by-step prediction framework for the water quality sequence of the drainage pipe network to predict the water quality of the drainage pipe network i steps ahead, and use it as the input for the prediction models of the water quality of the drainage pipe network (i + 1) steps ahead, …, m steps ahead (i.e., the (i + 1)th, …, mth models in the step-by-step prediction framework for the water quality sequence of the drainage pipe network);

[0021] (2.4) Use the mth model in the step-by-step prediction framework for the water quality sequence of the drainage pipe network to predict the water quality of the drainage pipe network m steps ahead;

[0022] (2.5) Combine steps (2.2)-(2.4), and use m models to predict the water quality prediction data of the drainage pipe network m steps ahead.

[0023] Further, the specific steps of step (3) are as follows:

[0024] (3.1) Determine the learnable parameters and hyperparameters of the water quality prediction model for the drainage pipe network, so as to train and test the m models in the step-by-step prediction framework for the water quality sequence of the drainage pipe network, and ensure that the prediction model can accurately output the water quality prediction data of the drainage pipe network;

[0025] (3.2) Determine the performance evaluation indicators of the water quality prediction model for the drainage pipe network, and ensure that each model in the step-by-step prediction framework for the water quality of the drainage pipe network can be effectively trained to obtain a water quality prediction model that meets the accuracy requirements;

[0026] (3.3) Input the input data of the water quality prediction model for the drainage pipe network into the water quality prediction model framework for the drainage pipe network, and train and test the water quality prediction model for the drainage pipe network, and ensure that the output data of the water quality prediction model for the drainage pipe network can accurately reflect the actual water quality change of the drainage pipe network.

[0027] Further, the specific step of step (4) is:

[0028] (4.1) Construct a two-layer long short-term memory network as the benchmark model for the water quality prediction of the drainage pipe network, and evaluate the prediction performance of the step-by-step prediction framework for the water quality sequence of the drainage pipe network;

[0029] (4.2) Obtain the time series data of the water quality of the drainage pipe network through the input data of the water quality prediction of the drainage pipe network and the water volume index prediction, and compare it with the output result of the step-by-step prediction framework for the water quality sequence of the drainage pipe network.

[0030] Furthermore, step (2.1) is specifically as follows:

[0031] (2.1.1) Construct a single-step prediction model for the water quality sequence of the drainage pipe network, and predict the output data of the water quality prediction of the drainage pipe network through the input data of the water quality prediction of the drainage pipe network;

[0032] (2.1.2) Construct m single-step prediction models for the water quality sequence of the drainage pipe network to obtain a single-step prediction framework for the water quality sequence of the drainage pipe network (including m single-step prediction models for the water quality sequence of the drainage pipe network), and predict the m-step water quality prediction data of the drainage pipe network by using the input data of the water quality prediction of the drainage pipe network.

[0033] Furthermore, step (2.5) is specifically as follows:

[0034] (2.5.1) Train the first leading water quality prediction model for the drainage pipe network, and predict the output data of the first-step leading water quality prediction of the drainage pipe network by using the input data of the water quality prediction of the drainage pipe network;

[0035] (2.5.2) Train the second leading water quality prediction model for the drainage pipe network, and predict the output data of the second-step leading water quality prediction of the drainage pipe network by using the input data of the water quality prediction of the drainage pipe network and the output data of the first-step leading drainage pipe network prediction;

[0036] (2.5.3) Train the i-th (1 < i ≤ m) leading water quality prediction model for the drainage pipe network, and predict the output data of the i-th step leading water quality prediction of the drainage pipe network by using the input data of the water quality prediction of the drainage pipe network and the output data of the previous i-1 step leading drainage pipe network prediction;

[0037] (2.5.4) Aggregate the m-step water quality prediction output data obtained in steps (2.5.1)-(2.5.3) to obtain the m-step leading water quality prediction data of the drainage pipe network.

[0038] Furthermore, step (3.1) is specifically as follows:

[0039] (3.1.1) Determine the dimensions of each long short-term memory network unit. Each network unit contains 7 dimensions, including: land area, drain pipe diameter, social index, water volume index, sewage flow rate, flow velocity, and liquid level;

[0040] (3.1.2) Normalize the 7-dimensional input data of each long short-term memory network unit. All input data are normalized by the z-score normalization method.

[0041] (3.1.3) The hidden state length of each LSTM network unit is set to 32, the push rate is set to 0.1 to avoid overfitting, the learning rate is set to 0.001, the batch size (per batch) sample number is set to 256, and the root mean square error (MSE) is used as the loss function;

[0042] (3.1.4) Select k real observation data of urban drainage network water quality to train the proposed drainage network water quality series step prediction framework. Get k NSE values ​​through k training times, and select the hyperparameter set that produces the highest NSE median value among all hyperparameter combinations as the hyperparameters of the drainage network water quality series step prediction framework.

[0043] Furthermore, the step (4.1) is specifically as follows:

[0044] (4.1.1) A two-layer drainage network water quality sequence prediction framework is constructed using a long short-term memory network. The framework includes two encoder sequences, a state vector, and a decoder sequence. The first decoder sequence has long short-term memory network units, and its input includes land area, drainage pipe diameter, social indicators, water quantity indicators, sewage flow, flow velocity, and liquid level. The second decoder sequence has long short-term memory network units, and its input data is drainage network water quality observation data. The state vector contains the compressed and processed information from the inputs of the two encoder sequences. The decoder sequence has m long short-term memory network units, and the output is the m-step-ahead drainage network water quality prediction.

[0045] (4.1.2) The actual water quality data of the drainage networks of k cities are used to train the double-layer drainage network water quality series prediction framework. After k training times, k NSE values ​​are obtained. The hyperparameter set that produces the highest NSE median value among all hyperparameter combinations is selected as the hyperparameter of the double-layer drainage network water quality series prediction framework.

[0046] Furthermore, the step (4.2) is specifically as follows:

[0047] (4.2.1) Select the actual observation data of drainage network water quality in j cities, input them into the drainage network water quality sequence step prediction framework and the double-layer drainage network water quality sequence prediction framework, and obtain the drainage network water quality prediction data;

[0048] (4.2.2) After obtaining the drainage network water quality prediction data, the Nash-Suteliffe model efficiency (NSE), the number of basins with NSE of 0, the recommended absolute top prediction error (TPE), the percentage bias (PBIAS) and the top peak flow deviation (FHV) are calculated. Based on these indicators, the prediction performance of the drainage network water quality series step prediction framework and the double-layer drainage network water quality series prediction framework are compared and evaluated.

[0049] Beneficial effects of the present invention: The present invention is of great significance for improving the prediction accuracy of drainage network water quality, especially for realizing multi-step advanced drainage network water quality prediction; the long short-term memory network solves the gradient explosion and vanishing problems of drainage network water quality prediction, and can improve the prediction performance; at the same time, the drainage network water quality sequence step prediction framework, which includes m models, can realize m-step drainage network water quality prediction; when predicting the drainage network water quality, the current drainage network water quality is not affected by the later water inlet data, and is more consistent with the actual situation; the present invention can be used for urban drainage network water quality prediction, improves the prediction accuracy of drainage network water quality, and is of great significance for improving the urban water environment. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 It is a flow chart of the drainage network water quality prediction method based on long short-term memory step sequence;

[0051] Figure 2 This is a schematic diagram of the topological structure of the drainage network in a city in southern China;

[0052] Figure 3 Schematic diagram of the average daily variation and range of BOD5 at the six sampling points;

[0053] Figure 4 Schematic diagram of the average daily variation and range of COD at the six sampling points;

[0054] Figure 5 NH4 for 6 sampling points + -Schematic diagram of the average daily variation and range of N;

[0055] Figure 6 Schematic diagram of the average daily variation and range of TN at the six sampling points;

[0056] Figure 7 Schematic diagram of the average daily variation and range of TP at the six sampling points;

[0057] Figure 8 Schematic diagram of the average daily variation and range of conductivity at the six sampling points;

[0058] Fig. 9 Schematic diagram of the network structure of a recursive neural network;

[0059] Fig.10 This is a schematic diagram of the network structure of the long short-term memory network;

[0060] Fig.11 This is a schematic diagram of the framework structure for the step prediction of the water quality sequence in the drainage network;

[0061] Fig.12It is a schematic diagram of the comparison between the predicted and observed values ​​of BOD5 at the six monitoring points;

[0062] Fig.13 The diagram is a comparison between the predicted and observed values ​​of COD at the six monitoring points;

[0063] Fig.14 NH4 at 6 monitoring points + -Schematic diagram of the comparison between the predicted and observed values ​​of N;

[0064] Fig.15 It is a schematic diagram of the comparison between the predicted and observed values ​​of TN at the six monitoring points;

[0065] Fig.16 Schematic diagram of the comparison between the predicted and observed values ​​of TP at the six monitoring points;

[0066] Fig.17 The schematic diagram of the architecture of the water quality sequence prediction framework for the double-layer drainage network;

[0067] Fig.18 The schematic diagram of the network structure of the double-layer drainage network water quality prediction framework;

[0068] Fig.19 Diagram of the training process of the water quality prediction framework for a double-layer drainage network;

[0069] Fig. 20 This is a comparison chart of the prediction performance of the drainage network water quality sequence step prediction framework and the double-layer drainage network water quality prediction framework. DETAILED DESCRIPTION

[0070] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments.

[0071] Example 1: Figure 1 As shown, a drainage network water quality prediction method based on long short-term memory step sequence includes the following steps:

[0072] 1. Prepare the input data and output data for urban drainage network water quality prediction and pre-process the data;

[0073] 2. Construct a drainage network prediction model based on long-short-term memory step sequence to predict the water quality of urban drainage network;

[0074] 3. Train and test the model, set the model parameters, and ensure that the model can accurately predict the water quality of the urban drainage network;

[0075] 4. Predict the water quality of urban drainage networks and evaluate the prediction performance of the model;

[0076] Further, step 1 is specifically as follows:

[0077] 1.1. Select the main influencing factors (input variables) and decision variables (output variables) for urban drainage network water quality prediction. The influencing factors mainly include: land area, drain pipe diameter, social indicators (population), water volume indicators (drinking water supply (DWS), sewage flow rate, flow velocity (V), and liquid level). The output variables of the prediction model mainly select variables that can reflect the water quality characteristics of the drainage network, mainly including: pH, temperature (T), conductivity, suspended solids (SS), BOD5, COD, NH4 + -N, TN, and TP;

[0078] 1.2. According to the data types of the input variables of the prediction model, the input variables are divided into numerical influencing factors and non-numerical influencing factors. For numerical influencing factors, standardize various types of input data uniformly and then use them as the input data of the prediction model. For non-numerical influencing factors, convert each input variable into a corresponding numerical value according to the actual attributes of the influencing factors and then use it as the input data of the prediction model. For example, according to the density of population residence, the population can be divided into three types: sparse, medium, and concentrated, which are represented by -1, 0, and 1 respectively;

[0079] 1.3. After collecting all the input data and output data of the urban drainage network water quality prediction model, check the data quality, and use a sliding time window to replace the missing data and incorrect data in the input data and output data to ensure that the quality of the input data and output data of the prediction model meets the prediction requirements;

[0080] Further, step 2 is specifically as follows:

[0081] 2.1. Construct a step prediction framework for the water quality sequence of the drainage network based on a long short-term memory network. This framework contains m models for realizing m-step water quality prediction of the drainage network;

[0082] 2.2. Use the first model in the step prediction framework for the water quality sequence of the drainage network to predict the water quality of the drainage network one step ahead and use it as the input of the water quality prediction models for the drainage network two steps ahead, three steps ahead,..., m steps ahead (i.e., the second, third,..., mth models in the step prediction framework for the water quality sequence of the drainage network);

[0083] 2.3. Use the ith (1 < i < m) model in the step prediction framework for the water quality sequence of the drainage network to predict the water quality of the drainage network i steps ahead and use it as the input of the water quality prediction models for the drainage network (i + 1) steps ahead,..., m steps ahead (i.e., the (i + 1)th,..., mth models in the step prediction framework for the water quality sequence of the drainage network);

[0084] 2.4. Use the mth model in the drainage network water quality sequence step prediction framework to predict the mth step ahead drainage network water quality;

[0085] 2.5. Combined with steps 2.2-2.4, the water quality prediction data of the m-step advanced drainage network is obtained through m model predictions.

[0086] Further, the step 3 is specifically as follows:

[0087] 3.1. Determine the learnable parameters and hyperparameters of the drainage network water quality prediction model so as to train and test the m models in the drainage network water quality sequence step prediction framework to ensure that the prediction model can accurately output the drainage network water quality sequence data;

[0088] 3.2. Determine the performance evaluation indicators of the drainage network water quality prediction model to ensure that each model of the drainage network water quality sequence step prediction framework can be effectively trained to obtain a drainage network water quality prediction model that meets the accuracy requirements;

[0089] 3.3. Input the input data of the drainage network water quality prediction model into the drainage network water quality sequence step prediction framework, train and test the drainage network water quality prediction model, and ensure that the output data of the drainage network water quality prediction model can accurately reflect the actual drainage network water quality change process.

[0090] Further, the step 4 is specifically as follows:

[0091] 4.1. Construct a two-layer long short-term memory network as a baseline model for drainage network water quality prediction and evaluate the prediction performance of the drainage network water quality sequence step prediction framework;

[0092] 4.2. The output data of the drainage network water quality prediction model (PH, temperature (T), conductivity, suspended solids (SS), BOD5, COD, NH4) are predicted by the drainage network water quality prediction model input data (land area, drainage pipe diameter, social indicators (population), water quantity indicators (drinking water supply (DWS), sewage flow, flow velocity (V) and liquid level)). + -N, TN and TP) and compared them with the output of the step prediction framework for water quality series in the drainage network.

[0093] Further, the step 2.1 is specifically as follows:

[0094] 2.1.1. Construct a single drainage network water quality sequence step prediction model, and obtain the drainage network water quality change data through the drainage network water quality prediction input data;

[0095] Long short-term memory network belongs to recursive neural network, which takes the state of hidden neurons in the previous time step as additional input of the next time step, remembers the previous information and captures the dynamic changes of time. In the traditional recursive neural network unit, the state of output data can be expressed as:

[0096] h t =tanh(Uh t-1 +Wx t + b);

[0097] Where tanh(·) is the hyperbolic tangent function, x t is the input vector at time t, h t-1 is the hidden state at time t-1, U is the learnable matrix connecting the two hidden states, W is the learning matrix connecting the input vector and the hidden state, and b is the adjustable bias vector. Due to its vanishing or exploding gradient problem, this model cannot learn patterns with long-term lags well;

[0098] LSTM networks can overcome this shortcoming by replacing ordinary neurons of recurrent neural networks with memory blocks that contain four parts: in addition to three gates (i.e., forget gate, input gate, and output gate), it also includes a constant error rotation unit. The constant error rotation unit can run straight down the entire chain without any activation function, so the gradient does not disappear when the LSTM network is trained using time back propagation of drainage network water quality series. In addition, the LSTM network can maintain its state over time, and its nonlinear gating unit can regulate the flow of information in and out of the memory unit;

[0099] The working principle of the long short-term memory network can be expressed by the following mathematical equation:

[0100] i t =σ(W i x t +U i h t-1 +b i );

[0101] f t =σ(W f x t +U f h t-1 +b f );

[0102] o t =σ(W o x t +U o h t-1 +b o );

[0103]

[0104]

[0105] h t =tanh(c t )⊙o t ;

[0106] Where σ(·) is the sigmoid function, ⊙ represents element-wise multiplication, and i t is the input gate at time t, and its learnable parameters are (W i , U i , b i ), f t is the forget gate at time t, and its learnable parameters are (W f , U f , b f ), o t is the output gate at time t, and its learnable parameters are (W o , U o , b o ), is the potential state of the unit at time t, and its learnable parameters are (W~, U~, b~), c t is the cell state at time t, h t is the hidden state of the cell. These gates can control the flow of information in and out of the memory cell. The forget gate determines what information the cell state forgets. The value range is from 0 to 1, indicating "completely delete the memory" to "completely keep the memory". The input gate determines what information is used to update the cell state. The potential cell state gate (i.e., tanh layer) adds a new candidate value to the state. The output gate controls the flow of information from the cell state into the new hidden state;

[0107] 2.1.2. Construct m drainage network water quality sequence step prediction models, obtain the drainage network water quality sequence step prediction framework (including m drainage network water quality sequence step prediction models), and use the drainage network water quality prediction input data to predict the m-step drainage network water quality prediction data;

[0108] The drainage network water quality sequence step prediction framework contains m drainage network water quality sequence step prediction models for m-step drainage network water quality prediction. The m drainage network water quality sequence step prediction models are not independent of each other. For example, when training the second-step drainage network water quality prediction model, the output data of the first-step advanced drainage network water quality prediction model is needed; for the previous-step drainage network water quality prediction model, the input data X = [x1, ..., x n+1 , y0,…,y n ] consists of the last n+1 consecutive time steps of the variable, where x i(i=1,…,n+1) including land area, sewer diameter, social indicators (population), water quantity indicators (drinking water supply (DWS), sewage flow, flow velocity (V), and liquid level);

[0109]

[0110] In the formula, is the predicted value of drainage network water quality on day n+1. Using drainage network water quality observation data and drainage network water quality prediction input data on day n+1 (land area, drainage pipe diameter, social indicators (population), water quantity indicators (drinking water supply (DWS), sewage flow, flow velocity (V) and liquid level)), the drainage network water quality on day (n+1) (i.e., drainage network water quality in step 1) is predicted. Then, the advanced drainage network water quality prediction model in step 2 is defined as:

[0111]

[0112] Using the n-time drainage network water quality observation data, (n+1)-time drainage network water quality prediction and the n+2-day drainage network water quality influencing factor data, the drainage network water quality on the (n+2)th day (i.e., the drainage network water quality in the second step) is predicted. Similarly, the m-th step advanced drainage network water quality prediction model is defined as:

[0113]

[0114] Using the drainage network water quality observation data on day n+1, the drainage network water quality prediction data on day m-1 and the drainage network influencing factor observation data on day n+m, the drainage network water quality on the (n+m)th day (i.e., the drainage network water quality at the mth step) is predicted.

[0115] Further, the step 2.5 is specifically as follows:

[0116] 2.5.1. Train the first advanced drainage network water quality prediction model and use the land area, drainage pipe diameter, social indicators (population), water quantity indicators (drinking water supply (DWS), sewage flow, flow velocity (V) and liquid level) data to predict the first step of advanced drainage network water quality prediction data;

[0117] 2.5.2. Train the second advanced drainage network water quality prediction model, and use the land area, drainage pipe diameter, social indicators (population), water quantity indicators (drinking water supply (DWS), sewage flow, flow velocity (V) and liquid level) data and the output data of the first step advanced drainage network water quality prediction model to predict the second step advanced drainage network water quality prediction data;

[0118] 2.5.3. Train the water quality prediction model for the \(i\)th (\(1 < i\leq m\)) advanced drainage pipe network. Use land area, pipe diameter, social indicators (population), water volume indicators (drinking water supply (DWS), sewage flow, flow velocity (\(V\)), and liquid level), and the water quality prediction data of the previous \(i - 1\) steps of the drainage pipe network to predict the output data of the \(i\)th step of the advanced drainage pipe network water quality prediction model;

[0119] 2.5.4. Summarize the output data of the \(m\) - step drainage pipe network water quality prediction models obtained in steps 2.5.1 - 2.5.3 to obtain the \(m\) - step advanced drainage pipe network water quality prediction data.

[0120] Further, step 3.1 is specifically as follows:

[0121] 3.1.1. Determine the dimensions of each long - short - term memory network unit. Each network unit contains 7 dimensions, including: land area, pipe diameter, social indicators (population), water volume indicators (drinking water supply (DWS), sewage flow, flow velocity (\(V\)), and liquid level);

[0122] 3.1.2. Normalize the input data of the 7 dimensions of each long - short - term memory network unit. All input data are normalized using the z - score normalization method.

[0123] 3.1.3. Set the hidden state length of each long - short - term memory network unit to 32. To avoid overfitting, set the dropout rate to 0.1, the learning rate to 0.001, the batchsize (number of samples per batch) to 256, and use the root mean square error (MSE) as the loss function.

[0124] 3.1.4. Select the true observed data of the water quality of the urban drainage pipe network \(k\) times to train the proposed step - jump prediction framework for the water quality sequence of the drainage pipe network. Obtain \(k\) NSE values through \(k\) trainings. Select the set of hyperparameters that produce the highest median NSE among all hyperparameter combinations as the hyperparameters of the step - jump prediction framework for the water quality sequence of the drainage pipe network.

[0125] Further, step 4.1 is specifically as follows:

[0126] 4.1.1. A two-layer drainage network water quality sequence prediction framework is constructed using a long short-term memory network, which includes two encoder sequences, a state vector, and a decoder sequence. The first decoder sequence has a long short-term memory network unit, and its input includes land area, drainage pipe diameter, social indicators (population), water quantity indicators (drinking water supply (DWS), sewage flow, flow velocity (V) and liquid level). The second decoder sequence has a long short-term memory network unit, and its input data is the drainage network water quality observation data. The state vector contains the compression and processing information of the inputs from the two encoder sequences. The decoder sequence has m long short-term memory network units, and the output is the m-step ahead drainage network water quality prediction data;

[0127] 4.1.2. The actual water quality data of k urban drainage networks are used to train the double-layer drainage network water quality sequence prediction framework. K NSE values ​​are obtained through k training times. The hyperparameter set that produces the highest NSE median value among all hyperparameter combinations is selected as the hyperparameter of the double-layer drainage network water quality sequence prediction framework.

[0128] Further, the step 4.2 is specifically as follows:

[0129] 4.2.1. Select the actual observation data of drainage network water quality in j cities, input them into the drainage network water quality sequence step prediction framework and the double-layer drainage network water quality sequence prediction framework respectively, and obtain the drainage network water quality prediction data;

[0130] 4.2.2. After obtaining the drainage network water quality prediction data, the Nash-Suteliffe model efficiency (NSE), the number of basins with NSE of 0, the recommended absolute top prediction error (TPE), the percentage bias (PBIAS) and the top peak flow deviation (FHV) are calculated. Based on these indicators, the prediction performance of the drainage network water quality sequence step prediction framework and the double-layer drainage network water quality sequence prediction framework are compared and evaluated.

[0131] Embodiment 2: A method for predicting water quality of a drainage network based on a long short-term memory step sequence, comprising the following steps:

[0132] 1. Prepare the input data and output data for drainage network water quality prediction and pre-process the data. Select the real observation data of a drainage network in a city in southern China, such as Figure 2 The total service area of ​​this area is 78.66km 2 , the area is mainly composed of residential areas, the drainage network is in good condition, and there is almost no mixing of rainwater and sewage. Figure 2 As shown, 6 monitoring points are set up in the entire drainage network;

[0133] According to the living habits of residents and the basic rules of urban drainage, 6 monitoring points collected drainage network water quality data at 5 time periods every day, namely 6:00 to 10:00, 10:00 to 14:00, 14:00 to 18:00, 18:00 to 22:00, and 22:00 to 6:00 the next day. The data set includes environmental indicators: land area, drainage pipe diameter (D), social indicators (population), water quantity indicators (drinking water supply (DWS), sewage flow, flow velocity (V) and liquid level) and water quality indicators (pH, temperature (T), conductivity, suspended solids (SS), BOD5, COD, NH4 + -N, TN and TP). We investigated and collected environmental and social indicators at the monitoring sites, and sampled and measured water quality and quantity data for the sewage network. Data were collected for 35 consecutive days from October 21, 2019 to November 25, 2019, and 1,050 observations were made (35 days × 5 times a day × 6 monitoring sites).

[0134] During the data collection period, there were no rainfall events as the study area was in the dry season. Therefore, all data were not affected by rainfall runoff. In addition, sewage samples were promptly sent to the laboratory for immediate processing and analysis. The tests included the above-mentioned 9 water quality indicators and 4 water quantity indicators. All 13 indicators were analyzed according to standard methods. A total of 13,650 data points were obtained through measurement. At the same time, the three environmental and social indicators were combined with the 13 indicators to give 16 indicators with a total of 16,800 data points.

[0135] 1.1. Select the main influencing factors (input) and decision variables (output) for the prediction of ammonia nitrogen concentration in the sewage treatment plant inlet, where the influencing factors mainly include: land area, sewer diameter, social indicators (population), water quantity indicators (drinking water supply (DWS), sewage flow, flow velocity (V) and liquid level);

[0136] The main influencing factors of drainage network water quality prediction are shown in Table 1:

[0137]

[0138] 1.2. According to the data type of the input quantity of the prediction model, the input quantity is divided into numerical influencing factors and non-numerical influencing factors. For numerical influencing factors, all types of input data are standardized and then used as input data of the prediction model. For non-numerical influencing factors, each input variable is converted into a corresponding numerical value according to the actual attributes of the influencing factor, and then used as input data of the prediction model. For example, according to the density of population residence, the population can be divided into three types: sparse, moderate and concentrated, represented by -1, 0 and 1 respectively;

[0139] 1.3. After collecting all the input data and output data of the drainage network water quality prediction model, check the data quality and use the sliding time window to replace the missing data and erroneous data in the input data and output data to ensure that the quality of the input data and output data of the prediction model meets the prediction requirements;

[0140] like Figure 3-8 As shown in the figure, the basic laws of water quality changes at the six monitoring points during the dry season are given in turn. The concentration of the same water quality index changes in a similar pattern at different monitoring points during the same time period, indicating that the wastewater quality changes in different drainage outlets in the same functional area are similar. In addition, the daily changes in water quality in the drainage network have certain regularities and will change in a predictable manner during different time periods. As shown in the figure, it can be clearly seen that BOD5, COD, NH4 + -The daily changes of N, TN, TP and conductivity have two obvious peaks at noon and at night. The peak concentrations at noon are relatively high: BOD5, COD, NH4 + -N, TN, TP and conductivity reached 131.48±20.17mg / L, 348.01±30.56mg / L, 35.71±3.27mg / L and 43.82±3.54mg / L, 4.68±0.56mg / L and 849±57.28S / m, respectively. The concentration and conductivity of the same peak at night were relatively low, 80.69±27.77mg / L, 217.88±31.65mg / L, 32.93±3.48mg / L, 37.65±3.69mg / L, 3.77±0.53mg / L and 769±62.51S / m, respectively. The concentrations of all indexes had an obvious trough in the afternoon and reached the lowest value at night.

[0141] 2. Construct a drainage network water quality prediction model based on long-short-term memory step sequence to predict the water quality of urban drainage network;

[0142] 2.1. Construct a drainage network water quality sequence step prediction framework based on long short-term memory network. The framework contains m models to achieve m-step drainage network water quality prediction;

[0143] 2.1.1. Construct a single drainage network water quality sequence step prediction model, and obtain the drainage network water quality prediction output data through the drainage network water quality prediction input data;

[0144] Long short-term memory networks are recursive neural networks that use the state of hidden neurons in the previous time step as additional input to the next time step, remembering the previous information and capturing dynamic changes in time. Fig. 9 As shown, x t represents the input at time t, h tRepresents the hidden state at time t. In a traditional recurrent neural network unit, the state of the output data can be expressed as;

[0145] h t =tanh(Uh t-1 +Wx t + b);

[0146] Where tanh(·) is the hyperbolic tangent function, x t is the input vector at time t, h t-1 is the hidden state at time t-1, U is the learnable matrix connecting the two hidden states, W is the learning matrix connecting the input vector and the hidden state, and b is the adjustable bias vector. Due to its vanishing or exploding gradient problem, this model cannot learn patterns with long-term lags well;

[0147] LSTM networks can overcome this shortcoming by replacing ordinary neurons of recurrent neural networks with memory blocks that contain four parts: in addition to three gates (i.e., forget gate, input gate, and output gate), it also includes a constant error rotation unit. The constant error rotation unit can run straight down the entire chain without any activation function, so the gradient does not disappear when the LSTM network is trained using time back propagation of drainage network water quality series. In addition, the LSTM network can maintain its state over time, and its nonlinear gating unit can regulate the flow of information in and out of the memory unit;

[0148] like Fig.10 As shown, x t 、h t and represent the input, hidden state and unit state at time t respectively;

[0149] The working principle of the long short-term memory network can be expressed by the following mathematical equation:

[0150] i t =σ(W i x t +U i h t-1 +b i );

[0151] f t =σ(W f x t +U f h t-1 +b f );

[0152] o t =σ(W o x t +U o h t-1 +bo );

[0153]

[0154]

[0155] h t =tanh(c t )⊙o t ;

[0156] Where σ(·) is the sigmoid function, ⊙ represents element-wise multiplication, and i t is the input gate at time t, and its learnable parameters are (W i , U i , b i ), f t is the forget gate at time t, and its learnable parameters are (W f , U f , b f ), o t is the output gate at time t, and its learnable parameters are (W o , U o , b o ), is the potential state of the unit at time t, and its learnable parameters are (W~, U~, b~), c t is the cell state at time t, h t is the hidden state of the cell. These gates can control the flow of information in and out of the memory cell. The forget gate determines what information the cell state forgets. The value range is from 0 to 1, indicating "completely delete the memory" to "completely keep the memory". The input gate determines what information is used to update the cell state. The potential cell state gate (i.e., tanh layer) adds a new candidate value to the state. The output gate controls the flow of information from the cell state into the new hidden state;

[0157] 2.1.2. Construct m drainage network water quality sequence step prediction models, obtain the drainage network water quality sequence step prediction framework (including m drainage network water quality sequence step prediction models), and use the drainage network water quality prediction input data to predict the m-step drainage network water quality prediction data, such as Fig.11 As shown;

[0158] The drainage network water quality sequence step prediction framework contains m drainage network water quality sequence step prediction models for m-step drainage network water quality prediction. The m drainage network water quality sequence step prediction models are not independent of each other. For example, when training the second-step advanced drainage network water quality prediction model, the output data of the first-step advanced drainage network water quality prediction model is needed; for the previous-step drainage network water quality prediction model, the input data X = [x1, ..., x n+1, y0, …, y n consists of the last n + 1 consecutive time steps of the variables, where x i (i = 1, …, n + 1) includes land area, drain pipe diameter, social indicators (population), and water volume indicators (drinking water supply (DWS), sewage flow rate, flow velocity (V), and liquid level);

[0159]

[0160] In the formula, is the predicted value of the water quality of the drainage pipe network on the (n + 1)-th day. Using the water quality observation data of the drainage pipe network and the predicted input data of the water quality of the drainage pipe network for n + 1 days (land area, drain pipe diameter, social indicators (population), water volume indicators (drinking water supply (DWS), sewage flow rate, flow velocity (V), and liquid level)), the water quality of the drainage pipe network on the (n + 1)-th day (i.e., the water quality of the drainage pipe network in the first step) is predicted. Then, the second-step advanced water quality prediction model of the drainage pipe network is defined as:

[0161]

[0162] Using the water quality observation data of the drainage pipe network for n days, the predicted data of the water quality of the drainage pipe network for (n + 1) days, and the predicted input data of the water quality of the drainage pipe network for n + 2 days, the water quality of the drainage pipe network on the (n + 2)-th day (i.e., the water quality of the drainage pipe network in the second step) is predicted. Similarly, the m-step advanced water quality prediction model of the drainage pipe network is defined as:

[0163]

[0164] Using the water quality observation data of the drainage pipe network for n + 1 days, the predicted data of the water quality of the drainage pipe network for m - 1 days, and the predicted input data of the water quality of the drainage pipe network for n + m days, the water quality of the drainage pipe network on the (n + m)-th day (i.e., the water quality of the drainage pipe network in the m-th step) is predicted.

[0165] 2.2. Using the first model in the step-by-step prediction framework of the drainage pipe network water quality sequence to predict the first-step advanced water quality of the drainage pipe network, and using it as the input of the (second, third, …, m)-step advanced water quality prediction models of the drainage pipe network (i.e., the second, third, …, m-th models in the step-by-step prediction framework of the drainage pipe network water quality sequence);

[0166] 2.3. Using the i-th (1 < i < m) model in the step-by-step prediction framework of the drainage pipe network water quality sequence to predict the i-step advanced water quality of the drainage pipe network, and using it as the input of the (i + 1, …, m)-step advanced water quality prediction models of the drainage pipe network (i.e., the i + 1-th, …, m-th models in the step-by-step prediction framework of the drainage pipe network water quality sequence);

[0167] 2.4. Use the m-th model in the step-by-step prediction framework of the drainage network water quality sequence to predict the water quality of the drainage network m steps ahead.

[0168] 2.5. Combine steps 2.2 - 2.4, and use m models to predict the water quality prediction data of the drainage network m steps ahead.

[0169] 2.5.1. Train the first water quality prediction model of the drainage network m steps ahead. Use data on land area, drain pipe diameter, social indicators (population), water volume indicators (drinking water supply (DWS), sewage flow, flow velocity (V), and liquid level) to predict the output data of the water quality of the drainage network m steps ahead.

[0170] 2.5.2. Train the second water quality prediction model of the drainage network m steps ahead. Use data on land area, drain pipe diameter, social indicators (population), water volume indicators (drinking water supply (DWS), sewage flow, flow velocity (V), and liquid level), and the output data of the water quality of the drainage network m steps ahead from step 2.5.1 to predict the output data of the water quality of the drainage network m steps ahead.

[0171] 2.5.3. Train the i-th (1 < i ≤ m) water quality prediction model of the drainage network m steps ahead. Use data on land area, drain pipe diameter, social indicators (population), water volume indicators (drinking water supply (DWS), sewage flow, flow velocity (V), and liquid level), and the output data of the water quality of the drainage network m steps ahead in the previous i - 1 steps to predict the output data of the water quality of the drainage network m steps ahead.

[0172] 2.5.4. Aggregate the output data of the water quality of the drainage network m steps obtained in steps 2.5.1 - 2.5.3 to obtain the water quality prediction data of the drainage network m steps ahead.

[0173] 3. Train and test the model, and set the model parameters to ensure that the model can accurately predict the water quality of the drainage network.

[0174] 3.1. Determine the learnable parameters and hyperparameters of the drainage network water quality prediction model to train and test the m models in the step-by-step prediction framework of the drainage network water quality sequence, and ensure that the prediction model can accurately output the water quality of the drainage network.

[0175] 3.1.1. Determine the dimensions of each long short-term memory network unit. Each network unit contains 7 dimensions, including: land area, drain pipe diameter, social indicators (population), water volume indicators (drinking water supply (DWS), sewage flow, flow velocity (V), and liquid level).

[0176] 3.1.2. Normalize the input data of the 7 dimensions of each long short-term memory network unit. All input data are normalized using the z-score normalization method.

[0177] 3.1.3. Set the hidden state length of each LSTM network unit to 32, set the rollout rate to 0.1 to avoid overfitting, set the learning rate to 0.001, set the batch size (per batch) sample number to 256, and use the root mean square error (MSE) as the loss function;

[0178] 3.1.4. Select k real observation data of urban drainage network water quality to train the proposed drainage network water quality sequence step prediction framework. Get k NSE values ​​through k training times, and select the hyperparameter set that produces the highest NSE median value among all hyperparameter combinations as the hyperparameters of the drainage network water quality sequence step prediction framework.

[0179] 3.2. Determine the performance evaluation indicators of the drainage network water quality prediction model to ensure that each model of the drainage network water quality sequence step prediction framework can be effectively trained to obtain a drainage network water quality prediction model that meets the accuracy requirements;

[0180] 3.3. Input the input data of the drainage network water quality prediction model into the drainage network water quality sequence step prediction framework, train and test the drainage network water quality prediction model, and ensure that the output data of the drainage network water quality prediction model can accurately reflect the actual drainage network water quality changes;

[0181] like Figure 12-16 As shown in the figure, the water quality data of 6 monitoring points were predicted by using the drainage network water quality sequence step prediction framework, and compared with the observed data at each monitoring point. As shown in the figure, the water quality data predicted by the drainage network water quality sequence step prediction framework is similar to the daily variation trend of the observed data, indicating that the drainage network water quality sequence step prediction framework can be used to simulate and predict the water quality of the drainage network.

[0182] 4. Simulate the changes in water quality in the urban drainage network and evaluate the prediction performance of the model;

[0183] 4.1. Construct a two-layer long short-term memory network as a baseline model for drainage network water quality prediction and evaluate the prediction performance of the drainage network water quality sequence step prediction framework;

[0184] 4.1.1. Use long short-term memory network to build a double-layer drainage network water quality sequence prediction framework, such as Fig.17As shown in , the framework consists of two encoder sequences, a state vector, and a decoder sequence. The first decoder sequence has long short-term memory network units, and its input includes land area, drainage pipe diameter, social indicators (population), water quantity indicators (drinking water supply (DWS), sewage flow, flow velocity (V), and liquid level). The second decoder sequence has long short-term memory network units, and its input data is the drainage network water quality observation data. The state vector contains the compression and processing information of the inputs from the two encoder sequences. The decoder sequence has m long short-term memory network units, and the output is the m-step ahead drainage network water quality prediction data, as shown Fig.18 As shown;

[0185] 4.1.2. The double-layer drainage network water quality sequence prediction framework was trained using 1050 sets of actual drainage network water quality data from cities. 1050 NSE values ​​were obtained through 1050 trainings. The hyperparameter set that produced the highest NSE median value among all hyperparameter combinations was selected as the hyperparameter of the double-layer drainage network water quality sequence prediction framework. The training process is as follows: Fig.17 shown.

[0186] 4.2. The water quality of the drainage network is predicted by the drainage network water quality prediction input data (land area, drainage pipe diameter, social indicators (population), water quantity indicators (drinking water supply (DWS), sewage flow, flow velocity (V) and liquid level)) and compared with the output results of the drainage network water quality sequence step prediction framework.

[0187] 4.2.1. Select the actual observation data of water quality of drainage pipe networks in j cities, input them into the drainage pipe network water quality sequence step prediction framework and the double-layer drainage pipe network water quality sequence prediction framework respectively, and obtain the drainage pipe network water quality prediction data;

[0188] 4.2.2. After obtaining the drainage network water quality prediction data, the Nash-Suteliffe model efficiency (NSE), the number of basins with NSE of 0, the recommended absolute top prediction error (TPE), the percentage bias (PBIAS) and the top peak flow deviation (FHV) are calculated. Based on these indicators, the prediction performance of the drainage network water quality sequence step prediction framework and the double-layer drainage network water quality prediction framework are compared and evaluated.

[0189] like Fig.18 As shown in the figure, compared with the prediction results of the double-layer drainage network water quality prediction framework, the performance of the drainage network water quality sequence step prediction framework for each water quality prediction value is better. Taking the performance of the double-layer drainage network water quality prediction framework as the baseline, the root mean square error of the drainage network water quality sequence step prediction framework has decreased significantly, and the BOD5, COD, NH4 + -R of N, TN and TP prediction results 2The increases were 23.65%, 22.88%, 30.67%, 28.42% and 28.36% respectively, indicating that the drainage network water quality sequence step prediction framework is more suitable for the water quality prediction of urban drainage networks than the double-layer drainage network water quality prediction framework.

[0190] The above embodiments are only preferred technical solutions of the present invention and should not be regarded as limiting the present invention. The protection scope of the present invention shall be the technical solutions recorded in the claims, including equivalent replacement solutions of the technical features in the technical solutions recorded in the claims. That is, equivalent replacement improvements within this scope are also within the protection scope of the present invention.

Claims

1. A method for predicting water quality in a drainage network based on long-short term memory step sequences, characterized in that: The steps include: (1) Prepare the input and output data for drainage network water quality prediction and preprocess the data; (2) Construct a drainage network water quality prediction model based on long-short-term memory step sequence to predict the water quality of urban drainage networks; (3) Train and test the model and set the model parameters to ensure that the model can accurately simulate the water quality changes in the drainage network; (4) Simulate the water quality changes in the drainage network and evaluate the prediction performance of the model; The step (1) is specifically as follows: (1.1) The main influencing factors and decision variables for drainage network water quality prediction are selected, including land area, drainage pipe diameter, social indicators, water volume indicators, sewage flow, flow rate and liquid level. The output of the prediction model is selected to reflect the characteristics of drainage network water quality changes, including pH, temperature, conductivity, suspended solids, BOD5, COD, NH4 + -N, TN and TP; (1.2) According to the data type of the input quantity of the prediction model, the input quantity is divided into numerical influencing factors and non-numerical influencing factors; for numerical influencing factors, all types of input data are standardized and then used as the input data of the prediction model; for non-numerical influencing factors, each input variable is converted into a corresponding numerical value according to the actual attributes of the influencing factor, and then used as the input data of the prediction model; (1.3) After collecting all the input data and output data of the drainage network water quality prediction model, check the data quality and use a sliding time window to replace the missing data and erroneous data in the input data and output data to ensure that the quality of the input data and output data of the prediction model meets the prediction requirements; The step (2) is specifically as follows: (2.1) Construct a water quality sequence step prediction framework for drainage network based on long short-term memory network, which includes m Models for implementation m Water quality prediction of drainage network; (2.2) The first model in the drainage network water quality sequence step prediction framework is used to predict the first step of the drainage network water quality, and the first step is used as the second, third, ..., m The input of the first-step advance drainage network water quality prediction model is the second, third, ..., and third steps in the drainage network water quality sequence step prediction framework. m Models; (2.3) Using the first step prediction framework of the drainage network water quality sequence i The model predicts the i Step ahead of the drainage network water quality, 1< i < m , and as the first i +1,…,th m The input of the first-step advance drainage network water quality prediction model is the first step in the drainage network water quality sequence step prediction framework. i +1, …, m Models; (2.4) Using the first step prediction framework of the drainage network water quality sequence m The model predicts the m Improve the water quality of the drainage network in advance; (2.5) Combine steps (2.2)-(2.4), by m The model predicts m Step ahead of time to predict water quality data for drainage network.

2. The method for predicting water quality of a drainage network based on a long short-term memory step sequence according to claim 1, characterized in that: The step (3) is specifically as follows: (3.1) Determine the learnable parameters and hyperparameters of the drainage network water quality prediction model to predict the water quality of the drainage network in the step prediction framework. m Train and test the model to ensure that the prediction model can accurately output the water quality prediction data of the drainage network; (3.2) Determine the performance evaluation indicators of the drainage network water quality prediction model to ensure that each model of the drainage network water quality step prediction framework can be effectively trained to obtain a drainage network water quality prediction model that meets the accuracy requirements; (3.3) Input the input data of the drainage network water quality prediction model into the drainage network water quality prediction model framework, train and test the drainage network water quality prediction model, and ensure that the output data of the drainage network water quality prediction model can accurately reflect the actual changes in the drainage network water quality.

3. The method for predicting water quality of a drainage network based on a long short-term memory step sequence according to claim 1, characterized in that: The step (4) is specifically as follows: (4.1) A two-layer long short-term memory network was constructed as a baseline model for drainage network water quality prediction, and the prediction performance of the drainage network water quality sequence step prediction framework was evaluated; (4.2) The drainage network water quality prediction input data and water quantity index prediction are used to obtain the drainage network water quality time series data, which are then compared with the output results of the drainage network water quality series step prediction framework.

4. The method for predicting water quality of a drainage network based on a long short-term memory step sequence according to claim 1, characterized in that: The step (2.1) is specifically as follows: (2.1.1) Construct a single drainage network water quality sequence step prediction model, and obtain the drainage network water quality prediction output data through the drainage network water quality prediction input data; (2.1.2) Build The drainage network water quality sequence step prediction model is obtained, and the drainage network water quality sequence step prediction framework is obtained, including A drainage network water quality sequence step prediction model is used to predict the drainage network water quality input data. The drainage network water quality prediction data.

5. The method for predicting water quality of a drainage network based on a long short-term memory step sequence according to claim 1, characterized in that: The step (2.5) is specifically as follows: (2.5.1) Training the first advanced drainage network water quality prediction model, and using the drainage network water quality prediction input data to predict the first step advanced drainage network water quality prediction output data; (2.5.2) Training the second advanced drainage network water quality prediction model, using the drainage network water quality prediction input data and the first step advanced drainage network prediction output data to predict the second step advanced drainage network water quality prediction output data; (2.5.3) i An advanced drainage network water quality prediction model is trained. , using the drainage network water quality prediction input data and previous i -1 step advance drainage network prediction output data prediction to obtain the i-th step advance drainage network prediction output data; (2.5.4) Summarize the m-step drainage network water quality prediction output data obtained in steps (2.5.1)-(2.5.3) to obtain the m-step advanced drainage network water quality prediction data.

6. The method for predicting water quality of a drainage network based on a long short-term memory step sequence according to claim 2, characterized in that: The step (3.1) is specifically: (3.1.1) Determine the dimensions of each LSTM network unit. Each network unit contains seven dimensions, including: land area, sewer diameter, social indicators, water quantity indicators, sewage flow, flow rate and liquid level; (3.1.2) Normalize the 7-dimensional input data of each LSTM network unit. All input data are normalized using the z-score normalization method. (3.1.3) The hidden state length of each LSTM network unit is set to 32. To avoid overfitting, the push rate is set to 0.1, the learning rate is set to 0.001, the number of samples per batch is set to 256, and the root mean square error (MSE) is used as the loss function. (3.1.4) Selection k The proposed drainage network water quality sequence step prediction framework is trained with real observation data of water quality in the sub-city drainage network. k Training times k The hyperparameter set that produces the highest median NSE value among all hyperparameter combinations is selected as the hyperparameters of the drainage network water quality series step prediction framework.

7. The method for predicting water quality of a drainage network based on a long short-term memory step sequence according to claim 3, characterized in that: The step (4.1) is specifically: (4.1.1) A two-layer drainage network water quality sequence prediction framework is constructed using LSTM networks. The framework consists of two encoder sequences, a state vector, and a decoder sequence. The first decoder sequence has LSTM network units, and its input includes land area, drainage pipe diameter, social indicators, water quantity indicators, sewage flow, flow velocity, and liquid level. The second decoder sequence has LSTM network units, and its input data is drainage network water quality observation data. The state vector contains the compressed and processed information of the inputs from the two encoder sequences. The decoder sequence has m LSTM network units, and the output is the m-step-ahead drainage network water quality forecast; (4.1.2) Adoption k The actual water quality data of the drainage pipe network in each city is used to train the double-layer drainage pipe network water quality sequence prediction framework. k Training times k The hyperparameter set that produces the highest median NSE value among all hyperparameter combinations is selected as the hyperparameters of the double-layer drainage network water quality series prediction framework.

8. The method for predicting water quality of a drainage network based on a long short-term memory step sequence according to claim 3, characterized in that: The step (4.2) is specifically as follows: (4.2.1) Selection The actual observation data of drainage network water quality in each city are input into the drainage network water quality sequence step prediction framework and the double-layer drainage network water quality sequence prediction framework respectively to obtain the drainage network water quality prediction data; (4.2.2) After obtaining the drainage network water quality prediction data, the Nash-Suteliffe model efficiency NSE, the number of basins with NSE of 0, the recommended absolute top prediction error TPE, the percentage deviation PBIAS and the top peak flow deviation FHV are calculated. Based on these indicators, the prediction performance of the drainage network water quality series step prediction framework and the double-layer drainage network water quality series prediction framework are compared and evaluated.

Citation Information

Patent Citations

  • Power plant coal storage capacity short-term prediction method based on SSA and LSTM deep learning

    CN110390436A

  • Water quality prediction method based on sequence-to-sequence deep learning mechanism

    CN112330005A

  • Drainage pipe network node water quality prediction method

    CN117333073A