Short-term prediction method and device for photovoltaic generating capacity, medium and product

By using the Transformer model for timing feature extraction and clustering analysis, and combining with the GRU model for classification training, the problem of high demand for data storage and computing resources in short-term photovoltaic prediction is solved, and high-precision and low-cost prediction effects are achieved.

CN119130187AActive Publication Date: 2024-12-13SHENYANG INST OF ENG

Patent Information

Application Number
CN202411208910.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-30
Publication Date
2024-12-13
Estimated Expiration
2044-08-30

AI Technical Summary

Technical Problem

The existing short-term photovoltaic prediction algorithms require a large number of samples and complex models, resulting in high demand for data storage space and computing resources, which hinders the implementation and deployment of the algorithm.

Method used

The Transformer model is used for timing feature extraction and clustering analysis, which reduces the data storage space requirement, and classify training through the gated cycle unit (GRU) model to reduce the computing time and achieve high-precision short-term photovoltaic prediction.

Benefits of technology

Reduces the number of data usage and computing time, avoids the reduction in prediction accuracy, and achieves high-precision short-term photovoltaic prediction, reducing deployment costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119130187A_ABST
    Figure CN119130187A_ABST
Patent Text Reader

Abstract

The invention discloses a short-term prediction method and device for photovoltaic generating capacity, a medium and a product, and relates to the technical field of short-term photovoltaic prediction.The method mainly comprises the steps that a Transform model is trained according to a photovoltaic generating capacity data set, the trained Transform model is obtained to serve as a preprocessing model, and time sequence characteristics of the photovoltaic generating capacity data set are extracted; clustering the time sequence characteristics of the photovoltaic power generation data set to obtain different types of photovoltaic power generation data; respectively training GRU models according to different types of photovoltaic power generation data to obtain a plurality of trained GRU models as prediction models, and extracting corresponding types of photovoltaic power generation data as screening samples; and performing short-term photovoltaic prediction based on the preprocessing model, the prediction model and the screening sample. According to the invention, the problems of large occupied space of samples and long operation time of a high-precision prediction model can be solved, and landing deployment is facilitated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of short-term photovoltaic prediction, and in particular to a method, device, medium and product for short-term prediction of photovoltaic power generation. Background Art

[0002] The randomness and uncertainty of photovoltaic power generation pose a challenge to the smooth operation of the power system. Among them, short-term photovoltaic forecasting is the research field that is most affected by meteorological changes and real-time interference, and is most affected by randomness and uncertainty.

[0003] In the past, short-term photovoltaic forecasting has been carried out from three aspects: reducing uncertainty, enhancing data quality, and improving prediction accuracy. It has adopted a variety of algorithms such as clustering, dimensionality reduction, risk assessment, Autoregressive Integrated Moving Average (ARIMA), and Long Short-Term Memory (LSTM) to achieve high-precision and fast prediction. However, since reducing uncertainty and enhancing data quality require a large number of samples, and improving prediction accuracy requires the use of complex models and long computing time, short-term prediction algorithms require a large amount of storage space and computing resources to be applied, which hinders the implementation of the algorithm. Summary of the invention

[0004] The purpose of this application is to provide a short-term prediction method, equipment, medium and product for photovoltaic power generation, which can solve the problems of large sample space occupation and long operation time of high-precision prediction model, and facilitate on-site deployment.

[0005] To achieve the above objectives, this application provides the following solutions:

[0006] In a first aspect, the present application provides a short-term prediction method for photovoltaic power generation, comprising:

[0007] Acquire a photovoltaic power generation data set; the photovoltaic power generation data set includes: 24h (hour) photovoltaic power generation data of several historical times;

[0008] Training a Transformer model according to the photovoltaic power generation data set, obtaining the trained Transformer model as a preprocessing model, and extracting time series features of the photovoltaic power generation data set;

[0009] Clustering the time series features of the photovoltaic power generation data set to obtain photovoltaic power generation data of different categories; the photovoltaic power generation data of different categories include: photovoltaic power generation power data of the first 24 hours of different categories and corresponding photovoltaic power generation power of the subsequent 1 hour; the photovoltaic power generation power of the subsequent 1 hour is predicted by using the preprocessing model;

[0010] According to the different categories of photovoltaic power generation data, a gated recurrent unit (GRU) model is trained respectively to obtain several trained GRU models as prediction models, and photovoltaic power generation data of corresponding categories are extracted as screening samples;

