Short-term photovoltaic power generation power prediction method adapting to weather change

By using the ISSA-optimized BiLSTM-Attention model in the photovoltaic power generation system, the timing characteristics of meteorological and power data are captured and analyzed, the problem of low accuracy of photovoltaic power generation power prediction during weather changes is solved, and higher prediction accuracy and power grid are achieved Support capability.

CN119401402APending Publication Date: 2025-02-07HUANENG JIANGSU COMPREHENSIVE ENERGY SERVICE CO LTD +1

Patent Information

Application Number
CN202411451758.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-17
Publication Date
2025-02-07

AI Technical Summary

Technical Problem

The accuracy of the prediction of future minute-level photovoltaic power output in the current technology when weather changes has dropped significantly, and it cannot effectively support the photovoltaic grid-connected system to respond to the dynamic demand of the power grid.

Method used

The BiLSTM-Attention model based on ISSA optimization is adopted to capture the timing characteristics and historical information of meteorological data and photovoltaic module power data to accurately predict the photovoltaic power generation, and update the model parameters by continuously fitting the predicted values ​​to achieve self-learning.

Benefits of technology

The short-term prediction accuracy of photovoltaic power generation under different weather conditions has been improved, helping the photovoltaic grid-connected system to respond to the stable demand of the power grid, and improving the support capacity of photovoltaic power generation to the power grid.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119401402A_ABST
    Figure CN119401402A_ABST
Patent Text Reader

Abstract

The invention discloses a short-term photovoltaic power generation power prediction method adaptive to weather change, which comprises the following steps of: firstly, acquiring meteorological data around a photovoltaic panel and power data of a photovoltaic module, preprocessing the data, and dividing a training set and a test set according to a proportion; according to the method, a Bi LSTM-Attention model based on ISSA optimization is constructed, photovoltaic power generation power prediction is realized by capturing time sequence characteristics and historical information of input data, meanwhile, a mean square error between a predicted value and a true value is calculated to continuously fit the predicted value, prediction model parameters can be updated, model self-learning is realized, and the prediction efficiency is improved. And the accuracy of the short-term photovoltaic power prediction value of the prediction model is further improved. According to the method, the short-term prediction precision of the photovoltaic power generation power under different weather conditions is improved, so that a photovoltaic grid-connected system is helped to respond to the control parameter design of the power grid stability requirement, and the support capability of photovoltaic power generation on the power grid is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of new energy power generation prediction, and mainly relates to a short-term photovoltaic power generation power prediction method adapting to weather changes. Background Art

[0002] The power generation capacity of photovoltaic power generation systems is affected by many factors such as solar radiation intensity, ambient temperature, seasonal changes, and cloud coverage. It has the characteristics of rapid changes and large fluctuations, which greatly increases the difficulty of predicting photovoltaic power generation capacity.

[0003] In the existing technology, researchers have proposed a variety of photovoltaic power generation prediction methods. Hu Shenghong et al. (patent number: 202311223922.4) proposed an active power optimization allocation method for photovoltaic power stations for ultra-short-term photovoltaic power prediction using PSO-LSTM; Zhang Jie et al. (patent number: 201210495015.0) used a BP neural network with momentum to predict power generation based on historical meteorological data; Mei Fei et al. (patent number: 201711103682.9) first clustered the daily feature data in the meteorological feature library through the KFCM algorithm, and then established an SVR sub-model to predict the power generation of photovoltaic power stations through the corresponding sub-model; Li Fei et al. (patent number: 202211407351.5) considered the impact of long-term data and established an LSTM power generation neural network. rate prediction model; Fan Jinxing et al. (Fan Jinxing, Gao Jifan, Li Yongtian. Ultra-short-term photovoltaic power prediction based on adaptive particle swarm algorithm [J]. Energy Conservation, 2024, 43 (05): 43-46) proposed an optimization algorithm of adaptive clustering analysis to predict power generation in order to solve the intermittent and unstable problems of photovoltaic power generation; Chen Jun et al. (Chen Jun, Guo Liying, Zhao Xiaohui, et al. Short-term photovoltaic power prediction based on MPBiLSTM [J / OL]. Computer Technology and Development, 1-8 [2024-07-15]) used variational mode decomposition to decompose the power generation, and then established a prediction model through residual inversion one-dimensional convolution and bidirectional long short-term memory network to predict photovoltaic power generation. The above methods have achieved certain prediction effects.

[0004] However, when the above prediction method is used for short-term prediction of photovoltaic power generation, that is, when predicting the future minute-level power output, the accuracy rate drops significantly, especially when the weather changes, such as changes between sunny and rainy days, rainy and snowy days, etc., it cannot support the control parameter design of the photovoltaic grid-connected system when responding to the dynamic transient demand of the power grid, which is not conducive to the role of photovoltaic power generation as the main power source in the new power system. Therefore, how to combine some meteorological data to improve the accuracy of short-term photovoltaic power generation prediction under various weather conditions has become a problem that technicians in this field are eager to solve. Summary of the invention

[0005] The present invention is aimed at the problem in the prior art that the accuracy of future minute-level power output prediction drops significantly when the weather changes. A short-term photovoltaic power generation prediction method that adapts to weather changes is proposed. First, the meteorological data and photovoltaic module power data around the photovoltaic panel are collected, and the data is pre-processed and divided into training sets and test sets in proportion; a BiLSTM-Attention model based on ISSA optimization is constructed to realize the prediction of photovoltaic power generation by capturing the time series characteristics and historical information of the input data, and the mean square error between the predicted value and the true value is calculated to continuously fit the predicted value, and then the prediction model parameters can be updated to realize model self-learning, and further improve the accuracy of the prediction model short-term photovoltaic power prediction value. The method of the present invention improves the short-term prediction accuracy of photovoltaic power generation under different weather conditions, so as to help the photovoltaic grid-connected system to respond to the control parameter design of the grid stability demand, and improve the support capacity of photovoltaic power generation to the grid.

