Photovoltaic power prediction method of deep attention network
Through the photovoltaic power prediction method of deep attention network, the problem of inaccurate prediction of photovoltaic power generation is solved, the accuracy of short-term and long-term prediction is improved, and the grid stability and energy utilization efficiency are promoted.
Patent Information
- Application Number
- CN202510505848.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-22
- Publication Date
- 2025-08-05
AI Technical Summary
The prior art is difficult to accurately predict photovoltaic power generation, affecting grid scheduling and energy utilization efficiency.
The photovoltaic power prediction method of a deep attention network is adopted, including step S1: reading the photovoltaic power data and converting it into a two-dimensional matrix, and data characterization is performed by inputting the embedded layer, deformable spatial attention and time-frequency decomposition network, deep Transformer and deformable spatial attention block, and finally obtaining the photovoltaic power prediction result.
It improves the accuracy of short-term and long-term prediction of photovoltaic power, reduces the impact of the power grid, and improves the economic benefits of energy.
Smart Images

Figure CN120433172A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of photovoltaic power prediction in machine learning, and in particular relates to a photovoltaic power prediction method based on a deep attention network. Background Art
[0002] With the growing global demand for clean energy, photovoltaic power generation, as a renewable energy technology, has become increasingly widely used. However, because the output power of photovoltaic power generation is affected by many factors, such as weather conditions, seasonal changes, and geographical location, accurately predicting photovoltaic power generation has become a major challenge for power plant operators and grid dispatchers.
[0003] Photovoltaic power forecasting is of great significance. First, it facilitates grid dispatch and security. Accurate power forecasting can balance power generation and load, reduce grid shocks, and improve grid security and reliability. Second, it provides data support for optimal resource allocation and informs decision-making for renewable energy grid integration and energy storage system planning and operation. Furthermore, by improving power generation utilization and reducing curtailment, photovoltaic power forecasting can enhance energy economic benefits. Summary of the Invention
[0004] A photovoltaic power prediction method based on a deep attention network is characterized by comprising the following steps:
[0005] Step S1: Reading photovoltaic power data and converting it into a two-dimensional photovoltaic power data matrix that changes with time;
[0006] Step S2: Passing the photovoltaic power data matrix through the input embedding layer to obtain a first data representation of the photovoltaic power data;
[0007] Step S3: The first data feature is passed through an encoding layer composed of a deformable spatial attention and a time-frequency decomposition network to obtain a second data representation of the photovoltaic power data;
[0008] Step S4: The second data representation is passed through a decoding block composed of a deep Transformer and a deformable spatial attention block to obtain a third data representation of the photovoltaic power data;
[0009] Step S5: Pass the third data representation through the output embedding layer to obtain the final photovoltaic power prediction result.
[0010] Experiments have shown that the proposed photovoltaic power prediction method using a deep attention network has superior performance. This invention and the classic Transformer, Autoformer, Informer, FEDformer, Reformer, Flowformer, Flashformer, iTransformer, LSTM, and GRU were used to predict data collected from a photovoltaic power station, with the corresponding prediction effect evaluation indicators MAE and MAPE. Compared with other classic algorithms, the present invention has better prediction results. Specifically, by leveraging the advanced modules mentioned in the claims, this model can not only improve the performance of short-term photovoltaic power prediction, but also improve the performance of long-term photovoltaic power prediction. At the same time, it has good computational performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 Schematic diagram of the process of photovoltaic power prediction method based on deep attention network of the present invention.
[0012] Figure 2 This is a comparison chart of the effects of the prediction method of the present invention and other classical methods. DETAILED DESCRIPTION
[0013] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solutions of the present invention and are not intended to limit the scope of protection of the present invention.
[0014] like Figure 1 As shown, the present invention discloses a photovoltaic power prediction method based on a deep attention network, comprising the following steps:
[0015] Step S1: Reading photovoltaic power data and converting it into a two-dimensional photovoltaic power data matrix that changes with time;
[0016] Step S2: Passing the photovoltaic power data matrix through the input embedding layer to obtain a first data representation of the photovoltaic power data;
[0017] Step S3: The first data feature is passed through an encoding layer composed of a deformable spatial attention and a time-frequency decomposition network to obtain a second data representation of the photovoltaic power data;
[0018] Step S4: The second data representation is passed through a decoding block composed of a deep Transformer and a deformable spatial attention block to obtain a third data representation of the photovoltaic power data;
[0019] Step S5: Pass the third data representation through the output embedding layer to obtain the final photovoltaic power prediction result.
[0020] The specific description is as follows:
[0021] In step S1, corresponding data is read from the photovoltaic power data set and converted into a two-dimensional photovoltaic power data matrix X.
[0022] In step S2, the two-dimensional photovoltaic power data matrix X is input into the input embedding layer to obtain the first data representation of the photovoltaic power data. The specific process is as follows:
[0023] X1=GeLU(X+MLP(SA(DWConv(CA(X)))))
[0024] Where X1 is the first data representation obtained, X is the input two-dimensional photovoltaic power data matrix, CA(·) is the channel attention network, DWConv(·) is the depthwise separable convolutional network, SA(·) is the spatial attention network, MLP(·) is the multi-layer perceptron, and GeLU(·) is the Gaussian error linear unit.
[0025] Step S3 passes the first data feature through the encoding layer composed of the deformable spatial attention and time-frequency decomposition network to obtain the second data representation of the photovoltaic power data. The specific process is as follows:
[0026] First, the first data feature X1 is obtained by the deformable spatial attention function The processing process is as follows:
[0027] Step S31: X1 is passed through a one-dimensional convolutional neural network and a Gaussian error linear unit to obtain X1′. The specific expression is as follows:
[0028] X1′=GeLU(1DConv(X1))
[0029] Among them, GeLU(·) is a Gaussian error linear unit, 1DConv(·) is a one-dimensional convolutional neural network;
[0030] Step S32: X1′ is subjected to depthwise separable convolution, 1×5-dimensional deformable convolutional neural network, 5×1-dimensional deformable convolutional neural network and one-dimensional convolutional neural network to obtain X1″. The specific expression is as follows:
[0031] X1″=DSCN2(DSCN1(DWConv(X1′)))+DSCN2(DWConv(X1′))
[0032] Among them, DWConv(·) is a depthwise separable convolutional network, DSCN1(·) is a 1×5 dimensional deformable convolutional neural network, and DSCN2(·) is a 5×1 dimensional deformable convolutional neural network;
[0033] Step S33: Add X1′ and X1″ processed by the convolutional neural network to obtain The expression is as follows:
[0034]
[0035] Secondly, The second data representation X2 is obtained through the time-frequency decomposition network. The processing process is as follows:
[0036] Step S33-1: Use moving average pooling network to Decomposed, the expression is as follows:
[0037]
[0038] Among them, PD(·) is the data filling function, AP(·) is the moving average pooling function, X t For trend information, X s For seasonal information;
[0039] Step S33-2: Use the time trend information encoder to t To process, the expression is as follows:
[0040]
[0041] Among them, DFT(·) is Fourier transform, MLP(·) is multi-layer perceptron, F FFN (·) is the frequency domain feedback network, DFT -1 (·) is the inverse Fourier transform;
[0042] Step S33-3: Use the time season information encoder to s To process, the expression is as follows:
[0043]
[0044] Among them, DFT(·) is Fourier transform, MLP(·) is multi-layer perceptron, F FFN (·) is the frequency domain feedback network, DFT -1 (·) is the inverse Fourier transform;
[0045] Step S34: R t and R s After adding, multi-layer perceptron processing is performed to obtain the second data representation X2, which is expressed as follows:
[0046] X2=MLP(R t +R s )
[0047] Among them, MLP(·) is a multi-layer perceptron.
[0048] Step S4 passes the second data representation through a decoding block composed of a deep Transformer and a deformable spatial attention block to obtain a third data representation of the photovoltaic power data. The specific process is as follows:
[0049] First, the second data representation is obtained by deep Transformer The specific process is as follows:
[0050] Step S41: Calculate the query value Q of the second data representation X2. The specific expression is as follows:
[0051] Q = 3DConv(1DConv(X2))
[0052] Among them, 1DConv(·) is a one-dimensional convolutional neural network, and 3DConv(·) is a three-dimensional convolutional neural network;
[0053] Step S42: Calculate the query value K of the second data representation X2. The specific expression is as follows:
[0054] K = 5DConv(1DConv(X2))
[0055] Among them, 1DConv(·) is a one-dimensional convolutional neural network, and 5DConv(·) is a five-dimensional convolutional neural network;
[0056] Step S43: Calculate the query value V of the second data representation X2. The specific expression is as follows:
[0057] V = 5DConv(1DConv(X2))
[0058] Among them, 1DConv(·) is a one-dimensional convolutional neural network, and 5DConv(·) is a five-dimensional convolutional neural network;
[0059] Step S44: Combine the values of Q, K and V to obtain The specific expression is as follows:
[0060]
[0061] Among them, Relu 2 (·) is the square of the linear rectification function, B is the learnable matrix;
[0062] Secondly, After processing by the deformable spatial attention block, the third data representation X3 is obtained, and the specific expression is as follows:
[0063]
[0064] Among them, BN(·) is the layer normalization function, DSA(·) is the variability spatial attention function, and FFN(·) is the feedforward neural network.
[0065] Step S5: The third data representation is input into the embedding layer to obtain the final photovoltaic power prediction result. The specific expression is as follows:
[0066] Y=GeLU(X+MLP(SA(DWConv(CA(X3)))))
[0067] Among them, X3 is the third data representation, Y is the obtained photovoltaic power prediction result, CA(·) is the channel attention network, DWConv(·) is the depthwise separable convolutional network, SA(·) is the spatial attention network, GeLU(·) is the Gaussian error linear unit, and MLP(·) is the multi-layer perceptron.
[0068] Figure 2 The figure is a comparison of the effects of the present invention and other classic methods. In order to verify the superiority of the proposed photovoltaic power prediction method based on a deep perception neural network, the invention and the classic Transformer, Autoformer, Informer, FEDformer, Reformer, Flowformer, Flashformer, iTransformer, LSTM and GRU are used to predict the data collected from a photovoltaic power station, and the corresponding prediction effect evaluation indicators MAE and MAPE are used. Figure 2 It can be seen that compared with other classic algorithms, the prediction effect of the present invention is better. Specifically, the simulation experiment of the present invention selects the measured data collected by a photovoltaic power station from 16:00:00 on August 15, 2018 to 15:45:00 on June 13, 2019 as the experimental data. The experimental data include NWP data (including 7 features of global radiation, direct radiation, temperature, humidity, wind speed, wind direction and air pressure), LMD data (including 6 features of global radiation, diffuse radiation, temperature, air pressure, wind direction and wind speed) and power data, which are collected once every 15 minutes. The ratio of the training set, test set and validation set of these two data sets is 6:2:2. The prediction process is to use the historical photovoltaic power data of the past 24 hours to predict the photovoltaic power conversion situation in the next 180 hours. As Figure 2 As shown in the figure, the proposed method achieves a MAE and RMSE of 0.5811 and 0.8957 for the 180-hour prediction of this dataset, respectively. This result is the best prediction performance among all the compared methods, validating the superiority of this method in photovoltaic power prediction.
Claims
1. A photovoltaic power prediction method based on a deep attention network, characterized by The steps include: Step S1: Reading photovoltaic power data and converting it into a two-dimensional photovoltaic power data matrix that changes with time; Step S2: Passing the photovoltaic power data matrix through the input embedding layer to obtain a first data representation of the photovoltaic power data; Step S3: The first data feature is passed through an encoding layer composed of a deformable spatial attention and a time-frequency decomposition network to obtain a second data representation of the photovoltaic power data; Step S4: The second data representation is passed through a decoding block composed of a deep Transformer and a deformable spatial attention block to obtain a third data representation of the photovoltaic power data; Step S5: Pass the third data representation through the output embedding layer to obtain the final photovoltaic power prediction result.
2. The photovoltaic power prediction method based on a deep attention network according to claim 1, characterized in that: In step S1, corresponding data is read from the photovoltaic power data set and converted into a two-dimensional photovoltaic power data matrix X.
3. The photovoltaic power prediction method based on a deep attention network according to claim 2, characterized in that: In step S2, the two-dimensional photovoltaic power data matrix X is input into the input embedding layer to obtain the first data representation of the photovoltaic power data. The specific process is as follows: X1=GeLU(X+MLP(SA(DWConv(CA(X))))) Where X1 is the first data representation obtained, X is the input two-dimensional photovoltaic power data matrix, CA(·) is the channel attention network, DWConv(·) is the depthwise separable convolutional network, SA(·) is the spatial attention network, MLP(·) is the multi-layer perceptron, and GeLU(·) is the Gaussian error linear unit.
4. The photovoltaic power prediction method based on a deep attention network according to claim 3, characterized in that: Step S3 passes the first data feature through the encoding layer composed of the deformable spatial attention and time-frequency decomposition network to obtain the second data representation of the photovoltaic power data. The specific process is as follows: First, the first data feature X1 is obtained by the deformable spatial attention function The processing process is as follows: Step S31: X1 is passed through a one-dimensional convolutional neural network and a Gaussian error linear unit to obtain X1′. The specific expression is as follows: X1′=GeLU(1DConv(X1)) Among them, GeLU(·) is a Gaussian error linear unit, 1DConv(·) is a one-dimensional convolutional neural network; Step S32: X1′ is subjected to depthwise separable convolution, 1×5-dimensional deformable convolutional neural network, 5×1-dimensional deformable convolutional neural network and one-dimensional convolutional neural network to obtain X1″. The specific expression is as follows: X1″=DSCN2(DSCN1(DWConv(X1′)))+DSCN2(DWConv(X1′)) Among them, DWConv(·) is a depthwise separable convolutional network, DSCN1(·) is a 1×5 dimensional deformable convolutional neural network, and DSCN2(·) is a 5×1 dimensional deformable convolutional neural network; Step S33: Add X1′ and X1″ processed by the convolutional neural network to obtain The expression is as follows: Secondly, The second data representation X2 is obtained through the time-frequency decomposition network. The processing process is as follows: Step S33-1: Use moving average pooling network to Decomposed, the expression is as follows: Among them, PD(·) is the data filling function, AP(·) is the moving average pooling function, X t For trend information, X s For seasonal information; Step S33-2: Use the time trend information encoder to t To process, the expression is as follows: Among them, DFT(·) is Fourier transform, MLP(·) is multi-layer perceptron, F FFN (·) is the frequency domain feedback network, DFT -1 (·) is the inverse Fourier transform; Step S33-3: Use the time season information encoder to s To process, the expression is as follows: Among them, DFT(·) is Fourier transform, MLP(·) is multi-layer perceptron, F FFN (·) is the frequency domain feedback network, DFT -1 (·) is the inverse Fourier transform; Step S34: R t and R s After adding, multi-layer perceptron processing is performed to obtain the second data representation X2, which is expressed as follows: X2=MLP(R t +R s ) Among them, MLP(·) is a multi-layer perceptron.
5. The photovoltaic power prediction method based on a deep attention network according to claim 4, characterized in that: Step S4 passes the second data representation through a decoding block composed of a deep Transformer and a deformable spatial attention block to obtain a third data representation of the photovoltaic power data. The specific process is as follows: First, the second data representation is obtained by deep Transformer The specific process is as follows: Step S41: Calculate the query value Q of the second data representation X2. The specific expression is as follows: Q = 3DConv(1DConv(X2)) Among them, 1DConv(·) is a one-dimensional convolutional neural network, and 3DConv(·) is a three-dimensional convolutional neural network; Step S42: Calculate the query value K of the second data representation X2. The specific expression is as follows: K = 5DConv(1DConv(X2)) Among them, 1DConv(·) is a one-dimensional convolutional neural network, and 5DConv(·) is a five-dimensional convolutional neural network; Step S43: Calculate the query value V of the second data representation X2. The specific expression is as follows: V = 5DConv(1DConv(X2)) Among them, 1DConv(·) is a one-dimensional convolutional neural network, and 5DConv(·) is a five-dimensional convolutional neural network; Step S44: Combine the values of Q, K and V to obtain The specific expression is as follows: Among them, Relu 2 (·) is the square of the linear rectification function, B is the learnable matrix; Secondly, After processing by the deformable spatial attention block, the third data representation X3 is obtained, and the specific expression is as follows: Among them, BN(·) is the layer normalization function, DSA(·) is the variability spatial attention function, and FFN(·) is the feedforward neural network.
6. The photovoltaic power prediction method based on a deep attention network according to claim 5, characterized in that: The third data representation is input into the embedding layer to obtain the final photovoltaic power prediction result. The specific expression is as follows: Y=GeLU(X+MLP(SA(DWConv(CA(X3))))) Among them, X3 is the third data representation, Y is the obtained photovoltaic power prediction result, CA(·) is the channel attention network, DWConv(·) is the depthwise separable convolutional network, SA(·) is the spatial attention network, GeLU(·) is the Gaussian error linear unit, and MLP(·) is the multi-layer perceptron.