[0011] Short-term photovoltaic prediction is performed based on the preprocessing model, the prediction model and the screening samples.

[0012] Optionally, a Transformer model is trained according to the photovoltaic power generation data set to obtain the trained Transformer model as a preprocessing model, and time series features of the photovoltaic power generation data set are extracted, specifically including:

[0013] Extracting a plurality of groups of photovoltaic power generation data for the first 24 hours and photovoltaic power generation data for the last 24 hours from the photovoltaic power generation data set; the last value of the photovoltaic power generation data for the first 24 hours is adjacent to the first value of the photovoltaic power generation data for the last 24 hours in time sequence;

[0014] The photovoltaic power generation data of the first 24 hours and the photovoltaic power generation data of the last 24 hours are inputted into the input data part of the Transformer model for preprocessing to obtain a corresponding position encoding matrix;

[0015] Input the position coding matrix corresponding to the photovoltaic power generation data of the previous 24 hours into the coding model part of the Transformer model for coding processing to obtain a coding feature matrix;

[0016] The position coding matrix corresponding to the photovoltaic power generation data of the last 24 hours and the coding feature matrix are input into the decoding model part of the Transformer model for decoding processing to obtain a decoding feature matrix;

[0017] Input the decoded feature matrix into the output result part of the Transformer model for calculation to obtain a result matrix;

[0018] Calculating the loss value according to the result matrix and the photovoltaic power generation data of the last 24 hours, and updating the parameters of the Transformer model by using the gradient descent method until the loss value converges, thereby obtaining a trained Transformer model as a preprocessing model;

[0019] The preprocessing model is used to extract the time series characteristics of the photovoltaic power generation data set.

[0020] Optionally, the input data part includes, in sequence: convolution layer and position encoding; the encoding model part includes, in sequence: vector calculation layer, multi-head attention layer, addition and layer normalization, feedforward network layer, and addition and layer normalization; the decoding model part includes, in sequence: vector calculation layer, mask and multi-head attention layer, addition and layer normalization, multi-head attention layer, addition and layer normalization, feedforward network layer, and addition and layer normalization; the output result part includes: fully connected layer.

[0021] Optionally, clustering the time series features of the photovoltaic power generation data set to obtain photovoltaic power generation data of different categories specifically includes:

[0022] Using a spectral clustering method to cluster the time series characteristics of the photovoltaic power generation data set to obtain a clustering result;

[0023] The photovoltaic power generation data set is classified according to the clustering result to obtain photovoltaic power generation data of different categories.

[0024] Optionally, a spectral clustering method is used to cluster the time series characteristics of the photovoltaic power generation data set to obtain a clustering result, which specifically includes:

[0025] The Euclidean distance formula is used to calculate the Euclidean distance between the time series features of the photovoltaic power generation data set, and a distance matrix is ​​constructed;

[0026] Calculate a standard Laplacian matrix based on the distance matrix;

[0027] Performing eigenvalue decomposition on the standard Laplace matrix to obtain an eigenvector;

[0028] Perform Kmeas clustering on the feature vector to obtain a clustering result.

[0029] Optionally, GRU models are trained respectively according to the photovoltaic power generation data of different categories to obtain several trained GRU models as prediction models, and photovoltaic power generation data of corresponding categories are extracted as screening samples, specifically including:

[0030] GRU models are trained respectively according to the photovoltaic power generation data of different categories to obtain several trained GRU models as prediction models; wherein, for any category of photovoltaic power generation data, the photovoltaic power generation data of the previous 24 hours is used as the input of the GRU model, and the photovoltaic power generation data of the subsequent 1 hour is used as the output of the GRU model, and the mean square error between the predicted value and the true value of the photovoltaic power generation data of the subsequent 1 hour is calculated, and the parameters of the GRU model are updated by using the gradient descent method until the mean square error converges to obtain a trained GRU model;

[0031] A set proportion of photovoltaic power generation data is extracted from the photovoltaic power generation data set by category as screening samples.

[0032] Optionally, performing short-term photovoltaic prediction based on the preprocessing model, the prediction model and the screening samples specifically includes:

[0033] The photovoltaic power generation data of the previous 24 hours at the current time is input into the preprocessing model as a prediction sample to obtain the corresponding time series characteristics;

