Solar photovoltaic power generation prediction method based on WPB-BiLSTM model
Through the photovoltaic power generation prediction method combined with the attention mechanism of wavelet packet transformation and a two-way long and short-term memory network, the multi-scale characteristics and nonlinear relationship problems of photovoltaic power generation prediction in the prior art are solved, and a higher accuracy and stable prediction effect is achieved.
Patent Information
- Application Number
- CN202510687383.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-27
- Publication Date
- 2025-09-05
AI Technical Summary
The existing photovoltaic power generation prediction methods have computational complexity and accuracy problems in ultra-short-term prediction, and it is difficult to effectively capture multi-scale features and nonlinear relationships, resulting in high prediction errors and insufficient robustness.
Wavelet packet transformation (WPB) is used to decompose the historical data of photovoltaic power generation on multi-scale, combine the bidirectional long and short-term memory network (BiLSTM) model for time series learning, and introduce attention mechanism to optimize the prediction results. Key time series features are extracted through WPB decomposition, and BiLSTM model for prediction.
It improves the accuracy and stability of short-term prediction of photovoltaic power generation, and can more accurately capture the multi-scale characteristics and nonlinear changes of photovoltaic power generation, reducing prediction errors.
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of photovoltaic power generation, and in particular relates to a solar photovoltaic power generation prediction method. Background Art
[0002] Solar photovoltaic power generation is subject to significant fluctuations in power output due to factors such as weather, season, and geographic location. Accurate short-term power generation forecasts are crucial for power dispatch and energy management. Existing photovoltaic power generation forecasting methods are mainly categorized into physical models, statistical models, and deep learning models. Physical models are based on solar radiation and weather data, but they suffer from computational complexity and accuracy issues in ultra-short-term forecasts. Statistical models rely on historical data but struggle to cope with nonlinear and dynamic changes. Deep learning models, such as long short-term memory networks (LSTMs), have been widely used for time series forecasting. However, they fail to fully account for the multi-scale characteristics of the data (multi-scale characteristics refer to characteristics with different time spans, such as seconds, minutes, and hours) and nonlinear relationships. This causes the model to confuse high-frequency and low-frequency signals, making it difficult to accurately track long-term changes. This ultimately leads to high forecast errors and insufficient robustness. Summary of the Invention
[0003] In response to the problems existing in long short-term memory network prediction, the technical problem to be solved by the present invention is to provide a solar photovoltaic power generation prediction method based on wavelet packet transform (WPB) and bidirectional long short-term memory network (BiLSTM) model. It uses WPB to perform multi-scale decomposition to effectively extract key time series features in photovoltaic power generation data, and combines the bidirectional time series learning capability of BiLSTM to improve the accuracy of photovoltaic power generation prediction.
[0004] In order to solve the above technical problems, the technical solution of the present invention is:
[0005] The present invention provides a solar photovoltaic power generation prediction method based on the WPB-BiLSTM model, comprising the following steps:
[0006] S1. Use WPB to perform multi-scale decomposition on the historical data of photovoltaic power generation to obtain time series data of multiple different frequency sub-bands;
[0007] S2. Input the time series data of each frequency subband obtained by S1 into the BiLSTM model. Use the BiLSTM model to learn the time series characteristics of photovoltaic power generation, extract the long-term dependent time series characteristics, and predict the future photovoltaic power generation power. The BiLSTM model outputs the prediction results.
[0008] Preferably, S3 is further included, which introduces an attention mechanism at the output end of the BiLSTM for weighting, and optimizes the prediction result by dynamically adjusting the attention weights of different time steps;
[0009] Step 31: Use the weight vector w for the hidden state of BiLSTM T Perform matrix multiplication:
[0010]
[0011] Where w is the trainable weight vector, b is the trainable bias, and e t is the attention score; h t is the hidden state output of BiLSTM at the tth time step;
[0012] Step 32: Get the attention weight of each time step through softmax normalization:
[0013]
[0014] Where, α t is the attention weight at time step t, w T is the weight matrix obtained through training, and T represents the total number of time steps.
[0015] The technical effect of the present invention is that the method invention includes steps such as data preprocessing, WPB decomposition, BiLSTM modeling, and attention mechanism optimization, which improves the accuracy and stability of short-term prediction of photovoltaic power generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The accompanying drawings of the present invention are as follows:
[0017] Figure 1 This is the structural diagram of the WPB-BiLSTM model based on the attention mechanism;
[0018] Figure 2 This is a graph of prediction results of the training data and test data of the present invention;
[0019] (a) Training set; (b) Test set
[0020] Figure 3 This is a diagram of the prediction results of the present invention and the existing method. DETAILED DESCRIPTION
[0021] The present invention will be further described below with reference to the accompanying drawings and examples:
[0022] The present invention comprises the following steps:
[0023] Step 1: Use wavelet packet transform (WPB) to perform multi-scale decomposition on the historical data of photovoltaic power generation to obtain time series data of multiple different frequency sub-bands (frequency sub-bands are the fluctuation segments of photovoltaic output power in different time spans).
[0024] Wavelet packet transform (WPB) time series data is decomposed according to the document “Ultra-Short-Term Photovoltaic Power Prediction Based on BiLSTM with Wavelet Decomposition and Dual Attention Mechanism[J]”, LIU Mingyang, WANG Xiaohuan, ZHONG Zhiwen, Electronics, 2025, 14(2): 306. DOI: 10.3390 / electronics14020306: Let the photovoltaic power generation time series data be x(t), and Daubechies wavelet be used as the mother wavelet. The decomposition formula of x(t) is as follows:
[0025]
[0026] In formula (1), x i (t) is the frequency subband signal obtained after wavelet packet transform decomposition, i = 1, 2, ..., N represents different frequency subbands, N is the number of decomposition layers, ψ ik (t) is the basis function of Daubechies wavelet, a ik is the coefficient of the basis function, that is, it represents the component of each frequency band, and t represents time.
[0027] Through wavelet packet transform (WPB), photovoltaic power generation data can be processed at multiple frequency levels, providing multi-level time series features for subsequent prediction models.
[0028] Historical power generation data from photovoltaic power plants is collected. Because the raw data may contain noise and missing values, it requires necessary data preprocessing. Sliding window filtering is used to remove outliers, and interpolation is used to fill in missing data. To improve model training efficiency and prediction accuracy, all input data is normalized to a distribution between [-1, 1].
[0029] Step 2: Input the time series data of each frequency subband obtained by S1 processing into the bidirectional long short-term memory (BiLSTM) model, and use the BiLSTM model to learn the time series characteristics of photovoltaic power generation (time series characteristics refer to the numerical vector extracted from the original time series data that can characterize its temporal regularity), extract the long-term dependent time series characteristics, and predict the future photovoltaic power generation power. The output prediction result of the BiLSTM model is obtained.
[0030] This step uses a BiLSTM network. BiLSTM is a network that connects a reverse loop chain in parallel to the traditional LSTM, allowing the network to capture both past-to-present and future-to-present dependency information at each time step. According to the document "Enhancing Electrical Load Prediction Using a Bidirectional LSTM Neural Network[J]", Pavlatos C, Makris E, Fotis G, Vita V, Mladenov V, Electronics, 2023, 12(22): 4652. DOI: 10.3390 / electronics12224652:
[0031] The processing of the BiLSTM network includes forward LSTM and reverse LSTM. For each time step t, the forward and reverse LSTM outputs are:
[0032] (Forward LSTM)
[0033] (Reverse LSTM)
[0034] Where h t-1 、h t 、h t+1 are the outputs of time steps t-1, t, and t+1 respectively, x t is the input data of the current time step. t It refers to x in formula (1) i (t).
[0035] The forward LSTM learns past time series information, while the backward LSTM optimizes the prediction results by processing future information. The BiLSTM network generates a predicted photovoltaic power value for a future time based on its output. This future time is the target output time and can be set, for example, 1 second or 1 minute later.
[0036] In the BiLSTM model, the input of each time step is the frequency subband signal after wavelet packet transformation. After processing by the forward LSTM and reverse LSTM units, the final output of BiLSTM is expressed as is the output of the forward LSTM unit at time step t, is the output of the reverse LSTM unit at time step t. Output h t It not only contains information from past time steps, but also combines information from future time steps, thereby effectively improving the accuracy of predictions.
[0037] Step 3: The output value of the BiLSTM network is weighted through the attention mechanism to enhance the BiLSTM network's attention to key time steps.
[0038] This step introduces the attention mechanism to weight the output values of BiLSTM. The core idea of the attention mechanism is to assign different weights to different time steps to highlight the time points that contribute most to the final prediction. The specific steps are as follows:
[0039] Step 31: The hidden state of BiLSTM (the hidden state refers to the output h of BiLSTM at each time step t) t ) with weight vector w T Perform linear transformation. According to the document “Hardware-oriented algorithms for softmax and layer normalization of large language models[J]”, Li W, Lyu D, Wang G, et al. Science China Information Sciences, 2024, 67(10): 200404. DOI: 10.1007 / s11432-024-4137-4: Linear transformation is a matrix multiplication operation on the hidden state, and the formula is as follows:
[0040]
[0041] Where w is the trainable weight vector, b is the trainable bias, and e t is the attention score, which indicates the importance of the t-th time step to the final prediction.
[0042] Step 32: Calculate the attention weight and obtain the importance coefficient of each time step (also called attention weight) through softmax normalization. The attention weight α t The calculation formula is:
[0043]
[0044] In formula (2), α t is the attention weight at time step t, w T is the weight matrix obtained through training, T represents the total number of time steps, h t is the hidden state output of BiLSTM at the tth time step.
[0045] Step 33: BiLSTM outputs the predicted electric power value
[0046] The predicted photovoltaic power generation value h at each time step t It is obtained by mapping through the fully connected layer (the fully connected layer is a linear mapping from weights to predicted values, which belongs to the output layer of the regression task). That is, the output weight vector of BiLSTM combined with the attention mechanism is input into the fully connected layer to obtain the predicted value, or the predicted value is calculated through the nonlinear activation function. The role of the nonlinear activation function is: t After the linear transformation, a nonlinear activation function ReLUf(x)=max(0,x) is added to improve the network's ability to fit nonlinear relationships.
[0047] The output value of BiLSTM is weighted and summed to obtain the photovoltaic power prediction value. The formula is:
[0048]
[0049] Through this weighted summation method, the power generation prediction value can be adjusted according to the time series characteristics of each time step to obtain a more accurate prediction result.
[0050] like Figure 1 As shown in the figure, the raw photovoltaic power series data is input in chronological order. Data preprocessing, such as missing value interpolation and outlier removal, is first performed. The data is then divided into units using a sliding window. The series is intercepted using windows of length x. Adjacent windows slide forward with a step length r. Therefore, when r < x, there is overlap between windows, ensuring the continuity of time series features. The data within each window is input to WPB and decomposed using the Daubechies4 (Db4) mother wavelet to obtain time series data in frequency subbands. Db4 is selected as the mother wavelet, and the number of decomposition levels is set to 3 (not shown in the figure). This allows for more fine-grained time series feature extraction at different frequency scales. After wavelet packet transform, the data in each subband effectively characterizes the multi-scale characteristics of photovoltaic power generation data, providing rich time series feature input for subsequent deep learning modeling.
[0051] The time series data of the frequency subband is input into BiLSTM, and the network extracts the bidirectional temporal dependency in parallel through the forward and reverse gated recurrent units and outputs the hidden state Then the hidden states of each time step are spliced into important time series features W k 、W k+1 Etc., input to the attention mechanism, perform softmax normalization on the hidden state of BiLSTM, calculate the attention weight, perform weighted summation, and finally output the photovoltaic power prediction result.
[0052] In the training and learning of the BiLSTM network model, the stochastic gradient descent (SGD) algorithm is used to backpropagate the BiLSTM network, with the mean square error (MSE) as the loss function. The model parameters are continuously optimized through backpropagation, and the network weights and biases are updated each time training.
[0053] The loss function ζ is calculated using the mean square error (MSE), specifically:
[0054]
[0055] In formula (3), is the predicted value, y i is the true value, and M is the number of samples.
[0056] Minimize the loss function ζ and improve the prediction accuracy.
[0057] like Figure 2 As shown in the figure, the horizontal axis represents the measured photovoltaic power at each moment, and the vertical axis is the predicted power output by the model at the same time point. The red diagonal line in the figure corresponds to the ideal state. The closer the scatter points are to the line, the smaller the error. 5024 samples were obtained through simulation, of which 4020 (about 80%) were used for training and 1004 (about 20%) were used for testing. The training scatter points almost completely fall near the diagonal, indicating that the model has fully fitted the historical data; the test scatter points are also distributed around the diagonal, but some scatter points are slightly larger, mainly concentrated in the peak area, indicating that the model still has slight underestimation in high irradiation or rapid power fluctuation scenarios, but the overall error is within a controllable range.
[0058] Comparison of the prediction results of this method with those of the prior art:
[0059] Existing technologies include BPNN, CNN+LSTM and LSTM.
[0060] The simulation training and testing were implemented in Python 3.8, and the hardware configuration was an NVIDIA RTX 2080Ti GPU. The data of the public dataset was used. After preprocessing the dataset, 80% of the dataset was divided into a training set and 20% into a test set. The training set was trained using BPNN, CNN+LSTM, LSTM, and the model of the present invention. The trained model was tested on the test set, and the error index of the test results was calculated using R 2 (coefficient of determination) and RMSE (root mean square error) were used for evaluation. Finally, a period of time was selected for power generation prediction to compare the accuracy of the predictions of the various methods.
[0061] 1. BPNN, based on the paper “Evaluating neural network and linear regression photovoltaic power forecasting models based on different input methods[J]”, AlShafeey M, Csáki C, Energy Reports, 2021, 7:7601–7614.
[0062] 2. CNN+LSTM, according to the literature “Solar power forecasting using CNN–LSTM hybrid model[J]”, Lee HJ, Shin HC, Cha HM, Kim JH, Energies, 2022, 15(21): 8233.
[0063] 3. LSTM, according to the literature “Solar photovoltaic forecasting of power output using LSTM networks[J]”, Stylianou ME, Kudo S, Bogomolov AV, et al, Atmosphere, 2021, 12(1): 124.
[0064] Actual data: Public dataset, available at:
[0065] https: / / www.nbsdc.cn / general / dataDetail?id=64ef84e8bb16e0591d0254ee&type=1
[0066] The prediction results of the present invention and the above method are shown in Figure 3 .exist Figure 3 In this study, seven sunrise-to-sunset periods were presented. All models roughly captured the power rise and fall trends during peak periods (around noon), but the BPNN and unidirectional LSTM models exhibited significant deviations in slope and peak height. The CNN+LSTM model performed better, but the curve still lagged under cloudy days or power fluctuations. The proposed method best matched the actual curve across all time periods, with minimal error.
[0067] Experimental results show that the prediction accuracy of the method of the present invention is better than that of existing photovoltaic power generation prediction methods.
Claims
1. A solar photovoltaic power generation prediction method based on the WPB-BiLSTM model, characterized by: The following steps are involved: S1. Use WPB to perform multi-scale decomposition on the historical data of photovoltaic power generation to obtain time series data of multiple different frequency sub-bands; S2. Input the time series data of each frequency subband obtained by S1 into the BiLSTM model. Use the BiLSTM model to learn the time series characteristics of photovoltaic power generation, extract the long-term dependent time series characteristics, and predict the future photovoltaic power generation power. The BiLSTM model outputs the prediction results.
2. The solar photovoltaic power generation prediction method according to claim 1, characterized in that: It also includes S3, which introduces an attention mechanism at the output of BiLSTM for weighting, and optimizes the prediction results by dynamically adjusting the attention weights of different time steps; Step 31: Use the weight vector w for the hidden state of BiLSTM T Perform matrix multiplication: Where w is the trainable weight vector, b is the trainable bias, and e t It is the attention score; h t is the hidden state output of BiLSTM at the tth time step; Step 32: Get the attention weight of each time step through softmax normalization: Where, α t is the attention weight at time step t, w T The weight matrix T obtained for training represents the total number of time steps.
3. The solar photovoltaic power generation prediction method according to claim 1 or 2, characterized in that: In S1, the WPB comprises the following steps: S11. Use Daubechies wavelet to perform wavelet packet transform: Let the original time series be x(t), Where x i (t) is the frequency subband signal obtained after wavelet packet transform decomposition, i = 1, 2, ..., N represents different frequency subbands, N is the number of decomposition layers, ψ ik (t) is the basis function of Daubechies wavelet, a ik is the coefficient of the basis function; S12. Perform stationarity test and denoising processing on each sub-band data to retain useful signal components and remove noise.
4. The solar photovoltaic power generation prediction method according to claim 3, wherein: In S2, the learning of the BiLSTM model includes the following steps: S21. Use the training set to train the BiLSTM model and use the stochastic gradient descent algorithm for back propagation. S22. In each training round, update the weights and biases in the BiLSTM model and use the mean squared error as the loss function ζ: in, is the predicted value, y i is the true value, and N is the number of samples.
Citation Information
Patent Citations
Solar photovoltaic power generation short-term prediction method based on sky image
CN117410976A
Short-term photovoltaic power generation power prediction method adapting to weather change
CN119401402A
New energy generation power prediction method based on BiLSTM-TPA-MTCN
CN119582169A
Cited By
Generator set fault diagnosis and detection method based on deep learning
CN121834633A
Generator set fault diagnosis and detection method based on deep learning
CN121834633B