Reservoir water level prediction and early warning method based on PSO-CNN-LSTM

Through PSO optimization of the CNN-LSTM model and combined with the historical data of the reservoir, the problem of reservoir water level prediction is solved, the rapid and effective prediction and regulation of reservoir water level is achieved, and the safety of reservoir is improved.

CN114386692BActive Publication Date: 2024-12-17FUJIAN ZHONGRUI NETWORK CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202210026076.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-11
Publication Date
2024-12-17
Estimated Expiration
2042-01-11

AI Technical Summary

Technical Problem

The existing technology is difficult to achieve rapid and effective reservoir water level prediction, which leads to difficulties in reservoir regulation and may lead to catastrophic events.

Method used

Using particle swarm optimization algorithm (PSO) and convolutional neural network long and short-term memory network (CNN-LSTM) models, water level prediction is carried out through historical water levels, rainfall, flood discharge and aging factors, and the model hyperparameters are optimized to improve prediction accuracy. .

Benefits of technology

It has achieved an effective grasp of the changing trend of reservoir water level, provided reliable reservoir regulation data, and improved reservoir safety.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114386692B_ABST
    Figure CN114386692B_ABST
Patent Text Reader

Abstract

The present invention relates to a reservoir water level prediction and early warning method based on PSO-CNN-LSTM, comprising the following steps: step S1: obtaining historical monitoring data of the reservoir and preprocessing it; step S2: sorting the preprocessed historical monitoring data of the reservoir by acquisition time to construct a feature data set; step S3: searching for optimal parameters of a CNN-LSTM model based on PSO; step S4: processing the feature data set and dividing it into a training set and a test set; step S5: constructing and training a CNN-LSTM model based on the optimal parameters and training set obtained in step S3; step S6: performing real-time reservoir water level prediction based on the trained CNN-LSTM model. The present invention realizes fast and effective reservoir water level prediction and provides reliable data for reservoir regulation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of dam water level prediction and early warning, and in particular to a reservoir water level prediction and early warning method based on PSO-CNN-LSTM. Background Art

[0002] As an important water conservancy project hub, reservoirs play a huge engineering role and bear the arduous tasks of people's daily life and industrial and agricultural production. Reservoirs not only make great contributions to flood control and dispatching and ensuring local safety, but also take into account the important tasks of irrigation, power generation, and drinking water storage. If you are not careful, it will bring unpredictable disasters to the country and the people. Reservoir health monitoring is particularly important.

[0003] Reservoir water level monitoring is one of the most important monitoring targets in the reservoir health monitoring project. The reservoir water level directly affects the health of the reservoir, and the reservoir water level needs to be monitored and dispatched in real time to control it in a safe range to ensure the safety of the reservoir. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a reservoir water level prediction and early warning method based on PSO-CNN-LSTM, so as to achieve fast and effective reservoir water level prediction and provide reliable data for reservoir regulation.

[0005] To achieve the above object, the present invention adopts the following technical solution:

[0006] A reservoir water level prediction and early warning method based on PSO-CNN-LSTM includes the following steps:

[0007] Step S1: Obtain historical monitoring data of the reservoir and preprocess it;

[0008] Step S2: sorting the preprocessed historical monitoring data of the reservoir by collection time to construct a feature data set;

[0009] Step S3: Search for optimal parameters of CNN-LSTM model based on PSO;

[0010] Step S4: Process the feature data set and divide it into a training set and a test set;

[0011] Step S5: Based on the optimal parameters and training set obtained in step S3, a CNN-LSTM model is constructed and trained;

[0012] Step S6: Based on the trained CNN-LSTM model, real-time prediction of reservoir water level is performed.

[0013] Furthermore, the step S1 is specifically as follows:

[0014] Step S11: Obtaining historical monitoring data of the reservoir including the water level, flood discharge, rainfall, and monitoring time of the reservoir;

[0015] Step S12: Select water level, flood discharge, rainfall, and monitoring time, and align them according to time so that each piece of data is the water level, flood discharge, and rainfall at the same time;

[0016] Step S13: Select a recent period of data with fewer missing values, and use the previous or next value to fill the missing values.

[0017] Furthermore, the step S2 is specifically as follows:

[0018] Step S21: construct the function expression, and construct the time-effect component according to f(α) and the reservoir water level observation time to obtain the time-effect component

[0019] f(α)=a 1 α+a 2 lnα

[0020] where a 1 , a 2 is the coefficient, t is the cumulative number of days from the monitoring day to the start monitoring day;

[0021] Step S22: The function expression of water level feature transformation is as follows:

[0022]