[0034] The Euclidean distance formula is used to calculate the similarity between the time series feature corresponding to the predicted sample and the time series feature corresponding to the screened sample, and the classification result of the predicted sample is determined;

[0035] According to the classification result of the prediction sample, a corresponding trained GRU model is selected from the prediction model;

[0036] The predicted samples are input into the trained GRU model for prediction to obtain the corresponding subsequent 1h photovoltaic power generation power.

[0037] In a second aspect, the present application provides a computer device, comprising: 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 short-term prediction method for photovoltaic power generation.

[0038] In a third aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the short-term prediction method for photovoltaic power generation when executed by a processor.

[0039] In a fourth aspect, the present application provides a computer program product, including a computer program, which implements the short-term prediction method of photovoltaic power generation when executed by a processor.

[0040] According to the specific embodiments provided in this application, this application discloses the following technical effects:

[0041] The present application provides a method, device, medium and product for short-term prediction of photovoltaic power generation. By training a Transformer model with high prediction accuracy as a preprocessing model for time series feature extraction, the data storage space requirement is reduced to ensure the accuracy of the subsequent lightweight prediction model; by clustering the time series features, it is convenient to process data by category and speed up the calculation speed; by training a lighter GRU model by category as a prediction model, the amount of data used, the calculation time and the equipment requirements can be reduced while avoiding the decrease in prediction accuracy; and the present application only needs to deploy the above-mentioned preprocessing model and prediction model at the site to achieve high-precision short-term photovoltaic prediction with lower deployment cost. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0043] Figure 1 A flow chart of a short-term prediction method for photovoltaic power generation provided for this application;

[0044] Figure 2 Transformer model structure diagram provided for this application;

[0045] Figure 3 Schematic diagram of the convolution kernel calculation method provided for this application;

[0046] Figure 4 The GRU model structure diagram provided for this application. DETAILED DESCRIPTION

[0047] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0048] This application proposes a short-term prediction method, equipment, medium and product for photovoltaic power generation, which is used to solve the problems of large sample space occupation and long operation time of high-precision prediction models, and is easy to deploy. The technical solution is mainly divided into four steps: feature extraction, cluster analysis, classification training model, and prediction results. Among them, the extracted features are used to extract the time series characteristics of photovoltaic power data, which is convenient for subsequent clustering and reduces the demand for data storage space; cluster analysis is used to divide data categories, which is convenient for data processing by category and speeds up the calculation speed; the classification training model is used to train a prediction model with less storage space and less precision loss; the prediction results are used to achieve the final prediction result output.

[0049] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0050] In an exemplary embodiment, the present application provides a short-term prediction method for photovoltaic power generation, which is executed by a computer device, and can be executed by a computer device such as a terminal or a server alone, or by a terminal and a server together. In the embodiment of the present application, Figure 1 As shown, the method includes the following steps 1 to 5. Wherein:

[0051] Step 1: Obtain a photovoltaic power generation data set. The photovoltaic power generation data set includes: 24-hour photovoltaic power generation data at a number of historical times.

[0052] Step 2: Train a Transformer model according to the photovoltaic power generation data set, obtain the trained Transformer model as a preprocessing model, and extract the time series features of the photovoltaic power generation data set.

[0053] This step specifically includes: extracting several groups of photovoltaic power generation data for the first 24 hours and photovoltaic power generation data for the last 24 hours from the photovoltaic power generation data set; inputting the photovoltaic power generation data for the first 24 hours and the photovoltaic power generation data for the last 24 hours into the input data part of the Transformer model for preprocessing to obtain the corresponding position coding matrix; inputting the position coding matrix corresponding to the photovoltaic power generation data for the first 24 hours into the coding model part of the Transformer model for coding processing to obtain the coding feature matrix; inputting the position coding matrix corresponding to the photovoltaic power generation data for the last 24 hours and the coding feature matrix into the decoding model part of the Transformer model for decoding processing to obtain the decoding feature matrix; inputting the decoding feature matrix into the output result part of the Transformer model for calculation to obtain the result matrix; calculating the loss value according to the result matrix and the photovoltaic power generation data for the last 24 hours, and updating the parameters of the Transformer model by using the gradient descent method until the loss value converges, and obtaining the trained Transformer model as the preprocessing model; and using the preprocessing model to extract the time series features of the photovoltaic power generation data set.

[0054] Among them, the input data part includes: convolution layer and position encoding in sequence; the encoding model part includes: vector calculation layer, multi-head attention layer, addition and layer normalization, feedforward network layer and addition and layer normalization in sequence; the decoding model part includes: vector calculation layer, mask and multi-head attention layer, addition and layer normalization, multi-head attention layer, addition and layer normalization, feedforward network layer and addition and layer normalization in sequence; the output result part includes: fully connected layer.

[0055] The Transformer model is used to learn the time series characteristics of photovoltaic power generation data. The input of the Transformer model contains two types of data: photovoltaic power generation data for the previous 24 hours (i.e. Figure 2 The photovoltaic power data for the first 24 hours in the figure) and the photovoltaic power data for the last 24 hours (i.e. Figure 2 The last value of the photovoltaic power data of the previous 24 hours is adjacent to the first value of the photovoltaic power data of the next 24 hours in time series. During training, the Transformer model needs to learn the photovoltaic power data of the previous day and predict the photovoltaic power data of the next day. The structure of the Transformer model is as follows: Figure 2 As shown, it can be divided into four parts. The calculation process of each part of the model is explained in the order of input data, encoding model, decoding model, and output results.

[0056] 1) Input data

[0057] The input data part is responsible for preprocessing the photovoltaic power data. The calculation process of processing the photovoltaic power data of the first 24 hours and the photovoltaic power data of the last 24 hours is exactly the same, both of which include two parts, the convolution layer and the position encoding.

[0058] First, the convolution layer is composed of N convolution kernels, which are 1×4 matrices. The calculation process of a single convolution kernel is as follows: Figure 3 As shown. For a 1×6 matrix, the result of using a 1×4 convolution kernel is a 1×6 matrix. The result of using N convolution kernels is N 1×6 matrices. Based on this method, N convolution kernels are used to convolve a B×L matrix, where B is the number of samples of 24h photovoltaic power generation data, and L is the length of the 24h photovoltaic power generation data. The results are concatenated to obtain a B×N×L matrix. Transpose the matrix to obtain a B×L×N matrix x.

[0059] Then, position codes are added to the elements in the matrix x. For the (b, k, i)th element in the matrix x0, the corresponding position code calculation formula is as follows.

[0060]

[0061] In the formula, n is 10000 and d is N. Use this formula to calculate the position codes of all elements in the matrix x and add them one by one. For the photovoltaic power generation data of the first 24 hours, a matrix X0 with a size of B×L×N containing position code information is obtained for the calculation of the encoding model; for the photovoltaic power generation data of the last 24 hours, a matrix Y0 with a size of B×L×N containing position code information is obtained for the calculation of the decoding model.

[0062] 2) Coding Model

[0063] The encoding model consists of five parts: vector calculation layer, multi-head attention layer, addition and layer normalization, feedforward network layer, addition and layer normalization. The calculation process of addition and layer normalization in the third and fifth steps is exactly the same, so we will not repeat them.

[0064] First, the vector calculation layer is used to calculate three values: query vector Q, key vector K, and value vector V. The calculation process is as follows.

[0065] Q=X0·W Q

[0066] K=X0·W K

[0067] V=X0·W V

[0068] Where W Q ,W K ,W V is the neural network parameter, which is an N×N matrix. After this calculation, the obtained Q, K, and V are B×L×N matrices.

[0069] After that, use the multi-head attention layer to calculate. The multi-head attention layer refers to using multiple attention layers to analyze the input data. Let the number of attention layers be H. Split Q, K, and V into H sub-matrices, named Q 1 ,Q 2 ,...,Q H , K 1 ,K 2 ,...,K H 、V 1 ,V 2 ,...,V H The size of the submatrix is ​​B×L×h, where the relationship among N, H, and h is as follows.

[0070] N=H·h

[0071] The calculation process of each attention layer is the same, with Q 1 , K 1 、V 1 The calculation process of the attention layer is explained as follows.

[0072]

[0073]

[0074] In the above calculation process, (K 1 ) T Only the last two dimensions are transposed, resulting in a B×h×L matrix. 1 ·(K1 ) T It is calculated row by row and concatenated to obtain a B×L×L matrix z 1 . Yes Normalize by row. Let the element at position (b, i, j) in the matrix before normalization be z bij The element at position (b, i, j) in the normalized matrix is ​​z' bij The normalized formula is as follows.

[0075]

[0076] Similarly, we calculate and concatenate rows to get a matrix of B×L×h

[0077] The calculation results of H attention layers are Concatenate and obtain the B×L×N matrix X1.

[0078] Then, the data is processed using addition and layer normalization. The processing is as follows.

[0079] X2=LN(X1+X0)

[0080] In the formula, X1+X0 means the one-to-one addition of X1 and X0. LN means column-by-column normalization. Calculate each column of data using the following formula.

[0081]

[0082]

[0083]

[0084] In the formula, v bij is the element at position (b, i, j) in the matrix. bi is the mean of the column data. bi is the variance of the column data. v' bij is the normalized column data. After normalizing each column, the output result X2 is obtained.

[0085] After that, the calculation formula of the feed-forward network layer is as follows.

[0086] X3=relu(X2·W 1 ·W 2 )

[0087] relu(v)=max(0,v)

[0088] Where W 1 is an L×C matrix, W 2is a C×L matrix. X3 is a B×L×N matrix, i.e., the time series feature.

[0089] Finally, the output results of the feedforward network layer are added and normalized to obtain the matrix X4, i.e., the encoding feature matrix, and the calculation formula is as follows.

[0090] X4=LN(X3+X2)

[0091] 3) Decoding model

[0092] The decoding model consists of seven parts: vector calculation layer, mask and multi-head attention layer, addition and layer normalization, multi-head attention layer, addition and layer normalization, feedforward network layer, addition and layer normalization. Among them, the calculation method of the vector calculation layer, multi-head attention layer, addition and layer normalization, feedforward network layer and the rectangle size are the same as those in the encoding model and will not be introduced here. Only the mask and multi-head attention layers are introduced below.

[0093] The computation process of the mask and multi-head attention layers is as follows.

[0094]

[0095]

[0096] The mask function is a function that uses a mask matrix to control data input. The mask function sets the elements at the corresponding positions of the input data to infinite negative numbers (-10 9 ). Since softmax uses an exponential function for normalization, when the value is an infinite negative number, the calculation result in softmax is close to 0, which has no effect on the normalization results of other values.

[0097] The mask matrix is ​​an L×L lower triangular matrix.

[0098]

[0099] Finally, the decoding model is used to obtain the B×L×N matrix X5, which is the decoding feature matrix.

[0100] 4) Output results

[0101] The output result uses a fully connected layer, and the calculation process is as follows.

[0102] Y=X5·W

[0103] Where W is a matrix of size N×1. X5·W is a B×L×1 matrix obtained by concatenating the rows. The B×L×1 matrix is ​​compressed into a B×L matrix Y, i.e., the result matrix. The loss value Loss is calculated based on the result matrix Y and the photovoltaic power generation data for the next 24 hours. The calculation formula is as follows.

[0104]

[0105] Based on the calculation results of Loss, the parameters of the Transformer model are updated using the gradient descent method, and training iterations are continued on the server until Loss converges.

[0106] After the server completes the training, the photovoltaic power generation data is input into the Transformer model to obtain the X3 data output by the encoding model, the 24h photovoltaic power generation data, and the subsequent 1h photovoltaic power generation predicted by the trained model are stored in the database as a "basic sample". The input data of the Transformer and the encoding model parameters are saved and stored in the station computer as a "preprocessing model".

[0107] Step 3: Cluster the time series features of the photovoltaic power generation data set to obtain photovoltaic power generation data of different categories. The photovoltaic power generation data of different categories include: photovoltaic power generation data of the first 24 hours of different categories and the corresponding photovoltaic power generation power of the subsequent 1 hour; the photovoltaic power generation power of the subsequent 1 hour is predicted by the preprocessing model.

[0108] This step specifically includes: clustering the time series characteristics of the photovoltaic power generation data set (i.e., the X3 data stored in the "basic sample") using a spectral clustering method to obtain a clustering result; and classifying the photovoltaic power generation data set according to the clustering result to obtain photovoltaic power generation data of different categories.

[0109] Use the spectral clustering method to cluster the X3 data stored in the "basic sample". The spectral clustering calculation process is as follows.

[0110] First, the distance matrix is ​​calculated using the Euclidean distance formula.

