A water quality prediction method for sewage treatment plants based on an improved LSTM neural network model
By improving the optimization of the LSTM neural network model and genetic algorithm, the problem of limitation and data dependence in the water quality prediction method of sewage treatment plants is solved, and higher prediction accuracy and energy consumption are reduced.
Patent Information
- Application Number
- CN202410840818.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-06-27
AI Technical Summary
The existing water quality prediction methods for sewage treatment plants have limitations, lack of robustness and data dependence, resulting in low prediction reliability and insufficient accuracy, and failure to fully utilize the time series nature of water quality data.
The water quality prediction method based on the improvement of the LSTM neural network model is adopted, and through the acquisition and pre -processing water quality monitoring data, the training set and test set are used to optimize the LSTM neural network model with genetic algorithm to improve their prediction accuracy and robustness.
Effectively improved the predictive accuracy of the water quality parameters of the sewage treatment plant and the control of the control system, which improved the water output to the greatest extent, reduced the energy consumption of the system, and achieved energy conservation.
Smart Images

Figure CN118886529B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of sewage treatment, and in particular to a method for predicting water quality of a sewage treatment plant based on an improved LSTM neural network model. Background Art
[0002] In recent years, with the rapid development of social economy, the continuous increase in residents' economic income, and the continuous increase in per capita domestic water consumption and sewage discharge, the status of sewage treatment plants has become increasingly prominent. It can effectively reduce pollution to the environment and ensure the quality of drinking water. The detection of water quality parameters is an important method to ensure the normal operation and governance effect of sewage treatment plants. However, the current water quality detection of traditional sewage treatment plants only analyzes and judges the data of the day, and fails to deal with abnormal situations in time to ensure the long-term operation of sewage treatment plants. With the advancement of machine learning and deep learning, it can be used to predict water quality.
[0003] So far, the water quality prediction methods include a method for accurately predicting the effluent quality of a sewage treatment plant with application number CN202010410065.9, which uses the real-time data and effluent water quality prediction model obtained by the convolutional neural network (CNN) model through the online monitoring system to accurately predict the effluent water quality parameters of the sewage treatment plant after a period of time. And a sewage treatment influent water quality prediction method based on peripheral data association analysis with application number CN202110389991.7, which predicts the influent water quality of the sewage treatment plant based on weather and economic data. These technical solutions use a single model and data association analysis, which have limitations, lack of robustness and data dependence, resulting in low prediction reliability and insufficient prediction accuracy. At the same time, water quality data is time series data. The above models only analyze and predict the laws of water quality data itself, and do not make full use of the time series of water quality data. Although the recurrent neural network (RNN) has the ability to mine time series, it is easy to cause the cumulative effect of gradient products when the gradient is back-propagated through time steps, making the gradient value very small or very large, leading to gradient vanishing or gradient explosion problems. LSTM neural network is an improved model of RNN, which can solve the problem of gradient vanishing or gradient explosion, but a single LSTM neural network model may fall into a local optimal solution or overfitting phenomenon, resulting in low model prediction accuracy and robustness. Therefore, a genetic algorithm is used to optimize the LSTM neural network to improve the prediction accuracy of the model.
[0004] To address the above problems, a sewage treatment plant water quality prediction method based on an improved LSTM neural network model is adopted, which can make full use of the time series of water quality data, effectively avoid the shortcomings of lack of robustness and data dependence, and improve its prediction accuracy. Summary of the invention
[0005] The present invention provides a method for predicting water quality of a sewage treatment plant based on an improved LSTM neural network model, predicts ammonia nitrogen, total nitrogen, total phosphorus and COD parameters in a device, controls water quality parameters through a computer control module regulation system, and monitors in real time through a water quality acquisition device, performs feedback verification to form a closed loop, and can effectively improve the prediction accuracy of water quality parameters in aquaculture tail water treatment process, thereby effectively improving the regulation accuracy of the control system, thereby improving effluent water quality to the greatest extent, and at the same time, the aquaculture tail water treatment method based on the neural network model proposed by the present invention can further reduce system energy consumption to the greatest extent and achieve energy saving on the premise of effectively improving effluent water quality.
[0006] The present invention provides a method for predicting water quality in a sewage treatment plant based on an improved LSTM neural network model, comprising:
[0007] Obtain water quality monitoring data from sewage treatment plants;
[0008] Performing outlier cleaning and smoothing processing on the water quality monitoring data to obtain processed data;
[0009] Normalizing the processed data to obtain normalized data;
[0010] Using the normalized data, construct training set data and test set data;
[0011] Based on genetic algorithm, the LSTM neural network is improved to obtain an improved LSTM neural network;
[0012] Using the training set data, the improved LSTM neural network is trained to obtain a water quality prediction model;
[0013] The test set data is used to input the water quality prediction model to obtain water quality prediction data.
[0014] Preferably, the water quality monitoring data includes at least: steam-water ratio, aeration intensity, ammonia nitrogen, pH, total nitrogen, total phosphorus, COD, MLSS, membrane flux, water temperature, water inlet, water outlet and dosage of chemical.
[0015] Preferably, the outlier cleaning at least includes: filling the outliers using a linear interpolation filling method;
[0016] The smoothing process at least includes: adopting a moving average method.
[0017] Preferably, the normalization at least includes:
[0018] The Z-score standardization method is used, and the formula is as follows:
[0019]
[0020] Among them, x * represents the normalized data; μ represents the mean of the processed data; σ represents the standard deviation of the processed data; and x represents the processed data.
[0021] Preferably, the data ratio of the training set data to the test set data is 7:3.
[0022] Preferably, the improving the LSTM neural network based on the genetic algorithm to obtain the improved LSTM neural network includes:
[0023] Establish the structure of LSTM neural network, including at least: input layer, hidden layer nodes, Relu activation layer, and output regression layer;
[0024] Set the parameters of the LSTM neural network, including at least: Adam gradient descent algorithm, maximum number of training times, initial learning rate, learning rate reduction factor, and regularization coefficient;
[0025] A set of initial LSTM learning rate, number of hidden layer nodes and regularization coefficient parameter settings are randomly generated to form an initial population. Each individual in the population represents an LSTM parameter setting.
[0026] Each individual is randomly encoded, and the parameters of the LSTM model are converted into a binary form that can be processed by the genetic algorithm, generating a group of binary strings representing different combinations of LSTM parameter settings;
[0027] Decoding is performed. When evaluating the fitness of each individual, the decoding step is used to remap the binary string into real number parameters, and the fitness function is evaluated to obtain a solution;
[0028] After decoding in the previous step, the fitness value of each individual in the population is calculated using the root mean square error (RMSE) as the fitness function, and the fitness value is stored in an array;
[0029] By finding the minimum fitness value in the array, determine the index and the best fitness value of the best individual and the parameter value of the global best individual;
[0030] Perform iterative optimization, including population update, crossover operation, mutation operation, update of individual best and global best individuals, and search for the best fitness value;
[0031] After each iteration, the current best fitness value is compared to see if it meets the end condition. If it does, the calculation is stopped. At this time, the learning rate, number of hidden layer nodes and regularization coefficient parameters of the LSTM neural network are optimal.
[0032] Preferably, the parameter settings of the improved LSTM neural network include at least: crossover probability, mutation probability, population size, maximum number of iterations, learning rate range, number of hidden layer nodes, and regularization coefficient range.
[0033] Preferably, the fitness function formula is as follows:
[0034]
[0035] In the formula, y i is the true value of water quality parameter; is the predicted value of water quality parameters, n is the number of water quality parameter data;
[0036] The crossover and mutation formulas are as follows:
[0037]
[0038] Where R1 is the randomly generated crossover position ratio, v1 and v2 are the gene values at the crossover positions on the two chromosomes, v is the gene value at the mutation position on the chromosome, p1 and p2 are the population sizes, θ is the new value after mutation, and f is a random number.
[0039] Preferably, the sewage treatment plant water quality prediction method based on the improved LSTM neural network model also includes:
[0040] Constructing a visualization model based on the water quality prediction data and the three-dimensional model of the sewage treatment plant;
[0041] displaying the visualization model to a user;
[0042] Assisting a user to determine secondary water quality prediction intention based on the visualization model;
[0043] The secondary water quality prediction intention is input into the water quality prediction model to obtain secondary water quality prediction data.
[0044] Preferably, the auxiliary user determines the secondary water quality prediction intention based on the visualization model, including:
[0045] When the user switches back and forth between at least two main perspectives to view the visualization model at least a preset number of times within a first time period, feature extraction is performed on the historical visual content of the main perspective and the operation instructions input by the user into the visualization model within a second time period to obtain a plurality of first feature values; wherein the first time period is a time period of any duration of the user viewing the visualization model in history that is a first preset duration threshold; the start and end moments of the second time period are respectively the earliest historical creation time of the main perspective and the latest historical creation time of the main perspective;
[0046] Based on the multiple first eigenvalues, construct a first feature description vector;
[0047] Determine a plurality of viewing angle conditions corresponding to the first feature description vector from a viewing angle condition library;
[0048] Based on the condition division requirement, each viewing angle condition is divided into at least one viewing angle condition set; wherein the condition division requirement includes: there is at least one condition association relationship between any two viewing angle conditions in the same viewing angle condition set;
[0049] At least one secondary perspective is created in the visualization model; the secondary perspectives correspond to the perspective condition sets one by one, and the secondary perspectives meet all the perspective conditions in the corresponding perspective condition sets;
[0050] Prompting the user to switch to any of the secondary perspectives to view the visualization model within a third time period; wherein the third time period is a time period starting from a second preset time threshold after the first time period and lasting for a third preset time threshold;
[0051] When the user switches to any of the secondary perspectives to view the visualization model within a fourth time period, feature extraction is performed on the viewing situation of the visualization model viewed by the user from the secondary perspective to which the user switches, to obtain a plurality of second feature values; wherein the start time of the fourth time period is the same as the start time of the third time period, and the end time of the fourth time period is later than the end time of the third time period by a fourth preset time threshold;
[0052] Based on the plurality of second eigenvalues, construct a second feature description vector;
[0053] Determining an intention value corresponding to the second feature description vector from an intention value library; the intention value corresponds one-to-one to the secondary perspective switched to by the user within a fourth time period;
[0054] taking the secondary viewing angle to which the user switches within a fourth time period and corresponding to an intention value greater than or equal to an intention threshold as a target secondary viewing angle;
[0055] The secondary water quality prediction intention is determined based on the perspective association relationship between the target secondary perspective and the main perspective and the perspective conditions in the perspective condition set corresponding to the target secondary perspective.
[0056] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings.
[0057] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0059] Figure 1 This is a flow chart of a method for predicting water quality in a sewage treatment plant based on an improved LSTM neural network model in an embodiment of the present invention;
[0060] Figure 2 It is a schematic diagram of the steps of the method for predicting water quality of a sewage treatment plant based on an improved LSTM neural network model of the present invention;
[0061] Figure 3 This is a COD prediction result diagram based on the improved LSTM neural network model of the present invention;
[0062] Figure 4 This is a graph of SS prediction results based on the improved LSTM neural network model of the present invention;
[0063] Figure 5 This is a graph of ammonia nitrogen prediction results based on the improved LSTM neural network model of the present invention;
[0064] Figure 6 This is a graph of TP prediction results based on the improved LSTM neural network model of the present invention;
[0065] Figure 7 This is a graph of TN prediction results based on the improved LSTM neural network model of the present invention. DETAILED DESCRIPTION
[0066] The preferred embodiments of the present invention are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0067] The present invention provides a method for predicting water quality in a sewage treatment plant based on an improved LSTM neural network model. Figure 1 As shown, including:
[0068] Obtain water quality monitoring data from sewage treatment plants;
[0069] Performing outlier cleaning and smoothing processing on the water quality monitoring data to obtain processed data;
[0070] Normalizing the processed data to obtain normalized data;
[0071] Using the normalized data, construct training set data and test set data;
[0072] Based on genetic algorithm, the LSTM neural network is improved to obtain an improved LSTM neural network;
[0073] Using the training set data, the improved LSTM neural network is trained to obtain a water quality prediction model;
[0074] The test set data is used to input the water quality prediction model to obtain water quality prediction data.
[0075] The water quality monitoring data at least include: steam-water ratio, aeration intensity, ammonia nitrogen, pH, total nitrogen, total phosphorus, COD, MLSS, membrane flux, water temperature, water inlet, water outlet and reagent dosage. The steam-water ratio and aeration intensity are the steam-water ratio of biochemical air volume and the aeration intensity of the total air volume of the membrane pool; ammonia nitrogen, pH, total nitrogen, total phosphorus and COD are water quality parameters of water plant effluent; MLSS is the sludge concentration of the membrane pool; membrane flux is the membrane flux of 5 membrane channels; water temperature, water inlet and water outlet are the temperature of water plant treated sewage, the daily water plant sewage inlet and the daily water plant sewage outlet; the reagent dosage is the composite dephosphorization agent, composite carbon source, sodium hypochlorite of membrane washing agent and sodium hypochlorite of disinfectant.
[0076] The outlier cleaning at least includes: using a linear interpolation filling method to fill in outliers; outlier cleaning refers to those data points in the collected data that are significantly different from most data points, which may be outliers caused by erroneous records, abnormal events or other reasons, and then selecting a linear interpolation filling method to fill in the outliers according to the nature of the outliers and the data characteristics;
[0077] The smoothing process at least includes: using a moving average method; smoothing and cleaning through filtering or other techniques, smoothing the noise and abnormal values in the data, and selecting a moving average method for smoothing.
[0078] The normalization at least includes:
[0079] The Z-score standardization method is used, and the formula is as follows:
[0080]
[0081] Among them, x * represents the normalized data; μ represents the mean of the processed data; σ represents the standard deviation of the processed data; and x represents the processed data.
[0082] The data ratio of the training set data to the test set data is 7:3.
[0083] The improved LSTM neural network based on the genetic algorithm is obtained by:
[0084] The structure of the LSTM neural network is established, which at least includes: input layer, hidden layer nodes, Relu activation layer, and output regression layer; the input layer receives the input of the sequence data and passes it to the next time step or the next layer; the hidden layer is the core part of the LSTM model, and is composed of multiple LSTM units; the Relu activation layer usually uses an activation function in the internal structure of the hidden layer nodes in the LSTM model, and Relu is a common activation function; the output regression layer is responsible for mapping the output of the hidden layer nodes to the final output result;
[0085] Set the parameters of the LSTM neural network, including at least: Adam gradient descent algorithm, maximum number of training times, initial learning rate, learning rate reduction factor, and regularization coefficient. The Adam gradient descent algorithm is a commonly used adaptive learning rate optimization algorithm that updates the weights and biases of the model according to the gradient information of the loss function to minimize the loss function. The maximum number of training times is the maximum number of iterations or rounds allowed during the training process. The initial learning rate is set as a parameter of the optimization algorithm and is an important parameter used to control the parameter update step size during the training process. The learning rate reduction factor is a parameter that controls the attenuation of the learning rate. The regularization coefficient is a technique used to control the complexity of the model.
[0086] A set of initial LSTM learning rate, number of hidden layer nodes and regularization coefficient parameter settings are randomly generated to form an initial population. Each individual in the population represents an LSTM parameter setting.
[0087] Each individual is randomly encoded, and the parameters of the LSTM model are converted into a binary form that can be processed by the genetic algorithm, generating a group of binary strings representing different combinations of LSTM parameter settings;
[0088] Decoding is performed. When evaluating the fitness of each individual, the decoding step is used to remap the binary string into real number parameters, and the fitness function is evaluated to obtain a solution;
[0089] After decoding in the previous step, the fitness value of each individual in the population is calculated using the root mean square error (RMSE) as the fitness function, and the fitness value is stored in an array;
[0090] By finding the minimum fitness value in the array, determine the index and the best fitness value of the best individual and the parameter value of the global best individual;
[0091] Perform iterative optimization, including population update, crossover operation, mutation operation, update of individual best and global best individuals, and find the best fitness value; the crossover probability, mutation probability and population size are the parameters set by the genetic algorithm, the maximum number of iterations is the stop condition for GA to optimize LSTM parameters, and the learning rate range, the number of hidden layer nodes range and the regularization coefficient range are the ranges for optimizing LSTM parameters;
[0092] After each iteration, compare whether the current best fitness value has met the end condition. If it has, stop the calculation. At this time, the learning rate, number of hidden layer nodes and regularization coefficient parameters of the LSTM neural network are optimal. Otherwise, return to step S323.
[0093] The parameter settings of the improved LSTM neural network include at least: crossover probability, mutation probability, population size, maximum number of iterations, learning rate range, number of hidden layer nodes, and regularization coefficient range.
[0094] The fitness function formula is as follows:
[0095]
[0096] In the formula, y i is the true value of water quality parameter; is the predicted value of water quality parameters, n is the number of water quality parameter data;
[0097] The crossover and mutation formulas are as follows:
[0098]
[0099] Where R1 is a random number between 0 and 1, which is used to control the exchange ratio of two individual gene fragments in the crossover operation. v1 and v2 are the difference between the value of a gene site in the chromosome and the lower bound of the site and the difference between the upper bound of a gene site in the chromosome and the value of the site, respectively. v is the current value of a gene site in the chromosome. p1 and p2 are the evolutionary generations of the current population and the maximum evolutionary generation, respectively. θ is the new value after mutation. f is a random number between 0 and 1, which is used to determine the mutation direction in the mutation operation.
[0100] Step 1: Obtain relevant water quality monitoring data of the sewage treatment plant, and perform discrete value removal and smoothing on the relevant water quality monitoring data.
[0101] Specifically, the data collected from the sewage treatment plant include steam-water ratio, aeration intensity, ammonia nitrogen, pH, total nitrogen, total phosphorus, COD, MLSS, membrane flux, water temperature, water inlet, water outlet, and dosage of reagents. The data collection time is one year, and the collected data is cleaned and smoothed. The outlier cleaning method is to fill the outlier value, the filling method is linear interpolation, the detection method is the moving center number, the threshold factor is set to 0.25, the smoothing method is the moving mean, the smoothing parameter is the smoothing factor, and the smoothing factor value is set to 0.25. Through outlier cleaning and smoothing, the abnormal data during data collection is eliminated and overall smoothed, so that the data can further fit the model prediction.
[0102] Step 2: Normalize the processed data and use the normalized data set to construct the training set and test set.
[0103] Specifically, the Z-score normalization method is used to normalize the processed data, and the formula is as follows:
[0104]
[0105] Among them, X * represents the normalized data, μ represents the mean of all sample data, σ represents the standard deviation of sample data, and x represents the original sample data. After data preprocessing, the data is split into a training set and a test set, with a ratio of 7:3 between the training set and the test set.
[0106] Step 3: Construct a water quality prediction model based on genetic algorithm to optimize the LSTM neural network and optimize the LSTM neural network parameters.
[0107] Specifically, the LSTM neural network model structure is established. LSTM consists of three parts: input gate, forget gate, and output gate. The formula is as follows:
[0108]
[0109] Where W f ,W i ,W C ,W o is the weight matrix, b f ,b i ,b C ,b o is the bias term, σ is the sigmoid function, tanh is the hyperbolic tangent function, h t-1 is the hidden state of the previous moment, x t is the input at the current moment, f t is the output of the forget gate, i t is the input gate output, is the candidate cell state, Ct is the cell state at the current moment, o t is the output gate output, h t is the hidden state at the current moment.
[0110] Next, we construct a genetic algorithm to optimize the LSTM neural network. Specifically, we perform binary encoding. When initializing the population, we randomly encode individuals, that is, we generate binary strings of length as our initial population, where each binary string is an individual; we perform decoding. According to an individual, we can get a solution to the corresponding optimization problem. Finally, after decoding the entire population, we get solutions; after decoding in the previous step, for each individual in the population, we use the root mean square error (RMSE) as the fitness function to calculate its fitness value. The fitness value is stored in an array. The fitness function formula of the genetic algorithm is as follows:
[0111]
[0112] In the formula, y i is the true value of water quality parameter; is the predicted value of water quality parameters, and n is the number of water quality parameter data.
[0113] By finding the minimum fitness value in the array, the index and the best fitness value of the best individual and the parameter value of the global best individual are determined; iterative optimization is performed, including population update, crossover operation, mutation operation, updating the best individual and the global best individual, and finding the best fitness value. The crossover and mutation formulas are as follows:
[0114]
[0115]
[0116] Where R1 is a random number between 0 and 1, which is used to control the exchange ratio of two individual gene fragments in the crossover operation. v1 and v2 are the difference between the value of a gene site in the chromosome and the lower bound of the site and the difference between the upper bound of a gene site in the chromosome and the value of the site, respectively. v is the current value of a gene site in the chromosome. p1 and p2 are the evolutionary generations of the current population and the maximum evolutionary generation, respectively. θ is the new value after mutation. f is a random number between 0 and 1, which is used to determine the mutation direction in the mutation operation.
[0117] After each iteration, compare whether the current best fitness value has met the end condition. If it has, stop the calculation. At this time, the learning rate, number of hidden layer nodes and regularization coefficient parameters of the LSTM neural network are optimal. Otherwise, return to crossover and mutation again.
[0118] Step 4: According to step 3, the optimal learning rate, number of hidden layer nodes and regularization coefficient parameters of the LSTM neural network are obtained, and the parameter settings of the genetic algorithm to optimize the LSTM neural network include: crossover probability is 0.7, mutation probability is 0.3, learning rate range is 1e-4 to 1e-2, number of hidden layer nodes is 5-20, regularization coefficient range is 1e-4 to 1e-2, Adam gradient descent algorithm, and at the same time, after continuous experiments, the population size is set to 5, the maximum number of iterations is 100, and the maximum number of training times is 1000. The processed data is used as input to iterate the training of the LSTM neural network prediction model, and the water quality data as the test set is output using the LSTM neural network model to obtain the predicted water quality data.
[0119] Finally, the COD, TP, TN, SS, and ammonia nitrogen effluent prediction data are obtained, and the prediction graphs are drawn as follows: Figure 3-Figure 7 The crossover probability is 0.7, the mutation probability is 0.3, the population size is 5, the maximum number of iterations is 100, the learning rate range is 1e-4 to 1e-2, the hidden layer nodes are 5-30, and the regularization coefficient range is 1e-4 to 1e-2. It can be seen from the figure that the predicted values of COD, TP, TN, SS, and ammonia nitrogen have a high degree of fit with the actual values, and their R 2 They are all above 0.95, indicating that the prediction accuracy of the model is high.
[0120] In one embodiment, the method for predicting water quality of a sewage treatment plant based on an improved LSTM neural network model further includes:
[0121] Constructing a visualization model based on the water quality prediction data and the three-dimensional model of the sewage treatment plant;
[0122] displaying the visualization model to a user;
[0123] Assisting a user to determine secondary water quality prediction intention based on the visualization model;
[0124] The secondary water quality prediction intention is input into the water quality prediction model to obtain secondary water quality prediction data.
[0125] The three-dimensional model of the plant is a one-to-one simulated three-dimensional model of the sewage treatment plant; when constructing the visualization model, the corresponding model area is found in the three-dimensional model of the plant according to the sewage treatment area to which the water quality prediction data belongs, and the water quality prediction data is set next to the model area; the visualization model is displayed to the user, and the user can view the visualization model to determine the secondary water quality prediction intention with the assistance of the system. The secondary water quality prediction intention is the user's intention to conduct a water quality prediction for the sewage plant again; the secondary water quality prediction intention is input into the water quality prediction model, and the water quality prediction model will re-predict the water quality according to the secondary water quality prediction intention. For example: the secondary water quality prediction intention is to adjust the amount of reagents added to a sewage treatment area and re-predict the water quality of the sewage treatment area. Generally, a water quality prediction model will adopt a fixed water quality prediction method to predict water quality and output a fixed type of water quality prediction result. At this time, the staff needs to analyze the fixed type of water quality prediction result to determine whether a secondary water quality prediction is needed. However, the fixed type of water quality prediction result is mostly a string of data. When the staff analyzes, they cannot analyze it in combination with the actual situation of the sewage treatment plant, which reduces the analysis efficiency. However, an embodiment of the present invention can solve this problem, construct a visualization model, display the visualization model to the user, and assist the user in determining the secondary water quality prediction intention based on the visualization model. The user can intuitively analyze the water quality prediction results in combination with the actual situation of the sewage treatment plant, and can also determine the secondary water quality prediction intention with the assistance of the system, which greatly improves the user's analysis and secondary water quality prediction efficiency.
[0126] The assisting user determines the secondary water quality prediction intention based on the visualization model, including:
[0127] When the user switches back and forth between at least two main perspectives to view the visualization model at least a preset number of times within a first time period, feature extraction is performed on the historical visual content of the main perspective and the operation instructions input by the user into the visualization model within a second time period to obtain a plurality of first feature values; wherein the first time period is a time period of any duration of the user viewing the visualization model in history that is a first preset duration threshold; the start and end moments of the second time period are respectively the earliest historical creation time of the main perspective and the latest historical creation time of the main perspective;
[0128] Based on the multiple first eigenvalues, construct a first feature description vector;
[0129] Determine a plurality of viewing angle conditions corresponding to the first feature description vector from a viewing angle condition library;
[0130] Based on the condition division requirement, each viewing angle condition is divided into at least one viewing angle condition set; wherein the condition division requirement includes: there is at least one condition association relationship between any two viewing angle conditions in the same viewing angle condition set;
[0131] At least one secondary perspective is created in the visualization model; the secondary perspectives correspond to the perspective condition sets one by one, and the secondary perspectives meet all the perspective conditions in the corresponding perspective condition sets;
[0132] Prompting the user to switch to any of the secondary perspectives to view the visualization model within a third time period; wherein the third time period is a time period starting from a second preset time threshold after the first time period and lasting for a third preset time threshold;
[0133] When the user switches to any of the secondary perspectives to view the visualization model within a fourth time period, feature extraction is performed on the viewing situation of the visualization model viewed by the user from the secondary perspective to which the user switches, to obtain a plurality of second feature values; wherein the start time of the fourth time period is the same as the start time of the third time period, and the end time of the fourth time period is later than the end time of the third time period by a fourth preset time threshold;
[0134] Based on the plurality of second eigenvalues, construct a second feature description vector;
[0135] Determining an intention value corresponding to the second feature description vector from an intention value library; the intention value corresponds one-to-one to the secondary perspective switched to by the user within a fourth time period;
[0136] taking the secondary viewing angle to which the user switches within a fourth time period and corresponding to an intention value greater than or equal to an intention threshold as a target secondary viewing angle;
[0137] The secondary water quality prediction intention is determined based on the perspective association relationship between the target secondary perspective and the main perspective and the perspective conditions in the perspective condition set corresponding to the target secondary perspective.
[0138] The preset number of times threshold can be, for example, 3 times; when the user views the visualization model independently, a main perspective will be generated; the first preset time threshold is, for example, 30 seconds; the earliest historical creation time of the main perspective is the earliest time when the main perspective was generated when the user viewed the visualization model in history, and the latest creation time of the main perspective is the latest time when the main perspective was generated when the user viewed the visualization model in history; the historical visible content is the content in the visualization model that can be seen from the main perspective; when the user views the visualization model, he can also input operation instructions to the visualization model; when the user switches back and forth between at least two main perspectives at least the preset number of times in the first time period to view the visualization model, it means that the user is analyzing the visualization model in a relatively invested manner, which may produce secondary water quality prediction The system detects intention and triggers the system to extract features from historical visual content and operation instructions to obtain multiple first feature values. The first feature values include: content type of historical visual content, operation instruction type of operation instructions, etc. There are different viewing conditions corresponding to first feature description vectors in the viewing condition library. The purpose of creating a secondary viewing angle is to determine the user's intention to conduct secondary water quality prediction based on the user's selection of a secondary viewing angle to view the visualization model. Based on the first feature description vector, it can be determined which data the user may want to view. The viewing angle requirement is to satisfy the user's ability to view the data that the user may want to view in the secondary viewing angle. For example, the first feature value is to view the dosage of the agent in the sewage treatment area A as 70% (the percentage is the actual dosage). The content values of different sewage components under the ratio of the dosage of the reagent to the maximum dosage of the reagent) and the content values of different sewage components under the dosage of the reagent in the sewage treatment area B of 60% indicate that the user is comparing the sewage treatment conditions of different proportions of the dosage of the reagent in different sewage treatment areas, and may want to simulate the change of the dosage of the reagent in the sewage treatment area A or the sewage treatment area B to re-predict the water quality. The viewing angle condition is the reagent dosage parameter adjustment interface of the sewage treatment area A included in the viewing angle, and the viewing angle condition can also be the reagent dosage parameter adjustment interface of the sewage treatment area B included in the viewing angle; the conditional association relationship includes: the content objects limited by the condition belong to the same sewage treatment area, etc.; the second preset time threshold can be, for example, 10 seconds; the third preset time threshold can be, for example, 20 seconds; When the user switches to any secondary viewing angle to view the visualization model within the fourth time period, feature extraction is performed on the viewing situation to obtain multiple second feature values, the second feature values include: the duration of the user viewing the visualization model from the secondary viewing angle, etc.; the fourth duration threshold may be, for example, 30 seconds; there are intention values corresponding to different second feature description vectors in the intention value library, and the intention value is the degree to which the user represented by the second feature description vector may have a secondary water quality prediction intention, for example: the second feature value is that the duration of the user viewing the visualization model from a certain secondary viewing angle is 100 seconds, and the secondary viewing angle is the agent dosage parameter adjustment interface of the sewage treatment area A, then the user is more likely to simulate the adjustment of the agent dosage of the sewage treatment area A to re-predict the water quality, and the corresponding intention value is 8;The intention threshold can be, for example, 5; the secondary perspective to which the user corresponding to the intention value greater than or equal to the intention threshold switches in the fourth time period is used as the target secondary perspective; the perspective association relationship includes: belonging to the same sewage treatment area, the content change under a certain perspective will cause the content under the associated perspective to change in a linkage manner (for example: changing the dosage of the agent, the water quality result changes), etc.; based on the perspective association relationship between the target secondary perspective and the main perspective, and the perspective conditions in the perspective condition set corresponding to the target secondary perspective, the secondary water quality prediction intention is determined, for example: the perspective condition is that the perspective contains the agent dosage parameter adjustment interface of the sewage treatment area A, then the secondary water quality prediction intention is to randomly adjust the agent dosage parameter of the sewage treatment area A, and re-predict the water quality of the effluent of the sewage treatment area A. The embodiment of the present invention interactively determines the user's secondary water quality prediction intention with the user, and the user can be identified by the system in the process of analyzing the visualization model, and the secondary water quality prediction intention is realized without feeling; secondly, the first time period, the second time period, the third time period and the fourth time period are introduced to accurately determine the identification and judgment timing, thereby improving the accuracy and efficiency of determining the user's secondary water quality prediction intention. ;
[0139] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A method for predicting water quality in a sewage treatment plant based on an improved LSTM neural network model, characterized in that: include: Obtain water quality monitoring data from sewage treatment plants; Performing outlier cleaning and smoothing processing on the water quality monitoring data to obtain processed data; Normalizing the processed data to obtain normalized data; Using the normalized data, construct training set data and test set data; Based on genetic algorithm, the LSTM neural network is improved to obtain an improved LSTM neural network; Using the training set data, the improved LSTM neural network is trained to obtain a water quality prediction model; Using the test set data to input the water quality prediction model to obtain water quality prediction data; The water quality monitoring data at least include: steam-water ratio, aeration intensity, ammonia nitrogen, pH, total nitrogen, total phosphorus, COD, MLSS, membrane flux, water temperature, water inlet, water outlet and dosage of reagents; The improved LSTM neural network based on the genetic algorithm is obtained by: Establish the structure of LSTM neural network, including at least: input layer, hidden layer nodes, Relu activation layer and output regression layer; Set the parameters of the LSTM neural network, including at least: Adam gradient descent algorithm, maximum number of training times, initial learning rate, learning rate reduction factor, and regularization coefficient; A set of initial LSTM learning rate, number of hidden layer nodes and regularization coefficient parameter settings are randomly generated to form an initial population. Each individual in the population represents an LSTM parameter setting. Each individual is randomly encoded, and the parameters of the LSTM model are converted into a binary form that can be processed by the genetic algorithm, generating a group of binary strings representing different combinations of LSTM parameter settings; Decoding is performed. When evaluating the fitness of each individual, the decoding step is used to remap the binary string into real number parameters, and the fitness function is evaluated to obtain a solution; After decoding in the previous step, for each individual in the population, the fitness value is calculated using the root mean square error as the fitness function, and the fitness value is stored in an array; By finding the minimum fitness value in the array, determine the index and the best fitness value of the best individual and the parameter value of the global best individual; Perform iterative optimization, including population update, crossover operation, mutation operation, update of individual best and global best individuals, and search for the best fitness value; Through continuous selection, crossover and mutation operations, a new population is generated and its fitness is evaluated until the stopping condition is reached. When the maximum number of iterations is reached, the calculation is stopped. At this time, the learning rate, number of hidden layer nodes and regularization coefficient parameters of the LSTM neural network are optimal; The crossover and mutation formulas are as follows: In the formula, R1 is a random number between 0 and 1, which is used to control the exchange ratio of two individual gene fragments in the crossover operation, v1 and v2 are the difference between the value of a gene site in the chromosome and the lower bound of the site and the difference between the upper bound of a gene site in the chromosome and the value of the site, v is the current value of a gene site in the chromosome, p1 and p2 are the evolutionary generations of the current population and the maximum evolutionary generations, θ is the new value after mutation, and f is a random number between 0 and 1, which is used to determine the mutation direction in the mutation operation; Also includes: Constructing a visualization model based on the water quality prediction data and the three-dimensional model of the sewage treatment plant; displaying the visualization model to a user; Assisting a user to determine secondary water quality prediction intention based on the visualization model; Inputting the secondary water quality prediction intention into the water quality prediction model to obtain secondary water quality prediction data; The assisting user determines the secondary water quality prediction intention based on the visualization model, including: When the user switches back and forth between at least two main perspectives to view the visualization model at least a preset number of times within a first time period, feature extraction is performed on historical visual content of the main perspective within a second time period and operation instructions input by the user into the visualization model to obtain a plurality of first feature values; Based on the multiple first eigenvalues, construct a first feature description vector; Determine a plurality of viewing angle conditions corresponding to the first feature description vector from a viewing angle condition library; Based on the condition division requirement, each viewing angle condition is divided into at least one viewing angle condition set; wherein the condition division requirement includes: there is at least one condition association relationship between any two viewing angle conditions in the same viewing angle condition set; At least one secondary perspective is created in the visualization model; the secondary perspectives correspond to the perspective condition sets one by one, and the secondary perspectives meet all the perspective conditions in the corresponding perspective condition sets; Prompting the user to switch to any of the secondary perspectives to view the visualization model within a third time period; When the user switches to any of the secondary perspectives to view the visualization model within a fourth time period, feature extraction is performed on a viewing situation of the visualization model viewed by the user at the secondary perspective to obtain a plurality of second feature values; Based on the plurality of second eigenvalues, construct a second feature description vector; Determining an intention value corresponding to the second feature description vector from an intention value library; the intention value corresponds one-to-one to the secondary perspective switched to by the user within a fourth time period; taking the secondary viewing angle to which the user switches within a fourth time period and corresponding to an intention value greater than or equal to an intention threshold as a target secondary viewing angle; The secondary water quality prediction intention is determined based on the perspective association relationship between the target secondary perspective and the main perspective and the perspective conditions in the perspective condition set corresponding to the target secondary perspective.
2. The method for predicting water quality of a sewage treatment plant based on an improved LSTM neural network model as claimed in claim 1, characterized in that: The outlier cleaning at least includes: filling the outliers using a linear interpolation filling method; The smoothing process at least includes: adopting a moving average method.
3. The method for predicting water quality of a sewage treatment plant based on an improved LSTM neural network model as claimed in claim 1, characterized in that: The normalization at least includes: The Z-score standardization method is used, and the formula is as follows: in, Represents the normalized data; represents the mean of the processed data; represents the standard deviation of the processed data; represents the processed data.
4. The method for predicting water quality of a sewage treatment plant based on an improved LSTM neural network model as claimed in claim 1, characterized in that: The data ratio of the training set data to the test set data is 7:
3.
5. The method for predicting water quality of a sewage treatment plant based on an improved LSTM neural network model as claimed in claim 1, characterized in that: The parameter settings of the improved LSTM neural network include at least: crossover probability, mutation probability, population size, maximum number of iterations, learning rate range, number of hidden layer nodes and regularization coefficient range.
6. The method for predicting water quality of a sewage treatment plant based on an improved LSTM neural network model as claimed in claim 1, characterized in that: The fitness function formula is as follows: In the formula, y i is the true value of water quality parameter; is the predicted value of water quality parameters, n is the number of water quality parameter data, and fitness is the fitness value.
Citation Information
Patent Citations
Method for accurately predicting effluent quality of sewage treatment plant
CN111553468A
Sewage treatment inflow water quality prediction method based on peripheral data association analysis
CN112949943A
Water quality prediction method for optimizing LSTM neural network based on improved genetic algorithm
CN111915097A
Sewage treatment dissolved oxygen concentration prediction method based on hybrid optimization algorithm
CN116542382A