[0006] In order to achieve the above object, the technical solution adopted by the present invention is: a short-term photovoltaic power generation power prediction method adapted to weather changes, comprising the following steps:

[0007] S1, data collection, preprocessing and division: collect meteorological data and photovoltaic module power data around the photovoltaic panels, preprocess the data, and divide the training set and test set in proportion; the meteorological data includes but is not limited to instantaneous radiation, temperature, humidity, wind speed, wind direction and rainfall; the training set is not less than 80%, and the test set is not less than 20%;

[0008] S2, building a prediction model: building a BiLSTM-Attention model based on ISSA optimization, which can predict photovoltaic power generation by capturing the time series characteristics and historical information of input data;

[0009] S3, ISSA algorithm optimization and optimal hyperparameter selection: Use the ISSA algorithm to find the optimal hyperparameters of the model and compare the validation set loss corresponding to each epochs. Finally, select the epochs with the smallest validation set loss as the optimal epochs value;

[0010] S4, model training: the model is trained with the optimal hyperparameters obtained in step S3. In each training iteration, the model calculates the loss values ​​of the training set and the validation set, and saves the best model;

[0011] S5, model evaluation: Denormalize the prediction results of the best model obtained in step S4, compare them with the true values, and evaluate the prediction performance of the model.

[0012] As an improvement of the present invention, in the data preprocessing of step S1, outlier detection and missing value processing are performed on the collected data, and then the data is standardized. The standardization formula is:

[0013]

[0014] Among them, z is the standardized value, μ is the mean of the data to be processed, σ is the standard deviation of the data to be processed, and x is the original value of the data to be processed.

[0015] As an improvement of the present invention, in step S1, the CEEMDAN method is used to perform signal decomposition on the collected photovoltaic module power data, specifically: firstly, the original power signal X(t) is preliminarily processed, and a set of new signal sequences is generated by adding adaptive Gaussian white noise n(t):

[0016] X k (t) = X (t) + n k (t)

[0017] Where n k (t) is the noise added to the kth iteration;

[0018] For each signal sequence X after adding noise k (t), using the EMD method, the first intrinsic mode function (IMF) is gradually decomposed and recorded as IMF 1,k (t), repeat this process N times to obtain a set of initial IMF sets {IMF 1,1 (t),IMF 1,2 (t),…,IMF 1,N (t)};

[0019] The final first IMF is obtained by averaging all the initial IMF sets: IMF 1 (t), IMF 1 (t) is removed from the original power signal X(t) to obtain the first residual signal R 1 (t) = X(t)-IMF 1 (t);

[0020] For the residual signal R 1 (t) Repeat the above process to obtain the second IMF by adding noise again and applying EMD decomposition: 2 (t); This process is iterated continuously until the energy of the remaining signal reaches a preset threshold or cannot be further decomposed, and finally a set of intrinsic mode functions {IMF 1 (t),IMF 2 (t),…,IMF n (t)} and a residual signal Rn (t), where each IMF represents the characteristics of the signal at different scales and frequencies.

[0021] As another improvement of the present invention, the step S2 specifically includes the following steps:

[0022] S21: Initialize a population, each individual represents a set of hyperparameter combinations, and the hyperparameter combination includes at least the number of BiLSTM layers, the number of neurons in each layer, and the learning rate; perform random search and local adjustment on the hyperparameters by simulating the foraging behavior of sparrows, and update the population after each iteration to retain the hyperparameter combination with the smallest loss value of the validation set;

[0023] S22: For a given input sequence X = [x 1 ,x 2 ,…,x T ], where x T Represents the input vector at time step t. The calculation process of BiLSTM is as follows: Forward LSTM:

[0024]

[0025] is the hidden state of the forward LSTM at time step t;

[0026] Reverse LSTM:

[0027]

[0028] is the hidden state of the reverse LSTM at time step t;

[0029] At each time step t, the hidden state of the forward LSTM is and the hidden state of the reverse LSTM will be concatenated to form the output of the BiLSTM:

[0030]

[0031] Among them, h t is the final hidden state at time step t, which contains information from the previous and next time steps;

[0032] S23: Introduce the Attention mechanism to perform weighted summation on the temporal features output by BiLSTM to generate a context vector that can capture the most relevant current and historical information;

[0033] S24: The context vector output by the attention mechanism is converted into a PV power prediction value through a fully connected layer.

[0034] As another improvement of the present invention, in the Attention mechanism of step S23, the output of BiLSTM is used as the input of attention calculation and defined as the hidden state of the decoder, the output sequence after convolution is defined as the maximum length of the encoder output, the hidden state of the decoder is dimensionally expanded along the output sequence to match the dimension of the encoder output, and the attention score scores is calculated.

[0035] As another improvement of the present invention, the prediction model of step S2 uses mean square error as the loss function, and the specific formula is:

[0036]

[0037] Among them, y i is the true value, is the model prediction value, that is, the number of samples, and the Adam optimizer is used to update the model parameters.

[0038] As another improvement of the present invention, in the ISSA algorithm optimization of step S3, the update of individuals follows the sparrow foraging strategy. The sparrow population includes two types of individuals: foragers and early warning individuals. In the global search process, the forager will update its position according to its own position and the position of its neighbor individuals. The update formula is:

[0039]

[0040] in, represents the position of the i-th individual in the t+1 generation, k is the maximum number of iterations, α is the learning rate, and Randn(d) is a random vector that follows a standard normal distribution;

[0041] During the local search process, the alerter updates its position as follows:

[0042]

[0043] in, It represents the individual with the best fitness in the current population, and β and γ control the intensity of local search respectively.

[0044] As another improvement of the present invention, in step S3, when comparing whether the validation set loss after each epochs training is the current minimum value, if the current validation set loss is less than the previously recorded minimum value, the minimum validation set loss is updated, and the current epochs value is recorded as the optimal number of training cycles, and the parameters of the current model are saved at the same time; if the validation set loss fails to decrease significantly within several consecutive epochs, the training is terminated early.

