A method for predicting influent ammonia nitrogen concentration based on long-short-term memory step sequence
By using a method based on long and short-term memory step sequence in the prediction of ammonia nitrogen concentration in sewage plant, a sewage plant inlet ammonia nitrogen concentration sequence step prediction framework containing m models is constructed, which solves the problems of limited accuracy and information leakage in the existing technology, and achieves high-precision multi-step advance prediction.
Patent Information
- Application Number
- CN202410329167.6
- 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
The prior art has limited accuracy in predicting ammonia nitrogen concentration in sewage plant, and traditional models fail to effectively capture the sequence information of sewage plant water inlet sequence and compressed information of influencing factors, resulting in information leakage and degradation of prediction performance.
The influent ammonia nitrogen concentration prediction method based on long and short-term memory step sequence is adopted. By constructing a sewage plant influent ammonia nitrogen concentration sequence prediction framework containing m models, the time series data is processed using the long and short-term memory network to capture the sequence information and compressed information of influential factors, and multi-step advance prediction is achieved.
It improves the accuracy of predicting ammonia nitrogen concentration in the inlet water in the sewage plant, avoids information leakage, and can accurately simulate and predict the multi-step forward ammonia nitrogen concentration, which is suitable for real-time management and maintenance of sewage treatment plants.
Smart Images