[0111]

[0112] Where, d ij It is the Euclidean distance between the i-th X3 data and the j-th X3 data. is the tth value of the i-th X3 data. L is the length of the 24h photovoltaic power generation data. Assume that the "basic sample" has r X3 data. According to the Euclidean distance formula, calculate the Euclidean distance between two X3 data and fill in the r×r distance matrix R.

[0113] Afterwards, the Laplacian matrix is ​​calculated.

[0114] To calculate the Laplacian matrix, you need to first calculate the adjacency matrix and the degree matrix.

[0115] The calculation of the adjacency matrix needs to be based on the distance matrix R. The numerical calculation method of the adjacency matrix A is as follows.

[0116]

[0117] The degree matrix is ​​a diagonal matrix D, and the calculation formula is as follows.

[0118]

[0119] The calculation formula of the Laplace matrix O is as follows.

[0120] O=DR

[0121] Then, the eigenvalues ​​of the standard Laplacian matrix are calculated.

[0122] The calculation formula of the standard Laplace matrix o is as follows.

[0123]

[0124] Perform eigenvalue decomposition on the standard Laplace matrix to obtain the eigenvector T.

[0125] Finally, Kmeas clustering is performed on the feature vector T. The Kmeas clustering result is output as the classification result of the X3 data. After completing the clustering analysis using spectral clustering, the classification result of the photovoltaic power generation data is obtained.

[0126] Step 4: GRU models are trained respectively according to the photovoltaic power generation data of different categories to obtain several trained GRU models as prediction models, and photovoltaic power generation data of corresponding categories are extracted as screening samples.

[0127] This step specifically includes: training GRU models according to the different categories of photovoltaic power generation data, and obtaining several trained GRU models as prediction models; wherein, for any category of photovoltaic power generation data, using the photovoltaic power generation data of the previous 24 hours as the input of the GRU model, using the photovoltaic power generation data of the subsequent 1 hour as the output of the GRU model, calculating the mean square error between the predicted value and the true value of the photovoltaic power generation power of the subsequent 1 hour, and updating the parameters of the GRU model by gradient descent method until the mean square error converges to obtain a trained GRU model; extracting a set proportion of photovoltaic power generation data by category from the photovoltaic power generation data set as screening samples.

[0128] Using a single category of data for training can reduce the amount of data used while avoiding a decrease in prediction accuracy. In addition, to reduce deployment costs, a GRU model with less complexity but better prediction accuracy is used to complete the prediction task.

[0129] The structure of the GRU model is as follows Figure 4 The calculation process of the variables is as follows.

[0130] r t =σ(x t U r +h t-1 W r )

[0131] z t =σ(x t U z +h t-1 W z )

[0132]

[0133]

[0134]

[0135] Where ° is the Hadamard integral, which refers to the one-to-one multiplication of the elements in the matrix. t It is the photovoltaic power generation data of the previous 24 hours, which is a matrix of size B×L. r is an L×E parameter matrix (E is the dimension of the hidden layer); W r is an E×E parameter matrix; h t-1 It is a B×E matrix, representing the time series characteristics of the previous moment. t is the forgetting matrix of B×E at time t, which is used to determine the time series feature h at the previous moment t-1 The retention ratio. t is the update matrix at time t, used to determine the new data at time t The retention ratio of U z is an L×E parameter matrix; W z is an E×E parameter matrix. It is the updated data at time t calculated based on the past photovoltaic power generation data and the current input photovoltaic power generation data. h is an L×E parameter matrix; W h is an E×E parameter matrix. t It is the time series feature at time t extracted from the current input photovoltaic power data, which is a B×E matrix. t Predict the photovoltaic power generation data Y at time t t .

[0136] Y t =h t W Y

[0137] Where W Y is an E×1 parameter matrix. t is the output result of B×1, that is, based on the photovoltaic power generation data x in the previous 24 hours t The predicted photovoltaic power generation data for the next 1h. t Compared with the real data y of the next 1h t Compare and calculate the mean square error (MSE).

[0138]

[0139] In the formula, Yes t The i-th data, Yes t Based on the calculation results of MSE, the parameters of the GRU model are updated using the gradient descent method, and the training is stopped after continuous iteration until MSE converges.