[0045] As a further improvement of the present invention, the method for evaluating the model prediction performance in step S5 includes but is not limited to: drawing a curve graph of the original power value and the predicted power value, calculating the model score and the mean square error, root mean square error and mean absolute error on the test set.

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

[0047] (1) The present invention proposes a short-term photovoltaic power prediction method that adapts to weather changes to solve the problem that the accuracy of future minute-level power output prediction is greatly reduced when the weather changes, improves the short-term prediction accuracy of photovoltaic power under different weather conditions, and helps the control parameter design of the photovoltaic grid-connected system to respond to the stability requirements of the power grid, thereby enhancing the support capacity of photovoltaic power generation for the power grid.

[0048] (2) In step S1 of the present invention, multi-dimensional meteorological data including instantaneous radiation, temperature, humidity, wind speed, wind direction, rainfall, etc. and photovoltaic module power data are collected to ensure the comprehensiveness and accuracy of the data. In the process of data preprocessing, the data quality is effectively guaranteed by outlier detection and missing value processing. The CEEMDAN method is used to decompose the power data. By adaptively adjusting the noise level, the influence of noise on signal decomposition can be better suppressed, and the accuracy and stability of decomposition can be improved, which is helpful to extract intrinsic mode functions at different scales and frequencies. It shows good performance in the tasks of denoising and modal decomposition, and can effectively eliminate the problem of modal aliasing.

[0049] (3) The model based on the bidirectional long short-term memory network used in step S2 of the present invention can capture the previous and next time series information at the same time, improving the feature extraction capability of time series data. At the same time, the introduction of the Attention mechanism enables the model to dynamically weight the input time series features, focus on the historical information most relevant to the current prediction, reduce the interference of irrelevant data, and further improve the prediction accuracy of the model. Compared with the traditional model, the BiLSTM-Attention model used in the present invention has a stronger time series feature capture capability and adaptability under complex conditions.

[0050] (4) In step S3 of the present invention, the improved sparrow search algorithm (ISSA) is used to optimize the hyperparameters, thereby ensuring the effective combination of global search and local search. The ISSA algorithm searches for the optimal hyperparameters globally by simulating the foraging behavior of sparrows, and makes fine adjustments locally, thereby improving the efficiency and accuracy of hyperparameter selection. Compared with the traditional SSA algorithm, the ISSA algorithm introduces an adaptive perturbation amplitude mechanism. In each iteration, the perturbation amplitude changes dynamically according to the number of iterations, which is specifically manifested as linear attenuation. This enables the algorithm to conduct a large-scale exploration in the early stage, ensuring that more search space can be covered. As the number of iterations increases, the perturbation amplitude decreases, which helps to conduct a more precise local search when approaching the optimal solution. At the same time, a linear reduction strategy of the proportion of early warnings with the number of iterations is introduced. In the early stage, the proportion of early warnings is high, so that a wide range of searches can be conducted; as the number of iterations increases, the proportion of early warnings decreases, so that more focus can be placed on small-scale precise searches in the later stage. This improvement enables the algorithm to conduct a wider range of exploration in the early stage, and gradually focus on local development and optimization in the later stage.

[0051] (5) During each training iteration of step S4 of the present invention, the model saves the parameters with the smallest loss in the validation set to ensure the continuous updating of the optimal model. In step S5, the prediction results are de-normalized and compared with the true values, and the model performance is comprehensively evaluated using evaluation indicators such as mean square error (MSE), root mean square error (RMSE), and mean absolute error (MAE). The evaluation results of the model are displayed by drawing a graph of the predicted and actual power curves, which can intuitively reflect the prediction effect of the model under different weather conditions, ensuring the prediction accuracy and stability of the model. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0053] Figure 2 This is a flow chart of the data preprocessing steps in step S1 of the method of the present invention;

[0054] Figure 3 This is a schematic diagram of the normalized photovoltaic power generation collected in step S1 of the method of the present invention;

[0055] Figure 4 (a) and Figure 4 (b) are curve comparison diagrams of the original power value and the predicted power value of one day under sunny conditions using the method of the present invention and the SSA algorithm;

[0056] Figure 5 (a) and Figure 5 (b) The model scores of our method and SSA method under sunny conditions and the mean square error, root mean square error and mean absolute error data on the test set;

[0057] Figure 6 (a) and Figure 6 (b) are curve comparison diagrams of the original power value and the predicted power value of one day under rainy conditions by the method of the present invention and the SSA algorithm;

[0058] Figure 7 (a) and Figure 7 (b) The model scores of the method of the present invention and the SSA algorithm under rainy conditions and the mean square error, root mean square error and mean absolute error data graph on the test set;

[0059] FIG8( a ) and FIG8( b ) are curve comparison diagrams of original power values ​​and predicted power values ​​of multiple days under different weather conditions according to the method of the present invention and the SSA algorithm, respectively;

[0060] Fig. 9 (a) and Fig. 9 (b) The model scores of the method of the present invention and the SSA algorithm under different weather conditions for multiple days and the mean square error, root mean square error and mean absolute error data on the test set. DETAILED DESCRIPTION

[0061] The present invention will be further explained below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the following specific embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention.

[0062] Example 1

[0063] A short-term photovoltaic power generation prediction method that adapts to weather changes, such as Figure 1 As shown, the following steps are included:

[0064] Step S1: Data collection, preprocessing and segmentation

[0065] The accuracy of short-term photovoltaic power generation prediction depends on the quality of input data. Therefore, the method of the present invention first collects relevant data of the photovoltaic power station installation site, pre-processes the data, and then divides them into training set and test set according to a certain ratio.

[0066] Collect key data around the photovoltaic panels, including but not limited to meteorological data such as instantaneous radiation, temperature, humidity, wind speed, wind direction and rainfall, and photovoltaic module power data. These meteorological parameters have a direct impact on photovoltaic power generation.