Figure CN118298962B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of prediction of influent ammonia nitrogen concentration of urban sewage treatment plants, and in particular to a method for predicting influent ammonia nitrogen concentration based on long-short term memory step sequences. Background Art
[0002] With the population explosion and the advancement of urbanization, the amount and complexity of urban sewage are increasing year by year. In order to control urban water pollution, protect the health of residents, and ensure the sustainable development of cities, sewage needs to be properly treated. As an important part of urban operation, sewage treatment needs to timely and accurately evaluate the water quality indicators of sewage treatment plant inlet, assist in formulating the operation strategy of sewage treatment plant, and intelligently manage and maintain the sewage treatment system.
[0003] Among water quality detection methods, direct detection methods based on experiments are accurate and reliable, but they consume the manpower cost of sample collection and processing and the time cost of chemical reactions, which is not conducive to real-time management. Therefore, soft detection methods that use water quality prediction models to evaluate water quality have become popular, thus avoiding systematic sampling and measurement.
[0004] Traditional water quality prediction models such as empirical models, dynamic models, and regression models have limited accuracy, which restricts their application. In recent years, deep learning algorithms have attracted widespread attention due to their ability to capture complex nonlinear mapping relationships between different variables, which makes them more advantageous than the above traditional models. For example, 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) can the water quality prediction results of the drainage network be accurately obtained. In addition, decomposition integration models that combine data decomposition and deep learning algorithms have also achieved significant prediction performance. For example, compared with a single long short-term memory network, the prediction performance of the comprehensive model combining modal empirical decomposition and long short-term memory network is better. However, these integrated models usually need to first decompose the complex prediction sequence, then model and predict 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.
[0005] Although decomposition ensemble 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 treatment plant influent encoding as input data, and do not obtain the following important information in the input data: (a) the sequence information of the sewage treatment plant influent sequence; (b) the previous influent quality containing partially compressed information of all factors that affect the predicted influent water quality. The compressed information mainly includes all possible influencing factors that affect the influent water quality, such as pH, suspended solids (SS), water temperature (WT), air temperature, air pressure, relative humidity, rainfall, wind speed, average total cloud cover and visibility. The term “compression” refers to the low-dimensional results obtained from high-dimensional factors, which contain information about these factors. In addition, sequence-to-sequence models do not consider the following situation in practice: the influent concentration on day j is not affected by the influent data after day j. Summary of the invention
[0006] The purpose of the present invention is to overcome the above-mentioned shortcomings and provide a method for predicting the influent ammonia nitrogen concentration based on long-short-term memory step sequences to improve the prediction accuracy of the influent ammonia nitrogen concentration of a sewage treatment plant.
[0007] In order to solve the above technical problems, the technical solution adopted by the present invention is: a method for predicting the influent ammonia nitrogen concentration based on long-short term memory step sequence, comprising the following steps:
[0008] (1) Prepare input data and output data for predicting ammonia nitrogen concentration in sewage treatment plant influent and preprocess the data;
[0009] (2) Construct a sewage treatment plant influent ammonia nitrogen concentration prediction model based on long-short-term memory step sequence to predict the influent ammonia nitrogen concentration of urban sewage treatment plants;
[0010] (3) Train and test the model and set the model parameters to ensure that the model can accurately simulate the ammonia nitrogen concentration in the sewage plant inlet;
[0011] (4) Simulate the ammonia nitrogen concentration in the sewage treatment plant inlet and evaluate the predictive performance of the model.
[0012] Furthermore, the step (1) is specifically as follows:
[0013] (1.1) Select the influencing factors (input variables) and decision variables (output variables) for predicting the influent ammonia nitrogen concentration of the sewage treatment plant. The influencing factors include: pH, suspended solids (SS), water temperature (WT), air temperature, air pressure, relative humidity, rainfall, wind speed, average total cloud cover, and visibility. The output variable of the prediction model is the influent ammonia nitrogen concentration of the sewage treatment plant.
[0014] (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 it 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.
[0015] (1.3) After collecting all the input data and output data of the prediction model for the influent ammonia nitrogen concentration of the sewage treatment plant, 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.
[0016] Further, the specific steps of step (2) are as follows:
[0017] (2.1) Construct a step-by-step prediction framework for the influent ammonia nitrogen concentration sequence of the sewage treatment plant based on a long short-term memory network. This framework contains m models for realizing the m-step prediction of the influent ammonia nitrogen concentration of the sewage treatment plant.
[0018] (2.2) Use the first model in the step-by-step prediction framework for the influent ammonia nitrogen concentration sequence of the sewage treatment plant to predict the first-step ahead influent ammonia nitrogen concentration, and use it as the input of the (second, third,..., m)-step ahead prediction models for the influent ammonia nitrogen concentration of the sewage treatment plant (i.e., the second, third,..., m-th models in the step-by-step prediction framework for the influent ammonia nitrogen concentration sequence of the sewage treatment plant).
[0019] (2.3) Use the i-th (1 < i < m) model in the step-by-step prediction framework for the influent ammonia nitrogen concentration sequence of the sewage treatment plant to predict the i-step ahead influent ammonia nitrogen concentration, and use it as the input of the (i + 1,..., m)-step ahead prediction models for the influent ammonia nitrogen concentration of the sewage treatment plant (i.e., the (i + 1)-th,..., m-th models in the step-by-step prediction framework for the influent ammonia nitrogen concentration sequence of the sewage treatment plant).
[0020] (2.4) Use the m-th model in the step-by-step prediction framework for the influent ammonia nitrogen concentration sequence of the sewage treatment plant to predict the m-step ahead influent ammonia nitrogen concentration.
[0021] (2.5) Combine steps 2.2 - 2.4 to obtain the m-step ahead prediction data for the influent ammonia nitrogen concentration of the sewage treatment plant through m models.
[0022] Furthermore, the step (3) is specifically as follows:
[0023] (3.1) Determine the learnable parameters and hyperparameters of the sewage treatment plant influent ammonia nitrogen concentration prediction model so as to train and test the m models in the sewage treatment plant influent ammonia nitrogen concentration series step prediction framework to ensure that the prediction model can accurately output the sewage treatment plant influent ammonia nitrogen concentration prediction data;
[0024] (3.2) Determine the performance evaluation index of the sewage treatment plant influent ammonia nitrogen concentration prediction model to ensure that each model of the sewage treatment plant influent ammonia nitrogen concentration step prediction framework can be effectively trained to obtain a sewage treatment plant influent ammonia nitrogen concentration prediction model that meets the accuracy requirements;
[0025] (3.3) Input the input data of the sewage plant inlet ammonia nitrogen concentration prediction model into the sewage plant inlet ammonia nitrogen concentration prediction model framework, train and test the sewage plant inlet ammonia nitrogen concentration prediction model, and ensure that the output data of the sewage plant inlet ammonia nitrogen concentration prediction model can accurately reflect the actual changes in the sewage plant inlet water quality.
[0026] Furthermore, the step (4) is specifically as follows:
[0027] (4.1) A two-layer long short-term memory network was constructed as a benchmark model for predicting the ammonia nitrogen concentration in the sewage treatment plant inlet, and the prediction performance of the step prediction framework for the ammonia nitrogen concentration series in the sewage treatment plant inlet was evaluated;
[0028] (4.2) The time series data of the inlet ammonia nitrogen concentration of the sewage treatment plant is obtained by predicting the input data of the inlet ammonia nitrogen concentration of the sewage treatment plant, and compared with the output results of the step prediction framework of the inlet ammonia nitrogen concentration series of the sewage treatment plant.
[0029] Furthermore, the step (2.1) is specifically as follows:
[0030] (2.1.1) Construct a single sewage treatment plant influent ammonia nitrogen concentration sequence step prediction model, and obtain the sewage treatment plant influent ammonia nitrogen concentration prediction output data through the sewage treatment plant influent ammonia nitrogen concentration prediction input data;
[0031] (2.1.2) Construct m sewage treatment plant influent ammonia nitrogen concentration sequence step prediction models, obtain sewage treatment plant influent ammonia nitrogen concentration sequence step prediction framework (including m sewage treatment plant influent ammonia nitrogen concentration sequence step prediction models), and use sewage treatment plant influent ammonia nitrogen concentration prediction input data to predict m-step sewage treatment plant influent ammonia nitrogen concentration prediction data.
[0032] Furthermore, the step (2.5) is specifically as follows:
[0033] (2.5.1) Train the prediction model for the influent ammonia nitrogen concentration of the first leading sewage treatment plant, and use the influent data of the sewage treatment plant to predict the output data of the influent ammonia nitrogen concentration of the first leading sewage treatment plant;
[0034] (2.5.2) Train the prediction model for the influent ammonia nitrogen concentration of the second leading sewage treatment plant, and use the predicted input data of the influent ammonia nitrogen concentration of the sewage treatment plant and the predicted output data of the influent ammonia nitrogen concentration of the first leading sewage treatment plant to predict the predicted output data of the influent ammonia nitrogen concentration of the second leading sewage treatment plant;
[0035] (2.5.3) Train the prediction model for the influent ammonia nitrogen concentration of the i-th (1 < i ≤ m) leading sewage treatment plant, and use the predicted input data of the influent ammonia nitrogen concentration of the sewage treatment plant and the predicted output data of the influent ammonia nitrogen concentration of the previous i - 1 leading sewage treatment plants to predict the predicted output data of the influent ammonia nitrogen concentration of the i-th leading sewage treatment plant;
[0036] (2.5.4) Aggregate the predicted output data of the influent ammonia nitrogen concentration of the m steps obtained in steps 2.5.1 - 2.5.3 to obtain the predicted data of the influent ammonia nitrogen concentration of the m-step leading sewage treatment plant.
[0037] Furthermore, the specific content of step (3.1) is as follows:
[0038] (3.1.1) Determine the dimensions of each long short-term memory network unit. Each network unit contains 10 dimensions, including: pH, suspended solids (SS), water temperature (WT), air temperature, air pressure, relative humidity, rainfall, wind speed, average total cloud cover, and visibility;
[0039] (3.1.2) Normalize the 10-dimensional input data of each long short-term memory network unit. All input data are normalized using the z-score normalization method.
[0040] (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.
[0041] (3.1.4) Select k sets of real observation data of the influent ammonia nitrogen concentration of urban sewage treatment plants to train the proposed step prediction framework for the influent ammonia nitrogen concentration sequence of sewage treatment plants. Through k times of training, k NSE values are obtained. Select the set of hyperparameters that produce the highest median NSE among all hyperparameter combinations as the hyperparameters of the step prediction framework for the influent ammonia nitrogen concentration sequence of sewage treatment plants.
[0042] Furthermore, the specific content of step (4.1) is as follows:
[0043] (4.1.1) A two-layer SSTM sequence prediction framework for the influent ammonia nitrogen concentration of a sewage treatment plant 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 a long short-term memory network unit, and its input includes pH, suspended solids (SS), water temperature (WT), air temperature, air pressure, relative humidity, rainfall, wind speed, average total cloud cover, and visibility. The second decoder sequence has a long short-term memory network unit, and its input data is the observed data of the influent ammonia nitrogen concentration of the sewage treatment plant. 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 prediction of the influent ammonia nitrogen concentration of the sewage treatment plant.
[0044] (4.1.2) The actual data of ammonia nitrogen concentration in the inlet water of sewage treatment plants in k cities are used to train the double-layer sewage treatment plant inlet ammonia nitrogen concentration 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 sewage treatment plant inlet ammonia nitrogen concentration series prediction framework.
[0045] Furthermore, the step (4.2) is specifically as follows:
[0046] (4.2.1) Select the actual observation data of ammonia nitrogen concentration in the sewage treatment plant in j cities, input them into the sewage treatment plant inlet ammonia nitrogen concentration series step prediction framework and the double-layer sewage treatment plant inlet ammonia nitrogen concentration series prediction framework, and obtain the sewage treatment plant inlet ammonia nitrogen concentration prediction data;
[0047] (4.2.2) After obtaining the prediction data of the ammonia nitrogen concentration in the sewage treatment plant inlet, the mean absolute error (MAE), mean absolute percentage error (MAPE) and root mean square error (RMSE) were used to compare and evaluate the prediction performance of the sewage treatment plant inlet ammonia nitrogen concentration series step prediction framework and the double-layer sewage treatment plant inlet ammonia nitrogen concentration series prediction framework.
[0048] The beneficial effects of the present invention are as follows: the present invention is of great significance for improving the prediction accuracy of influent ammonia nitrogen concentration, especially for realizing multi-step ahead influent ammonia nitrogen concentration prediction; the long short-term memory network solves the gradient explosion and vanishing problems of influent ammonia nitrogen concentration prediction, and can improve the prediction performance; at the same time, the influent ammonia nitrogen concentration sequence step prediction framework, which includes m models, can realize m-step influent ammonia nitrogen concentration prediction; when predicting the influent ammonia nitrogen concentration, the current influent ammonia nitrogen concentration is not affected by the later influent data, and is more consistent with the actual situation; the method of the present invention can be used for predicting the influent ammonia nitrogen concentration of a sewage treatment plant, can improve the prediction accuracy of the influent ammonia nitrogen concentration of a sewage treatment plant, and is of great significance for reducing the ammonia nitrogen concentration in sewage. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 It is a flow chart of a method for predicting influent ammonia nitrogen concentration based on long short-term memory step sequence;
[0050] Figure 2 This is the distribution map of the sewage plant inlet observation data at one of the monitoring points of a sewage plant;
[0051] Figure 3 This is the distribution map of the sewage plant inlet observation data at two monitoring points of a sewage plant;
[0052] Figure 4 It is the Spearman correlation diagram between NH3-N and other indicators;
[0053] Figure 5 Schematic diagram of the network structure of a recursive neural network;
[0054] Figure 6 This is a schematic diagram of the network structure of the long short-term memory network;
[0055] Figure 7 This is a schematic diagram of the framework structure for step prediction of the ammonia nitrogen concentration sequence in the sewage plant influent;
[0056] Figure 8 A comparison chart of the influent ammonia nitrogen concentration of a sewage plant predicted by using the step prediction framework of the influent ammonia nitrogen concentration sequence and the actual observed data of the influent ammonia nitrogen concentration of the sewage plant;
[0057] Fig. 9 The schematic diagram of the architecture of the double-layer sewage treatment plant influent ammonia nitrogen concentration series prediction framework;
[0058] Fig.10 The schematic diagram of the network structure of the double-layer sewage treatment plant influent ammonia nitrogen concentration series prediction framework;
[0059] Fig.11 A comparison chart of the predicted ammonia nitrogen concentration in the sewage plant inlet using the double-layer sewage plant inlet ammonia nitrogen concentration series prediction framework and the actual observed data of the ammonia nitrogen concentration in the sewage plant inlet;
[0060] Fig.12 This is a comparative analysis chart of the prediction performance of the sewage influent ammonia nitrogen concentration series step prediction framework and the double-layer sewage plant influent ammonia nitrogen concentration series prediction framework. DETAILED DESCRIPTION
[0061] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0062] Example 1: Figure 1 As shown, a method for predicting influent ammonia nitrogen concentration based on long short-term memory step sequence includes the following steps:
[0063] 1. Prepare the input data and output data for predicting the ammonia nitrogen concentration in the influent of the urban sewage treatment plant and pre-process the data;
[0064] 2. Construct a sewage treatment plant influent ammonia nitrogen concentration prediction model based on long-short-term memory step sequence to predict the influent ammonia nitrogen concentration of urban sewage treatment plants;
[0065] 3. Train and test the model, set the model parameters, and ensure that the model can accurately predict the ammonia nitrogen concentration in the influent of the urban sewage treatment plant;
[0066] 4. Predict the ammonia nitrogen concentration in the influent of urban sewage treatment plants and evaluate the prediction performance of the model;
[0067] Further, the step 1 is specifically as follows:
[0068] 1.1. The main influencing factors (input) and decision variables (output) for the prediction of ammonia nitrogen in the influent of urban sewage treatment plants are selected. The influencing factors mainly include: pH, suspended solids (SS), water temperature (WT), air temperature, air pressure, relative humidity, rainfall, wind speed, average total cloud cover and visibility. The output of the prediction model is the ammonia nitrogen concentration in the influent of the sewage treatment plant.
[0069] 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 size of the wind speed, the wind speed can be divided into three types: small, medium and large, represented by -1, 0 and 1 respectively;
[0070] 1.3. After collecting all the input data and output data of the sewage treatment plant influent ammonia nitrogen concentration 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;
[0071] Further, the step 2 is specifically as follows:
[0072] 2.1. Construct a step prediction framework for the influent ammonia nitrogen concentration sequence of sewage treatment plants based on long short-term memory network. The framework contains m models to realize the m-step ammonia nitrogen concentration of sewage treatment plant influent;
[0073] 2.2. Use the first model in the step-by-step prediction framework of the influent ammonia nitrogen concentration sequence of the wastewater treatment plant to predict the first-step ahead influent ammonia nitrogen concentration, and use it as the input for the (second, third, …, m)-step ahead influent ammonia nitrogen concentration prediction models of the wastewater treatment plant (i.e., the second, third, …, m-th models in the influent ammonia nitrogen concentration prediction framework of the wastewater treatment plant);
[0074] 2.3. Use the i-th (1 < i < m) model in the step-by-step prediction framework of the influent ammonia nitrogen concentration sequence of the wastewater treatment plant to predict the i-step ahead influent ammonia nitrogen concentration, and use it as the input for the (i + 1, …, m)-step ahead influent ammonia nitrogen concentration prediction models of the wastewater treatment plant (i.e., the (i + 1)-th, …, m-th models in the influent ammonia nitrogen concentration prediction framework of the wastewater treatment plant);
[0075] 2.4. Use the m-th model in the influent ammonia nitrogen concentration prediction framework of the wastewater treatment plant to predict the m-step ahead influent ammonia nitrogen concentration of the wastewater treatment plant;
[0076] 2.5. Combine steps 2.2 - 2.4, and use the m models to predict the m-step ahead influent ammonia nitrogen concentration prediction data of the wastewater treatment plant.
[0077] Furthermore, the specific content of step 3 is as follows:
[0078] 3.1. Determine the learnable parameters and hyperparameters of the influent ammonia nitrogen concentration prediction model of the wastewater treatment plant, so as to train and test the m models in the step-by-step prediction framework of the influent ammonia nitrogen concentration sequence of the wastewater treatment plant, and ensure that the prediction model can accurately output the influent ammonia nitrogen concentration sequence data of the wastewater treatment plant;
[0079] 3.2. Determine the performance evaluation index of the influent ammonia nitrogen concentration prediction model of the wastewater treatment plant, and ensure that each model in the step-by-step prediction framework of the influent ammonia nitrogen concentration sequence of the wastewater treatment plant can be effectively trained to obtain an influent ammonia nitrogen concentration prediction model that meets the accuracy requirements;
[0080] 3.3. Input the input data of the influent ammonia nitrogen concentration prediction model of the wastewater treatment plant into the step-by-step prediction framework of the influent ammonia nitrogen concentration sequence of the wastewater treatment plant, and train and test the influent ammonia nitrogen concentration prediction model of the wastewater treatment plant, and ensure that the output data of the influent ammonia nitrogen concentration prediction model of the wastewater treatment plant (i.e., the influent ammonia nitrogen concentration of the wastewater treatment plant) can accurately reflect the real influent ammonia nitrogen concentration of the wastewater treatment plant.
[0081] Furthermore, the specific content of step 4 is as follows:
[0082] 4.1. Construct a two-layer long short-term memory network as the benchmark model for predicting the influent ammonia nitrogen concentration of the wastewater treatment plant, and evaluate the prediction performance of the step-by-step prediction framework of the influent ammonia nitrogen concentration sequence of the wastewater treatment plant;
[0083] 4.2. The output data (NH3-N) of the sewage treatment plant inlet ammonia nitrogen concentration prediction model are predicted by the input data of the sewage treatment plant inlet ammonia nitrogen concentration prediction model (PH, suspended solids (SS), water temperature (WT), air temperature, air pressure, relative humidity, rainfall, wind speed, average total cloud cover and visibility), and compared with the output results of the sewage treatment plant inlet ammonia nitrogen concentration sequence step prediction framework.
[0084] Further, the step 2.1 is specifically as follows:
[0085] 2.1.1. Construct a single sewage treatment plant influent ammonia nitrogen concentration sequence step prediction model, and predict the sewage treatment plant influent ammonia nitrogen concentration through the sewage treatment plant influent ammonia nitrogen concentration prediction input data;
[0086] 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:
[0087] h = tanh(Uh-1+Wx+b);
[0088] 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;
[0089] LSTM networks can overcome this shortcoming by replacing ordinary neurons of recurrent neural networks with memory blocks containing four parts: in addition to three gates (i.e., forget gate, input gate, and output gate), a constant error rotation unit is included. 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 the ammonia nitrogen concentration series of the sewage plant influent. 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 storage unit;
[0090] The working principle of the long short-term memory network can be expressed by the following mathematical equation:
[0091] i t =σ(W i x t +U i h t-1 +b i );
[0092] f t =σ(W f x t +U f h t-1 +b f );
[0093] o t =σ(W o x t +U o h t-1 +b o );
[0094]
[0095]
[0096] h t =tanh(c t )☉o t ;
[0097] 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;
[0098] 2.1.2. Construct a step prediction model for the influent ammonia nitrogen concentration sequence of m sewage treatment plants, obtain a step prediction framework for the influent ammonia nitrogen concentration sequence of m sewage treatment plants (including a step prediction model for the influent ammonia nitrogen concentration sequence of m sewage treatment plants), and use the influent ammonia nitrogen concentration prediction input data of the sewage treatment plants to predict the influent ammonia nitrogen concentration prediction data of m steps;
[0099] The framework of the step prediction of the ammonia nitrogen concentration sequence of the sewage treatment plant inlet contains m step prediction models of the ammonia nitrogen concentration sequence of the sewage treatment plant inlet, which are used for the m-step prediction of the ammonia nitrogen concentration of the sewage treatment plant inlet. The m step prediction models of the ammonia nitrogen concentration sequence of the sewage treatment plant inlet are not independent of each other. For example, when training the second-step sewage treatment plant inlet ammonia nitrogen concentration prediction model, the output data of the first-step advance sewage treatment plant inlet ammonia nitrogen concentration prediction model is needed; for the previous-step sewage treatment plant inlet ammonia nitrogen concentration 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 pH, suspended solids (SS), water temperature (WT), air temperature, air pressure, relative humidity, rainfall, wind speed, average total cloud cover and visibility;
[0100]
[0101] In the formula, It is the predicted value of the sewage treatment plant influent ammonia nitrogen concentration on the n+1 day. The sewage treatment plant influent ammonia nitrogen concentration on the (n+1) day (i.e., the sewage treatment plant influent ammonia nitrogen concentration in the first step) is predicted using the sewage treatment plant influent ammonia nitrogen concentration observation data and the sewage treatment plant influent ammonia nitrogen concentration prediction input data on the n+1 day (PH, suspended solids (SS), water temperature (WT), air temperature, air pressure, relative humidity, rainfall, wind speed, average total cloud cover, and visibility). Then, the second step advance sewage treatment plant influent ammonia nitrogen concentration prediction model is defined as:
[0102]
[0103] Using the observation data of the influent ammonia nitrogen concentration of the nth sewage treatment plant, the prediction of the influent ammonia nitrogen concentration of the (n+1)th sewage treatment plant, and the data of the factors affecting the influent ammonia nitrogen concentration of the sewage treatment plant on the n+2th day, the influent ammonia nitrogen concentration of the sewage treatment plant on the (m+2)th day (i.e. the influent ammonia nitrogen concentration of the sewage treatment plant in the second step) is predicted. Similarly, the prediction model of the influent ammonia nitrogen concentration of the mth-step sewage treatment plant is defined as:
[0104]
[0105] Using the observed ammonia nitrogen concentration data of the sewage treatment plant's influent on the (n + 1)-th day, the predicted data of the ammonia nitrogen concentration of the sewage treatment plant's influent on the (m - 1)-th day, and the observed data of the influencing factors of the ammonia nitrogen concentration of the sewage treatment plant's influent on the (n + m)-th day, the ammonia nitrogen concentration of the sewage treatment plant's influent on the (n + m)-th day (i.e., the ammonia nitrogen concentration of the sewage treatment plant's influent at the m-th step) is predicted.
[0106] Further, step 2.5 is specifically as follows:
[0107] 2.5.1. Train the first advanced ammonia nitrogen concentration prediction model of the sewage treatment plant's influent, and use data such as pH, suspended solids (SS), water temperature (WT), air temperature, air pressure, relative humidity, rainfall, wind speed, average total cloud cover, and visibility to predict the predicted data of the ammonia nitrogen concentration of the sewage treatment plant's influent at the first advanced step;
[0108] 2.5.2. Train the second advanced ammonia nitrogen concentration prediction model of the sewage treatment plant's influent, and use data such as pH, suspended solids (SS), water temperature (WT), air temperature, air pressure, relative humidity, rainfall, wind speed, average total cloud cover, visibility, and the data of the ammonia nitrogen concentration of the sewage treatment plant's influent at the first advanced step to predict the predicted data of the ammonia nitrogen concentration of the sewage treatment plant's influent at the second advanced step;
[0109] 2.5.3. Train the i-th (1 < i ≤ m) advanced ammonia nitrogen concentration prediction model of the sewage treatment plant's influent, and use data such as pH, suspended solids (SS), water temperature (WT), air temperature, air pressure, relative humidity, rainfall, wind speed, average total cloud cover, visibility, and the predicted data of the ammonia nitrogen concentration of the sewage treatment plant's influent in the previous i - 1 steps to predict the output data of the ammonia nitrogen concentration of the sewage treatment plant's influent at the i-th advanced step;
[0110] 2.5.4. Summarize the output data of the ammonia nitrogen concentration of the sewage treatment plant's influent in m steps obtained in steps 2.5.1 - 2.5.3 to obtain the predicted data of the ammonia nitrogen concentration of the sewage treatment plant's influent in m advanced steps.
[0111] Further, step 3.1 is specifically as follows:
[0112] 3.1.1. Determine the dimensions of each long short-term memory network unit. Each network unit contains 10 dimensions, including: pH, suspended solids (SS), water temperature (WT), air temperature, air pressure, relative humidity, rainfall, wind speed, average total cloud cover, and visibility;
[0113] 3.1.2. Normalize the input data of the 10 dimensions of each long short-term memory network unit. All input data are normalized using the z-score normalization method.
[0114] 3.1.3. The hidden state length of each LSTM network unit is set to 32. To avoid overfitting, the dropout rate is set to 0.1, 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.
[0115] 3.1.4. Select k real observation data of ammonia nitrogen concentration in the inlet of urban sewage treatment plants to train the proposed sewage treatment plant inlet ammonia nitrogen concentration series step 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 sewage treatment plant inlet ammonia nitrogen concentration series step prediction framework.
[0116] Further, the step 4.1 is specifically as follows:
[0117] 4.1.1. A two-layer sewage treatment plant influent ammonia nitrogen concentration 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 pH, suspended solids (SS), water temperature (WT), air temperature, air pressure, relative humidity, rainfall, wind speed, average total cloud cover and visibility. The second decoder sequence has a long short-term memory network unit, and its input data is the sewage treatment plant influent ammonia nitrogen concentration 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 sewage treatment plant influent ammonia nitrogen concentration prediction;
[0118] 4.1.2. The actual data of ammonia nitrogen concentration in the inlet of k urban sewage plants are used to train the double-layer sewage plant inlet ammonia nitrogen concentration 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 sewage plant inlet ammonia nitrogen concentration series prediction framework.
[0119] Further, the step 4.2 is specifically as follows:
[0120] 4.2.1. Select the actual observation data of ammonia nitrogen concentration in the sewage treatment plant in j cities, and input them into the sewage treatment plant inlet ammonia nitrogen concentration sequence step prediction framework and the double-layer sewage treatment plant inlet ammonia nitrogen concentration sequence prediction framework respectively to obtain the sewage treatment plant inlet ammonia nitrogen concentration prediction data;
[0121] 4.2.2. After obtaining the prediction data of the ammonia nitrogen concentration in the sewage treatment plant inlet, the mean absolute error (MAE), mean absolute percentage error (MAPE) and root mean square error (RMSE) are calculated. Based on these indicators, the prediction performance of the sewage treatment plant inlet ammonia nitrogen concentration series step prediction framework and the double-layer sewage treatment plant inlet ammonia nitrogen concentration series prediction framework are compared and evaluated.
[0122] Embodiment 2: A method for predicting influent ammonia nitrogen concentration based on long short-term memory step sequence, comprising the following steps:
[0123] 1. Prepare the input data and output data for the prediction of ammonia nitrogen concentration in the sewage treatment plant and preprocess the data. A total of 11 indicators were collected, including NH3-N, pH, suspended solids (SS), water temperature (WT), air temperature, air pressure, relative humidity, rainfall, wind speed, average total cloud cover and visibility; water quality data came from two different monitoring points of a sewage treatment plant in a southern city in China. The data were sampled every two hours. The sampling time of monitoring point 1 was 1:00, 3:00, 5:00..., and the sampling time of monitoring point 2 was 2:00, 4:00, 6:00... Meteorological data came from the local meteorological station. The data were sampled once every hour, and the sampling time was 1:00, 2:00, 3:00... The data of 11 indicators were collected from the sewage treatment plant for 120 consecutive days from January 1, 2022 to April 30, 2022.
[0124] 1.1. The main influencing factors (input) and decision variables (output) for the prediction of ammonia nitrogen concentration in the sewage treatment plant inlet are selected. The influencing factors mainly include: pH, suspended solids (SS), water temperature (WT), air temperature, air pressure, relative humidity, rainfall, wind speed, average total cloud cover and visibility. The output of the prediction model is the ammonia nitrogen concentration in the sewage treatment plant inlet;
[0125] The main influencing factors for the prediction of ammonia nitrogen concentration in sewage treatment plant influent are shown in Table 1:
[0126]
[0127] 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 size of the wind speed, the wind speed can be divided into three types: small, medium and large, represented by -1, 0 and 1 respectively;
[0128] 1.3. After collecting all the input data and output data of the sewage plant influent concentration 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;
[0129] At each monitoring point, each indicator has a total of 1440 observations, the entire original data set has a total of 2880 samples, and a total of 31680 observations. After data preprocessing, the data with multiple consecutive missing values within 1 day were deleted (a total of 240 data points), and the final number of samples was 2640, of which 181 were sparse missing / outliers, accounting for 6.86% of the remaining data set. The observation data at monitoring points 1 and 2 are as follows: Figure 2 and Figure 3 shown.
[0130] In order to test whether the collected indicators are helpful for the prediction of NH3-N, the Spearman correlation coefficient between NH3-N and other indicators was calculated, as shown in Figure 4 As shown in the figure, except for wind speed, the Spearman correlations between the other nine indicators and NH3-N all reached a statistically significant level (P<0.01). Therefore, the remaining nine indicators were selected as input indicators, and wind speed was removed from the input data for the prediction of ammonia nitrogen water quality in the sewage plant inlet.
[0131] 2. Construct a sewage treatment plant influent ammonia nitrogen concentration prediction model based on long-short-term memory step sequence to predict the influent ammonia nitrogen concentration of urban sewage treatment plants;
[0132] 2.1. Construct a step prediction framework for the influent ammonia nitrogen concentration sequence of sewage treatment plants based on long short-term memory network. The framework contains m models to realize the m-step prediction of the influent ammonia nitrogen concentration of sewage treatment plants;
[0133] 2.1.1. Construct a single sewage treatment plant influent ammonia nitrogen concentration sequence step prediction model, and obtain the sewage treatment plant influent concentration output data through the sewage treatment plant influent ammonia nitrogen concentration prediction input data;
[0134] 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. Figure 5 As shown, x t represents the input at time t, h t Represents the hidden state at time t. In a traditional recurrent neural network unit, the state of the output data can be expressed as;
[0135] h t =tanh(Uh t-1 +Wx t + b);
[0136] Where tanh(·) is the hyperbolic tangent function, x t is the input vector at time t, h t-1is 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;
[0137] LSTM networks can overcome this shortcoming by replacing ordinary neurons of recurrent neural networks with memory blocks containing four parts: in addition to three gates (i.e., forget gate, input gate, and output gate), a constant error rotation unit is included. 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 the ammonia nitrogen concentration series of the sewage plant influent. 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 storage unit;
[0138] like Figure 6 As shown, x t 、h t and represent the input, hidden state and unit state at time t respectively;
[0139] The working principle of the long short-term memory network can be expressed by the following mathematical equation:
[0140] i t =σ(W i x t +U i h t-1 +b i );
[0141] f t =σ(W f x t +U f h t-1 +b f );
[0142] o t =σ(W o x t +U o h t-1 +b o );
[0143]
[0144]
[0145] h t =tanh(c t )☉o t ;
[0146] 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;
[0147] 2.1.2. Construct a step prediction model for the influent ammonia nitrogen concentration sequence of m sewage treatment plants, obtain a step prediction framework for the influent ammonia nitrogen concentration sequence of urban sewage (including m sewage treatment plant influent concentration sequence step prediction models), and use the sewage treatment plant influent ammonia nitrogen concentration prediction input data to predict the influent ammonia nitrogen concentration prediction data of m sewage treatment plants, such as Figure 7 As shown;
[0148] The framework of the step prediction of the influent ammonia nitrogen concentration sequence of the sewage treatment plant contains m step prediction models of the influent ammonia nitrogen concentration sequence of the sewage treatment plant, which are used for the m-step prediction of the influent ammonia nitrogen concentration of the sewage treatment plant. The m step prediction models of the influent ammonia nitrogen concentration sequence of the sewage treatment plant are not independent of each other. For example, when training the second-step advanced sewage treatment plant influent ammonia nitrogen concentration prediction model, the output data of the first-step advanced sewage treatment plant influent ammonia nitrogen concentration prediction model is needed; for the previous-step sewage treatment plant influent ammonia nitrogen concentration 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 pH, suspended solids (SS), water temperature (WT), air temperature, air pressure, relative humidity, rainfall, average total cloud cover and visibility;
[0149]
[0150] In the formula, is the predicted value of the ammonia nitrogen concentration in the influent of the sewage treatment plant on the (n + 1)-th day. Using the observed data of the ammonia nitrogen concentration in the influent of the sewage treatment plant and the predicted input data (PH, suspended solids (SS), water temperature (WT), air temperature, air pressure, relative humidity, rainfall, average total cloud cover, and visibility) of the ammonia nitrogen concentration in the influent of the sewage treatment plant for n + 1 days, the ammonia nitrogen concentration in the influent of the sewage treatment plant on the (n + 1)-th day (i.e., the ammonia nitrogen concentration in the influent of the sewage treatment plant in the first step) is predicted. Then, the second-step advanced ammonia nitrogen concentration prediction model in the sewage treatment plant influent is defined as:
[0151]
[0152] Using the observed data of the ammonia nitrogen concentration in the influent of the sewage treatment plant for n days, the predicted data of the ammonia nitrogen concentration in the influent of the sewage treatment plant for (n + 1) days, and the predicted input data of the ammonia nitrogen concentration in the influent of the sewage treatment plant for n + 2 days, the ammonia nitrogen concentration in the influent of the sewage treatment plant on the (n + 2)-th day (i.e., the ammonia nitrogen concentration in the influent of the sewage treatment plant in the second step) is predicted. Similarly, the m-step advanced ammonia nitrogen concentration prediction model in the sewage treatment plant influent is defined as:
[0153]
[0154] Using the observed data of the ammonia nitrogen concentration in the influent of the sewage treatment plant on the (n + 1)-th day, the predicted data of the ammonia nitrogen concentration in the influent of the sewage treatment plant for m - 1 days, and the predicted input data of the ammonia nitrogen concentration in the influent of the sewage treatment plant for n + m days, the ammonia nitrogen concentration in the influent of the sewage treatment plant on the (m + m)-th day (i.e., the ammonia nitrogen concentration in the influent of the sewage treatment plant in the m-th step) is predicted.
[0155] 2.2. The first-step advanced ammonia nitrogen concentration in the sewage treatment plant influent is predicted using the first model in the step prediction framework of the ammonia nitrogen concentration sequence in the sewage treatment plant influent, and is used as the input for the (second, third,..., m-th) step advanced ammonia nitrogen concentration prediction models in the sewage treatment plant influent (i.e., the second, third,..., m-th models in the step prediction framework of the ammonia nitrogen concentration sequence in the sewage treatment plant influent);
[0156] 2.3. The i-th (1 < i < m) step advanced ammonia nitrogen concentration in the sewage treatment plant influent is predicted using the i-th model in the step prediction framework of the ammonia nitrogen concentration sequence in the sewage treatment plant influent, and is used as the input for the (i + 1,..., m-th) step advanced ammonia nitrogen concentration prediction models in the sewage treatment plant influent (i.e., the i + 1-th,..., m-th models in the step prediction framework of the ammonia nitrogen concentration sequence in the sewage treatment plant influent);
[0157] 2.4. The m-th step advanced ammonia nitrogen concentration in the sewage treatment plant influent is predicted using the m-th model in the step prediction framework of the ammonia nitrogen concentration sequence in the sewage treatment plant influent;
[0158] 2.5. Combining steps 2.2 - 2.4, the m-step advanced ammonia nitrogen concentration prediction data is obtained through m models.
[0159] 2.5.1. Train the prediction model for the influent ammonia nitrogen concentration of the first advanced wastewater treatment plant, and use the data of pH, suspended solids (SS), water temperature (WT), air temperature, air pressure, relative humidity, rainfall, average total cloud cover, and visibility to predict the output data of the influent ammonia nitrogen concentration of the first-step advanced wastewater treatment plant;
[0160] 2.5.2. Train the prediction model for the influent ammonia nitrogen concentration of the second advanced wastewater treatment plant, and use the data of pH, suspended solids (SS), water temperature (WT), air temperature, air pressure, relative humidity, rainfall, average total cloud cover, visibility, and the output data of the influent ammonia nitrogen concentration of the first-step advanced wastewater treatment plant to predict the output data of the influent ammonia nitrogen concentration of the second-step advanced wastewater treatment plant;
[0161] 2.5.3. Train the prediction model for the influent ammonia nitrogen concentration of the i-th (1 < i ≤ m) advanced wastewater treatment plant, and use the data of pH, suspended solids (SS), water temperature (WT), air temperature, air pressure, relative humidity, rainfall, average total cloud cover, visibility, and the output data of the influent ammonia nitrogen concentration of the previous i - 1 steps of the advanced wastewater treatment plant to predict the output data of the influent ammonia nitrogen concentration of the i-th step of the advanced wastewater treatment plant;
[0162] 2.5.4. Aggregate the output data of the influent ammonia nitrogen concentration of the m steps obtained in steps 2.5.1 - 2.5.3 to obtain the prediction data of the influent ammonia nitrogen concentration of the m-step advanced wastewater treatment plant.
[0163] 3. Train and test the model, set the model parameters to ensure that the model can accurately predict the influent ammonia nitrogen concentration of the wastewater treatment plant. The dataset is divided into a training set, a validation set, and a test set in a ratio of 3:1:1 in chronological order. The role of the training set is to train the model, that is, to let the model learn the rules; the role of the validation set is to adjust and select the model, that is, to modify the parameters of the model according to the performance of the model in the validation set; the purpose of the test set is to make an unbiased estimate of the model results so as to evaluate the final performance of the model. NH3-N is the output index, and pH, suspended solids (SS), water temperature (WT), air temperature, air pressure, relative humidity, rainfall, average total cloud cover, and visibility are the model input indices. For the two monitoring points, train simultaneously to obtain a unified prediction model for the influent ammonia nitrogen concentration of the wastewater treatment plant.
[0164] 3.1. Determine the learnable parameters and hyperparameters of the prediction model for the influent ammonia nitrogen concentration of the wastewater treatment plant, so as to train and test the m models in the step-by-step prediction framework of the influent ammonia nitrogen concentration sequence of the wastewater treatment plant, and ensure that the prediction model can accurately output the influent ammonia nitrogen concentration of the wastewater treatment plant;
[0165] 3.1.1. Determine the dimensions of each LSTM network unit. Each network unit contains 9 dimensions, including pH, suspended solids (SS), water temperature (WT), air temperature, air pressure, relative humidity, rainfall, average total cloud cover and visibility.
[0166] 3.1.2. Normalize the 9-dimensional input data of each LSTM network unit. All input data are normalized using the z-score normalization method.
[0167] 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;
[0168] 3.1.4. 2640 sets of real observation data of urban sewage plant influent were selected to train the proposed sewage plant influent ammonia nitrogen concentration series step prediction framework. 2640 NSE values were obtained through 2640 training times. The hyperparameter set that produced the highest NSE median value among all hyperparameter combinations was selected as the hyperparameter of the sewage plant influent ammonia nitrogen concentration series step prediction framework.
[0169] 3.2. Determine the performance evaluation index of the sewage plant influent ammonia nitrogen concentration prediction model to ensure that each model of the sewage plant influent ammonia nitrogen concentration sequence step prediction framework can be effectively trained to obtain a sewage plant influent ammonia nitrogen concentration prediction model that meets the accuracy requirements;
[0170] 3.3. Input the input data of the sewage plant inlet ammonia nitrogen concentration prediction model into the sewage plant inlet ammonia nitrogen concentration sequence step prediction framework, train and test the sewage plant inlet ammonia nitrogen concentration prediction model to ensure that the output data of the sewage plant inlet ammonia nitrogen concentration prediction model can accurately reflect the actual sewage plant inlet ammonia nitrogen concentration.
[0171] like Figure 8 As shown in the figure, the comparison diagram of the sewage plant inlet ammonia nitrogen concentration data predicted by the sewage plant inlet ammonia nitrogen concentration sequence step prediction framework and the actual observation data of the inlet ammonia nitrogen concentration is shown. As shown in the figure, the predicted sewage plant inlet ammonia nitrogen concentration shows a strong correlation with the observation data of the sewage plant inlet ammonia nitrogen concentration, indicating that the sewage plant inlet ammonia nitrogen concentration can be predicted by the sewage plant inlet ammonia nitrogen concentration sequence step prediction framework.
[0172] 4. Simulate the ammonia nitrogen concentration in the influent of the municipal sewage treatment plant and evaluate the prediction performance of the model;
[0173] 4.1. Construct a two-layer long short-term memory network as a benchmark model for predicting the ammonia nitrogen concentration in the sewage plant inlet, and evaluate the prediction performance of the step prediction framework for the ammonia nitrogen concentration sequence in the urban sewage plant inlet;
[0174] 4.1.1. Use long short-term memory network to build a double-layer sewage plant influent ammonia nitrogen concentration sequence prediction framework, such as Fig. 9 As shown in , the framework contains 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 pH, suspended solids (SS), water temperature (WT), air temperature, air pressure, relative humidity, rainfall, average total cloud cover and visibility. The second decoder sequence has a long short-term memory network unit, and its input data is the observed data of ammonia nitrogen concentration in the sewage treatment plant inlet. 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 sewage treatment plant inlet ammonia nitrogen concentration prediction data, as shown in Fig.10 As shown;
[0175] 4.1.2. The double-layer sewage treatment plant inlet ammonia nitrogen concentration series prediction framework was trained using 2640 sets of actual sewage treatment plant inlet water data. 2640 NSE values were obtained through 2640 trainings. The hyperparameter set that produced the highest NSE median value among all hyperparameter combinations was selected as the hyperparameter of the double-layer sewage treatment plant inlet ammonia nitrogen concentration series prediction framework.
[0176] like Fig.11 As shown in the figure, the comparison diagram of the sewage plant inlet ammonia nitrogen concentration data predicted by the double-layer sewage plant inlet ammonia nitrogen concentration sequence prediction framework and the actual observation data of the inlet ammonia nitrogen concentration is shown. As shown in the figure, the predicted sewage plant inlet ammonia nitrogen concentration shows a strong correlation with the observation data of the sewage plant inlet ammonia nitrogen concentration, indicating that the double-layer sewage plant inlet ammonia nitrogen concentration sequence prediction framework can be used to predict the sewage plant inlet ammonia nitrogen concentration.
[0177] 4.2. The inlet ammonia nitrogen concentration of the sewage treatment plant is predicted by the input data of the sewage treatment plant inlet ammonia nitrogen concentration prediction (PH, suspended solids (SS), water temperature (WT), air temperature, air pressure, relative humidity, rainfall, wind speed, average total cloud cover and visibility), and compared with the output results of the sewage treatment plant inlet ammonia nitrogen concentration sequence step prediction framework.
[0178] 4.2.1. Select the actual observation data of the influent ammonia nitrogen concentration of the southern urban sewage treatment plants, and input them into the step prediction framework of the influent ammonia nitrogen concentration sequence of the urban sewage treatment plants and the double-layer sewage treatment plants influent ammonia nitrogen concentration sequence prediction framework, and obtain the predicted data of the influent ammonia nitrogen concentration of the sewage treatment plants;
[0179] 4.2.2. After obtaining the prediction data of the ammonia nitrogen concentration in the sewage treatment plant inlet, the mean absolute error (MAE), mean absolute percentage error (MAPE) and root mean square error (RMSE) are used to compare and evaluate the prediction performance of the sewage treatment plant inlet ammonia nitrogen concentration series step prediction framework and the double-layer sewage treatment plant inlet ammonia nitrogen concentration prediction framework;
[0180] like Fig.12 As shown, a schematic diagram of the prediction performance comparison of the sewage plant influent ammonia nitrogen concentration sequence step prediction framework and the double-layer sewage plant influent ammonia nitrogen concentration prediction framework is given. Compared with the prediction results of the double-layer sewage plant influent ammonia nitrogen concentration sequence prediction framework, the prediction performance of the sewage plant influent ammonia nitrogen concentration sequence step prediction framework is better, with RMSE reduced by 14.32%, MAE reduced by 10.02%, and MAPE reduced by 10.34%.
[0181] 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 influent ammonia nitrogen concentration based on long-short term memory step sequence, characterized in that: The steps include: (1) Prepare the input data and output data for predicting the ammonia nitrogen concentration in the sewage treatment plant and pre-process the data; (2) Construct a sewage treatment plant influent ammonia nitrogen concentration prediction model based on long-short-term memory step sequence to predict the influent ammonia nitrogen concentration of urban sewage treatment plants; (3) Train and test the model and set the model parameters to ensure that the model can accurately simulate the ammonia nitrogen concentration in the sewage treatment plant inlet; (4) Simulate the ammonia nitrogen concentration in the sewage treatment plant inlet and evaluate the prediction performance of the model; The step (1) is specifically as follows: (1.1) Select the influencing factors input and decision variable output for the prediction of ammonia nitrogen concentration in the sewage treatment plant inlet, where the influencing factors include: pH, suspended solids SS, water temperature WT, air temperature, air pressure, relative humidity, rainfall, wind speed, average total cloud cover and visibility. The output of the prediction model is the ammonia nitrogen concentration in the sewage treatment plant inlet; (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 sewage plant inlet ammonia nitrogen concentration 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 step prediction framework for the ammonia nitrogen concentration sequence in the sewage treatment plant based on the long short-term memory network. The framework includes m Models for implementation m Prediction of ammonia nitrogen concentration in sewage treatment plant influent; (2.2) The first model in the step prediction framework of the influent ammonia nitrogen concentration sequence of the sewage treatment plant is used to predict the first step influent ammonia nitrogen concentration, and it is used as the second, third, ..., m The input of the sewage treatment plant influent ammonia nitrogen concentration prediction model is advanced, that is, the second, third, ..., and third steps in the sewage treatment plant influent ammonia nitrogen concentration sequence step prediction framework. m Models; (2.3) Using the first step prediction framework of the sewage plant influent ammonia nitrogen concentration sequence i The model predicts the i Step ahead of the sewage treatment plant influent ammonia nitrogen concentration, 1 < i < m , and as the first i +1,…,th m The first step is to predict the ammonia nitrogen concentration in the sewage treatment plant influent in the first step prediction framework. i +1, …, m Models; (2.4) Using the first step prediction framework of the sewage plant influent ammonia nitrogen concentration sequence m The model predicts the m Step ahead to measure the ammonia nitrogen concentration in the sewage treatment plant inlet; (2.5) Combine steps 2.2-2.4, by m The model predicts m Step ahead to predict the ammonia nitrogen concentration in the sewage treatment plant influent.
2. The method for predicting influent ammonia nitrogen concentration based on 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 sewage treatment plant influent ammonia nitrogen concentration prediction model so as to predict the ammonia nitrogen concentration series in the sewage treatment plant influent step prediction framework. m The model is trained and tested to ensure that the prediction model can accurately output the prediction data of ammonia nitrogen concentration in the sewage plant inlet; (3.2) Determine the performance evaluation indicators of the sewage treatment plant influent ammonia nitrogen concentration prediction model to ensure that each model of the sewage treatment plant influent ammonia nitrogen concentration step prediction framework can be effectively trained to obtain a sewage treatment plant influent ammonia nitrogen concentration prediction model that meets the accuracy requirements; (3.3) Input the input data of the sewage treatment plant inlet ammonia nitrogen concentration prediction model into the sewage treatment plant inlet ammonia nitrogen concentration prediction model framework, train and test the sewage treatment plant inlet ammonia nitrogen concentration prediction model, and ensure that the output data of the sewage treatment plant inlet ammonia nitrogen concentration prediction model can accurately reflect the actual changes in the sewage treatment plant inlet water quality.
3. The method for predicting influent ammonia nitrogen concentration based on long short-term memory step sequence according to claim 1, characterized in that: The step (4) is specifically as follows: (4.1) Construct a two-layer long short-term memory network as a benchmark model for predicting the ammonia nitrogen concentration in the sewage treatment plant inlet, and evaluate the prediction performance of the step prediction framework for the ammonia nitrogen concentration series in the sewage treatment plant inlet; (4.2) The time series data of the influent ammonia nitrogen concentration of the sewage treatment plant are obtained by predicting the input data of the influent ammonia nitrogen concentration of the sewage treatment plant, and compared with the output results of the step prediction framework of the influent ammonia nitrogen concentration series of the sewage treatment plant.
4. The method for predicting influent ammonia nitrogen concentration based on 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 sewage treatment plant influent ammonia nitrogen concentration sequence step prediction model, and obtain the sewage treatment plant influent ammonia nitrogen concentration prediction output data through the sewage treatment plant influent ammonia nitrogen concentration prediction input data; (2.1.2) Build The step prediction model of the ammonia nitrogen concentration sequence in the sewage treatment plant inlet is obtained, and the step prediction framework of the ammonia nitrogen concentration sequence in the sewage treatment plant inlet is obtained, including The step prediction model of the influent ammonia nitrogen concentration of a sewage treatment plant is used to predict the input data of the ammonia nitrogen concentration of the sewage treatment plant. Prediction data of ammonia nitrogen concentration in the influent of the sewage treatment plant.
5. The method for predicting influent ammonia nitrogen concentration based on long short-term memory step sequence according to claim 1, characterized in that: The step (2.5) is specifically as follows: (2.5.1) Train the prediction model for the influent ammonia nitrogen concentration of the first advanced sewage treatment plant, and use the sewage treatment plant influent data to predict the influent ammonia nitrogen concentration of the first advanced sewage treatment plant; (2.5.2) Training the second advanced sewage treatment plant inlet ammonia nitrogen concentration prediction model, using the sewage treatment plant inlet ammonia nitrogen concentration prediction input data and the first step advanced sewage treatment plant inlet ammonia nitrogen concentration prediction output data to predict the second step advanced sewage treatment plant inlet ammonia nitrogen concentration prediction output data; (2.5.3) Train the prediction model for the influent ammonia nitrogen concentration of the i-th advanced sewage treatment plant, , using the predicted input data of the sewage plant influent ammonia nitrogen concentration and the predicted output data of the sewage plant influent ammonia nitrogen concentration in the previous i-1 step to predict the predicted output data of the i-th step sewage plant influent ammonia nitrogen concentration; (2.5.4) Summarize the predicted output data of the influent ammonia nitrogen concentration of the m-step sewage treatment plant obtained in steps 2.5.1-2.5.3 to obtain the predicted data of the influent ammonia nitrogen concentration of the m-step advanced sewage treatment plant.
6. The method for predicting influent ammonia nitrogen concentration based on 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 10 dimensions, including pH, suspended solids SS, water temperature WT, air temperature, air pressure, relative humidity, rainfall, wind speed, average total cloud cover and visibility; (3.1.2) Normalize the 10-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) Select k real observation data of urban sewage treatment plant influent ammonia nitrogen concentration to train the proposed sewage treatment plant influent ammonia nitrogen concentration series step 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 sewage treatment plant influent ammonia nitrogen concentration series step prediction framework.
7. The method for predicting influent ammonia nitrogen concentration based on 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 sewage treatment plant influent ammonia nitrogen concentration 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 a long short-term memory network unit, and its input includes pH, suspended solids SS, water temperature WT, air temperature, air pressure, relative humidity, rainfall, wind speed, average total cloud cover, and visibility. The second decoder sequence has a long short-term memory network unit, and its input data is the sewage treatment plant influent ammonia nitrogen concentration observation data. The state vector contains the compression and processing 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 prediction of the ammonia nitrogen concentration in the sewage plant inlet; (4.1.2) The actual data of ammonia nitrogen concentration in the influent of sewage treatment plants in k cities are used to train the double-layer sewage treatment plant influent ammonia nitrogen concentration 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 sewage treatment plant influent ammonia nitrogen concentration series prediction framework.
8. The method for predicting influent ammonia nitrogen concentration based on long short-term memory step sequence according to claim 3, characterized in that: The step (4.2) is specifically: (4.2.1) Selection The actual observation data of the influent ammonia nitrogen concentration of the sewage treatment plants in the cities were input into the step prediction framework of the influent ammonia nitrogen concentration sequence of the sewage treatment plants and the double-layer sewage treatment plant influent ammonia nitrogen concentration sequence prediction framework, and the predicted data of the influent ammonia nitrogen concentration of the sewage treatment plants were obtained. (4.2.2) After obtaining the prediction data of the ammonia nitrogen concentration in the sewage treatment plant inlet, the mean absolute error MAE, mean absolute percentage error MAPE and root mean square error RMSE are used to compare and evaluate the prediction performance of the sewage treatment plant inlet ammonia nitrogen concentration series step prediction framework and the double-layer sewage treatment plant inlet ammonia nitrogen concentration series prediction framework.
Citation Information
Patent Citations
Power plant coal storage capacity short-term prediction method based on SSA and LSTM deep learning
CN110390436A
Effluent ammonia nitrogen soft measurement method based on hybrid coding particle swarm-long short-term memory neural network
CN113111576A