[0140] The multiple GRU models obtained through training are saved as "prediction models" and stored in the station computer. Samples are extracted by category based on the classification results, and 30% of the samples are extracted from each category to form "screening samples" and stored in the station computer.

[0141] Step 5: Perform short-term photovoltaic prediction based on the preprocessing model, the prediction model and the screened samples.

[0142] For the sake of explanation, it is assumed that the photovoltaic power generation for the next hour needs to be predicted. The photovoltaic power generation data for the previous 24 hours of the current time is input into the "preprocessing model" stored in the station computer as the "prediction sample" to obtain the corresponding X3. The similarity between the X3 of the "prediction sample" and all X3 in the "screening sample" is calculated, and the similarity calculation formula uses the Euclidean distance formula.

[0143] The similarity calculation results of the same category are averaged as "category similarity". Compare the "category similarities" of different categories. The category with the highest "category similarity" is the classification result of the "prediction sample".

[0144] According to the classification results, take out the GRU model of the corresponding category from the saved "prediction model". Input the "prediction sample" into the GRU model for prediction and get the prediction result.

[0145] In summary, compared with previous short-term photovoltaic prediction technologies, this application uses the Transformer algorithm with high prediction accuracy as time series feature extraction to ensure the accuracy of the subsequent lightweight prediction model; only part of the model is deployed at the site, reducing storage space requirements and local deployment costs; using a lighter GRU model for prediction reduces computing time and equipment requirements. Moreover, on the basis of reducing deployment costs and computing time, the prediction accuracy loss of this application is relatively small, which has certain value for the deployment of high-precision photovoltaic power generation prediction algorithms.

[0146] In an exemplary embodiment, the present application further provides a computer device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

[0147] In an exemplary embodiment, the present application further provides a computer-readable storage medium storing a computer program, which implements the steps in the above-mentioned method embodiments when executed by a processor.

[0148] In an exemplary embodiment, the present application further provides a computer program product, including a computer program, which implements the steps in the above-mentioned method embodiments when executed by a processor.

[0149] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant legal provisions.

[0150] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0151] The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a distributed database based on blockchain, etc., but is not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but is not limited thereto.

[0152] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0153] This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application. At the same time, for those skilled in the art, according to the ideas of this application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.

Claims

1. A short-term prediction method for photovoltaic power generation, characterized in that: include: Acquire a photovoltaic power generation data set; the photovoltaic power generation data set includes: 24h photovoltaic power generation data at a certain historical time; Training a Transformer model according to the photovoltaic power generation data set, obtaining the trained Transformer model as a preprocessing model, and extracting time series features of the photovoltaic power generation data set; Clustering the time series features of the photovoltaic power generation data set to obtain photovoltaic power generation data of different categories; the photovoltaic power generation data of different categories include: photovoltaic power generation power data of the first 24 hours of different categories and corresponding photovoltaic power generation power of the subsequent 1 hour; the photovoltaic power generation power of the subsequent 1 hour is predicted by using the preprocessing model; GRU models are trained respectively according to the photovoltaic power generation data of different categories to obtain several trained GRU models as prediction models, and photovoltaic power generation data of corresponding categories are extracted as screening samples; Short-term photovoltaic prediction is performed based on the preprocessing model, the prediction model and the screening samples.

2. The short-term prediction method for photovoltaic power generation according to claim 1, characterized in that: A Transformer model is trained according to the photovoltaic power generation data set to obtain the trained Transformer model as a preprocessing model, and time series features of the photovoltaic power generation data set are extracted, specifically including: Extracting a plurality of groups of photovoltaic power generation data for the first 24 hours and photovoltaic power generation data for the last 24 hours from the photovoltaic power generation data set; the last value of the photovoltaic power generation data for the first 24 hours is adjacent to the first value of the photovoltaic power generation data for the last 24 hours in time sequence; The photovoltaic power generation data of the first 24 hours and the photovoltaic power generation data of the last 24 hours are inputted into the input data part of the Transformer model for preprocessing to obtain a corresponding position encoding matrix; Input the position coding matrix corresponding to the photovoltaic power generation data of the previous 24 hours into the coding model part of the Transformer model for coding processing to obtain a coding feature matrix; The position coding matrix corresponding to the photovoltaic power generation data of the last 24 hours and the coding feature matrix are input into the decoding model part of the Transformer model for decoding processing to obtain a decoding feature matrix; Input the decoded feature matrix into the output result part of the Transformer model for calculation to obtain a result matrix; Calculating the loss value according to the result matrix and the photovoltaic power generation data of the last 24 hours, and updating the parameters of the Transformer model by using the gradient descent method until the loss value converges, thereby obtaining a trained Transformer model as a preprocessing model; The preprocessing model is used to extract the time series characteristics of the photovoltaic power generation data set.