[0067] In the data collection stage, only the meteorological data of the day before the forecast day is used, the data of 12 hours at night is removed, and the sampling data every five minutes during the day is retained to ensure that the data is more representative. The data read by the sensor is saved in JSON format. Because the Pn node of the photovoltaic solar panel is sensitive to temperature, the read data is classified into four seasons of spring, summer, autumn and winter. The geographical location is East China. The data after the four seasons are clustered again to separate the data of rain, snow, sunny and cloudy days.

[0068] Perform outlier detection and missing value processing on the collected data, and then standardize the data. The standardization formula is:

[0069]

[0070] Among them, z is the standardized value, μ is the mean of the data to be processed, σ is the standard deviation of the data to be processed, and x is the original value of the data to be processed. Standardization can eliminate the differences between different dimensions, thereby improving the training effect of the model.

[0071] The CEEMDAN method is used to decompose the collected power data. The CEEMDAN method first performs preliminary processing on the original power signal X(t), and generates a new signal sequence by adding adaptive Gaussian white noise n(t):

[0072] X k (t) = X (t) + n k (t)

[0073] Where n k (t) is the noise added to the kth iteration. The addition of noise helps to reduce the influence of mode aliasing in the EMD method, thereby improving the accuracy and stability of the decomposition.

[0074] For each signal sequence X after adding noise k (t), the classic EMD method is used to gradually decompose the first intrinsic mode function (IMF), denoted as IMF 1,k (t). For each signal sequence, repeat this process N times to obtain a set of initial IMF sets {IMF 1,1 (t),IMF 1,2 (t),…,IMF 1,N (t)}.

[0075] The final first IMF is obtained by averaging all the initial IMF sets: IMF 1 (t) Then, the IMF 1 (t) is removed from the original power signal X(t) to obtain the first residual signal R 1 (t) = X(t)-IMF 1(t).

[0076] For the residual signal R 1 (t) Repeat the above process to obtain the second IMF by adding noise again and applying EMD decomposition: 2 (t). This process continues to iterate until the energy of the remaining signal reaches a preset threshold or cannot be further decomposed.

[0077] The final output of the CEEMDAN method is a set of intrinsic mode functions {IMF 1 (t),IMF 2 (t),…,IMF n (t)} and a residual signal R n (t), where each IMF represents the characteristics of the signal at different scales and frequencies. The main features in the power data are extracted to facilitate the subsequent model to learn these features.

[0078] Based on the sliding window method, a sliding window size is set, time series data is extracted in each sliding window, and feature sets and label sets are constructed for data sets for model training and testing.

[0079] The training set of preprocessed data is no less than 80%, and the prediction set is no less than 20%, ensuring the validity and representativeness of the training set and test set data. At the same time, the data outside the training set and test set are divided as the prediction set for prediction to prevent data leakage.

[0080] Step S2: Build the ISSA-BiLSTM-Attention photovoltaic power prediction model, which can accurately predict the photovoltaic power generation by capturing the time series characteristics and historical information of the input data.

[0081] First, a population is initialized, and each individual represents a set of hyperparameter combinations, including the number of BiLSTM layers, the number of neurons in each layer, and the learning rate. The algorithm simulates the foraging behavior of sparrows to perform random searches and local adjustments on these hyperparameters. After each iteration, the population is updated to retain the hyperparameter combination with the smallest loss value on the validation set.

[0082] The BiLSTM layer is a deep learning network that can process time series data. It adds a back-propagation LSTM unit to the traditional LSTM, so that it can capture the bidirectional dependencies of time series data. For a given input sequence X = [x 1 ,x 2 ,…,x T ] where x T Represents the input vector at time step t. The calculation process of BiLSTM is as follows: Forward LSTM:

[0083]

[0084] is the hidden state of the forward LSTM at time step t.

[0085] Reverse LSTM:

[0086]

[0087] is the hidden state of the reverse LSTM at time step t.

[0088] At each time step t, the hidden state of the forward LSTM is and the hidden state of the reverse LSTM will be concatenated to form the output of the BiLSTM:

[0089]

[0090] Among them, h t is the final hidden state at time step t, which contains information from previous and next time steps.

[0091] The Attention mechanism is introduced on the basis of BiLSTM to perform weighted summation on the temporal features of the BiLSTM output and generate a context vector that can capture the most relevant current and historical information. The Attention mechanism generates a context vector by calculating the "importance" of each time step in the input sequence to the current time step and assigning different weights. The output of BiLSTM is used as the input of the attention calculation and defined as the hidden state of the decoder. The output sequence after convolution is defined as the maximum length of the encoder output. The hidden state of the decoder is dimensionally expanded along the output sequence to match the dimension of the encoder output, and the attention score scores is calculated.

[0092] Finally, the context vector output by the attention mechanism is converted into a PV power prediction value through a fully connected layer.

[0093] Step S3: ISSA algorithm optimization and optimal hyperparameter selection

[0094] The core function of the ISSA algorithm is to optimize the hyperparameter combination of the model. Through the ISSA algorithm, the BiLSTM-Attention model is trained under different hyperparameter combinations, and the loss value of the validation set is used as the optimization target to find the optimal hyperparameter combination and the best epochs value.

[0095] The ISSA algorithm first initializes a population, where each individual represents a set of hyperparameter combinations, including the number of BiLSTM layers, the number of neurons in each layer, and the learning rate. The algorithm simulates the foraging behavior of sparrows to perform random searches and local adjustments on these hyperparameters. After each iteration, the population is updated, and the hyperparameter combination with the smallest loss value of the validation set is retained. After optimization by the ISSA algorithm, the optimal hyperparameter combination is found.

[0096] The optimal number of training cycles is selected by evaluating different epochs one by one and using the criterion of minimizing the validation set loss. This method effectively avoids the risks of overfitting and underfitting, allowing the model to achieve optimal performance in a shorter time. In addition, by introducing an early stopping mechanism, the efficiency and robustness of model training are further improved.

[0097] Step S4: Model training and saving

[0098] After finding the optimal hyperparameter combination, use these parameters to train the model. During each training process, record the loss values ​​of the training set and the validation set, and save the model parameters with the smallest validation set loss value.

[0099] First, the model is trained using the hyperparameter combination optimized in step S3. The input of the model is the data processed in step S1, and the output is the predicted value of photovoltaic power generation. During the training process, the model will continuously adjust the internal parameters to minimize the loss value.

[0100] In addition, in each training iteration, the model calculates the loss values ​​of the training set and the validation set. Define the lowest mean square error value, compare the mean square error obtained after each round of test set validation with the lowest mean square error, and if the mean square error on the current test set is less than the defined mean square error value, update the minimum mean square error and save the current model as the best model. The root mean square error formula is:

[0101]

[0102] Where n is the number of samples, x i is the true value of the i-th sample, y i is the model's predicted value for the i-th sample. The smaller the MSE value, the smaller the difference between the model's predicted value and the true value, and the better the model's performance.

[0103] Step S5: Model evaluation and prediction

[0104] After training is complete, use the saved best model to make predictions to evaluate the generalization ability of the model. By comparing the model prediction results with the true values, the accuracy and reliability of the model are evaluated.

[0105] The saved best model is adjusted to evaluation mode, and predictions are made using the test set data collected later. The prediction results of the model are denormalized and compared with the true values. The prediction performance of the model is evaluated by plotting the curve of the original power value and the predicted power value and calculating the model score and the mean square error, root mean square error and mean absolute error on the test set to ensure the reliability of the model in practical applications.

[0106] The hyperparameter combination training model optimized by the SSA algorithm is used, and the saved best model is adjusted to the evaluation mode, and the test set data collected later is used for prediction. The prediction results of the model are denormalized and compared with the true values. By drawing a curve graph of the original power value and the photovoltaic predicted power value and calculating the model score and the mean square error, root mean square error and mean absolute error on the test set, the prediction results of the ISSA algorithm and the SSA algorithm are compared to prove the progress of the present invention.

[0107] Example 2

[0108] This embodiment takes the data in the Huaneng Jiangsu distributed photovoltaic outdoor demonstration platform as an example, and mainly uses meteorological data such as instantaneous radiation, temperature, humidity, wind speed, wind direction, reflected radiation and rainfall and photovoltaic module power data in the Huaneng Jiangsu distributed photovoltaic outdoor demonstration platform. The instantaneous radiation data is monitored by the CMP10 total radiation sensor; the temperature, humidity, wind speed, wind direction and rainfall data are monitored by the LM-600 integrated sensor; the photovoltaic module power data is monitored by the PV-500 tester and the HW-50-R power generation measurement device. Figure 1 , which is a flow chart of the steps of the method of the present invention, is a short-term photovoltaic power generation power prediction method adapted to weather changes, comprising the following steps:

[0109] Step S1: Data collection, preprocessing and segmentation

[0110] First, we use meteorological instruments and sensors to collect data from 7 am to 7 pm every day. The historical meteorological data comes from the Huaneng Jiangsu Distributed Photovoltaic Outdoor Demonstration Platform, which includes meteorological data collected by meteorological instruments and photovoltaic component-related data, mainly meteorological data such as instantaneous radiation, temperature, humidity, wind speed, wind direction and rainfall collected by photovoltaic power stations, and photovoltaic component power data. Ambient temperature and instantaneous irradiation intensity are the two factors that have the greatest impact on photovoltaic power generation. The collected photovoltaic power generation is as follows: Figure 3 shown.

[0111] Figure 2This is a flowchart of the steps of meteorological data preprocessing. The data read by the sensor is saved in JSON format. Since the Pn node of the photovoltaic solar panel is sensitive to temperature, the read data is classified into four seasons: spring, summer, autumn and winter. The geographical location is East China. The data after the four seasons are clustered again to separate the data of rain, snow, sunny and cloudy days. Check whether the data is abnormal, including zero value, null data, extreme data, etc. Then the data is standardized. The standardization formula is:

[0112]

[0113] Among them, z is the standardized value, μ is the mean of the data to be processed, σ is the standard deviation of the data to be processed, and x is the original value of the data to be processed. Normalization can eliminate the differences between different dimensions. The power generation and meteorological data every five minutes are used as variables.

[0114] As described in Example 1, the CEEMDAN method is used to perform signal decomposition on the collected power data.

[0115] In order to verify the decomposition effect, visualization is used to display the decomposed power signal and its various IMF components. By drawing the curves before and after decomposition, the changes of different frequency components in the power signal can be intuitively observed, so as to better understand the change law of photovoltaic power.

[0116] The decomposed data is normalized and converted into a standard normal distribution with a mean of zero and a variance of one. The standardized data helps to eliminate the numerical differences between different IMF components and ensure that each component contributes evenly to the model training.

[0117] Based on the sliding window method, a sliding window size is set, time series data is extracted in each sliding window, and feature sets and label sets are constructed for model training and testing data sets. The test sliding window value size ranges from 1 to 14. When the sliding window value is 9, the prediction result is the most accurate. The sliding window size is set to 9 time steps.

[0118] The processed meteorological data is divided into training set and test set according to a certain ratio. Usually, 80% of the data is used for training and 20% for testing. This division method ensures that the model can learn enough features on the training set, and at the same time, it can be effectively verified on the test set to evaluate the generalization ability of the model.

[0119] In addition to the training set and test set division, a portion of data is also divided as a prediction set. This prediction set data will not participate in the training and testing of the model, but will be used in the actual power prediction task after the model training is completed to evaluate the performance of the model on new data and prevent the prediction performance from being too high due to the leakage of training data.

[0120] Finally, save the constructed training set, test set, and prediction set data, and check their data shapes to ensure that each data set can be correctly applied in subsequent model training.

[0121] Step S2: Use the data from the Huaneng Jiangsu distributed photovoltaic outdoor demonstration platform to establish the ISSA-BiLSTM-Attention short-term power generation prediction model. The ISSA-BiLSTM-Attention short-term power generation prediction model consists of the following parts: input layer, BiLSTM layer, attention mechanism, fully connected layer, loss function and optimizer.