[0023] The reservoir water level data collection time is T t (t=0, 1, 2, ..., n), T 0 ~T n Reservoir water level during the period, H i for Any non-empty subset of , W is the reservoir water level.

[0024] According to f(W), the reservoir water level characteristics are transformed to obtain W 1 ,W 2 ,W 3 They are:

[0025]

[0026] Furthermore, the step S3 is specifically as follows:

[0027] Step S31: Use MSE as the evaluation index of the hyperparameters of the particle swarm optimization model, and the loss in the CNN-LSTM model as the objective function of PSO optimization.

[0028] Step S32: embed the CNN-LSTM model into the PSO model, and set the hyperparameters that need to be optimized in the model to the dimensions corresponding to the particle swarm. After the setting is completed, iterate, and after the optimization iteration is completed, select the group with the smallest loss value as the hyperparameters of the CNN-LSTM model.

[0029] Furthermore, the step S4 is specifically as follows:

[0030] Step S41: normalize using the maximum and minimum values. The normalization function expression is as follows:

[0031]

[0032] Where x is the value of a single data, min is the minimum value of the column where the data is located, and max is the maximum value of the column where the data is located;

[0033] Step S42: After normalization, the data set is obtained, sorted by data collection time, and divided into a training set and a test set according to a preset ratio;

[0034] Step S43: Split the divided training set and test set into independent variables and dependent variables;

[0035] Step S44: The separated group independent variables and dependent variables are reshaped into 3D data readable by the CNN-LSTM model, and the reshaped data shape is shape.

[0036] 1. Further, the independent variable of the CNN-LSTM model is N = (batch_size-width) / width, which is a matrix including rainfall, flood_Discharge, timeffcent, ln_timeffcent, water_ago1Level, water_ago2Level, and water_Level features; batch_sizew is the data volume, and width is the independent variable window width; the independent variable matrix sequence is expressed as F(X), and its function expression is as follows:

[0037] F(X)=(X 0 ,X 1 ,X 2 ,…,X n ),(n∈Z * )

[0038] The matrix X in F(X) 0 Expand as follows:

[0039]

[0040] Matrix K ijIn , i is the independent variable window width and j is the input feature dimension.

[0041] The dependent variable sequence is:

[0042] y={x i,j ,x i+1,j ,x i+2,j ,…,x n-i,j}

[0043] Furthermore, the step S5 is specifically as follows:

[0044] Step S51: Input the training set data processed in step S4 into the CNN-LSTM model, and read the data into Conv1D for feature fusion;

[0045] Step S52: Pool the fused features, input the pooled data and the hyperparameters searched by the PSO model into LSTMLayers for training, and after the training, perform dimensionality reduction through Fatten Layers, input the reduced dimensionality data into the specified dimension of Dense Layers and output the predicted features.

[0046] Compared with the prior art, the present invention has the following beneficial effects:

[0047] 1. The reservoir water level prediction and early warning method based on the PSO-CNN-LSTM model of the present invention uses historical water level, rainfall, flood discharge, and time factor to predict future water level. It can effectively grasp the changing trend of reservoir water level in the future, so as to dispatch the reservoir water level.

[0048] 2. The present invention uses CNN to perform data feature fusion, which can effectively fine-grain the data features. After fine-graining, LSTM is used for model training to extract its coarse-grained feature information, so that the model has a better prediction effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 is a flow chart of the method of the present invention;

[0050] Figure 2 This is a diagram of the CNN-LSTM reservoir water level prediction architecture in one embodiment of the present invention;

[0051] Figure 3 This is a schematic diagram of data splitting in one embodiment of the present invention;

[0052] Figure 4 is a schematic diagram of a feature fusion method in one embodiment of the present invention;

[0053] Figure 5 It is a schematic diagram of a detailed feature fusion method in one embodiment of the present invention. DETAILED DESCRIPTION

[0054] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.

[0055] Please refer to Figure 1 The present invention provides a reservoir water level prediction and early warning method based on PSO-CNN-LSTM, comprising the following steps:

[0056] Step S1: Obtain historical reservoir monitoring data and pre-process it, specifically:

[0057] Step S11: Obtaining historical monitoring data of the reservoir including the water level, flood discharge, rainfall, and monitoring time of the reservoir;

[0058] Step S12: Select water level, flood discharge, rainfall, and monitoring time, and align them according to time so that each piece of data is the water level, flood discharge, and rainfall at the same time;

[0059] Step S13: Select a recent period of data with fewer missing values, and use the previous or next value to fill the missing values.

[0060] Step S2: Sort the preprocessed historical reservoir monitoring data by collection time and construct a feature data set, specifically:

[0061] Step S21: construct the function expression, and construct the time-effect component according to f(α) and the reservoir water level observation time to obtain the time-effect component

[0062] f(α)=a 1 α+a 2 lnα

[0063] where a 1 , a 2 is the coefficient, t is the cumulative number of days from the monitoring day to the start monitoring day;

[0064] Step S22: The function expression of water level feature transformation is as follows:

[0065]

[0066] The reservoir water level data collection time is T t (t=0, 1, 2, ..., n), T 0 ~T n Reservoir water level during the period, H i for Any non-empty subset of , W is the reservoir water level.

[0067] According to f(W), the reservoir water level characteristics are transformed to obtain W 1 ,W2 ,W 3 They are:

[0068]

[0069] Step S3: Use the PSO algorithm to optimize the hyperparameters of the CNN-LSTM model, such as the backtracking length, the number of neurons in the LSTM layer, the Dropout rate, and the read-in capacity, to obtain better model hyperparameters, where the objective function of PSO is set to MSE, and the parameters of the PSO model are set, namely, the inertia weight, the learning factor, the number of particles, and the particle swarm search dimension. The particle swarm search dimensions are the backtracking length of the CNN-LSTM model, the number of neurons in the two LSTM layers, the two-layer Dropout rate, and the data capacity of the batch read-in model.

[0070] MSE is used as the evaluation index of the hyperparameters of the particle swarm optimization model, and the loss in the CNN-LSTM model is used as the objective function of PSO optimization.

[0071] The CNN-LSTM model is embedded in the PSO model, and the hyperparameters that need to be optimized are set to the dimensions corresponding to the particle swarm. After the settings are completed, iterations are performed. After the optimization iterations are completed, the group with the smallest loss value is selected as the hyperparameters of the CNN-LSTM model.

[0072] Step S4: Process the feature data set and divide it into a training set and a test set, specifically:

[0073] Step S41: normalize using the maximum and minimum values. The normalization function expression is as follows:

[0074]

[0075] Where x is the value of a single data, min is the minimum value of the column where the data is located, and max is the maximum value of the column where the data is located;

[0076] Step S42: After normalization, the data set is obtained, sorted by data collection time, and divided into a training set and a test set according to a preset ratio;

[0077] Step S43: Split the divided training set and test set into independent variables and dependent variables;

[0078] Step S44: The separated group independent variables and dependent variables are reshaped into 3D data readable by the CNN-LSTM model, and the reshaped data shape is shape.

[0079] 2. In this embodiment, the independent variable of the CNN-LSTM model is N = (batch_size-width) / width, which is a matrix including rainfall, flood_Discharge, timeffcent, ln_timeffcent, water_ago1Level, water_ago2Level, and water_Level features; batch_sizew is the data volume, and width is the independent variable window width; the independent variable matrix sequence is expressed as F(X), and its function expression is as follows:

[0080] F(X)=(X 0 ,X 1 ,X 2 ,…,X n ),(n∈Z * )

[0081] The matrix X in F(X) 0 Expand as follows:

[0082]

[0083] Matrix K ij In , i is the independent variable window width and j is the input feature dimension.

[0084] The dependent variable sequence is:

[0085] y={x i,j ,x i+1,j ,x i+2,j ,…,x n-i,j}

[0086] Step S5: Based on the optimal parameters and training set obtained in step S3, a CNN-LSTM model is constructed and trained;

[0087] Step S51: Input the training set data processed in step S4 into the CNN-LSTM model, and read the data into Conv1D for feature fusion;

[0088] Step S52: Pool the fused features, input the pooled data and the hyperparameters searched by the PSO model into LSTMLayers for training, and after the training, perform dimensionality reduction through FattenLayers, input the reduced dimensionality data into the specified dimension of DenseLayers and output the predicted features.

[0089] Step S6: Based on the trained CNN-LSTM model, real-time prediction of reservoir water level is performed.

[0090] Embodiment 1:

[0091] In this embodiment, Kafka is used to read the reservoir water level, flood discharge, rainfall and other data collected by sensors. The producer calls the python API related to Kafka to produce and push the messages read from the stream data to the Broker. The consumer uses the corresponding partition allocation strategy to pull the stream data from the Broke through the pull operation and into the CNN-LSTM model.

[0092] Based on the trained CNN-LSTM model, the data is read into the CNN-LSTM model for reservoir water level prediction. After the prediction is completed, the predicted value is saved for use in the next step.

[0093] According to the saved reservoir water level forecast value, the forecast value is compared with the reservoir standard safety water level. If the judgment condition is met, the saved forecast value and the reservoir standard safety water level are output, and the reservoir water level is dispatched according to the output forecast information and reservoir standard safety water level information, and the process ends; if the judgment condition is not met, the process ends.

