An improved short-term solar photovoltaic power prediction method

CN122931664APending Publication Date: 2026-10-16CHANGSHA UNIVERSITY OF SCIENCE AND TECHNOLOGY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611042702.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-14
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

[0004](1)普通LSTM模型难以充分挖掘时间序列的多尺度特征,对光伏功率中的高频波动和长期趋势建模能力有限

Benefits of technology

[0049] 1. The three-layer stacked LSTM structure with enhanced feature attention can dynamically focus on key meteorological features and extract hierarchical features from the time series layer by layer. Compared with ordinary LSTM, BiLSTM, CNNLSTM and other models, it achieves better performance in RMSE, MAE and R².

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122931664A_ABST
    Figure CN122931664A_ABST
Patent Text Reader

Abstract

The application discloses an improved short-term solar photovoltaic power prediction method, which comprises the following steps: collecting meteorological data and power generation data of a solar photovoltaic power station, forming a time series data set, and performing pretreatment; decomposing the power generation data of the time series data set into high-frequency components and low-frequency components, constructing a stacked LSTM prediction model, obtaining the prediction values of each component, reconstructing and outputting the power generation prediction value; dividing the training set by using an adaptive sliding window mechanism and dynamically adjusting the training window length; constructing a hybrid loss function based on a smoothing constraint, a seasonal consistency constraint and a physical constraint regular term, training the stacked LSTM prediction model based on the training set, applying the trained stacked LSTM prediction model, and completing power generation prediction of a target solar photovoltaic power station. Compared with the prior art, the application has higher prediction accuracy, better robustness and physical interpretability, and is suitable for power grid dispatching and real-time photovoltaic power prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of renewable energy forecasting and deep learning technology, specifically to an improved method for predicting short-term solar photovoltaic power generation. Background Technology

[0002] With the depletion of fossil fuels and the increasing prominence of environmental problems, solar photovoltaic (PV) power generation, as a clean energy source, has been widely adopted. However, the power output of solar PV is significantly affected by weather conditions, exhibiting intermittency and volatility, posing a severe challenge to grid dispatch and stable operation. Accurate short-term forecasting of PV power output is of great significance for grid dispatch, energy storage management, and electricity market transactions.

[0003] Currently, photovoltaic power prediction methods are mainly divided into physical models, statistical models, machine learning models, and deep learning models. Physical models rely on the photovoltaic conversion mechanism and weather forecasts, and their accuracy is limited due to numerous parameter assumptions. Statistical models, such as ARIMA, struggle to capture nonlinear and long-term dependencies. Traditional machine learning methods, such as support vector regression and random forests, require manual feature engineering and have insufficient generalization ability. Deep learning methods, such as convolutional neural networks and recurrent neural networks, have achieved good results, but existing methods still have the following problems:

[0004] (1) Ordinary LSTM models are difficult to fully explore the multi-scale features of time series and have limited ability to model high-frequency fluctuations and long-term trends in photovoltaic power. In addition, existing models usually treat all input features equally and cannot adaptively enhance the contribution of key meteorological features (such as radiation) and suppress noise features.

[0005] (2) The training window length is fixed and cannot adapt to changes in data, which affects the robustness of prediction. Furthermore, existing adaptive window methods are only based on overall error adjustment and cannot distinguish whether the error comes from high-frequency fluctuations or low-frequency trends.

[0006] (3) The loss function only considers point error and lacks physical constraints (such as smoothness and seasonal consistency). It also does not consider basic physical laws such as non-negative power, upper limit of rated capacity, and maximum ramp rate, which leads to unreasonable jumps in the prediction curve.

[0007] (4) Most methods do not provide a prediction interval, making it difficult to quantify the uncertainty of prediction. Summary of the Invention

[0008] The purpose of this invention is to provide an improved method for predicting short-term solar photovoltaic power generation. This method achieves high accuracy, high robustness, and uncertainty quantification in short-term photovoltaic power prediction by using a stacked LSTM structure with enhanced feature attention, multi-scale temporal decomposition, a dual-scale adaptive sliding window mechanism, and a hybrid loss function with physical constraints.

[0009] To achieve the above functions, this invention designs an improved short-term solar photovoltaic power generation prediction method, which executes the following steps S1-S6 to complete the power generation prediction of the target solar photovoltaic power station:

[0010] Step S1: Collect meteorological data and power generation data of the solar photovoltaic power station at preset historical times, match the meteorological data and power generation data of each historical time to form a sample, and construct a time series dataset;

[0011] Step S2: Preprocess each data point in the time series dataset;

[0012] Step S3: Decompose the power generation data of the time series dataset into high-frequency components and low-frequency components, construct a stacked LSTM prediction model, perform normalization and feature extraction on each component independently to obtain the predicted value of each component, and then perform weighted summation and reconstruction based on the predicted value of each component to output the predicted power generation value.

[0013] Step S4: Divide the preprocessed time series dataset into training set, validation set and test set. The division of training set and test set adopts an adaptive sliding window mechanism, and the length of training window is dynamically adjusted according to the historical prediction error of the high frequency component and low frequency component of power generation data.

[0014] Step S5: Construct a hybrid loss function and train the stacked LSTM prediction model based on samples in the training set to obtain the trained stacked LSTM prediction model.

[0015] Step S6: Input the meteorological data and power generation data from several time steps before the time period to be predicted into the trained stacked LSTM prediction model, and output the predicted power generation value of the target solar photovoltaic power station at the future time.

[0016] As a preferred technical solution of the present invention: the meteorological data mentioned in step S1 includes wind speed, global horizontal radiation, horizontal diffuse radiation, ambient temperature, relative humidity, wind direction, and daily rainfall.

[0017] As a preferred technical solution of the present invention, the preprocessing in step S2 includes missing value processing, outlier detection and removal, feature selection and data normalization.

[0018] As a preferred technical solution of the present invention: in step S3, the power generation data sequence is decomposed into high-frequency components and low-frequency components according to the following formula:

[0019] ;

[0020] In the formula, Here is the power generation data at time t. Let k be the high-frequency component of the k-th layer at time t. The low-frequency component of the Kth layer at time t;

[0021] Each component is input into the stacked LSTM prediction model, normalized, and its features are extracted. The predicted values ​​of the high-frequency and low-frequency components are output. Based on the predicted values ​​of each component, the predicted power generation value is output as follows:

[0022] ;

[0023] in, Let be the predicted power generation value at time t. Let be the predicted value of the k-th layer high-frequency component at time t. Let be the predicted value of the low-frequency component of the Kth layer at time t.

[0024] As a preferred technical solution of the present invention: a stacked LSTM prediction model is constructed, wherein the stacked LSTM prediction model comprises multiple cascaded LSTM layers, each LSTM layer contains multiple LSTM units, each LSTM layer is followed by a dropout layer, and the last LSTM layer is connected to a fully connected output layer; wherein, a feature attention mechanism is introduced into the input layer of each LSTM unit, and at each time t, the input feature vector is... Calculate feature attention weights The input feature vector includes meteorological data and power generation data, and a weighted feature vector is generated. :

[0025] ;

[0026] ;

[0027] in, , , The learnable parameters corresponding to the k-th feature; , , The learnable parameters corresponding to the j-th feature; The dimension of the input feature vector is given, and then the weighted feature vector is calculated. As input to the current LSTM unit.

[0028] As a preferred technical solution of the present invention: the stacked LSTM model in step S3 includes three LSTM layers, the first LSTM layer has 64 units, the second LSTM layer has 32 units, the third LSTM layer has 32 units, and a dropout layer with a dropout rate of 0.01 is set after each LSTM layer. The fully connected output layer is a neuron.

[0029] As a preferred embodiment of the present invention: In step S4, when performing the m-th prediction, the average absolute percentage error of the high-frequency components is: The mean absolute percentage error of the low-frequency components is Based on the mean absolute percentage error of the high-frequency components and the mean absolute percentage error of the low-frequency components, the following formula is used for the high-frequency window length. and low-frequency window length Update:

[0030] ;

[0031] ;

[0032] In the formula, The target error threshold, This is the step size adjustment coefficient. It is a symbolic function; , These are the high-frequency window length and low-frequency window length for the m-th prediction, respectively. , These are the high-frequency window length and low-frequency window length for the (m-1)th prediction, respectively. The final training window length is the maximum value of the two or a weighted combination.

[0033] As a preferred technical solution of the present invention: the hybrid loss function constructed in step S5 As shown in the following formula:

[0034] ;

[0035] in, This is the mean square error term. For the smoothing constraint term, For seasonal consistency constraints, For physical constraint regularization terms, , , These are the regularization coefficients for the smoothing constraint, seasonal consistency constraint, and physical constraint regularization, respectively.

[0036] Mean square error term As shown in the following formula:

[0037] ;

[0038] Smoothing constraint As shown in the following formula:

[0039] ;

[0040] Seasonal Consistency Constraints As shown in the following formula:

[0041] ;

[0042] in, This is the average of the actual values ​​for the same period in history. This represents the total number of samples in the current prediction batch. Let i be the actual power generation value of the i-th sample. Predict the power generation value for the model of the i-th sample; The total number of historical time steps considered for seasonal consistency constraints;

[0043] Physical constraint regularization term As shown in the following formula:

[0044] ;

[0045] in, The rated power of the power station This represents the maximum allowable gradeability.

[0046] The present invention also designs an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the improved short-term solar photovoltaic power generation prediction method.

[0047] The present invention also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the improved short-term solar photovoltaic power generation prediction method.

[0048] Beneficial effects: Compared with the prior art, the advantages of the present invention include:

[0049] 1. The three-layer stacked LSTM structure with enhanced feature attention can dynamically focus on key meteorological features and extract hierarchical features from the time series layer by layer. Compared with ordinary LSTM, BiLSTM, CNNLSTM and other models, it achieves better performance in RMSE, MAE and R².

[0050] 2. By using discrete wavelet transform or empirical mode decomposition, the original sequence is decomposed into high-frequency and low-frequency components for prediction, effectively capturing the rapid fluctuations and long-term trends in photovoltaic power.

[0051] 3. The window length is adjusted independently based on the prediction errors of high-frequency and low-frequency components to avoid underlearning or overlearning caused by a fixed window. It can also make fine adjustments for error sources of different frequencies, improving the model's adaptability to data changes.

[0052] 4. In addition to the smoothing constraint and the seasonal consistency constraint, three physical constraint regularization terms are introduced: power non-negativity, rated capacity upper limit, and maximum ramp rate. This ensures that the prediction curve strictly conforms to the physical limits and variation laws of photovoltaic power generation, and significantly reduces unreasonable jumps. Attached Figure Description

[0053] Figure 1 This is a flowchart of an improved short-term solar photovoltaic power generation prediction method provided by an embodiment of the present invention;

[0054] Figure 2 This is a schematic diagram of the overall structure of the stacked LSTM prediction model provided in an embodiment of the present invention;

[0055] Figure 3 This is a comparison diagram of different methods provided according to embodiments of the present invention. Detailed Implementation

[0056] The present invention will be further described below with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and should not be used to limit the scope of protection of the present invention.

[0057] An improved short-term solar photovoltaic power generation prediction method is provided in this embodiment of the invention, referring to... Figure 1 Perform the following steps S1-S6 to complete the power generation prediction of the target solar photovoltaic power station:

[0058] Step S1: Collect meteorological data and power generation data of the solar photovoltaic power station at preset historical times, match the meteorological data and power generation data of each historical time to form a sample, and construct a time series dataset;

[0059] The meteorological data includes wind speed, global horizontal radiation, horizontal diffuse radiation, ambient temperature, relative humidity, wind direction, and daily rainfall.

[0060] Step S2: Preprocess each data point in the time series dataset;

[0061] The preprocessing includes missing value handling, outlier detection and removal, feature selection, and data normalization.

[0062] Missing values ​​are handled using the K-nearest neighbor imputation method, which uses the five nearest neighbors to perform distance-weighted imputation in the normalized feature space.

[0063] Outlier detection uses the interquartile range (IQR) method: observations below Q1 - 1.5 × IQR or above Q3 + 1.5 × IQR are considered outliers and removed. Here, Q1 is the first quartile (the value at the 25th percentile after all observations are sorted in ascending order), Q3 is the third quartile (the value at the 75th percentile), and IQR is the interquartile range, i.e., IQR = Q3 - Q1.

[0064] Feature selection was based on correlation heatmaps, selecting the five meteorological features with the highest correlation to photovoltaic power generation: wind speed, global horizontal radiation, horizontal diffusion radiation, ambient temperature, and relative humidity.

[0065] Data normalization uses the minimum-maximum normalization formula:

[0066] ;

[0067] In the formula, The original data for features and These are the minimum and maximum values ​​of the feature, respectively.

[0068] Step S3: Decompose the power generation data of the time series dataset into high-frequency components and low-frequency components, construct a stacked LSTM prediction model, perform normalization and feature extraction on each component independently to obtain the predicted value of each component, and then perform weighted summation and reconstruction based on the predicted value of each component to output the predicted power generation value.

[0069] In step S3, the power generation data sequence is decomposed into high-frequency and low-frequency components according to the following formula:

[0070] ;

[0071] In the formula, Here is the power generation data at time t. Let be the k-th layer high-frequency component (detail component) at time t. The Kth layer low-frequency component (approximate component) at time t.

[0072] Each component is input into the stacked LSTM prediction model, normalized, and its features are extracted. The predicted values ​​of the high-frequency and low-frequency components are output. Based on the predicted values ​​of each component, the predicted power generation value is output as follows:

[0073] ;

[0074] in, Let be the predicted power generation value at time t. Let be the predicted value of the k-th layer high-frequency component at time t. Let be the predicted value of the low-frequency component of the Kth layer at time t.

[0075] A stacked LSTM prediction model is constructed, comprising multiple cascaded LSTM layers. Each LSTM layer contains multiple LSTM units, followed by a dropout layer. The final LSTM layer is connected to a fully connected output layer. A feature attention mechanism is introduced into the input layer of each LSTM unit to dynamically adjust the contribution weights of meteorological conditions and photovoltaic power features across different feature dimensions. At each time t, the input feature vector... Calculate feature attention weights The input feature vector includes meteorological data and power generation data, specifically historical power generation data, wind speed, global horizontal radiation, horizontal diffusion radiation, ambient temperature, relative humidity, wind direction, and daily rainfall, generating a weighted feature vector. :

[0076] ;

[0077] ;

[0078] in, , , The learnable parameters corresponding to the k-th feature; , , The learnable parameters corresponding to the j-th feature; The dimension of the input feature vector is given, and then the weighted feature vector is calculated. As input to the current LSTM unit.

[0079] The memory update formula for a single LSTM cell is:

[0080] ;

[0081] ;

[0082] ;

[0083] ;

[0084] ;

[0085] ;

[0086] In the formula, , , These are the forget gate, input gate, and output gate, respectively. Candidate cell state, In cellular state, In hidden state, For the Sigmoid function, This is element-wise multiplication; , , , These are the weight matrices for the forget gate, input gate, candidate cell state, and output gate, respectively. , , , These are the bias terms for the forget gate, input gate, candidate cell state, and output gate, respectively.

[0087] The stacked LSTM model contains three LSTM layers: the first LSTM layer has 64 units, the second LSTM layer has 32 units, and the third LSTM layer has 32 units. Each LSTM layer is followed by a dropout layer with a dropout rate of 0.01. The fully connected output layer consists of a single neuron.

[0088] Step S4: Divide the preprocessed time series dataset into training set, validation set and test set. The division of training set and test set adopts an adaptive sliding window mechanism, and the length of training window is dynamically adjusted according to the historical prediction error of the high frequency component and low frequency component of power generation data.

[0089] In step S4, when performing the m-th prediction, the mean absolute percentage error of the high-frequency components is: The mean absolute percentage error of the low-frequency components is Based on the mean absolute percentage error of the high-frequency components and the mean absolute percentage error of the low-frequency components, the following formula is used for the high-frequency window length. and low-frequency window length Update:

[0090] ;

[0091] ;

[0092] In the formula, The target error threshold, This is the step size adjustment coefficient. It is a symbolic function; , These are the high-frequency window length and low-frequency window length for the m-th prediction, respectively. , These represent the high-frequency window length and low-frequency window length for the (m-1)th prediction, respectively. When the high-frequency error increases, the high-frequency window is extended to incorporate more detailed information; when the low-frequency error increases, the low-frequency window is extended to capture long-term trends; when the error decreases, the window is shortened accordingly to reduce computational burden. The final training set window length is the maximum of the two or a weighted combination.

[0093] Step S5: Construct a hybrid loss function and train the stacked LSTM prediction model based on samples in the training set to obtain the trained stacked LSTM prediction model.

[0094] Training employs an adaptive moment estimation optimizer and a hybrid loss function to update the parameters of the stacked LSTM prediction model. In this example, training lasts for 50 iterations, with a batch size of 200 and an initial learning rate of 0.001.

[0095] Reference Figure 2 In one embodiment, the layers of the stacked LSTM prediction model are described in detail below:

[0096] (1) Input layer:

[0097] Input shape: (batch_size, time_steps, features);

[0098] time_steps=72 (72 past time points, each 5 minutes apart, totaling 6 hours of historical data);

[0099] features=6 (historical photovoltaic power + wind speed + global horizontal radiation + horizontal diffuse radiation + temperature + relative humidity). Feature attention weighting is performed immediately after the input layer (independent at each time step).

[0100] (2) First LSTM layer (64 units): Extracts short-term temporal dependencies and outputs the hidden state at each time step for use by the next layer. Activation function: default tanh, sigmoid is used for gating.

[0101] (3) First layer Dropout (rate=0.01): Randomly discard 1% of neurons to prevent overfitting.

[0102] (4) Second LSTM layer (32 units): Based on the low-level features extracted in the previous layer, learn more abstract mid-term time patterns. return_sequences=True, continue to pass the complete sequence.

[0103] (5) Second-level Dropout (rate=0.01);

[0104] (6) The third layer of LSTM (32 units): captures long-term dependencies, outputs the hidden state of the final time step (return_sequences=False), and no longer outputs the sequence.

[0105] (7) Third-level Dropout (rate=0.01);

[0106] (8) Fully connected output layer (1 neuron);

[0107] A linear transformation maps the hidden state of the third-layer LSTM to a single numerical value, namely the predicted photovoltaic power value (unit: kW or normalized value).

[0108] Before entering the main network, the original photovoltaic power sequence can be decomposed into multiple subsequences by Discrete Wavelet Transform (DWT) or Empirical Mode Decomposition (EMD) (e.g., 3-layer DWT yields 3 high-frequency detail components + 1 low-frequency approximation component). Each subsequence is predicted by an independent stacked LSTM sub-model with feature attention, and finally, the prediction results of all sub-models are weighted and summed to obtain the final prediction value.

[0109] For training, the dataset comes from DKASCAliceSprings (one year, 5-minute intervals), and is divided into training and testing sets at 80% and 20% respectively. 10% of the training set is then extracted as a validation set. A sliding window is used to generate samples. Each sample is input by 6 features over 72 consecutive time steps (6 hours), and the corresponding label is the average power value over the next 6 time steps (30 minutes).

[0110] The hybrid loss function constructed in step S5 As shown in the following formula:

[0111]

[0112] in, This is the mean square error term. For the smoothing constraint term, For seasonal consistency constraints, For physical constraint regularization terms, , , The regularization coefficients for the smoothness constraint, seasonal consistency constraint, and physical constraint regularization are respectively obtained through optimization on the validation set. The optimizer used is Adam, with an initial learning rate of 0.001, a batch size of 200, a maximum training epoch of 50 (early stopping if the validation loss does not decrease for 10 consecutive epochs), and a gradient clipping limit of 1.0. Furthermore, the training window length employs a dual-scale adaptive mechanism, adjusted separately based on the MAPE of the high-frequency and low-frequency components.

[0113] Mean square error term As shown in the following formula:

[0114] ;

[0115] Smoothing constraint As shown in the following formula:

[0116] ;

[0117] Seasonal Consistency Constraints As shown in the following formula:

[0118] ;

[0119] in, This is the average of the actual values ​​for the same period in history. This represents the total number of samples in the current prediction batch, i.e., the number of data points involved in the loss calculation. Let i be the actual power generation value of the i-th sample. Predict the power generation value for the model of the i-th sample; The total number of historical time steps considered for seasonal consistency constraints;

[0120] Physical constraint regularization term As shown in the following formula:

[0121] ;

[0122] in, The rated power of the power station To determine the maximum allowable ramp rate, in this embodiment, 0.2 times the rated capacity per 5 minutes is set.

[0123] In this embodiment, the training process is as follows:

[0124] 1. Generate input X (shape: [number of samples, 72, 6]) and label y (shape: [number of samples, 1]) from the training data using a sliding window.

[0125] 2. Initialize network weights (using Xavier for initialization).

[0126] 3. Within each epoch, the training set is randomly shuffled and fed into the stacked LSTM prediction model in batches (batchsize=200).

[0127] 4. Calculate the predicted value through forward propagation, and then calculate the mixed loss. .

[0128] 5. Backpropagation is used to calculate the gradient, and Adam updates the weights.

[0129] 6. After each epoch, calculate the loss and RMSE on the validation set. If the validation loss does not decrease for 10 consecutive epochs, stop training and restore the optimal model weights.

[0130] 7. After training, evaluate the final model on the test set.

[0131] During training, the training window length is not fixed, but dynamically adjusted based on the mean absolute percentage error (MAPE) of the most recent validation set.

[0132] ;

[0133] in, Let n be the length of the training window for the nth training iteration. This represents the length of the training window for the (n+1)th training iteration. The error of the nth training iteration; the initial window length. , Set the target error. Step length If the current error The window length is increased by 1 to incorporate more historical data; otherwise, it is decreased by 1 to reduce computational overhead. The window length is limited to [48, 144]. This mechanism enables the model to adapt to seasonal variations in photovoltaic power and sudden weather fluctuations.

[0134] Step S6: Input the meteorological data and power generation data from several time steps before the time period to be predicted into the trained stacked LSTM prediction model, and output the predicted power generation value of the target solar photovoltaic power station at the future time.

[0135] The feature data of several time steps prior to the time period to be predicted are input into the trained stacked LSTM prediction model, which outputs the predicted value of solar photovoltaic power generation at future times. Preferably, the several time steps are the past 72 time steps (each time step is 5 minutes), and the predicted power generation value is for the next 6 time steps (i.e., 30 minutes).

[0136] For the predicted power generation, the coverage probability and average prediction interval width are calculated at a 90% confidence level to quantify the prediction uncertainty. The prediction interval is obtained through quantile regression or Bayesian methods based on the residual distribution.

[0137] For the trained stacked LSTM prediction model, a forward validation method is used for model evaluation: at each step, the model is trained using the past 72 observations to predict the next 6 time steps, and then the training window is moved forward by one observation. This process is repeated until the entire test set is covered. The prediction results are evaluated using one or more of the following error metrics: root mean square error (RMSE), mean absolute error (MAE), and coefficient of determination (R²). 2 ), Explanation of variance, Symmetric Mean Absolute Percentage Error (sMAPE).

[0138] in:

[0139] ;

[0140] ;

[0141] in, Represents the total number of samples. Let i be the true value of the i-th sample. Let be the predicted value for the i-th sample. This represents the sample mean.

[0142] Figure 3 This paper presents the comparison results of different methods. The comparison of prediction models covers classic machine learning models and mainstream deep learning models. Among them, ANN is a traditional fully connected artificial neural network that can fit the nonlinear relationship between input features and photovoltaic power; XGBoost is an extreme gradient boosting tree that handles temporal features with its powerful ensemble learning capabilities; SVR is support vector regression that achieves nonlinear regression fitting in high-dimensional space based on kernel functions; 1DCNN is a one-dimensional convolutional neural network that focuses on extracting local features of time series; CNNLSTM is a hybrid model combining convolutional and recurrent networks, which has both spatial feature extraction and temporal dependency modeling capabilities; BiLSTM is a bidirectional long short-term memory network that can simultaneously utilize forward and backward contextual information of temporal data; the multi-layer stacked long short-term memory network used in this invention learns short-term, medium-term, and long-term temporal dependencies step by step through a multi-layer structure, and has a stronger ability to capture complex dynamic features. The average prediction errors of each model on the RMSE index are 2.67, 2.69, 2.80, 3.26, 3.14, 2.92, and 2.34, respectively, indicating that the method of this invention has the best prediction accuracy.

[0143] This invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the improved short-term solar photovoltaic power generation prediction method described above.

[0144] This invention also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the improved short-term solar photovoltaic power generation prediction method.

[0145] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made without departing from the spirit of the present invention.

Claims

1. An improved method for predicting short-term solar photovoltaic power generation, characterized in that, Perform the following steps S1-S6 to complete the power generation prediction of the target solar photovoltaic power station: Step S1: Collect meteorological data and power generation data of the solar photovoltaic power station at preset historical times, match the meteorological data and power generation data of each historical time to form a sample, and construct a time series dataset; Step S2: Preprocess each data point in the time series dataset; Step S3: Decompose the power generation data of the time series dataset into high-frequency components and low-frequency components, construct a stacked LSTM prediction model, perform normalization and feature extraction on each component independently to obtain the predicted value of each component, and then perform weighted summation and reconstruction based on the predicted value of each component to output the predicted power generation value. Step S4: Divide the preprocessed time series dataset into training set, validation set and test set. The division of training set and test set adopts an adaptive sliding window mechanism, and the length of training window is dynamically adjusted according to the historical prediction error of the high frequency component and low frequency component of power generation data. Step S5: Construct a hybrid loss function and train the stacked LSTM prediction model based on samples in the training set to obtain the trained stacked LSTM prediction model. Step S6: Input the meteorological data and power generation data from several time steps before the time period to be predicted into the trained stacked LSTM prediction model, and output the predicted power generation value of the target solar photovoltaic power station at the future time.

2. The improved short-term solar photovoltaic power generation prediction method according to claim 1, characterized in that, The meteorological data mentioned in step S1 includes wind speed, global horizontal radiation, horizontal diffuse radiation, ambient temperature, relative humidity, wind direction, and daily rainfall.

3. The improved short-term solar photovoltaic power generation prediction method according to claim 1, characterized in that, The preprocessing described in step S2 includes missing value handling, outlier detection and removal, feature selection, and data normalization.

4. An improved short-term solar photovoltaic power generation prediction method according to claim 1, characterized in that, In step S3, the power generation data sequence is decomposed into high-frequency and low-frequency components according to the following formula: ; In the formula, Here is the power generation data at time t. Let k be the high-frequency component of the k-th layer at time t. The low-frequency component of the Kth layer at time t; Each component is input into the stacked LSTM prediction model, normalized, and its features are extracted. The predicted values ​​of the high-frequency and low-frequency components are output. Based on the predicted values ​​of each component, the predicted power generation value is output as follows: ; in, Let be the predicted power generation value at time t. Let be the predicted value of the k-th layer high-frequency component at time t. Let be the predicted value of the low-frequency component of the Kth layer at time t.

5. An improved short-term solar photovoltaic power generation prediction method according to claim 1, characterized in that, A stacked LSTM prediction model is constructed, comprising multiple cascaded LSTM layers. Each LSTM layer contains multiple LSTM units, followed by a dropout layer. The final LSTM layer is connected to a fully connected output layer. A feature attention mechanism is introduced at the input layer of each LSTM unit. At each time t, the input feature vector is... Calculate feature attention weights The input feature vector includes meteorological data and power generation data, and a weighted feature vector is generated. : ; ; in, , , The learnable parameters corresponding to the k-th feature; , , The learnable parameters corresponding to the j-th feature; The dimension of the input feature vector is given, and then the weighted feature vector is calculated. As input to the current LSTM unit.

6. An improved short-term solar photovoltaic power generation prediction method according to claim 1, characterized in that, The stacked LSTM model described in step S3 contains three LSTM layers: the first LSTM layer has 64 units, the second LSTM layer has 32 units, and the third LSTM layer has 32 units. Each LSTM layer is followed by a dropout layer with a dropout rate of 0.

01. The fully connected output layer consists of one neuron.

7. An improved short-term solar photovoltaic power generation prediction method according to claim 1, characterized in that, In step S4, when performing the m-th prediction, the mean absolute percentage error of the high-frequency components is: The mean absolute percentage error of the low-frequency components is Based on the mean absolute percentage error of the high-frequency components and the mean absolute percentage error of the low-frequency components, the following formula is used for the high-frequency window length. and low-frequency window length Update: ; ; In the formula, The target error threshold, This is the step size adjustment coefficient. It is a symbolic function; , These are the high-frequency window length and low-frequency window length for the m-th prediction, respectively. , These are the high-frequency window length and low-frequency window length for the (m-1)th prediction, respectively. The final training window length is the maximum value of the two or a weighted combination.

8. An improved short-term solar photovoltaic power generation prediction method according to claim 1, characterized in that, The hybrid loss function constructed in step S5 As shown in the following formula: ; in, This is the mean square error term. For the smoothing constraint term, For seasonal consistency constraints, For physical constraint regularization terms, , , These are the regularization coefficients for the smoothing constraint, seasonal consistency constraint, and physical constraint regularization, respectively. Mean square error term As shown in the following formula: ; Smoothing constraint As shown in the following formula: ; Seasonal Consistency Constraints As shown in the following formula: ; in, This is the average of the actual values ​​for the same period in history. This represents the total number of samples in the current prediction batch. Let i be the actual power generation value of the i-th sample. Predict the power generation value for the model of the i-th sample; The total number of historical time steps considered for seasonal consistency constraints; Physical constraint regularization term As shown in the following formula: ; in, The rated power of the power station This represents the maximum allowable gradeability.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements an improved short-term solar photovoltaic power generation prediction method as described in any one of claims 1-8.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements an improved short-term solar photovoltaic power generation prediction method as described in any one of claims 1-8.