[0122] Step S21: In the input layer, the input data is the normalized meteorological data and the corresponding power generation data. The input dimension input_dim is 16, indicating that the input data of the model contains 16 feature variables.

[0123] Step S22: The BiLSTM layer is a deep learning network that can process time series data. It adds a back-propagation LSTM unit on the basis of the traditional LSTM, so as to capture the bidirectional dependency of time series data.

[0124] Step S23: The introduction of the Attention mechanism is to enhance the model's ability to capture important time series features. The core of the Attention mechanism is to generate a context vector by calculating the "importance" of each time step in the input sequence to the current time step and assigning different weights. The output of BiLSTM is used as the input of the attention calculation and defined as the hidden state of the decoder. The output sequence after convolution is defined as the maximum length of the encoder output. The hidden state of the decoder is dimensionally expanded along the output sequence to match the dimension of the encoder output, and the attention score scores is calculated. The formula for the attention score scores is:

[0125] scores=v(tanh(W h [h dec ,h enc ]))

[0126] where h dec is the hidden state of the decoder, h enc is the output of the encoder, W is the weight of the linear layer, v is the linear layer, and finally the attention score is normalized by softmax to obtain α norm,i , output context vector c, the calculation formula is Where T is the length of the encoder output sequence, α norm,i is the normalized attention weight of the i-th time step, henc,i is the output of the encoder at the i-th time step.

[0127] Step S24: Pass the context vector generated by the attention mechanism to the fully connected layer, which converts the context vector into the final power prediction value. The input dimension of the fully connected layer is attention_dim×2, that is, the output dimension of the attention mechanism is multiplied by 2 (corresponding to the bidirectional output of BiLSTM). The output dimension output_dim=16, corresponding to the 16 power prediction values ​​finally output by the model.

[0128] Step S25: Use mean square error (MSE) as the loss function to measure the difference between the model prediction value and the true value. The formula of MSE is:

[0129]

[0130] Among them, y i is the true value, is the model prediction value, is the number of samples. The Adam optimizer is used to update the model parameters. The learning rate learn_rate=0.0022080553136867537.

[0131] Step S3: ISSA algorithm optimizes the optimal hyperparameters and epochs value selection

[0132] ISSA (Improved Sparrow Search Algorithm) is used to optimize the hyperparameters of the BiLSTM-Attention model. The ISSA algorithm can effectively find the optimal solution in the high-dimensional parameter space by simulating the foraging behavior of sparrows and combining global search and local search strategies. The selection of training epochs directly affects the performance of the model on the training set and the validation set. If the number of training rounds is too small, the model may not be able to fully learn the characteristics of the data, resulting in underfitting; on the contrary, if the number of training rounds is too large, the model may overfit the training data and the generalization ability on the validation set will decrease. Therefore, the method of the present invention traverses different training rounds and selects the round with the smallest loss of the validation set as the best training round (i.e., the optimal Epochs) to improve the overall performance of the model.

[0133] Step S31: The ISSA algorithm starts the optimization process by randomly generating a set of initial populations. Each individual represents a set of candidate hyperparameters for the BiLSTM-Attention model. Set the population size population_size to 10, that is, 10 different hyperparameter combinations are evaluated simultaneously in each generation iteration. Each individual in the initial population consists of the following parameters: Number of layers of the BiLSTM network (num_layers): indicates the number of layers stacked by the BiLSTM model, and this parameter is randomly selected between 1 and 5. Number of neurons in each layer of BiLSTM units (bilstm_neurons_list): indicates the number of neurons contained in each layer of BiLSTM units. The number of neurons in each layer is randomly generated between 10 and 100. Learning rate (learn_rate): used to control the step size of the model parameter update. The learning rate is randomly selected between 10^-4 and 10^-2. The combination of these parameters constitutes each individual in the population and is used as a candidate hyperparameter for the BiLSTM-Attention model.

[0134] Step S32: The fitness value of each individual is measured by the loss function value of its corresponding model on the validation set. Commonly used loss functions include mean square error (MSE):

[0135]

[0136] Where n is the number of samples in the validation set, and y i is the true value of the i-th sample, is the predicted value of the model.

[0137] Step S33: In the ISSA algorithm, the update of individuals follows the sparrow foraging strategy. The sparrow population includes two types of individuals: foragers and early warning. Foragers are responsible for global search and exploring new solution spaces; early warnings perform local searches in high fitness areas to ensure rapid convergence of the population. During the global search process, foragers will update their positions based on their own and neighboring individuals. The update formula is:

[0138]

[0139] in, represents the position of the ith individual in the t+1 generation, k is the maximum number of iterations, α is the learning rate, and Randn(d) is a random vector that follows a standard normal distribution. During the local search process, the alerter updates its position using the following formula:

[0140]

[0141] in, It represents the individual with the best fitness in the current population, and β and γ respectively control the intensity of local search. After each iteration, ISSA updates the optimal solution according to the fitness value, that is, it selects the individual with the lowest fitness value (the smallest validation set loss value) as the current optimal solution and records its corresponding hyperparameter combination.

[0142] Step S34: Set the number of iterations to 20, and the ISSA algorithm will gradually converge to an optimal solution, that is, the hyperparameter combination with the smallest validation set loss value. The optimal parameter combination finally obtained is: the number of BiLSTM layers is 1, the number of neurons is 84, and the learning rate is 0.0022080553136867537.

[0143] Step S35: multiple candidate epoch values ​​are set. In this embodiment, epoch values ​​of 10-50 are traversed, model training is performed respectively, and the validation set loss corresponding to each epoch value is recorded.

[0144] Step S36: After each epoch, the model is evaluated on the validation set using the mean square error formula:

[0145] Where n is the number of samples in the validation set, and y i is the true value of the i-th sample, is the predicted value of the model to calculate the validation set loss. The validation set loss is used to measure the generalization ability of the model on unseen data.

