CN118228596A - Secondary water supply residual chlorine prediction and control method based on cascade LSTM deep learning model - Google Patents
Secondary water supply residual chlorine prediction and control method based on cascade LSTM deep learning model Download PDFInfo
- Publication number
- CN118228596A CN118228596A CN202410413842.3A CN202410413842A CN118228596A CN 118228596 A CN118228596 A CN 118228596A CN 202410413842 A CN202410413842 A CN 202410413842A CN 118228596 A CN118228596 A CN 118228596A
- Authority
- CN
- China
- Prior art keywords
- residual chlorine
- data
- lstm
- model
- chlorine
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 229910052801 chlorine Inorganic materials 0.000 title claims abstract description 141
- 239000000460 chlorine Substances 0.000 title claims abstract description 141
- ZAMOUSCENKQFHK-UHFFFAOYSA-N Chlorine atom Chemical compound [Cl] ZAMOUSCENKQFHK-UHFFFAOYSA-N 0.000 title claims abstract description 135
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 title claims abstract description 70
- 238000000034 method Methods 0.000 title claims abstract description 27
- 238000013136 deep learning model Methods 0.000 title claims abstract description 15
- 230000006870 function Effects 0.000 claims abstract description 15
- 238000012545 processing Methods 0.000 claims abstract description 12
- 238000012549 training Methods 0.000 claims description 28
- 230000000737 periodic effect Effects 0.000 claims description 14
- 238000012360 testing method Methods 0.000 claims description 12
- 125000001309 chloro group Chemical group Cl* 0.000 claims description 7
- 238000007781 pre-processing Methods 0.000 claims description 7
- 210000002569 neuron Anatomy 0.000 claims description 6
- 230000009469 supplementation Effects 0.000 claims description 6
- 230000002238 attenuated effect Effects 0.000 claims description 3
- 238000001914 filtration Methods 0.000 claims description 3
- 238000005457 optimization Methods 0.000 claims description 3
- 238000007619 statistical method Methods 0.000 claims description 2
- 238000007493 shaping process Methods 0.000 claims 1
- 238000013528 artificial neural network Methods 0.000 abstract description 30
- 230000001502 supplementing effect Effects 0.000 abstract description 26
- 230000008859 change Effects 0.000 abstract description 13
- 238000012544 monitoring process Methods 0.000 abstract description 12
- 238000004458 analytical method Methods 0.000 abstract description 10
- 230000007246 mechanism Effects 0.000 abstract description 9
- AKHNMLFCWUSKQB-UHFFFAOYSA-L sodium thiosulfate Chemical compound [Na+].[Na+].[O-]S([O-])(=O)=S AKHNMLFCWUSKQB-UHFFFAOYSA-L 0.000 abstract description 7
- 238000011217 control strategy Methods 0.000 abstract description 4
- 238000001514 detection method Methods 0.000 abstract description 4
- 230000004044 response Effects 0.000 abstract description 2
- 239000010410 layer Substances 0.000 description 24
- 230000015654 memory Effects 0.000 description 21
- 210000004027 cell Anatomy 0.000 description 11
- 230000007774 longterm Effects 0.000 description 9
- 238000013135 deep learning Methods 0.000 description 7
- 230000000694 effects Effects 0.000 description 7
- 230000008569 process Effects 0.000 description 5
- 230000000306 recurrent effect Effects 0.000 description 5
- 230000008034 disappearance Effects 0.000 description 4
- 238000010801 machine learning Methods 0.000 description 4
- 238000004659 sterilization and disinfection Methods 0.000 description 4
- 238000013499 data model Methods 0.000 description 3
- 238000013461 design Methods 0.000 description 3
- 230000006403 short-term memory Effects 0.000 description 3
- 239000008400 supply water Substances 0.000 description 3
- 238000010276 construction Methods 0.000 description 2
- 125000004122 cyclic group Chemical group 0.000 description 2
- 238000007405 data analysis Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000004880 explosion Methods 0.000 description 2
- 238000013507 mapping Methods 0.000 description 2
- 238000011160 research Methods 0.000 description 2
- 239000008399 tap water Substances 0.000 description 2
- 235000020679 tap water Nutrition 0.000 description 2
- 241000894006 Bacteria Species 0.000 description 1
- 101001095088 Homo sapiens Melanoma antigen preferentially expressed in tumors Proteins 0.000 description 1
- 102100037020 Melanoma antigen preferentially expressed in tumors Human genes 0.000 description 1
- 241000700605 Viruses Species 0.000 description 1
- 230000004913 activation Effects 0.000 description 1
- 230000002411 adverse Effects 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 230000001580 bacterial effect Effects 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 210000004556 brain Anatomy 0.000 description 1
- 238000004140 cleaning Methods 0.000 description 1
- 230000019771 cognition Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000007418 data mining Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000009792 diffusion process Methods 0.000 description 1
- 230000008030 elimination Effects 0.000 description 1
- 238000003379 elimination reaction Methods 0.000 description 1
- 230000008451 emotion Effects 0.000 description 1
- 239000000284 extract Substances 0.000 description 1
- 230000036541 health Effects 0.000 description 1
- 238000007689 inspection Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000007787 long-term memory Effects 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 244000005700 microbiome Species 0.000 description 1
- 239000000203 mixture Substances 0.000 description 1
- 230000008450 motivation Effects 0.000 description 1
- 238000003058 natural language processing Methods 0.000 description 1
- 238000003062 neural network model Methods 0.000 description 1
- 239000002356 single layer Substances 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000012731 temporal analysis Methods 0.000 description 1
- 238000000700 time series analysis Methods 0.000 description 1
- 238000013519 translation Methods 0.000 description 1
- 230000003442 weekly effect Effects 0.000 description 1
Landscapes
- Treatment Of Water By Oxidation Or Reduction (AREA)
Abstract
The invention discloses a secondary water supply residual chlorine prediction and control method based on a cascade LSTM deep learning model, which is used for analyzing fluctuation change characteristics of monitoring data of residual chlorine sensors and exploring response mechanisms of the monitoring data and chlorine supplementing units. The artificial neural network of the deep learning model is used for processing residual chlorine data and analyzing potential operation rules thereof, so that residual chlorine control strategies are gradually searched, residual chlorine control is guided by a residual chlorine prediction method, the LSTM neural network of the artificial intelligent time sequence is used for analyzing residual chlorine historical data of the secondary water supply tank, control parameters of the chlorine supplementing device are automatically acquired, and operation of the chlorine supplementing device is optimized. And the performance of the residual chlorine sensor is monitored in real time, so that the functions of supervision and optimal control operation are achieved. Automatic control based on residual chlorine sensor detection data drive is converted into intelligent control based on LSTM neural network prediction data, and an intelligent analysis method framework for residual chlorine sensor historical data is provided.
Description
Technical Field
The invention relates to a secondary water supply residual chlorine control technology, in particular to a secondary water supply residual chlorine prediction and control method based on a cascade LSTM deep learning model.
Background
Along with the increasing of secondary water supply pump rooms of high-rise residences in towns, the quality of secondary water supply is closely related to lives of residents, and the quality of secondary water supply has been widely paid attention to. At present, secondary water supply tank water quality secondary pollution is a common problem, and the problem of tank disinfection is not solved well all the time. Residual chlorine refers to the residual part of tap water after disinfection and is an important index for detecting the disinfection effect of secondary water supply. The low residual chlorine in the secondary water supply water tank can cause the problem of water quality safety risk, the residence time of tap water in the water tank is longer, the residual chlorine concentration can be gradually reduced, and if the residual chlorine content in the water tank is too low, the growth of bacteria, viruses and other microorganisms can not be effectively inhibited, so that the risk of water quality pollution and bacterial growth is increased. In order to effectively ensure the water quality of users of urban secondary water supply, the secondary water supply pump house needs to be provided with on-line water quality monitoring and automatic disinfection equipment according to the situations of sanitary departments and actual secondary water supply. In actual use, the secondary water supply automatic chlorine supplementing device needs more consideration of safety, and a water supply enterprise must continuously strengthen monitoring of the running state of the chlorine supplementing device, so that various potential running problems are reduced, and the water quality of urban secondary water supply can be ensured more safely.
The automatic chlorine supplementing device is configured on the water tank with part of secondary community water supply, and the basic principle is that the chlorine supplementing unit is controlled to form closed loop control according to the configured residual chlorine sensor. However, the conventional automatic control theory and method are generally insufficient in application in a nonlinear system with long time lag such as secondary water supply chlorine supplementing, and the mode of monitoring the running state can only be detected and controlled in real time, so that the effect of pre-judging the chlorine supplementing in advance cannot be achieved. The excessive residual chlorine content can have adverse effects on human health, and how to ensure the safe operation of an automatic chlorine supplementing device becomes a problem to be solved in the secondary water supply industry.
Deep learning is an important branch of machine learning, and is a concept proposed by Hinton [24] et al in 2006, and because of the introduction of the deep learning, the deep learning creates a new era of neural networks, so that the machine learning is closer to an object, namely artificial intelligence. Deep learning is a multi-layer neural network, although single-layer neural networks can achieve approximate predictions, the added hidden layers can help optimize and improve accuracy. As with other machine learning, deep learning is also a "fitting" mechanism by which an unsupervised network model is built through the imitation of brain learning mechanisms. The available method rules are learned and summarized from a large number of data analyses, so that the system can cluster the data and make predictions.
The cyclic neural network (Recurrent Neural Network, RNN) is that the relation of front and back time sequences is added on the basis of the fully connected neural network, so that the time sequence related problems such as machine translation and the like can be better processed. RNN is called a recurrent neural network in the sense that a sequence's current output is related to the previous output. It is based on the idea that "human cognition is based on past experience and memory", which not only considers previous inputs, but also gives the network a "memory" function for previous content. In theory, RNNs are able to process sequence data of any length. However, in practice, RNNs only have short-term memory due to the disappearance of gradients, and the earliest inputs may generate gradient explosions or gradient vanishes when the neural network counter-propagates, so that RNNs cannot recall too long memories, which may reduce the accuracy of prediction, and thus long-and-short-term memory neural networks LSTM are grown. The long-short-term memory (LSTM) neural network structure has memory capacity, can capture dynamic modes and dependency relations in time sequence data, can be used for judging the development trend of things through time sequence prediction, and can provide powerful basis for application decision.
The main reason LSTM can be used for prediction is that it is excellent in processing sequence data. LSTM is better able to capture long-term dependencies of sequence data than other traditional machine learning methods or artificial neural networks. The LSTM can better process long sequence data by introducing a gating mechanism, avoid the problem of gradient disappearance, and enable a network to better remember and utilize long-term dependencies in the sequence, which makes the LSTM suitable for a plurality of tasks requiring consideration of time sequence and long-term relationships. Such as time series predictions, stock price predictions, weather predictions, semantic analysis and emotion analysis in natural language processing, etc. The LSTM neural network has the characteristics of strong nonlinearity, mapping property, self-adaption and the like, and can effectively improve the prediction precision.
Disclosure of Invention
Aiming at the problems in the prior art, the invention provides the secondary water supply residual chlorine prediction and control method based on the cascade LSTM deep learning model, which can accurately predict the residual chlorine trend in a future period, form a corresponding control strategy, can improve the prediction accuracy, provides an effective intelligent guarantee function for a water tank chlorine supplementing device and has higher practical value.
The aim of the invention is achieved by the following technical scheme.
A secondary water supply residual chlorine prediction and control method based on a cascade LSTM deep learning model comprises the following steps: the method comprises the steps of data preprocessing, periodic model training, data processing, fluctuation model training, testing and output control, wherein the data processing comprises fitting data and sequence slicing, an LSTM network for the periodic model training and data fitting is composed of 5 hidden layers, each layer is provided with a network model composed of 64 LSTM neurons, and a full-connection layer, low-frequency characteristics of input data are analyzed in a lower LSTM model, and periodic rules in a larger time domain are learned; the LSTM network for training the fluctuation model and predicting the data consists of 5 hidden layers, a network model formed by 68 LSTM neurons in each layer and a full-connection layer, wherein the LSTM model is used for analyzing the local characteristics of input data and outputting a preset number of predicted data and corresponding time axes; and the testing and outputting the predicted control parameter stage performs statistical analysis on the predicted data, finds out the residual chlorine value of the lowest point of the predicted residual chlorine, namely the time when the residual chlorine value of the highest point of the predicted residual chlorine is attenuated to the lowest point, and the time when the residual chlorine rises to the set highest point after chlorine supplementation, and the two predicted times are subtracted to obtain the predicted chlorine supplementation time.
The data preprocessing is to normalize the input residual chlorine data.
The LSTM network with the periodic model training and the data fitting has the functions of filtering and eliminating jitter, shapes the original data, removes most of high-frequency jitter of residual chlorine signals, and outputs the processed data representing the residual chlorine signals.
The LSTM network for the fluctuation model training and the data prediction adopts AdamW optimization functions with L2 regularization and weight attenuation, the L2 regularization adds penalty items consisting of square sums of all weights of the model to the loss function, and specific super parameters are multiplied to control penalty force.
Compared with the prior art, the invention has the advantages that: the invention provides a cascade long-short-term memory model, which is used for dividing residual chlorine prediction into two stages: extracting periodic characteristics of residual chlorine in the first stage to obtain a general variation trend; and extracting fluctuation characteristics of residual chlorine in the second stage, learning correlation characteristics of residual chlorine in the previous and later periods, and further improving the accuracy of prediction. The cascade long-term and short-term memory neural network for establishing the time sequence automatically analyzes residual chlorine historical data of the water tank, can accurately predict residual chlorine trend in a period of time in the future, forms a corresponding control strategy, and shows that the deep learning model provides an effective intelligent guarantee effect for the water tank chlorine supplementing device through the operation inspection of the experimental water tank and the secondary water supply water tank of an actual community, and has higher practical value.
Drawings
FIG. 1 is a flow chart of the cascade LSTM model of the invention.
FIG. 2 is a schematic diagram of a cascade LSTM structure according to the present invention.
Fig. 3 is a graph showing chlorine residue monitoring data in one day of a secondary water supply tank of a certain district according to an embodiment of the present invention.
Fig. 4 is a training set loss graph.
Fig. 5 is a graph of test set loss.
FIG. 6 is a graph of predicted and actual values versus the graph of the present invention.
Detailed Description
The invention will now be described in detail with reference to the drawings and the accompanying specific examples.
The invention starts from the basic principles of a large number of data records and residual chlorine diffusion attenuation of the actual secondary water supply pump house chlorine supplementing device operation, analyzes the fluctuation change characteristics of residual chlorine sensor monitoring data, and explores the response mechanisms of the monitoring data and the chlorine supplementing unit. The artificial neural network of the deep learning model is used for processing residual chlorine data and analyzing potential operation rules thereof, so that residual chlorine control strategies are gradually searched, residual chlorine control is guided by a residual chlorine prediction method, and the safety of chlorine supplementing of the secondary water supply tank is more and more necessary. According to the invention, the LSTM neural network of the artificial intelligent time sequence is adopted to analyze residual chlorine historical data of the secondary water supply tank, control parameters of the chlorine supplementing device are automatically obtained, and the operation of the chlorine supplementing device is optimized. And the performance of the residual chlorine sensor is monitored in real time, so that the functions of supervision and optimal control operation are achieved. Automatic control based on residual chlorine sensor detection data drive is converted into intelligent control based on LSTM neural network prediction data, and an intelligent analysis method framework for residual chlorine sensor historical data is provided. The framework comprises 4 stages of data cleaning, data model construction, data training, control parameter prediction and the like, provides standardized data analysis and mining flow, and can be applied to development of various time sequence prediction control systems.
The result shows that the operation of the secondary water supply tank residual chlorine monitoring data and the chlorine supplementing device has the correlation characteristics of time dimension periodic change and space dimension cooperative change, and the secondary water supply residual chlorine prediction method based on the LSTM neural network model has obvious advantages. The built long-short-period memory network (LSTM) framework based on deep learning combines the advantages of multiple layers of long-short-period memory models, improves the accuracy of neural network prediction, and provides powerful safety guarantee for realizing residual chlorine control. The novel combination framework based on the cascade LSTM data model, the LSTM data preprocessing algorithm and the LSTM data prediction algorithm, which is innovatively built in the text, is that a pre-stage LSTM model is firstly built to process the residual chlorine time sequence data, the characteristics are rapidly extracted, the periodicity rule of the data is analyzed, the long-term change trend of the residual chlorine is learned, and the change rule of each period is obtained; and then, a post-stage LSTM model is established to extract residual chlorine value fluctuation characteristics from the processed data, the residual chlorine value correlation characteristics in the front and rear time periods are learned, the overall trend is corrected, and the accuracy of prediction is further improved. Compared with other model prediction results, the method has the advantages of small overall error, good stability and high network training speed, and is more beneficial to the on-site deployment and operation of the edge computing units. Residual chlorine prediction can be used for real-time monitoring and anomaly detection of the sensor, and the predicted result is used as the basis for data drift and failure judgment. Practice proves that the secondary water supply residual chlorine prediction method based on the cascade LSTM deep learning model is used for an intelligent supervision mechanism of the secondary water supply chlorine supplementing device and has practical application value for guaranteeing the safety of residual chlorine in the water tank.
The invention further discusses the core concept, structure and mathematical principle of long-short-term memory network (LSTM), the working principle of LSTM is explained through logic analysis, error comparison analysis is carried out on the LSTM prediction and actual detection value, the article also demonstrates in detail how to construct and train the LSTM model by using the deep learning framework Pytorch, and predict future data, thus embodying the advantages of LSTM in practical application.
LSTM structure of long-short-term memory network
The LSTM model is called as Long short-term memory (LSTM), the network structure of the LSTM is similar to that of RNN, and is a chain structure, the LSTM model is improved on the basis of a cyclic neural network (Recurrent Neural Network, RNN), and the LSTM model successfully solves the problems of gradient elimination and Long-term dependence in application in training through the introduction of a storage unit and a forgetting door. LSTM is very suitable for solving the problem of time series prediction, and can converge to an optimal solution more quickly in predicting the time series.
The LSTM model mainly avoids the problems of gradient explosion and gradient disappearance in a standard RNN network structure, introduces a gating mechanism concept on the basis of the problems, and controls the flow of data information through an input door, a forgetting door and an output door, so that the training speed is faster, and the problem of gradient disappearance is solved to a certain extent. LSTM can remember long-term information, all recurrent neural networks have chain-like repeating modules of the neural network.
LSTM has three gates to protect and control cell status: forget gate (for gate), update gate (update gate), and output gate (output gate). The cell state is similar to a conveyor belt. Running directly over the entire chain, with only a few linear interactions, it is easy for the information to remain unchanged on top. The LSTM model has four main structures of an input gate, a forgetting gate, an output gate and a memory unit, wherein the input gate, the forgetting gate, the output gate and the memory unit interact in a special mode, and the input of the current time step and the hidden state of the previous time step are used as data to be sent into the gate of the long-short-period memory network as in the gating circulation unit. They are processed by three fully connected layers with sigmoid activation functions to calculate the values of the input gate, the forget gate and the output gate. Thus, the values of these three gates are all in the range of (0, 1).
The design concept of the long-short-period memory network comes from the logic circuit gate of the electronic computer, and the long-short-period memory network introduces memory cells or simply referred to as cells. Some documents consider memory cells as a special type of hidden state, which have the same shape as the hidden state, and are designed for recording additional information. To control the memory cell, a number of gates are required. One of the gates is used to output an entry from the cell, which we call the output gate (output gate). The other gate is used to determine when to read data into the cell, which we call the input gate (input gate). There is also a need for a mechanism to reset the contents of the cell, managed by a forget gate (forget gate), and the motivation of this design, like the gated loop cell, can decide when to memorize or ignore the input in the hidden state by a dedicated mechanism. So that it is possible to effectively memorize valuable things in the past information and then form a neural network structural model. Long-short-term memory networks (LSTM) are an extension of Recurrent Neural Networks (RNN), particularly for sequence modeling and time series analysis. The design uniqueness of LSTM makes the logical structure of LSTM very useful in many practical applications, especially in tasks that require capturing long-term dependencies in a time series.
Cascade LSTM model
The research finds that the time sequence of the residual chlorine data of the water tank shows a certain level rule, such as the residual chlorine rises and then decays when the chlorine is supplemented each time; the regularity of the chlorine supplementing times per day is strong. The periodicity enables residual chlorine in each period of each day to have similar variation trend, on the other hand, the residual chlorine value has strong fluctuation, residual chlorine at the current moment can be influenced by the residual chlorine condition in the previous period to generate fluctuation, and meanwhile, the residual chlorine has strong correlation. If the internal level rules contained in the data can be utilized, the analysis effect is likely to be improved, so that the invention introduces a cascade network structure of a two-layer LSTM model, and as shown in figures 1 and 2, historical time series data are learned from two different scales.
The LSTM module firstly carries out denoising processing on the original time sequence data, then extracts characteristics from the denoising data and takes the characteristics as the input of the LSTM network to generate a prediction result. The cascade LSTM model consists of two basic LSTM network modules, and the core idea is to establish preliminary characteristic processing of input data in a lower LSTM layer, analyze the periodicity rule of the data, learn the long-term change trend of residual chlorine and obtain the change rule of each period; extracting residual chlorine value fluctuation characteristics from a higher LSTM layer, learning residual chlorine value correlation characteristics in a front period and a rear period, correcting the overall trend, and further improving the prediction accuracy.
The cascade LSTM deep neural network enhances the expressive power of the model by creating additional hierarchical relationships between the two LSTM networks. The conventional LSTM network is composed of a series of LSTM units, where each LSTM unit includes key gating units, such as an input gate, a forget gate, and an output gate, and the like, for controlling the flow of input data and updating state information. Each LSTM unit is calculated in sequence on a time sequence, and the output result is transmitted to the next LSTM unit. And the cascade LSTM network constructs a plurality of LSTM unit hierarchical structures by adding additional LSTM layers in the LSTM network, so that information can be transferred and interacted among the LSTM layers. The output result of each LSTM layer is used as the input of the next LSTM layer, so that more nonlinear mapping and abstract capability can be introduced, and the generalization capability and expression capability of the model are improved. In a tandem LSTM network, each LSTM layer typically has a different number of hidden units and different parameters in order to capture different features and patterns at different levels. Meanwhile, by increasing the depth of the network, the cascade LSTM network can model and learn more complex time sequence modes, and has stronger learning ability. The following introduces the processing flow of the cascade LSTM network model, which is divided into: data preprocessing, periodic model training, data processing, fluctuation model training, testing and output control.
1. Advanced periodic model training and data fitting stage
The level LSTM network is composed of 5 hidden layers, each layer having a network model of 64 LSTM neurons, and a Fully Connected (FC) layer. The core idea is that the low-frequency characteristic of the input data is analyzed in a lower LSTM model, and the periodic rule on a larger time domain is learned as the main work, so that the training time of the front-stage LSTM network is not too long, the overfitting should be avoided, the layer also has the functions of filtering and eliminating jitter, the original data is shaped, the high-frequency jitter of most residual chlorine signals is removed, and the processed data representing the residual chlorine signals is output
2. Later stage volatility model training and data prediction stage
The level LSTM network is a network model consisting of 5 hidden layers, each layer having 68 LSTM neurons, and a Full Connectivity (FC) layer is formed to analyze the local features of the input data in the higher LSTM model. Thanks to the sorting of the raw data by the preceding stage, this stage uses a lower learning rate to improve the accuracy of the predictions. The LSTM network adopts AdamW optimization functions with L2 regularization and weight attenuation, L2 regularization is a classical method for reducing overfitting, penalty items consisting of square sums of all weights of a model can be added to a loss function, and specific superparameters are multiplied to control penalty force, so that overfitting is effectively avoided. Outputting a predetermined number of predicted data and corresponding time axis
3. Testing and outputting predictive control parameter phases
The predicted data are statistically analyzed, so that the residual chlorine value of the lowest point of predicted residual chlorine, namely the time when the residual chlorine is attenuated to the lowest point, and the residual chlorine value of the highest point of predicted residual chlorine, namely the time when the residual chlorine rises to the set highest point after chlorine supplementation, can be conveniently found, and the predicted chlorine supplementation time is obtained by subtracting the two predicted times.
Examples
Correlation of residual chlorine change curve and time
The residual chlorine data of the water tank is a typical time sequence, and the data are arranged according to the time sequence of collection. The time series of residual chlorine in the water tank shows a significant periodicity due to the composition of the users in each cell and their daily water usage behavior being relatively fixed. The invention refers to a water use time sequence in a complete period of 0:00-24:00 a day as a residual chlorine use change curve. Fig. 3 shows residual chlorine monitoring data in one day of a secondary water tank of a certain district, and the data interval of the data is 1min.
The method adopts Pytorch-based construction of a neural network framework, python3.9 is used as a programming language, pyCharm Community Edition 2023.2.5 is used as an editor, a field edge computing unit adopts the configuration of a mini-host CPU (Central processing Unit) N95 and a memory 16G+512G, and a database adopts MySQL. The data obtained herein are from an automatic chlorine supplementing device of a secondary water supply tank of a certain district in Changzhou through on-site industrial Ethernet communication. And uploading the data and control parameters to a remote data monitoring cloud platform through the 4G_DTU, wherein the data acquisition frequency is 30.
LSTM network data model preprocessing
The system automatically obtains the original residual chlorine data from the database, and the data is in the shape of datay shape (5250,1). A function named split_data is defined. The partitioned data dataX. Shape (5186,64,1) and datay. Shape (5186,1) were obtained for a total of 5186 records. The dataset was divided into training and testing sets, 90% of which were training sets and 10% of which were testing sets. The pre-LSTM algorithm will train on the training set and then be used to detect the effect of the network training on the test set. The predicted results will be compared to actual values in the test set to evaluate the trained model performance.
LSTM model parameter tuning description: the parameters of the neural network are relatively large, and under the same network model, different parameter settings can influence the overall operation efficiency, operation speed and the like of the network model. Iterative training of the pre-LSTM network for 2000 times, the learning rate is 2.03127 minutes when the learning rate is 0.0001, 5186 pieces of residual chlorine data are fitted, and mean square error MSE is 0.00010094, MAE is 0.00614, MAPE is 0.020552 and R2 is 0.8875 compared with the original data; the post LSTM network is trained for 800 times, the learning rate is 0.00005, the time is 67.51 minutes, and the mean square error MSE of the training set is 0.00179; the test set is MSE 0.00134. As shown in fig. 4 and 5.
The prediction control parameter analysis is that a time axis of the lowest point of the nearest residual chlorine can be conveniently found in future prediction data, the next chlorine supplementing time can be calculated, the time axis of the highest point of the nearest residual chlorine can be similarly found, the chlorine supplementing stopping time can be calculated, and the time of the next chlorine supplementing process can be calculated by subtracting the time axis from the time axis of the highest point of the nearest residual chlorine. Furthermore, the time axis of the lowest point of the second closest residual chlorine can be found, so that the time interval between the two metering pump operations, namely the time of residual chlorine attenuation, can be conveniently calculated. Fig. 6 is a graph of predicted and actual values according to the present invention, (the data and graph are only examples).
Predicting residual chlorine minimum | 0.256mg/L | Predicting the maximum value of residual chlorine | 0.338mg/L |
Time axis for predicting residual chlorine minimum point | 14 | Time axis for predicting maximum point of residual chlorine | 22 |
Predicting minimum time of residual chlorine | After 28 minutes | Predicting the maximum time of residual chlorine | After 44 minutes |
The predicted dosing time is | For 16 minutes |
The residual chlorine of the secondary water supply tank is usually non-static, nonlinear and unstable, residual chlorine data has complex characteristics such as instability, irregularity and the like, meanwhile, the residual chlorine is influenced by the water consumption, the water inflow and temperature difference, the daily and weekly user water consumption condition and the holiday instability, and the accuracy can be greatly reduced by analyzing the data by the personal experience and intuition of an analyzer. Therefore, a scientific, intelligent and highly accurate research method is needed to reduce errors, reasonably forecast and analyze residual chlorine data of the water tank, and the residual chlorine data is used as a technology and a management measure for guaranteeing the water quality safety of secondary water supply.
The invention establishes a secondary water supply residual chlorine prediction model based on a cascade LSTM deep learning model by taking an LSTM network model as a basic model. The prediction process is divided into two stages of extracting periodic characteristics of data, predicting general change trend and extracting fluctuation characteristics of the data, and improving prediction accuracy. The actual residual chlorine control data of the secondary water supply tank of a certain area in Changzhou shows that the multi-scale analysis structure of the hierarchical neural network is benefited, the time sequence change relation between the data is well mastered by the network, the long-term change trend and the short-term fluctuation feature of the residual chlorine can be well learned, and the accuracy of residual chlorine prediction is further improved. After stability analysis is carried out on the cascade LSTM network model, the prediction accuracy is higher than 0.9, the feasibility of the model in the field of secondary water supply water tank residual chlorine prediction is verified, and the model can be widely applied to a water tank chlorine supplementing system and has a great effect on optimizing water tank chlorine supplementing control and avoiding water quality risks.
Claims (4)
1. A secondary water supply residual chlorine prediction and control method based on a cascade LSTM deep learning model is characterized by comprising the following steps: the method comprises the steps of data preprocessing, periodic model training, data processing, fluctuation model training, testing and output control, wherein the data processing comprises fitting data and sequence slicing, an LSTM network for the periodic model training and data fitting is composed of 5 hidden layers, each layer is provided with a network model composed of 64 LSTM neurons, and a full-connection layer, low-frequency characteristics of input data are analyzed in a lower LSTM model, and periodic rules in a larger time domain are learned; the LSTM network for training the fluctuation model and predicting the data consists of 5 hidden layers, a network model formed by 68 LSTM neurons in each layer and a full-connection layer, wherein the LSTM model is used for analyzing the local characteristics of input data and outputting a preset number of predicted data and corresponding time axes; and the testing and outputting the predicted control parameter stage performs statistical analysis on the predicted data, finds out the residual chlorine value of the lowest point of the predicted residual chlorine, namely the time when the residual chlorine value of the highest point of the predicted residual chlorine is attenuated to the lowest point, and the time when the residual chlorine rises to the set highest point after chlorine supplementation, and the two predicted times are subtracted to obtain the predicted chlorine supplementation time.
2. The secondary water supply residual chlorine prediction and control method based on the cascade LSTM deep learning model as claimed in claim 1, wherein the data preprocessing is to normalize input residual chlorine data.
3. The secondary water supply residual chlorine prediction and control method based on the cascade LSTM deep learning model as claimed in claim 1, wherein the LSTM network with the periodic model training and the data fitting has the functions of filtering and eliminating jitter, shaping the original data, removing high-frequency jitter of most residual chlorine signals, and outputting the processed data representing the residual chlorine signals.
4. The secondary water supply residual chlorine prediction and control method based on the cascade LSTM deep learning model as claimed in claim 1, wherein the LSTM network for the fluctuation model training and data prediction adopts AdamW optimization functions with L2 regularization and weight attenuation, L2 regularization adds penalty terms consisting of square sums of all weights of the model to the loss function, and multiplies specific super parameters to control penalty force.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410413842.3A CN118228596A (en) | 2024-04-08 | 2024-04-08 | Secondary water supply residual chlorine prediction and control method based on cascade LSTM deep learning model |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410413842.3A CN118228596A (en) | 2024-04-08 | 2024-04-08 | Secondary water supply residual chlorine prediction and control method based on cascade LSTM deep learning model |
Publications (1)
Publication Number | Publication Date |
---|---|
CN118228596A true CN118228596A (en) | 2024-06-21 |
Family
ID=91512537
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410413842.3A Pending CN118228596A (en) | 2024-04-08 | 2024-04-08 | Secondary water supply residual chlorine prediction and control method based on cascade LSTM deep learning model |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN118228596A (en) |
-
2024
- 2024-04-08 CN CN202410413842.3A patent/CN118228596A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Niu et al. | Detection of long-term effect in forecasting municipal solid waste using a long short-term memory neural network | |
CN113887616B (en) | Real-time abnormality detection method for EPG connection number | |
CN111994970B (en) | LSTM-based dosing prediction method and dosing system for efficient sewage sedimentation tank | |
CN112990556A (en) | User power consumption prediction method based on Prophet-LSTM model | |
CN113554466B (en) | Short-term electricity consumption prediction model construction method, prediction method and device | |
CN114282443B (en) | Residual service life prediction method based on MLP-LSTM supervised joint model | |
CN113065703A (en) | Time series prediction method combining multiple models | |
CN112801388B (en) | Power load prediction method and system based on nonlinear time series algorithm | |
Zhang | The regional disparity of influencing factors of technological innovation in China: Evidence from high-tech industry | |
CN111680786A (en) | Time sequence prediction method based on improved weight gating unit | |
Jichang et al. | Water quality prediction model based on GRU hybrid network | |
CN114218872A (en) | Method for predicting remaining service life based on DBN-LSTM semi-supervised joint model | |
Dang et al. | A novel multivariate grey model for forecasting periodic oscillation time series | |
Tan et al. | Application of CNN and long short-term memory network in water quality predicting | |
CN112132334A (en) | Method for predicting yield of urban domestic garbage | |
CN115456245A (en) | Prediction method for dissolved oxygen in tidal river network area | |
Sun et al. | The CEEMD-LSTM-ARIMA model and its application in time series prediction | |
Qu et al. | A trend forecast of import and export trade total volume based on LSTM | |
Juan et al. | Multi-step prediction of dissolved oxygen in river based on random forest missing value imputation and attention mechanism coupled with recurrent neural network | |
CN111369078A (en) | Water supply quality prediction method based on long-term and short-term memory neural network | |
CN118228596A (en) | Secondary water supply residual chlorine prediction and control method based on cascade LSTM deep learning model | |
Kang et al. | Research on forecasting method for effluent ammonia nitrogen concentration based on GRA-TCN | |
CN114726751A (en) | Intelligent early warning method, system, equipment and storage medium for resource quality monitoring | |
Liu et al. | Network traffic big data prediction model based on combinatorial learning | |
Xie et al. | SO2 prediction for wet flue gas desulfurization based on improved long and short-term memory |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination |