Photovoltaic power generation power prediction method and device, terminal and medium
Through the SQGRU-Transformer prediction model, combined with CNN, SQGRU and Transformer modules, the shortcomings of the existing photovoltaic power prediction methods in timing feature extraction and sequence relationship comparison are solved, and more efficient and accurate photovoltaic power prediction is achieved.
Patent Information
- Application Number
- CN202510177852.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-18
- Publication Date
- 2025-06-27
AI Technical Summary
The existing photovoltaic power prediction methods are poor in timing feature extraction and sequence relationship comparison, resulting in limitations in the short-term photovoltaic power prediction accuracy.
The SQGRU-Transformer prediction model is adopted to reduce the feature dimension of the input data through the CNN network, and the SQGRU module integrating the stacked gating cycle is used for timing feature extraction and position embedding, and the Transformer module combining the autocorrelation attention mechanism is used to mine the timing relationship between meteorological data and power data.
The prediction accuracy and learning efficiency of photovoltaic power generation power are improved, and the prediction model's adaptability to prediction days with large differences in meteorological data is enhanced, achieving more effective information aggregation and fitting effects.
Smart Images

Figure CN120222322A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of new energy power generation, and particularly relates to a photovoltaic power prediction method, device, terminal and medium. Background Art
[0002] At present, with the substantial increase in photovoltaic installed capacity, since photovoltaic power generation is affected by weather conditions and has the characteristics of volatility and randomness, it will bring pressure to the operation and dispatching of the power grid, greatly increasing the difficulty of power grid regulation. Accurate prediction of photovoltaic power can effectively solve this problem, and it is of great significance to achieve accurate prediction of photovoltaic power.
[0003] In terms of the classification of prediction methods, photovoltaic power prediction methods are usually divided into physical prediction methods and statistical prediction methods. Among them, the physical prediction method establishes a prediction model according to the power generation principle, but this type of method has too high requirements for the accuracy of the model and is prone to deviation. Statistical prediction methods are further divided into traditional statistical methods and deep learning methods. Among them, the traditional statistical method mainly analyzes the laws of historical data to build a prediction model. Common traditional statistical methods include Bayesian statistics, Markov chain, and SARIMA seasonal difference moving average autoregressive model, etc. Although such methods have achieved good prediction effects, their prediction ability is poor when the photovoltaic power fluctuates greatly, and their prediction accuracy will be greatly reduced.
[0004] In addition, deep learning methods mainly include convolutional neural network, long short-term memory neural network, and attention mechanism, etc.; in some related technologies, Spearman correlation coefficient is used to select influencing factors with high correlation of photovoltaic power at different times, and then a long short-term memory network model is established for each time respectively to achieve time-sharing prediction and improve the single long short-term memory network architecture; in other related technologies, distance correlation coefficient and principal component analysis method are incorporated into the CNN convolutional neural network, and the FCM-WS-CNN model is constructed using the training data weighted by the membership matrix to achieve effective prediction of photovoltaic power generation; however, it is difficult for the above methods to have good effects in both time series feature extraction and sequence relationship comparison, and there are limitations in the prediction accuracy of short-term photovoltaic power. Therefore, how to effectively improve the prediction efficiency and prediction accuracy of photovoltaic power generation is still a technical problem to be solved in this field. Summary of the Invention
[0005] To solve the deficiencies in the prior art, the present invention provides a photovoltaic power prediction method, device, terminal and medium. By selecting similar days and using the SQGRU-Transformer prediction model to mine the time series relationship between input sequences, more effective information aggregation is realized, the learning efficiency is higher, and the prediction efficiency and prediction accuracy of photovoltaic power are effectively improved.
[0006] The present invention adopts the following technical solutions.
[0007] In a first aspect, the present invention provides a photovoltaic power prediction method, which includes:
[0008] Collecting multiple sets of historical photovoltaic power data and corresponding meteorological data at a set time interval to construct an original data set;
[0009] Performing preprocessing of selecting similar days on the original data set to form a sample set;
[0010] Dividing the sample set into a training set, a validation set and a test set according to a set ratio;
[0011] Based on the training set, training the constructed SQGRU-Transformer prediction model with the goal of minimizing the loss function, and determining the optimal parameters of the model in combination with the validation set;
[0012] Inputting the meteorological data of each prediction day in the test set and the photovoltaic power data and meteorological data of the historical similar days corresponding to their respective weather types into the SQGRU-Transformer prediction model with the optimal parameters for prediction, and obtaining the photovoltaic power prediction results corresponding to each prediction day.
[0013] Optionally, the prediction process of the SQGRU-Transformer prediction model includes: first reducing the feature dimension of the input data through a CNN network; then using the SQGRU module that fuses stacked gated recurrent units to encode the positional embedding of the time series after dimensionality reduction, so as to provide inductive bias information for the time series input; finally, mining the temporal relationship between the meteorological data and the power data in the output sequence of the SQGRU module through the Transformer module based on the self-correlation attention mechanism for temporal prediction, and finally outputting the photovoltaic power prediction result of the prediction day.
[0014] Optionally, the steps of performing preprocessing of selecting similar days on the original data set include:
[0015] Based on the obtained meteorological data, calculating the grey relational degree coefficients of each group of data in the original data set between the prediction day and each corresponding historical day in each meteorological factor, so as to obtain the comprehensive similarity between each historical day and the prediction day in each group of data;
[0016] Sorting the comprehensive similarity values of each historical day in each group of data from large to small, and selecting the historical days with the top Z% of the comprehensive similarity values in the sorting as the similar days of their corresponding prediction days; where Z is a preset value;
[0017] For each prediction day, combine the photovoltaic power generation data and meteorological data corresponding to each similar day and perform normalization processing to form each sample in the sample set.
[0018] Optionally, the meteorological factors include irradiance, temperature, and / or humidity.
[0019] Optionally, the expression of the comprehensive similarity is as follows:
[0020] σ i = λ1r i 1 + λ2r i 2 + λ3r i 3
[0021] In the formula, σ i represents the comprehensive similarity between the i-th historical day and its corresponding prediction day; λ1, λ2, and λ3 are the similarity weights of r i 1 , r i 2 and r i 3 respectively; r i 1 , r i 2 and r i 3 respectively represent the grey correlation coefficients of irradiance, temperature, and humidity between the i-th historical day and the prediction day.
[0022] Optionally, the similarity weights r i 1 , r i 2 and r i 3 are obtained based on the historical photovoltaic power generation data and optimized by combining the shuffled frog leaping SFLA algorithm.
[0023] Optionally, the SQGRU module integrating stacked gated recurrent units includes multiple double-layer gated recurrent units with the same structure. Each double-layer gated recurrent unit includes a pair of first high-low level gated recurrent units and second high-low level gated recurrent units that are reverse complementary; the first high-low level gated recurrent unit includes a forward low-level gated recurrent unit layer and a backward high-level gated recurrent unit layer The second high-low level gated recurrent unit includes a backward low-level gated recurrent unit layer and a forward high-level gated recurrent unit layer The unit layer and Both include N GRU units connected in sequence; where the subscript l is the serial number of the double-layer gated recurrent unit, l = 1, 2... L; L is the number of double-layer gated recurrent units; N is the feature dimension of the input data.
[0024] Optionally, each GRU unit in the unit layer extracts the features of each dimension of the input data time series in sequence from front to back, and outputs the hidden layer state corresponding to each GRU Correspondingly, each GRU unit in the unit layer refines the feature information of each hidden layer state output by the unit layer in sequence from back to front, and outputs the hidden layer state corresponding to each GRU
[0025] Each GRU unit in the unit layer extracts the features of each dimension of the input data time series in sequence from back to front, and outputs the hidden layer state corresponding to each GRU Correspondingly, each GRU unit in the unit layer refines the feature information of each hidden layer state output by the unit layer in sequence from front to back, and outputs the hidden layer state corresponding to each GRU
[0026] After merging the hidden layer states output by the unit layer and the unit layer respectively, the output sequence of the l-th double-layer gated recurrent unit is obtained Among them, t ∈ [1, N]; represents the output feature after the l-th double-layer gated recurrent unit refines the information of the t-th dimension feature in the input data time series.
[0027] Optionally, the hidden layer states corresponding to each GRU in the unit layer and the unit layer in the first high-low level gated recurrent unit and respectively satisfy the following formula:
[0028]
[0029] In the formula, represents that the GRU unit extracts features from front to back; represents the hidden layer state after the input data of the previous t - 1 dimensions is extracted by the first t - 1 GRU units in the unit layer in sequence from front to back; Represents the data of the t-th dimension input to the l-th double-layer gated recurrent unit; Indicates that the GRU unit extracts features from back to front; Represents the input data of the last N - t dimensions after passing through the unit layer The hidden layer state after the last N - t GRU units in the unit layer extract features from back to front in sequence.
[0030] Optionally, the hidden layer states corresponding to each GRU in the unit layer and the unit layer of the second high-low level gated recurrent unit and respectively satisfy the following formula:
[0031]
[0032] In the formula, Indicates that the GRU unit extracts features from back to front; Represents the hidden layer state after the input data of the last N - t dimensions passes through the last N - t GRU units in the unit layer and extracts features from back to front in sequence; Represents the data of the t-th dimension input to the l-th double-layer gated recurrent unit; Indicates that the GRU unit extracts features from front to back; Represents the hidden layer state after the input data of the first t - 1 dimensions passes through the first t - 1 GRU units in the unit layer and extracts features from front to back in sequence.
[0033]
[0033] Optionally, the expression of the loss function is as follows:
[0034]
[0035] In the formula, is the true value of the j-th sample, y j is the predicted value of the j-th sample, and n is the number of samples in the training set.
[0036] In a second aspect, the present invention provides a photovoltaic power prediction device that operates according to the steps of any one of the methods in the first aspect of the present invention. The device includes:
[0037] An acquisition module, configured to collect multiple sets of historical photovoltaic power data and corresponding meteorological data at a set time interval, and construct an original data set;
[0038] A preprocessing module, configured to perform preprocessing of selecting similar days on the original data set to form a sample set;
[0039] A partitioning module for partitioning the sample set into a training set, a validation set, and a test set according to a set ratio;
[0040] A training module for training the constructed SQGRU-Transformer prediction model based on the training set with the goal of minimizing the loss function, and determining the optimal parameters of the model in combination with the validation set;
[0041] A prediction module for inputting the meteorological data of each prediction day in the test set and the photovoltaic power data and meteorological data of the historical similar days corresponding to the weather types into the SQGRU-Transformer prediction model with optimal parameters for prediction, and obtaining the photovoltaic power prediction results corresponding to each prediction day.
[0042] In a third aspect, the present invention provides a terminal, including a processor and a storage medium;
[0043] The storage medium is used for storing instructions;
[0044] The processor is used to operate according to the instructions to execute the steps of the method described in any one of the first aspects of the present invention.
[0045] In a fourth aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, it implements the steps of the method described in any one of the first aspects of the present invention.
[0046] The beneficial effects of the present invention are as follows. Compared with the prior art:
[0047] 1. Aiming at the problem of the limitation of the prediction accuracy of short-term photovoltaic power by traditional algorithm models, the SQGRU-Transformer prediction model designed by the present invention based on the fusion of stacked gated recurrent attention is an efficient algorithm prediction model with high prediction accuracy. This model obtains features of photovoltaic data through a CNN network and reduces the data dimension, extracts temporal features and performs position embedding operations through an SQGRU network, more accurately finds the relationship between sequences through self-correlation attention and breaks the information utilization bottleneck, and finally constructs a feature vector based on the relatively highly correlated photovoltaic power and meteorological features and similar-day data to predict the photovoltaic power; compared with traditional physical prediction methods and deep learning methods, the prediction accuracy is higher and the learning efficiency is more efficient.
[0048] 2. The present invention calculates the comprehensive similarity between historical days and prediction days through the selection of similar days, classifies and predicts different weather types, and improves the adaptability of the prediction model to prediction days with large differences in meteorological data. In addition, the SQGRU model that fuses and stacks gated recurrent units, improved based on GRU, can repeatedly extract the features of time series data from different aspects. The Transformer module based on the self - correlation attention mechanism then mines the time series relationship between meteorological data and power data among the output sequences of SQGRU. The combination of the two can achieve more effective information aggregation and achieve a better fitting effect, with a significant improvement in prediction accuracy. The present invention has greatly improved the prediction accuracy while reducing the training time of the model with low loss. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 It is a schematic flow chart of the photovoltaic power prediction method in the embodiment of the present invention;
[0050] Figure 2 It is for the SQGRU - Transformer attention model in the embodiment of the present invention;
[0051] Figure 3 It is a schematic diagram of the comparison result of the photovoltaic power prediction curves of the Transformer model, Imformer model, Autoformer model and the prediction model designed by the invention on sunny, cloudy and rainy days in the embodiment of the present invention;
[0052] Figure 4 It is a schematic block diagram of the structure principle of the photovoltaic power prediction device in the embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0053] To make the objectives, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. The embodiments described herein are only a part of the embodiments of the present invention, rather than all of them. All other embodiments obtained by those of ordinary skill in the art based on the spirit of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0054] Embodiment 1:
[0055] Referring to Figure 1 , the embodiment of the present invention provides a photovoltaic power prediction method, which specifically includes the following steps:
[0056] Step 1: Collect multiple groups of historical photovoltaic power data and corresponding meteorological data at a set time interval to construct an original data set;
[0057] Step 2: Perform preprocessing on the original dataset to select similar days and form a sample set;
[0058] Step 3: Divide the sample set into a training set, a validation set, and a test set according to a set ratio;
[0059] Step 4: Based on the training set, train the constructed SQGRU-Transformer prediction model with the goal of minimizing the loss function, and determine the optimal parameters of the model in combination with the validation set;
[0060] Step 5: Input the meteorological data of each prediction day in the test set and the photovoltaic power generation data and meteorological data of the historical similar days corresponding to the weather types into the SQGRU-Transformer prediction model with optimal parameters for prediction, and obtain the photovoltaic power generation prediction results corresponding to each prediction day.
[0061] Specifically, in this embodiment, wind power data from a certain wind-solar-hydrogen energy storage microgrid demonstration project and local meteorological bureau data are collected. The data is sampled every 15 minutes. The dataset is divided into a training set, a validation set, and a test set in a ratio of 8:1:1. The training set is used to train and establish the model, the validation set is used to determine the performance of the trained model, and the test set is used to evaluate the prediction ability of the model.
[0062] As an embodiment of the present invention, the steps of performing preprocessing on the original dataset to select similar days in Step 2 include:
[0063] S2.1: Based on the obtained meteorological data, calculate the grey correlation degree coefficients of each group of data in the original dataset between the prediction day and each corresponding historical day for each meteorological factor, so as to obtain the comprehensive similarity between each historical day and the prediction day in each group of data;
[0064] Preferably, in this embodiment, vectors are constructed considering three meteorological factors: irradiance, temperature, and humidity to select photovoltaic similar days. The historical meteorological data is used to construct the variables of each historical day in the meteorological factors, and the prediction day meteorological data is used to construct the variables of the prediction day in the meteorological factors;
[0065] Calculate the grey correlation degree between the historical day variables and the prediction day variables. The formula is:
[0066]
[0067] In the formula, ξ i(k) represents the correlation degree of the variable at the k-th sampling moment on the i-th historical day and the prediction day; x0(k) is the reference meteorological sequence on the prediction day, which is an ideal standard selected manually and consists of the optimal values of each index; k is the sampling point position, and m is the number of sampling points in a day; ρ is the discrimination factor, and its value is related to the discrimination degree. As the value increases, the discrimination degree becomes smaller. Usually, ρ = 0.5; r i is the similarity factor of the variable on the i-th historical day;
[0068] According to Equation (1) and Equation (2), the similarity factors r i 1 、r i 2 、r i 3 of the three meteorological characteristics of irradiance, temperature, and humidity of the variable on the i-th historical day can be obtained. By adding the similarity weight value between the correlation coefficients, the comprehensive similarity factor σ i between the variable on the i-th historical day and the variable on the prediction day can be obtained. The formula is as follows:
[0069] σ i =λ1r i 1 +λ2r i 2 +λ3r i 3 (3)
[0070] In the formula, σ i represents the comprehensive similarity degree between the i-th historical day and its corresponding prediction day; λ1, λ2, and λ3 are the similarity weight values of r i 1 、r i 2 and r i 3 respectively; r i 1 、r i 2 and r i 3 represent the grey correlation degree coefficients of irradiance, temperature, and humidity between the i-th historical day and the prediction day respectively.
[0071] In a preferred but non-limiting embodiment, in order to obtain better technical effects, the embodiment of the present invention is based on the historical data of photovoltaic power generation and combines the similarity weight values r i 1 、r i 2 and r i 3 optimized by the Shuffled Frog Leaping Algorithm (SFLA) in the formula (3); in this embodiment, λ1 = 0.8, λ2 = 0.5, and λ3 = 0.3.
[0072] S2.2: Sort the comprehensive similarity values of each historical day in each group of data in descending order, and select the historical days with the top Z% of the comprehensive similarity values in the sorting as the similar days for their corresponding prediction days; where Z is a preset value.
[0073] Preferably, in this embodiment, σ i is selected such that the historical days in the top 35% of the sequence are used as similar days.
[0074] S2.3: Combine and normalize the photovoltaic power generation data and meteorological data of each prediction day and its corresponding similar days respectively to form each sample in the sample set.
[0075] Among them, the input sample of each sample in the sample set is a feature vector composed of the meteorological data of the prediction day and the photovoltaic power generation data and meteorological data of its corresponding similar days, and the corresponding output sample is the power data of its prediction day.
[0076] Based on the above, when training the SQGRU-Transformer prediction model in step 4, the CNN network is used to extract the data features of the input samples to reduce the data dimension. The CNN network passes through the convolutional layer, pooling layer and fully connected layer to better capture the features and dependencies between time series data, obtain the spatial correlation features of the data, and obtain valuable hidden state feature vectors in a large amount of multivariate data; input the historical feature data and the feature sequence data after fusing the future prediction days into the SQGRU module, and encode the position embedding through the SQGRU network to provide inductive bias information for the time series input and retain the position information of the data; send the feature sequence output by the SQGRU into the Transformer module based on the self-correlation attention mechanism to achieve efficient cascading, and input the feature K and feature V processed by the encoder and the feature Q processed by the decoder into the self-correlation attention mechanism of the decoder; finally, through the forward propagation layer and the linear layer, etc., realize the non-linear mapping and output the prediction result corresponding to the input sample; it should be noted that in the photovoltaic power similar day data set, the power change laws of sunny, cloudy, rainy and other weather are similar respectively. Based on the self-correlation attention mechanism, the extended information utility can be realized, the similar day data can be effectively utilized, the similar information of the feature sequence can be learned, and the data law between the prediction day and the feature sequence can be found, so as to improve the prediction accuracy of the photovoltaic power generation on the prediction day.
[0077] During the training process, it is judged whether the SQGRU-Transformer model reaches the iteration termination condition. When the loss is minimized, the iteration is stopped and the parameter setting stage is entered. Otherwise, the model parameters are optimized with the minimum loss and the iteration loop continues; in this embodiment, the cosine similarity loss function is adopted, and its formula is as follows:
[0078]
[0079] wherein, is the true value of the j-th sample, and y j is the predicted value of the j-th sample, and n is the number of samples in the training set.
[0080] Furthermore, the optimal parameters of the model are determined using the validation set. Appropriate parameters are determined according to the model. The general parameters of the model are: model type features, encoder input dimension enc_in, decoder input dimension dec_in, output dimension c_out; model size d_model, number of multi-head attentions n_heads, batch size batach_size; encoder input length seq_len, decoder input length label_len, output length pred_len; number of training iterations train_epochs, etc.
[0081] Finally, the data is substituted into the model with the parameters set, and the test set is predicted based on the optimal model, and the performance of the model is evaluated;
[0082] Correspondingly, the prediction process of the SQGRU-Transformer prediction model in step 5 includes: first reducing the feature dimension of the input data through a CNN network; then using the SQGRU module that fuses stacked gated recurrent units to encode the positional embedding of the time series after dimensionality reduction, so as to provide inductive bias information for the time series input; finally, mining the temporal relationship between meteorological data and power data in the output sequence of the SQGRU module through the Transformer module based on the self-correlation attention mechanism for temporal prediction, and finally outputting the predicted result of the photovoltaic power generation on the predicted day.
[0083] A preferred but non-limiting embodiment, referring to Figure 2 , in this embodiment, the SQGRU module that fuses stacked gated recurrent units includes a plurality of double-layer gated recurrent units with the same structure, and each of the double-layer gated recurrent units includes a pair of reverse complementary first high-low level gated recurrent units and second high-low level gated recurrent units; the first high-low level gated recurrent unit includes a forward low-level gated recurrent unit layer and a backward high-level gated recurrent unit layer The second high-low level gated recurrent unit includes a backward low-level gated recurrent unit layer and a forward high-level gated recurrent unit layer The unit layer and All include N GRU units connected in sequence; where the subscript l is the serial number of the double-layer gated recurrent unit, l = 1, 2... L; L is the number of double-layer gated recurrent units; N is the feature dimension of the input data.
[0084] The SQGRU module in this embodiment is an improvement on the basic structure of GRU, establishing a multi-level bidirectional gated recurrent unit to capture the current photovoltaic information and reduce errors.
[0085] Specifically, each forward low-level gated recurrent unit layer The GRU units in it sequentially extract the features of each dimension of the input data time series from front to back and output the hidden layer states corresponding to each GRU Correspondingly, each backward high-level gated recurrent unit layer The GRU units in it sequentially refine the feature information of the hidden layer states output by the unit layer from back to front and output the hidden layer states corresponding to each GRU
[0086] Specifically, the hidden layer states corresponding to each GRU in the unit layer and the unit layer in the first high-low level gated recurrent unit and respectively satisfy the following formula:
[0087]
[0088] In the formula, represents that the GRU unit extracts features from front to back; represents the hidden layer state after the input data of the first t - 1 dimensions (i.e., the input data of the first t - 1 sampling points) is sequentially extracted by the first t - 1 GRU units in the unit layer from front to back; represents the data of the t-th dimension input to the l-th double-layer gated recurrent unit; represents that the GRU unit extracts features from back to front; represents the hidden layer state after the input data of the last N - t dimensions is sequentially extracted by the last N - t GRU units in the unit layer from back to front.
[0089] Similarly, each backward low-level gated recurrent unit layer The GRU units in it sequentially extract the features of each dimension of the input data time series from back to front and output the hidden layer states corresponding to each GRU Correspondingly, each forward high-level gated recurrent unit layer Each GRU unit in the [unit layer] sequentially extracts features from the hidden layer states output by the previous unit layer in order from front to back, and outputs the hidden layer states corresponding to each GRU. The hidden layer states output by the [unit layer] are refined to output the hidden layer states corresponding to each GRU.
[0090] Specifically, the hidden layer states corresponding to each GRU in the unit layer and the unit layer of the second high-low gated recurrent unit respectively satisfy the following equations: and respectively satisfy the following equations:
[0091]
[0092] In the equations, represents that the GRU unit extracts features from back to front; represents the hidden layer state after the input data of the last N - t dimensions are sequentially extracted from back to front by the last N - t GRU units in the unit layer ; represents the data of the t-th dimension input to the l-th double-layer gated recurrent unit; represents that the GRU unit extracts features from front to back; represents the hidden layer state after the input data of the first t - 1 dimensions are sequentially extracted from front to back by the first t - 1 GRU units in the unit layer ;
[0093] Furthermore, after merging the hidden layer states output by the unit layer and the unit layer respectively, the output sequence of the l-th double-layer gated recurrent unit is obtained.
[0094]
[0095] In the equations, represents the output feature after the l-th double-layer gated recurrent unit refines the feature of the t-th dimension in the input data time series.
[0096] Furthermore, the output of the l-th double-layer gated recurrent unit is the input of the output of the (l + 1)-th double-layer gated recurrent unit; finally, the output of the SQGRU module is expressed as In this embodiment, the value of L is 3.
[0097] It should be noted that in the prediction model constructed in this embodiment, the input samples are subjected to feature fusion through a CNN network, and a more comprehensive representation is obtained without losing data features, enabling the model input to learn meteorological factors and similar-day features while paying more attention to historical power data, and enhancing the reliability and diversity of the input data.
[0098] In addition, in view of the data characteristics of photovoltaic power, the SQGRU module fully mines the historical information of the data, discovers information relationships in future information, and processes the feature data composed of similar-day photovoltaic power, historical photovoltaic power, corresponding meteorological data, and future meteorological data; the SQGRU module reads the input data information from front to back through multiple groups of first-level and second-level high-low gating recurrent units with reverse complementarity, and refines the input data information again from back to front to realize the learning of future sequence data, which can more effectively capture the features of the current data point and achieve more effective information aggregation.
[0099] Furthermore, the Transformer module is also used to cascade the sequence level through the multi-head self-correlation attention mechanism, extract features using the attention mechanism, support the parallel processing of the input sequence, thereby bringing a faster training speed; and it has a stronger long-term dependence modeling ability and better effects on long sequences. The present invention realizes the expansion of information utility based on the self-correlation attention mechanism, effectively utilizes similar-day data, learns the similar information of the feature sequence, and finds the data law between the prediction day and the feature sequence.
[0100] To verify the effectiveness of the photovoltaic power prediction method provided by the present invention, the existing Transformer model, Imformer model, Autoformer model and the SQGRU-Transformer prediction model designed by the invention are respectively used to perform photovoltaic power prediction under sunny, cloudy, and rainy weather conditions, and the comparison results are as Figure 3 shown.
[0101] From Figure 3 the comparison results with the true values, it can be seen that under the three different meteorological conditions, the SQGRU-Transformer prediction model based on the present invention can follow the true values more accurately than the above existing models, without drastic fluctuations, with a high fitting degree, showing good trend prediction ability; the simulation experiment proves the superiority of the method proposed by the present invention.
[0102] The beneficial effects of the present invention are as follows: compared with the prior art:
[0103] 1. Aiming at the problem of the limitation of the prediction accuracy of traditional algorithm models for short-term photovoltaic power prediction, the SQGRU-Transformer prediction model based on the fusion of stacked gated recurrent attention designed by the present invention is an efficient algorithm prediction model with high prediction accuracy. This model obtains features of photovoltaic data through a CNN network and reduces the data dimension, extracts temporal features and performs position embedding operations through an SQGRU network, and more accurately finds the relationship between sequences and breaks the information utilization bottleneck through self-correlation attention. Finally, a feature vector is constructed based on the highly correlated photovoltaic power and meteorological features and similar-day data to predict the photovoltaic power. Compared with traditional physical prediction methods and deep learning methods, the prediction accuracy is higher and the learning efficiency is more efficient.
[0104] 2. The present invention calculates the comprehensive similarity between historical days and prediction days through the selection of similar days, and conducts classification prediction for different weather types to improve the adaptability of the prediction model to prediction days with large differences in meteorological data. In addition, the SQGRU model with a fused stacked gated recurrent network improved on the basis of GRU can repeatedly extract features of time-series data from different aspects, and the Transformer module based on the self-correlation attention mechanism further mines the temporal relationship between meteorological data and power data among the output sequences of SQGRU. The combination of the two can achieve more effective information aggregation and achieve a better fitting effect, with a significant improvement in prediction accuracy. The present invention has greatly improved the prediction accuracy under the condition of low loss and short model training time.
[0105] Embodiment 2:
[0106] As Figure 4 shown, the present invention provides a photovoltaic power prediction device, which is used to implement the steps of the method in Embodiment 1 above. The device specifically includes:
[0107] An acquisition module, configured to acquire multiple groups of historical photovoltaic power data and corresponding meteorological data at a set time interval, and construct an original data set;
[0108] A preprocessing module, configured to perform preprocessing of similar-day selection on the original data set to form a sample set;
[0109] A partitioning module, configured to partition the sample set into a training set, a validation set, and a test set according to a set ratio;
[0110] A training module, configured to train the constructed SQGRU-Transformer prediction model based on the training set with the goal of minimizing the loss function, and determine the optimal parameters of the model in combination with the validation set;
[0111] A prediction module, configured to input the meteorological data of each prediction day in the test set and the photovoltaic power generation data and meteorological data of the historical similar days corresponding to the weather types thereof into the SQGRU-Transformer prediction model with optimal parameters for prediction, so as to obtain the photovoltaic power generation prediction results corresponding to each prediction day.
[0112] The photovoltaic power generation prediction device provided by an embodiment of the present invention and the photovoltaic power generation prediction method provided by Embodiment 1 are based on the same technical concept, and can produce the beneficial effects as described in Embodiment 1. The content not described in detail in this embodiment can be referred to in Embodiment 1.
[0113] Embodiment 3:
[0114] A terminal provided by an embodiment of the present invention includes a processor and a storage medium;
[0115] The storage medium is used for storing instructions;
[0116] The processor is used for operating according to the instructions to execute the steps of the method according to any one of Embodiment 1.
[0117] Embodiment 4:
[0118] A computer-readable storage medium provided by an embodiment of the present invention stores a computer program, and when the program is executed by a processor, the steps of the method according to any one of Embodiment 1 are implemented.
[0119] The present disclosure may be a system, a method, and / or a computer program product. The computer program product may include a computer-readable storage medium having thereon computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.
[0120] A computer-readable storage medium can be a tangible device that can retain and store instructions for use by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disc (DVD), a memory stick, a floppy disk, a mechanically encoded device such as a punch card or raised structures in grooves having instructions stored thereon, and any suitable combination of the foregoing. The computer-readable storage medium as used herein is not construed to be a transitory signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., an optical pulse through an optical fiber cable), or an electrical signal transmitted through a wire.
[0121] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to various computing / processing devices, or downloaded to an external computer or external storage device through a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network may include a copper transmission cable, an optical fiber transmission, a wireless transmission, a router, a firewall, a switch, a gateway computer, and / or an edge server. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in each computing / processing device.
[0122] The computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine - related instructions, microcode, firmware instructions, state - setting data, or source code or object code written in any combination of one or more programming languages, including object - oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer - readable program instructions may be executed entirely on the user's computer, partially on the user's computer, executed as a stand - alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider). In some embodiments, by using the state information of the computer - readable program instructions to customize an electronic circuit, such as a programmable logic circuit, a field - programmable gate array (FPGA), or a programmable logic array (PLA), the electronic circuit can execute the computer - readable program instructions to implement various aspects of the present disclosure.
[0123] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the above embodiments, those of ordinary skill in the art should understand that: it is still possible to modify the specific embodiments of the present invention or make equivalent replacements. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention shall be covered by the protection scope of the claims of the present invention.
Claims
1. A photovoltaic power generation power prediction method, characterized in that: Methods include: Collect multiple sets of photovoltaic power generation historical data and corresponding meteorological data at set time intervals to construct original data sets; Preprocessing the original data set by selecting similar days to form a sample set; Dividing the sample set into a training set, a validation set and a test set according to a set ratio; Based on the training set, the constructed SQGRU-Transformer prediction model is trained with the goal of minimizing the loss function, and the optimal parameters of the model are determined in combination with the validation set; The meteorological data of each forecast day in the test set and the photovoltaic power generation data and meteorological data of historical similar days of their corresponding weather types are respectively input into the SQGRU-Transformer prediction model with optimal parameters for prediction, and the photovoltaic power generation prediction results corresponding to each forecast day are obtained.
2. The photovoltaic power generation prediction method according to claim 1, characterized in that: The prediction process of the SQGRU-Transformer prediction model includes: firstly reducing the feature dimension of the input data through the CNN network; then using the SQGRU module fused with stacked gated loops to encode the position embedding of the time series after dimensionality reduction, thereby providing inductive bias information for the time series input; finally, using the Transformer module based on the autocorrelation attention mechanism to mine the time series relationship between the meteorological data and the power data in the output sequence of the SQGRU module to perform time series prediction, and finally output the photovoltaic power generation power prediction result of the prediction day.
3. The photovoltaic power generation prediction method according to claim 1, characterized in that: The steps of preprocessing the original data set by selecting similar days include: Based on the acquired meteorological data, the grey correlation coefficients of the predicted day and the corresponding historical days in each group of data in the original data set on each meteorological factor are calculated respectively, so as to obtain the comprehensive similarity between each historical day and the predicted day in each group of data; The comprehensive similarity values of each historical day in each group of data are sorted in descending order, and the historical days with comprehensive similarity values that are in the top Z% in the sorting are selected as similar days to the corresponding predicted day; wherein Z is a preset value; The photovoltaic power generation data and meteorological data of each forecast day and its corresponding similar days are combined and normalized to form each sample in the sample set.
4. The photovoltaic power generation prediction method according to claim 3, characterized in that: The meteorological factors include irradiance, temperature and / or humidity.
5. The photovoltaic power generation prediction method according to claim 3 or 4, characterized in that: The expression of the comprehensive similarity is as follows: s i =λ1r i 1 +λ2r i 2 +λ3r i 3 In the formula, σ i represents the comprehensive similarity between the i-th historical day and its corresponding forecast day; λ1, λ2 and λ3 are r i 1 、r i 2 and r i 3 Similarity weight of i 1 、r i 2 and r i 3 Represent the grey correlation coefficients of irradiance, temperature and humidity between the i-th historical day and the predicted day respectively.
6. The photovoltaic power generation prediction method according to claim 5, characterized in that: The similarity weight r i 1 、r i 2 and r i 3 The value of is based on the historical data of photovoltaic power generation and is optimized in combination with the hybrid frog leapfrog SFLA algorithm.
7. The photovoltaic power generation prediction method according to claim 2, characterized in that: The SQGRU module of the fused stacked gated loop includes a plurality of double-layer gated loop units with the same structure, each of which includes a pair of reverse complementary first high-low-level gated loop units and second high-low-level gated loop units; the first high-low-level gated loop unit includes a forward low-level gated loop unit layer and a backward high-level gated recurrent unit layer The second high-low level gated recurrent unit includes a backward low level gated recurrent unit layer and a forward high-level gated recurrent unit layer The unit layer and They all include N GRU units connected in sequence; where the subscript l is the serial number of the double-layer gated recurrent unit, l = 1, 2...L; L is the number of double-layer gated recurrent units; and N is the feature dimension of the input data.
8. The photovoltaic power generation prediction method according to claim 7, characterized in that: The unit layer Each GRU unit in the extracts the dimensional features of the input data time series from front to back, and outputs the hidden layer state corresponding to each GRU. Correspondingly, the unit layer Each GRU unit in the unit layer is sequentially processed from back to front. Output of each hidden layer state Extract the feature information and output the hidden layer state corresponding to each GRU The unit layer Each GRU unit in the extracts the dimensional features of the input data time series from back to front, and outputs the hidden layer state corresponding to each GRU. Correspondingly, the unit layer Each GRU unit in the unit layer is sequentially from front to back. Output of each hidden layer state Extract the feature information and output the hidden layer state corresponding to each GRU The unit layer and unit layer After merging the output states of each hidden layer, the output sequence of the l-th double-layer gated recurrent unit is obtained. in, t∈[1,N]; It represents the output feature after the l-th double-layer gated recurrent unit extracts information from the t-th dimension feature in the input data time series.
9. The photovoltaic power generation prediction method according to claim 8, characterized in that: The first high-low level gated recurrent unit has a unit layer and unit layer The hidden layer states corresponding to each GRU and Satisfy the following formulas respectively: In the formula, Indicates that the GRU unit extracts features from front to back; Indicates that the input data of the first t-1 dimensions passes through the unit layer The hidden layer state after the first t-1 GRU units extract features from front to back in sequence; Represents the t-th dimension data input to the l-th double-layer gated recurrent unit; Indicates that the GRU unit extracts features from back to front; Indicates that the input data of the last Nt dimensions passes through the unit layer The hidden layer states after the Nt GRU units extract features from back to front in sequence.
10. The photovoltaic power generation prediction method according to claim 8, characterized in that: The second high-low level gated recurrent unit has a unit layer and unit layer The hidden layer states corresponding to each GRU and Satisfy the following formulas respectively: In the formula, Indicates that the GRU unit extracts features from back to front; Indicates that the input data of the last Nt dimensions passes through the unit layer The hidden layer state after the Nt GRU units in the middle and back extract features from back to front in sequence; Represents the t-th dimension data input to the l-th double-layer gated recurrent unit; Indicates that the GRU unit extracts features from front to back; Indicates that the input data of the first t-1 dimensions passes through the unit layer The hidden layer state after the first t-1 GRU units extract features from front to back.
11. The photovoltaic power generation prediction method according to claim 1, characterized in that: The expression of the loss function is as follows: In the formula, is the true value of the jth sample, y j is the predicted value of the jth sample, and n is the number of samples in the training set.
12. A photovoltaic power generation prediction device, running the photovoltaic power generation prediction method according to any one of claims 1 to 11, characterized in that: The device includes The acquisition module is used to collect multiple sets of photovoltaic power generation historical data and corresponding meteorological data according to the set time interval to construct the original data set; A preprocessing module, used for preprocessing the original data set by selecting similar days to form a sample set; A partitioning module, used to divide the sample set into a training set, a validation set and a test set according to a set ratio; A training module, used to train the constructed SQGRU-Transformer prediction model based on the training set with the goal of minimizing the loss function, and determine the optimal parameters of the model in combination with the validation set; The prediction module is used to input the meteorological data of each prediction day in the test set and the photovoltaic power generation data and meteorological data of historical similar days of corresponding weather types into the SQGRU-Transformer prediction model with optimal parameters for prediction, so as to obtain the photovoltaic power generation prediction results corresponding to each prediction day.
13. A terminal comprising a processor and a storage medium; characterized in that: The storage medium is used to store instructions; The processor is configured to operate according to the instructions to execute the steps of the method according to any one of claims 1-11.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.
Citation Information
Patent Citations
Impact load prediction method based on improved GRU and differential error compensation
CN113837480A
Photovoltaic power ultra-short-term prediction method and device, electronic equipment and storage medium
CN116011608A
Short-term photovoltaic power prediction method, system and equipment based on similar day algorithm
CN119340961A
Fishing light system photovoltaic power prediction method considering environmental change and photovoltaic panel aging
CN119448261A