[0146] Step S37: After each epochs training is completed, the method of the present invention will check whether the validation set loss under the epochs is the current minimum value. If the current validation set loss is less than the previously recorded minimum value, the minimum validation set loss is updated, and the current epochs value is recorded as the optimal number of training cycles, and the parameters (state_dict) of the current model are saved for subsequent use. At the same time, an early stopping mechanism is introduced. If the validation set loss fails to drop significantly within several consecutive epochs, the training is terminated in advance. This embodiment sets patience to 10 epochs. This mechanism can prevent the model from wasting computing resources on invalid training cycles, thereby improving training efficiency.

[0147] Step S38: After traversing all candidate epochs values, select the epochs value with the smallest validation set loss as the optimal epochs value. Finally, set the optimal epochs value to 44.

[0148] Step S4: Model training and saving

[0149] After finding the optimal hyperparameter combination, use these parameters to train the model. During each training process, record the loss values ​​of the training set and the validation set, and save the model parameters with the smallest validation set loss value.

[0150] The model is trained using the hyperparameter combination and optimal epochs optimized in step S3. The input of the model is the data processed in step S1, and the output is the predicted value of photovoltaic power generation. During the training process, the model will continuously adjust the internal parameters to minimize the loss value.

[0151] In each training iteration, the model calculates the loss values ​​of the training set and the validation set. Define the lowest mean square error value, compare the mean square error obtained after each round of test set validation with the lowest mean square error, and if the mean square error on the current test set is less than the defined mean square error value, update the minimum mean square error and save the current model as the best model. The root mean square error formula is:

[0152]

[0153] Where n is the number of samples in the validation set, and y i is the true value of the i-th sample, is the predicted value of the model. The smaller the MSE value, the smaller the difference between the predicted value of the model and the true value, and the better the performance of the model.

[0154] Step S5: Model evaluation and prediction. After training is completed, the best model is saved for prediction to evaluate the generalization ability of the model. The accuracy and reliability of the model are evaluated by comparing the model prediction results with the true values.

[0155] The best model saved is adjusted to the evaluation mode, and the test set data collected later is used for prediction. The prediction results of the model are denormalized and compared with the true values. The prediction performance of the model is evaluated by plotting the curve of the original power value and the predicted power value and calculating the model score and the mean square error, root mean square error and mean absolute error on the test set to ensure the reliability of the model in practical applications. The curve of the original power value and the predicted power value on a sunny day is shown in Figure 1. Figure 4 (a) shows the model score and the mean square error, root mean square error and mean absolute error data on the test set. Figure 5 (a) shows the curve of the original power value and the predicted power value under rainy conditions. Figure 6 (a) shows the model score and the mean square error, root mean square error and mean absolute error data on the test set. Figure 7(a); The curves of the original power values ​​and the predicted power values ​​for multiple days under different weather conditions are shown in Figure 8(a). The model score and the mean square error, root mean square error and mean absolute error data on the test set are shown in Figure 8(a). Fig. 9 (a) shown.

[0156] The hyperparameter combination training model optimized using the SSA algorithm is adjusted to the evaluation mode, and the test set data collected later is used for prediction. The prediction results of the model are denormalized and compared with the true values. By plotting the curve of the original power value and the photovoltaic predicted power value and calculating the model score and the mean square error, root mean square error and mean absolute error on the test set, the prediction results of the ISSA algorithm and the SSA algorithm are compared to prove the progress of the present invention. The curve of the original power value and the predicted power value of one day under sunny conditions using the SSA algorithm is shown in the figure below: Figure 4 (b) shows the model score and the mean square error, root mean square error and mean absolute error data on the test set. Figure 5 (b) shows the curve of the original power value and the predicted power value under rainy conditions for one day. Figure 6 (b) shows the model score and the mean square error, root mean square error and mean absolute error data on the test set. Figure 7 (b); The curves of the original power values ​​and the predicted power values ​​for multiple days under different weather conditions are shown in Figure 8(b). The model scores and the mean square error, root mean square error and mean absolute error data on the test set are shown in Figure 8(b). Fig. 9 By comparing the curves of the original power value and the predicted power value under different optimization algorithms and calculating the model score and the mean square error, root mean square error and mean absolute error on the test set, it is concluded that the photovoltaic power prediction curve of the model under the ISSA optimization algorithm is more consistent with the original curve than the model under the SSA optimization algorithm, the model score is higher, and the correlation error is smaller, achieving progress in the optimization algorithm.

[0157] It should be noted that the above content only illustrates the technical idea of ​​the present invention and cannot be used to limit the protection scope of the present invention. For ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications all fall within the protection scope of the claims of the present invention.

Claims

1. A short-term photovoltaic power generation prediction method adapted to weather changes, characterized in that: The steps include: S1, data collection, preprocessing and division: collect meteorological data and photovoltaic module power data around the photovoltaic panels, preprocess the data, and divide the training set and test set in proportion; the meteorological data includes but is not limited to instantaneous radiation, temperature, humidity, wind speed, wind direction and rainfall; the training set is not less than 80%, and the test set is not less than 20%; S2, building a prediction model: building a BiLSTM-Attention model based on ISSA optimization, which can predict photovoltaic power generation by capturing the time series characteristics and historical information of input data; S3, ISSA algorithm optimization and optimal hyperparameter selection: Use the ISSA algorithm to find the optimal hyperparameters of the model and compare the validation set loss corresponding to each epochs. Finally, select the epochs with the smallest validation set loss as the optimal epochs value; S4, model training: the model is trained with the optimal hyperparameters obtained in step S3. In each training iteration, the model calculates the loss values ​​of the training set and the validation set, and saves the best model; S5, model evaluation: Denormalize the prediction results of the best model obtained in step S4, compare them with the true values, and evaluate the prediction performance of the model.

