A short-term wind power forecasting method based on improved LSTM-CNN
By improving the LSTM-CNN model combined with K-means clustering and multi-scale feature extraction, the problem of low prediction accuracy in wind power prediction is solved, and more efficient wind power prediction is achieved.
Patent Information
- Application Number
- CN202210543841.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-18
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2042-05-18
AI Technical Summary
The prior art has the problem of low prediction accuracy in wind power prediction, especially when facing complex weather conditions, the limitations of shallow model and the deep learning model do not consider the problem of input data uncertainty and the single scale of feature extraction.
The short-term wind power prediction method based on improved LSTM-CNN is adopted, and the wind power historical data and numerical weather forecast data of the wind farm are obtained, and the data is clustered using the K-means algorithm, and the samples of the target clustering category are selected as the training set, and input them into the improved LSTM-CNN prediction model for parameter iteration to establish the mapping relationship between weather parameters and wind power.
The accuracy of wind power prediction is improved, and the sample that has the greatest impact on prediction accuracy is found through clustering. The improved neural network is used to effectively extract multi-scale features to achieve adaptive weighting of features, making up for the insufficient prediction accuracy of traditional prediction algorithms in complex weather conditions.
Smart Images

Figure CN115115090B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of wind power prediction, and in particular to a wind power short-term prediction method based on an improved LSTM-CNN. Background Art
[0002] Wind power generation largely relies on random meteorological factors, such as wind speed, wind direction, irradiance, etc. It is intermittent in nature and difficult to control and dispatch like conventional thermal power plants. Due to the volatility and intermittency of wind power generation, its large-scale grid connection poses severe challenges to the safe operation and dispatch of the power grid. Therefore, accurate prediction of wind turbine power generation is of great significance to maintaining the stability of the power grid and improving the utilization efficiency of wind farms.
[0003] Traditional wind power prediction methods are generally based on shallow models, but since wind power often faces complex weather conditions, shallow models have great limitations in practical applications. The rapid development of deep learning provides a new idea for wind power prediction. In the existing technology, although the network prediction model based on deep learning can establish a relatively complete mapping relationship for wind power prediction, it does not consider the impact of input data uncertainty and the single scale of feature extraction on prediction accuracy, resulting in low accuracy. Summary of the invention
[0004] In view of the shortcomings of the prior art, the present invention provides a wind power short-term prediction method based on an improved LSTM-CNN, aiming to improve the accuracy of the prediction.
[0005] The technical solution adopted by the present invention is as follows:
[0006] A short-term wind power prediction method based on improved LSTM-CNN includes:
[0007] S1. Obtain the historical wind power data of the wind farm throughout the year and the numerical weather forecast data of the corresponding time, pre-process the data, and splice the processed numerical weather forecast data and wind power data to form a multi-dimensional time series data set;
[0008] S2, divide the data set into four groups of samples representing four seasons according to time, cluster each group of samples using the K-means algorithm, and divide each group of samples into several cluster categories;
[0009] S3, select samples of the target cluster category, divide them into training set and test set, input the training set into the improved LSTM-CNN prediction model for parameter iteration, establish the mapping relationship between weather parameters and wind power, and stop updating when the loss function meets the iteration termination condition;
[0010] The first half of the improved LSTM-CNN prediction model is an LSTM network, and the second half is a CNN network;
[0011] The CNN network consists of a convolution-pooling pair, a multi-scale feature extraction layer, a self-attention mechanism layer, and a fully connected layer;
[0012] The multi-scale feature extraction layer includes two convolution kernels of different sizes to capture the multi-scale features of the signal and generate cascade features of different receptive fields;
[0013] S4. Input the test set into the trained improved LSTM-CNN prediction model to obtain the corresponding short-term wind power prediction data.
[0014] Further technical solutions are:
[0015] Use the K-means algorithm to cluster each group of samples, including:
[0016] S21. Use the elbow method to determine the number of clustering categories for each group of samples based on the sum of squared errors. The calculation formula is:
[0017]
[0018] In the formula, SSE is the clustering error of the sample, m is the total number of clusters in the sample, that is, the number of clustering categories, C i is the i-th cluster, p is C i The sample points, m i It is C i The centroid of
[0019] S22, input the number of cluster categories m of each group of samples and the corresponding sample data into the K-means model, and randomly select m initial cluster centers;
[0020] S23, calculating the Euclidean distance between the sample data and each initial cluster center, and dividing the sample data into the category corresponding to the nearest initial cluster center according to the principle of the shortest distance;
[0021] S24, calculating the mean of all sample data in each category, and using the mean as the new cluster center of each category;
[0022] S25. Repeat step S23 and step S24 until the cluster center no longer changes, thereby obtaining the best clustering model.
[0023] The self-attention mechanism layer is used to assign weights to features of different values. The calculation formula is as follows:
[0024]
[0025] Where Q, K, and V represent the query vector matrix, key vector matrix, and value vector matrix, respectively. The input vector matrix is multiplied by the three matrices W. q , W k , W v And the obtained W q , W k , W v is the parameter of the self-attention mechanism layer; n is the dimension of the matrix Q and K.
[0026] The loss function adopts the mean square error function MSE. When the loss function is lower than the set threshold or reaches the set maximum number of iterations, the training is stopped. The mean square error function MSE calculation formula is as follows:
[0027]
[0028] In the formula, Represents the predicted power of the network output, y t Indicates the actual wind power data corresponding to the input forecast time, L is y t The number of .
[0029] The LSTM network includes two hidden layers, and the number of hidden layer nodes is 128 and 256 respectively.
[0030] The size of the convolution kernel in the convolution-pooling pair is 5, the sliding window of the pooling layer is 2, and the sizes of the two convolution kernels in the multi-scale feature extraction layer are 3 and 5 respectively.
[0031] The beneficial effects of the present invention are as follows:
[0032] The present invention combines the K-means clustering method and the improved LSTM-CNN network based on multi-scale and self-attention mechanism. The samples with the greatest impact on prediction accuracy are found through clustering, thereby improving prediction efficiency and effectively compensating for the low efficiency of wind power prediction caused by excessive data gap in the wind power prediction process. The improved neural network is used to effectively extract multi-scale features, and adaptive weighting of features is achieved to obtain key effective features, thereby compensating for the defect that the traditional prediction algorithm has low wind power prediction accuracy under complex weather conditions and further improving the prediction accuracy.
[0033] The improved LSTM-CNN prediction model used in the present invention adds a multi-scale feature extraction layer and a self-attention mechanism layer on the basis of the traditional model. It not only uses a deep neural network to extract the spatial features and time domain information features of the data and fuses them for wind power prediction, which is beneficial to improving the prediction accuracy, but also captures the features of different receptive fields in the data through the multi-scale feature extraction layer, extracts multi-scale features, and adaptively weights the features through the self-attention mechanism fusion layer. It has strong adaptability and high application value.
[0034] Other features and advantages of the present invention will be set forth in the description which follows, and in part will be apparent from the description, or may be learned by practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 It is a flow chart of the present invention.
[0036] Figure 2 It is a structural diagram of an improved LSTM-CNN model according to an embodiment of the present invention.
[0037] Figure 3 It is a schematic diagram of short-term wind power prediction results according to an embodiment of the present invention. DETAILED DESCRIPTION
[0038] The specific implementation of the present invention is described below with reference to the accompanying drawings.
[0039] See also Figure 1 , a short-term wind power prediction method based on improved LSTM-CNN in this embodiment includes:
[0040] S1. Obtain the historical wind power data of the wind farm throughout the year and the numerical weather forecast (NWP) data of the corresponding time, pre-process the data, and splice the processed numerical weather forecast data and wind power data to form a multi-dimensional time series data set;
[0041] Preprocess the data, including:
[0042] Detect and process abnormal values, such as keeping wind direction data between 0 and 360°, and replacing data exceeding rated power with rated power;
[0043] For missing data, linear interpolation method is used to fill the data.
[0044] The data were normalized using the standard variance normalization method.
[0045] S2. Divide the data set into four groups of samples representing four seasons according to time. Use the K-means algorithm to cluster each group of samples and divide each group of samples into several cluster categories, including:
[0046] S21. Use the elbow method to determine the number of clustering categories for each group of samples based on the sum of squared errors. The calculation formula is:
[0047]
[0048] In the formula, SSE is the clustering error of the sample, which represents the quality of the clustering effect, m is the total number of clusters in the sample, that is, the number of clustering categories, and C i is the i-th cluster, p is Ci The sample points, m i It is C i The centroid of
[0049] In the elbow method, as the number of clustering categories m increases, the sample division will become more refined, the degree of aggregation of each cluster will gradually increase, and the sum of squared errors (SSE) will gradually decrease.
[0050] When m is less than the true number of clusters, the SSE decreases greatly because the increase in m will greatly increase the degree of aggregation of each cluster. When m reaches the true number of clusters, the return of the degree of aggregation obtained by increasing m will rapidly decrease, so the decrease in SSE will decrease sharply, and then tend to be flat as the value of m continues to increase. In other words, the relationship between SSE and m is an elbow shape, and the m value corresponding to this elbow is the true number of clusters of the data;
[0051] S22, input the number of cluster categories m of each group of samples and the corresponding sample data into the K-means model, and randomly select m initial cluster centers;
[0052] S23, calculating the Euclidean distance between the sample data and each initial cluster center, and dividing the sample data into the category corresponding to the nearest initial cluster center according to the principle of the shortest distance;
[0053] S24, calculating the mean of all sample data in each category, and using the mean as the new cluster center of each category;
[0054] S25. Repeat step S23 and step S24 until the cluster center no longer changes, thereby obtaining the best clustering model.
[0055] S3. Select samples of the target cluster category, divide them into training set and test set, input the training set into the improved LSTM-CNN prediction model for parameter iteration, establish the mapping relationship between weather parameters and wind power, and stop updating when the loss function meets the iteration termination condition.
[0056] By considering the uncertainty and seasonality of the input data, K-means clustering can be used to determine in advance the cluster category to which the sample to be predicted belongs, thereby obtaining the samples that have the greatest impact on the prediction accuracy as training sets for training, which can improve the prediction efficiency of the model and shorten the prediction time.
[0057] See also Figure 2 , the first half of the improved LSTM-CNN prediction model is an LSTM network, and the second half is a CNN network;
[0058] The CNN network consists of a convolution-pooling pair, a multi-scale feature extraction layer, a self-attention mechanism layer, and a fully connected layer;
[0059] The multi-scale feature extraction layer includes two convolution kernels of different sizes to capture the multi-scale features of the signal and generate cascade features of different receptive fields;
[0060] Specifically, the LSTM network includes two hidden layers, and the number of hidden layer nodes is 128 and 256 respectively.
[0061] The size of the convolution kernel in the convolution-pooling pair is 5, the sliding window of the pooling layer is 2, and the sizes of the convolution kernels in the multi-scale feature extraction layer are 3 and 5 respectively.
[0062] The self-attention mechanism layer is used to assign weights to features of different values. The calculation formula is as follows:
[0063]
[0064] In the formula, the three matrices Q, K, and V are obtained by multiplying the input vector matrix by the three matrices W respectively. q , W k , W v We get, Q, K, V represent the query vector matrix, key vector matrix and value vector matrix respectively; W q , W k , W v are the parameters in the self-attention mechanism layer, n is the dimension of the matrices Q and K;
[0065] Specifically, the loss function adopts the mean square error function MSE. When the loss function is lower than a set threshold or reaches a set maximum number of iterations, the training is stopped. The mean square error function MSE calculation formula is as follows:
[0066]
[0067] In the formula, Represents the predicted power of the network output, y t Indicates the actual wind power data corresponding to the input forecast time, L is y t The number of .
[0068] S4. Input the test set into the trained improved LSTM-CNN prediction model to obtain the corresponding short-term wind power prediction data.
[0069] In the traditional network, each layer only uses a convolution kernel of one size. The improved LSTM-CNN prediction model adopted by the method of this application adopts a multi-scale feature extraction layer with two convolution kernels of different sizes. The multi-scale feature extraction layer can capture the multi-scale features of the signal and generate cascade features of different receptive fields, thereby enriching the feature information of the original data in the network.
[0070] The integration of the self-attention mechanism layer can effectively filter and refine high-quality content from a large amount of complex and redundant information with limited attention resources.
[0071] The effectiveness of the method of the present application is further illustrated by a specific example below.
[0072] The historical wind power data of a wind farm in Jiangsu from January 1 to December 31, 2020 and the corresponding NWP data were used as the data for the prediction model, with a time resolution of 15 minutes.
[0073] Considering the seasonal factors, the data are divided into four seasons. In each season, after K-means clustering, the cluster category to which the sample to be predicted (i.e., the test set) belongs is selected, and the other samples in the cluster category are used as the training set.
[0074] The short-term wind power prediction test results are as follows: Figure 3 As shown. Figure 3 It can be seen that the prediction results are roughly the same as the actual wind power results, and the developed model has good short-term wind power prediction capabilities.
[0075] Those skilled in the art can understand that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention is described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions recorded in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A short-term wind power prediction method based on improved LSTM-CNN, characterized in that: include: S1. Obtain the historical wind power data of the wind farm throughout the year and the numerical weather forecast data of the corresponding time, pre-process the data, and splice the processed numerical weather forecast data and wind power data to form a multi-dimensional time series data set; S2, divide the data set into four groups of samples representing four seasons according to time, cluster each group of samples using the K-means algorithm, and divide each group of samples into several cluster categories; S3, select samples of the target cluster category, divide them into training set and test set, wherein, select the cluster category to which the sample to be predicted, i.e., the test set, belongs, and use other samples in the cluster category as the training set; input the training set into the improved LSTM-CNN prediction model for parameter iteration, establish the mapping relationship between weather parameters and wind power, and stop updating when the loss function meets the iteration termination condition; The first half of the improved LSTM-CNN prediction model is an LSTM network, and the second half is a CNN network; The CNN network consists of a convolution-pooling pair, a multi-scale feature extraction layer, a self-attention mechanism layer, and a fully connected layer; The multi-scale feature extraction layer includes two convolution kernels of different sizes to capture the multi-scale features of the signal and generate cascade features of different receptive fields; S4. Input the test set into the trained improved LSTM-CNN prediction model to obtain the corresponding short-term wind power prediction data.
2. The method for short-term wind power prediction based on improved LSTM-CNN according to claim 1 is characterized in that: Use the K-means algorithm to cluster each group of samples, including: S21. Use the elbow method to determine the number of clustering categories for each group of samples based on the sum of squared errors. The calculation formula is: In the formula, SSE is the clustering error of the sample, m is the total number of clusters in the sample, that is, the number of clustering categories, C i is the i-th cluster, p is C i The sample points, m i It is C i The centroid of S22, input the number of cluster categories m of each group of samples and the corresponding sample data into the K-means model, and randomly select m initial cluster centers; S23, calculating the Euclidean distance between the sample data and each initial cluster center, and dividing the sample data into the category corresponding to the nearest initial cluster center according to the principle of the shortest distance; S24, calculating the mean of all sample data in each category, and using the mean as the new cluster center of each category; S25. Repeat step S23 and step S24 until the cluster center no longer changes, thereby obtaining the best clustering model.
3. The method for short-term wind power prediction based on improved LSTM-CNN according to claim 1 is characterized in that: The self-attention mechanism layer is used to assign weights to features of different values. The calculation formula is as follows: Where Q, K, and V represent the query vector matrix, key vector matrix, and value vector matrix, respectively. The input vector matrix is multiplied by the three matrices W. q , W k , W v And the obtained W q , W k , W v is the parameter of the self-attention mechanism layer; n is the dimension of the matrix Q and K.
4. The method for short-term wind power prediction based on improved LSTM-CNN according to claim 1 is characterized in that: The loss function adopts the mean square error function MSE. When the loss function is lower than the set threshold or reaches the set maximum number of iterations, the training is stopped. The mean square error function MSE calculation formula is as follows: In the formula, Represents the predicted power of the network output, y t Indicates the actual wind power data corresponding to the input forecast time, L is y t The number of .
5. The method for short-term wind power prediction based on improved LSTM-CNN according to claim 1 is characterized in that: The LSTM network includes two hidden layers, and the number of hidden layer nodes is 128 and 256 respectively.
6. The method for short-term wind power prediction based on improved LSTM-CNN according to claim 1 is characterized in that: The size of the convolution kernel in the convolution-pooling pair is 5, the sliding window of the pooling layer is 2, and the sizes of the two convolution kernels in the multi-scale feature extraction layer are 3 and 5 respectively.
Citation Information
Patent Citations
Wind turbine generator power cluster prediction method based on clustering and deep learning
CN111753893A
CNN-LSTM short-term wind power prediction method based on attention mechanism
CN113642225A