3. The short-term prediction method for photovoltaic power generation according to claim 2, characterized in that: The input data part includes: convolution layer and position encoding in sequence; the encoding model part includes: vector calculation layer, multi-head attention layer, addition and layer normalization, feedforward network layer and addition and layer normalization in sequence; the decoding model part includes: vector calculation layer, mask and multi-head attention layer, addition and layer normalization, multi-head attention layer, addition and layer normalization, feedforward network layer and addition and layer normalization in sequence; the output result part includes: fully connected layer.

4. The short-term prediction method for photovoltaic power generation according to claim 1, characterized in that: Clustering the time series features of the photovoltaic power generation data set to obtain photovoltaic power generation data of different categories, specifically including: Using a spectral clustering method to cluster the time series characteristics of the photovoltaic power generation data set to obtain a clustering result; The photovoltaic power generation data set is classified according to the clustering result to obtain photovoltaic power generation data of different categories.

5. The short-term prediction method for photovoltaic power generation according to claim 4, characterized in that: The spectral clustering method is used to cluster the time series characteristics of the photovoltaic power generation data set to obtain clustering results, which specifically include: The Euclidean distance formula is used to calculate the Euclidean distance between the time series features of the photovoltaic power generation data set, and a distance matrix is ​​constructed; Calculate a standard Laplacian matrix based on the distance matrix; Performing eigenvalue decomposition on the standard Laplace matrix to obtain an eigenvector; Perform Kmeas clustering on the feature vector to obtain a clustering result.

6. The short-term prediction method for photovoltaic power generation according to claim 1, characterized in that: GRU models are trained respectively according to the photovoltaic power generation data of different categories to obtain several trained GRU models as prediction models, and photovoltaic power generation data of corresponding categories are extracted as screening samples, specifically including: GRU models are trained respectively according to the photovoltaic power generation data of different categories to obtain several trained GRU models as prediction models; wherein, for any category of photovoltaic power generation data, the photovoltaic power generation data of the previous 24 hours is used as the input of the GRU model, and the photovoltaic power generation data of the subsequent 1 hour is used as the output of the GRU model, and the mean square error between the predicted value and the true value of the photovoltaic power generation data of the subsequent 1 hour is calculated, and the parameters of the GRU model are updated by using the gradient descent method until the mean square error converges to obtain a trained GRU model; A set proportion of photovoltaic power generation data is extracted from the photovoltaic power generation data set by category as screening samples.

7. The short-term prediction method for photovoltaic power generation according to claim 1, characterized in that: Performing short-term photovoltaic prediction based on the preprocessing model, the prediction model and the screening samples specifically includes: The photovoltaic power generation data of the previous 24 hours at the current time is input into the preprocessing model as a prediction sample to obtain the corresponding time series characteristics; The Euclidean distance formula is used to calculate the similarity between the time series feature corresponding to the predicted sample and the time series feature corresponding to the screened sample, and the classification result of the predicted sample is determined; According to the classification result of the prediction sample, a corresponding trained GRU model is selected from the prediction model; The predicted samples are input into the trained GRU model for prediction to obtain the corresponding subsequent 1h photovoltaic power generation power.

8. A computer device comprising: 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 short-term prediction method for photovoltaic power generation according to any one of claims 1 to 7.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the short-term prediction method for photovoltaic power generation according to any one of claims 1 to 7 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the short-term prediction method for photovoltaic power generation according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Short-term photovoltaic power generation prediction method and system

    CN110322364A

  • Photovoltaic power prediction method, device and equipment and readable storage medium

    CN111695601A

  • Intelligent substation secondary system fault positioning method based on Transform-GRU

    CN114492662A

  • Ultra-short-term photovoltaic power prediction method based on deep learning

    CN115879629A

  • Power prediction method and system based on photovoltaic power generation

    CN117878883A

Cited By

  • Generating capacity prediction method, device and equipment based on meteorological data

    CN119990836A