2. A method for predicting short-term photovoltaic power generation that adapts to weather changes as claimed in claim 1, characterized in that: In the data preprocessing of step S1, outlier detection and missing value processing are performed on the collected data, and then the data is standardized. The standardization formula is: Among them, z is the standardized value, μ is the mean of the data to be processed, σ is the standard deviation of the data to be processed, and x is the original value of the data to be processed.

3. A method for predicting short-term photovoltaic power generation that adapts to weather changes as claimed in claim 2, characterized in that: In step S1, the CEEMDAN method is used to perform signal decomposition on the collected photovoltaic module power data, specifically: firstly, the original power signal X(t) is preliminarily processed, and a set of new signal sequences is generated by adding adaptive Gaussian white noise n(t): X k (t)=X(t)+n k (t) where n k (t) is the noise added to the kth iteration; For each signal sequence X after adding noise k (t), using the EMD method, the first intrinsic mode function (IMF) is gradually decomposed and recorded as IMF 1,k (t), repeat this process N times to obtain a set of initial IMF sets {IMF 1,1 (t),IMF 1,2 (t),…,IMF 1,N (t)}; All initial IMF sets are averaged to obtain the final first IMF: IMF1(t), and IMF1(t) is removed from the original power signal X(t) to obtain the first residual signal R1(t) = X(t) - IMF1(t); Repeat the above process for the residual signal R1(t), add noise again and apply EMD to decompose it to obtain the second IMF: IMF2(t); this process is iterated until the energy of the residual signal reaches a preset threshold or cannot be further decomposed, and finally outputs a set of intrinsic mode functions {IMF1(t),IMF2(t),…,IMF n (t)} and a residual signal R n (t), where each IMF represents the characteristics of the signal at different scales and frequencies.

4. A method for predicting short-term photovoltaic power generation adapting to weather changes as claimed in claim 1, characterized in that: The step S2 specifically includes the following steps: S21: Initialize a population, each individual represents a set of hyperparameter combinations, and the hyperparameter combination includes at least the number of BiLSTM layers, the number of neurons in each layer, and the learning rate; perform random search and local adjustment on the hyperparameters by simulating the foraging behavior of sparrows, and update the population after each iteration to retain the hyperparameter combination with the smallest loss value of the validation set; S22: For a given input sequence X = [x1, x2, ..., x T ], where x T Represents the input vector at time step t. The calculation process of BiLSTM is as follows: Forward LSTM: is the hidden state of the forward LSTM at time step t; Reverse LSTM: is the hidden state of the reverse LSTM at time step t; At each time step t, the hidden state of the forward LSTM is and the hidden state of the reverse LSTM will be concatenated to form the output of the BiLSTM: Among them, h t is the final hidden state at time step t, which contains information from the previous and next time steps; S23: Introduce the Attention mechanism to perform weighted summation on the temporal features output by BiLSTM to generate a context vector that can capture the most relevant current and historical information; S24: The context vector output by the attention mechanism is converted into a PV power prediction value through a fully connected layer.

5. A method for predicting short-term photovoltaic power generation adapting to weather changes as claimed in claim 4, characterized in that: In the Attention mechanism of step S23, the output of BiLSTM is used as the input of attention calculation and defined as the hidden state of the decoder. The output sequence after convolution is defined as the maximum length of the encoder output. The hidden state of the decoder is dimensionally expanded along the output sequence to match the dimension of the encoder output, and the attention score scores is calculated.

6. A method for predicting short-term photovoltaic power generation adapting to weather changes as claimed in claim 5, characterized in that: The prediction model in step S2 uses mean square error as the loss function, and the specific formula is: Among them, y i is the true value, is the model prediction value, that is, the number of samples, and the Adam optimizer is used to update the model parameters.

7. A method for predicting short-term photovoltaic power generation adapting to weather changes as claimed in claim 1, characterized in that: In the ISSA algorithm optimization of step S3, the update of individuals follows the sparrow foraging strategy. The sparrow population includes two types of individuals: foragers and alarmists. In the global search process, the forager will update its position according to its own position and the position of its neighbor individuals. The update formula is: in, represents the position of the i-th individual in the t+1 generation, k is the maximum number of iterations, α is the learning rate, and Randn(d) is a random vector that follows a standard normal distribution; During the local search process, the alerter updates its position as follows: in, It represents the individual with the best fitness in the current population, and β and γ control the intensity of local search respectively.

8. A method for predicting short-term photovoltaic power generation adapting to weather changes as claimed in claim 7, characterized in that: In step S3, when comparing whether the validation set loss after each epochs training is the current minimum value, if the current validation set loss is less than the previously recorded minimum value, the minimum validation set loss is updated, and the current epochs value is recorded as the optimal number of training cycles, and the parameters of the current model are saved; if the validation set loss fails to decrease significantly within several consecutive epochs, the training is terminated early.

9. A method for predicting short-term photovoltaic power generation adapting to weather changes as claimed in claim 8, characterized in that: The method for evaluating the prediction performance of the model in step S5 includes but is not limited to: drawing a curve graph of the original power value and the predicted power value, calculating the model score and the mean square error, root mean square error and mean absolute error on the test set.

Citation Information

Patent Citations

  • Neural network prediction method for generated output of photovoltaic power station

    CN102930358A

  • Photovoltaic power station generation power prediction method

    CN107766990A

  • Photovoltaic power generation power prediction model construction method and photovoltaic power generation power prediction method

    CN115796338A

  • Photovoltaic power station active power optimal distribution method for ultra-short-term photovoltaic power prediction

    CN117134436A

Cited By

  • Photovoltaic power prediction method and system based on seasonal weather classification and RLHF large model

    CN119623772A

  • Photovoltaic power prediction method and system based on seasonal weather classification and RLHF large model

    CN119623772B

  • Photovoltaic power generation power prediction method based on Bi-LSTM

    CN120146096A

  • Medium-term photovoltaic power generation power prediction method, electronic equipment and medium

    CN120601384A

  • Solar photovoltaic power generation prediction method based on WPB-BiLSTM model

    CN120601397A