[0094] The above description is only a preferred embodiment of the present invention. All equivalent changes and modifications made according to the scope of the patent application of the present invention should fall within the scope of the present invention.

Claims

1. A reservoir water level prediction and early warning method based on PSO-CNN-LSTM, characterized in that: The following steps are involved: Step S1: Obtain historical monitoring data of the reservoir and preprocess it; Step S2: sorting the preprocessed historical monitoring data of the reservoir by collection time to construct a feature data set; Step S3: Search for optimal parameters of CNN-LSTM model based on PSO; Step S4: Process the feature data set and divide it into a training set and a test set; Step S5: Based on the optimal parameters and training set obtained in step S3, a CNN-LSTM model is constructed and trained; Step S6: Based on the trained CNN-LSTM model, real-time prediction of reservoir water level is performed; The step S2 is specifically as follows: Step S21: construct the function expression, and construct the time-effect component according to f(α) and the reservoir water level observation time to obtain the time-effect component f(α)=a1α+a2lnα Where a1 and a2 are coefficients, t is the cumulative number of days from the monitoring day to the start monitoring day; Step S22: The function expression of water level feature transformation is as follows: The reservoir water level data collection time is T t (t=0, 1, 2, ..., n), T0~T n Reservoir water level during the period, H i for Any non-empty subset of , W is the reservoir water level; According to f(W), the reservoir water level characteristics are transformed to obtain W1, W2, and W3 respectively: The step S4 is specifically as follows: Step S41: normalize using the maximum and minimum values. The normalization function expression is as follows: Where x is the value of a single data, min is the minimum value of the column where the data is located, and max is the maximum value of the column where the data is located; Step S42: After normalization, the data set is obtained, sorted by data collection time, and divided into a training set and a test set according to a preset ratio; Step S43: Split the divided training set and test set into independent variables and dependent variables; Step S44: reshape the separated group independent variables and dependent variables into 3D data readable by the CNN-LSTM model, and the reshaped data shape is shape; The N groups of independent variables of the CNN-LSTM model include matrices of rainfall, flood_Discharge, timeffcent, ln_timeffcent, water_ago1Level, water_ago2Level, and water_Level features; wherein N=(batch_size-width) / width, batch_size is the amount of data, and width is the width of the independent variable window; the independent variable matrix sequence is expressed as F(X), and its function expression is as follows: F(X)=(X0,X1,X2,…,X n ),(n∈Z * ) Expand the matrix X0 in F(X) as follows: Matrix K ij In , i is the independent variable window width, and j is the input feature dimension; The dependent variable sequence is: y={x i,j ,x i+1,j ,x i+2,j ,…,x n-i,j }; The step S3 is specifically as follows: Step S31: Use MSE as the evaluation index of the hyperparameters of the particle swarm optimization model, and the loss in the CNN-LSTM model as the objective function of PSO optimization. Step S32: embed the CNN-LSTM model into the PSO model, and set the hyperparameters that need to be optimized for the model to the dimensions corresponding to the particle swarm. After the setting is completed, iterate, and after the optimization iteration is completed, select the group with the smallest loss value as the hyperparameters of the CNN-LSTM model; The step S5 is specifically as follows: Step S51: Input the training set data processed in step S4 into the CNN-LSTM model, and read the data into Conv1D for feature fusion; Step S52: Pool the fused features, input the pooled data and the hyperparameters searched by the PSO model into LSTM Layers for training, and after training, reduce the dimension through Fatten Layers, input the reduced-dimensional data into the specified dimension of Dense Layers and output the predicted features.

2. The reservoir water level prediction and early warning method based on PSO-CNN-LSTM according to claim 1 is characterized in that: The step S1 is specifically as follows: Step S11: Obtaining historical monitoring data of the reservoir including the water level, flood discharge, rainfall, and monitoring time of the reservoir; Step S12: Select water level, flood discharge, rainfall, and monitoring time, and align them according to time so that each piece of data is the water level, flood discharge, and rainfall at the same time; Step S13: Select a recent period of data with fewer missing values, and use the previous or next value to fill the missing values.

Citation Information

Patent Citations

  • Multivariable logistics freight volume prediction method based on LSTM network

    CN111563706A

  • Power demand load prediction method and system, electronic equipment and storage medium

    CN112329997A

  • Short-term load prediction method and device based on neural network combination model, and medium

    CN113239624A

  • Reservoir water level prediction method based on neural network

    CN113887774A

  • Water level prediction program, water level prediction method, and information processing device

    JP2021140536A