A photovoltaic power generation power prediction method based on a periodic attention mechanism
Patent Information
- Application Number
- CN202311240480.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-25
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2043-09-25
AI Technical Summary
然而,现有的预测模型不能利用光伏数据潜在的周期性对序列特征建模
[0069]本发明相对于现有技术具备的有益效果为:本发明公开了一种基于周期注意力机制的光伏发电功率预测方法,采用编码器-解码器架构,对历史序列求潜在周期,在编码器中对历史序列挖掘其潜在周期内和潜在周期间的关系,最后在解码器中对历史序列按照周期同步时间戳聚合、前向传播,得到预测结果;与现有光伏发电功率预测方法相比,本发明从周期的角度考虑功率预测问题,消除了累计误差,对于类似光照、光伏这类周期性较强的信息,通过挖掘不同周期同一时刻的信息间的关系预测下一个周期相同时间的信息,将传统方法的累计误差转化为该方法的平均误差,使其在长期预测任务中能够保持较高的精度;同时本发明兼顾了气象信息,弥补了传统方法难以利用协变量的不足。通过引入嵌入模块,将气象信息编码,使模型能够获取更丰富的信息。同时,在解码器的嵌入模块中,可以将零向量换为通过其它方法获取的预报值,实现与物理或其它方法的融合。
Smart Images

Figure CN117273222B_ABST
Abstract
Description
Technical Field
[0001] This invention provides a photovoltaic power generation prediction method based on a periodic attention mechanism, belonging to the field of photovoltaic power generation prediction technology. Background Technology
[0002] Photovoltaic power generation forecasting involves using power data and other characteristics (such as temperature and solar irradiance at a given time point) from several consecutive past timestamps to establish a predictive model to identify underlying patterns and forecast power generation at various points in the future. Photovoltaic power generation forecasting helps power system dispatching departments coordinate conventional energy and photovoltaic power generation, fully utilize solar energy resources, reduce power system spinning reserve and operating costs, and is of great significance to grid security and energy utilization. However, power forecasts typically span several days, a week, or longer, and are affected by seasonal variations, geographical location, and weather uncertainties. Actual power generation often exhibits intermittency, randomness, and fluctuations, making accurate forecasting challenging.
[0003] For this task, traditional prediction models can be divided into statistical models and physical models. Statistical models are difficult to utilize meteorological information and are more suitable for linear data, making them ineffective for sequences with obvious periodicity, such as photovoltaic power generation. Furthermore, statistical models focus more on uncovering data patterns and struggle to consider the characteristics implicit in covariates. Physical models, on the other hand, cannot account for the potential patterns inherent in the periodicity and require strong professional backgrounds for modeling, making them difficult to apply in practice.
[0004] With the development of neural networks, deep learning-based models have been applied to photovoltaic (PV) power generation prediction. Compared with traditional physics and statistical methods, deep learning models can encode and utilize historical meteorological information and mine latent features in historical sequences from a deeper perspective, gradually becoming an important method for PV power generation prediction. However, existing prediction models cannot utilize the potential periodicity of PV data to model sequence features. To address this issue, this invention proposes a PV power generation prediction method based on a periodic attention mechanism, designing a deep learning model that relies on mining the periodic patterns in the data to predict PV power generation. Summary of the Invention
[0005] In order to overcome the shortcomings of the prior art, the technical problem to be solved by the present invention is to provide an improvement on the photovoltaic power generation prediction method based on the periodic attention mechanism.
[0006] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is: a photovoltaic power generation prediction method based on a periodic attention mechanism, comprising the following prediction steps:
[0007] Step 1: Establish a dataset of photovoltaic power generation and corresponding solar irradiance. By summarizing historical data from photovoltaic power plants, collect multi-dimensional time-series data samples including total irradiance, direct irradiance, diffuse irradiance, temperature, air pressure, azimuth, wind speed, and actual power.
[0008] Step 2: Clean and standardize the data. Fill missing values in the dataset due to hardware failure with the mean of the two values before and after the missing interval. Then standardize all values to a mean of 0 and a variance of 1.
[0009] Step 3: Collect the sequence of photovoltaic power generation and input it into the encoder. The encoder encodes the historical data as feature values, calculates the potential period and outputs it, thus constructing a photovoltaic power generation prediction model with encoder and decoder:
[0010] Step 3.1: Construct the encoder module, including periodic slicing and embedding, and periodic enhancement modules;
[0011] Step 3.2: Construct the decoder module, which includes a Decoder slicing and embedding module, a periodic multi-head cross-attention module, and a periodic fusion module, to parse the features from the Encoder and output the predicted values;
[0012] Step 4: Based on the constructed prediction model, train the network using the dataset established in Step 1;
[0013] Step 5: Deploy the trained model in the photovoltaic power generation equipment operation status evaluation system, upload the information collected on site to the system, predict the trend of photovoltaic power generation, and obtain the prediction results.
[0014] The specific method for constructing the encoder module in step 3.1 is as follows:
[0015] Step 3.1.1: Construct the periodic slice and embedding module:
[0016] Perform a Fast Discrete Fourier Transform on the power properties of the historical sequence to obtain the amplitude and phase. The result is half the sequence length l plus 1, calculated using the following formula:
[0017]
[0018] In the formula: RFFT represents the first half of the classical fast discrete Fourier transform, Amp represents the magnitude, and Phase represents the phase;
[0019] Select the indices of the top 3 amplitudes excluding the 0th frequency, divide the input length by the index, and obtain the potential period. The calculation formula is as follows:
[0020]
[0021] In the formula: K is 3, and top means finding the top few largest values;
[0022] The original sequence is cyclically extended, and a sinusoidal sequence is generated from the extended result according to its length to distinguish positional information. This result is then passed through a convolutional layer, where a one-dimensional convolution with a kernel of 3 is performed on the time axis. The convolution result is added to the sinusoidal sequence to obtain the embedded vector. The calculation formula is as follows:
[0023]
[0024]
[0025] In the formula: i represents the i-th sub-period sequence; padding represents the cyclic extension of the original sequence;
[0026] positionalEmbedding represents positional embedding of a sequence, while tokenEmbedding represents word embedding of a sequence.
[0027] Finally, the embedding results are sliced according to the latent periodicity and stacked vertically to obtain the output of the periodic slice and the embedding module. The calculation formula is as follows:
[0028]
[0029] In the formula: inception means slicing the sequence according to the period p, and trunc means stacking the results along the periodic direction;
[0030] Step 3.1.2: Construct the cycle enhancement module:
[0031] 2D convolutions are performed on the periodic slices and the embedded output features along the temporal and periodic order to obtain the potential relationship between the same period and adjacent periods.
[0032] The result of convolution is standardized, activated by the ReLU activation function, and then randomly deactivated to prevent overfitting.
[0033] The results of random deactivation are residually linked with the periodic slices and the features output by the embedding module to obtain the output of the periodic enhancement module, which is the output of the Encoder.
[0034] The specific method for constructing the decoder module in step 3.2 is as follows:
[0035] Step 3.2.1: Construct the Decoder slice and embedding module:
[0036] The initialized zero vector is mapped to a high-dimensional feature space. First, the initialized zero vector or the sequence composed of meteorological information is processed by position embedding and word embedding as described in step 3.1.1. Then, the processed sequence is sliced and concatenated according to the latent features output by the periodic slicing and embedding module to obtain the high-dimensional feature vector. The calculation formula is as follows:
[0037]
[0038] In the formula: L represents the length of the sequence after pruning or extension under a certain latent period, p represents the number of sequences formed after slicing according to the latent period, d represents the model depth, and l represents the length of the latent period;
[0039] Step 3.2.2: Construct a periodic multi-head cross-attention module:
[0040] The embedded high-dimensional feature vector and the encoder features are input into a periodic multi-head cross-attention module to obtain aggregated features. In the periodic multi-head cross-attention module, the embedded initial vector is passed through a fully connected layer to obtain several Q values, and the encoder features are passed through a fully connected layer to obtain K and V. The calculation formula is as follows:
[0041]
[0042]
[0043]
[0044] Where: i represents the sequence block under the i-th sub-cycle, l and p represent the p-th cycle within a certain sub-cycle, t and s represent the timestamps within each cycle, and E represents the output depth of the fully connected layer;
[0045] For each Q value, the corresponding time dimension in K is multiplied by the dot product to obtain a series of attention scores, calculated using the following formula:
[0046] Attn iltps =Q ilt ×K ips
[0047] In the formula, t = s;
[0048] The attention score is proportionalized, and the calculation formula is as follows:
[0049]
[0050] The obtained attention score is processed using softmax, then multiplied by the previously calculated value and summed to obtain the predicted value for this moment. The calculation formula is as follows:
[0051] score = softmax(Attn′);
[0052]
[0053] After repeating the above steps several times without sharing parameters, the average value is taken to obtain the output of the periodic multi-head cross attention module.
[0054] Step 3.2.3: Construct a periodic fusion module to forward propagate the aggregated features to obtain the final predicted value:
[0055] In the periodic cross-attention module, the input is pruned according to the corresponding sub-period length to obtain a series of sequences, and the calculation formula is as follows:
[0056] seq i =reshape(MPACout) i );
[0057] These sequences are trimmed to the predicted length L and then concatenated into a cube. The calculation formula is as follows:
[0058] cube = cat(seq) i );
[0059] Perform a 1D convolution on the cube along the time axis L to obtain the convolution result. The calculation formula is as follows:
[0060] slice = conv1D(cube);
[0061] Finally, the convolution result is forward-propagated through a fully connected layer to obtain the final prediction result, calculated as follows:
[0062] pred=outLinearProj(slice).
[0063] The specific method for training the network in step 4 is as follows:
[0064] Construct the L2 loss function, the function expression is:
[0065]
[0066] The dataset was divided into training, testing, and validation sets in a ratio of 0.7:0.2:0.1.
[0067] The training is performed on the training set using L2 loss, and the loss is tested on the test set after each training round.
[0068] Training is stopped when the loss increases for three consecutive rounds, and the weight file with the minimum loss on the test set is stored at the end.
[0069] The advantages of this invention compared to existing technologies are as follows: This invention discloses a photovoltaic power generation prediction method based on a periodic attention mechanism. It employs an encoder-decoder architecture, calculating the latent period of historical sequences. The encoder mines the relationships within and between latent periods of the historical sequences. Finally, the decoder aggregates and forward-propagates the historical sequences according to periodic synchronization timestamps to obtain the prediction results. Compared to existing photovoltaic power generation prediction methods, this invention considers the power prediction problem from a periodic perspective, eliminating accumulated errors. For highly periodic information such as solar radiation and photovoltaic data, it predicts information at the same time in the next period by mining the relationships between information at the same moment in different periods, transforming the accumulated errors of traditional methods into the average error of this method, thus maintaining high accuracy in long-term prediction tasks. Simultaneously, this invention incorporates meteorological information, compensating for the shortcomings of traditional methods in utilizing covariates. By introducing an embedding module to encode meteorological information, the model can acquire richer information. Furthermore, in the embedding module of the decoder, the zero vector can be replaced with forecast values obtained through other methods, achieving fusion with physical or other methods. Attached Figure Description
[0070] The present invention will be further described below with reference to the accompanying drawings:
[0071] Figure 1 This is a flowchart of the prediction method of the present invention;
[0072] Figure 2 This is a schematic diagram of the photovoltaic power generation prediction model of the present invention;
[0073] Figure 3 This is a schematic diagram of the encoder structure of the present invention;
[0074] Figure 4 This is a schematic diagram of the decoder structure of the present invention;
[0075] Figure 5 This is a rendering of the effect of constructing a periodic multi-head cross-attention module according to the present invention;
[0076] Figure 6 This is a flowchart illustrating the steps of training a network based on a dataset according to the present invention.
[0077] Figure 7 This is a graph showing the predicted effect of photovoltaic power generation trend in an embodiment of the present invention. Detailed Implementation
[0078] This invention pertains to the fields of intelligent prediction of new energy power generation, deep learning, and photovoltaic power generation. Specifically, it relates to a photovoltaic power generation prediction method based on a periodic attention mechanism. This method addresses the difficulty of previous deep learning methods in capturing the potential periodic patterns in photovoltaic power generation, and proposes a photovoltaic power generation prediction model based on periodic features. In the model's encoding stage, this invention proposes a periodic enhancement module to mine and strengthen the potential connections between different periods. In the decoder stage, it proposes a periodic multi-head cross-attention mechanism to aggregate features and predict power sequentially within a period. Experiments show that the proposed prediction method can effectively capture the potential periodic features of the time series, thereby improving prediction accuracy. This method is simple to train and deploy, and demonstrates excellent performance and application prospects for predicting photovoltaic power generation data in natural scenarios, providing a typical example for power prediction in the photovoltaic field.
[0079] like Figure 1 As shown, to achieve the above objectives, the photovoltaic power generation prediction method based on Zhou Qi's attention mechanism proposed in this invention mainly includes the following steps:
[0080] Step 1: Establish a dataset of photovoltaic (PV) power generation and corresponding solar irradiance. By aggregating historical data from PV power plants, collect multi-dimensional time-series data samples including total irradiance, direct irradiance, diffuse irradiance, temperature, air pressure, azimuth, wind speed, and actual power. Data is acquired every 15 minutes, accumulating 70,176 historical data points, which are saved as a CSV file. This PV power generation data, covering multiple scenarios and factors, provides data support for subsequent model training.
[0081] Step 2: Clean and standardize the data. First, for values in the dataset that are missing due to hardware failure or other reasons, fill them with the mean of the two values before and after the missing interval. Next, standardize all values to a mean of 0 and a variance of 1.
[0082] Step 3: Building the model:
[0083] Design a photovoltaic power generation prediction model with encoders and decoders, such as Figure 2 As shown, the sequence of photovoltaic power generation is first collected and input to the encoder. The encoder encodes the historical data into feature values and calculates the latent period, and outputs it. The decoder is input to the latent period, feature values, and a series of all-zero vectors output by the encoder. The predicted output is obtained by aggregating the feature values according to the latent period.
[0084] 3.1: Building the encoder module:
[0085] The structure of the encoder is as follows Figure 3 As shown, it includes periodic slicing and embedding, and periodic enhancement modules.
[0086] 3.1.1 Constructing the periodic slicing and embedding module:
[0087] The periodic slicing and embedding module performs feature engineering on the input sequence to obtain its high-dimensional features and the sequence's latent period. Within this module, the power attributes of the historical sequence are first subjected to a Fast Discrete Fourier Transform to obtain the amplitude and phase.
[0088]
[0089] In the formula, RFFT represents truncating the first half of the classical Fast Discrete Fourier Transform, Amp represents the amplitude, and Phase represents the phase. The result is half the sequence length plus one, which is determined by the property of the Fourier Transform; because its result is symmetrical, RFFT only truncates the first half of the result. Then, the indices of the top three largest amplitudes (excluding the 0th frequency) are selected, and finally, the input length is divided by this index to obtain the latent period.
[0090]
[0091] In the formula, K is 3, and `top` represents finding the top few largest values. Next, the original sequence is cyclically extended. From the extended result, a sine sequence is generated according to its length to distinguish positional information. Then, it is passed through a convolutional layer, performing a one-dimensional convolution with a kernel of 3 on the time axis. The convolution result is added to the sine sequence to obtain the embedded vector.
[0092]
[0093]
[0094] In the formula, i represents the i-th sub-period sequence, the same below; padding represents cyclic extension of the original sequence, positionalEmbedding represents positional embedding of the sequence, and tokenEmbedding represents word vector embedding of the sequence; the embedding results are sliced according to latent periodicity and stacked vertically to obtain the periodic slices and the output of the embedding module:
[0095]
[0096] In the formula, inception means slicing the sequence according to the period p, and trunc means stacking the results along the periodic direction.
[0097] 3.1.2 Constructing a cycle enhancement module:
[0098] The periodic enhancement module extracts periodic information from the high-dimensional features after feature engineering through operations such as iso-periodic 2D convolution. Within the periodic enhancement module, firstly, 2D convolutions are performed on the periodic slices and the features output from the embedding module along both temporal and periodic sequences to obtain the potential relationships between the same period and adjacent periods. Next, the convolution result is standardized, activated using a ReLU activation function, and then randomly deactivated to prevent overfitting. Finally, the result after random deactivation is residually linked with the features output from the periodic slices and the embedding module to obtain the output of the periodic enhancement module, which is also the output of the Encoder.
[0099] 3.2 Building the decoder module:
[0100] The structure of the decoder is as follows Figure 4 As shown, it includes a Decoder slicing and embedding module, a periodic multi-head cross-attention module, and a periodic fusion module, which parses features from the Encoder and outputs predicted values.
[0101] 3.2.1 Constructing the Decoder Slicing and Embedding Module:
[0102] In the Decoder slicing and embedding module, the initialized zero vector is mapped to a high-dimensional feature space. Here, the zero vector can be replaced with meteorological features predicted using other physical or deep learning methods, enabling the integration of prediction information from other models. In the Decoder slicing and embedding module, the sequence composed of the initialized zero vector or meteorological information is first subjected to position embedding and word embedding as described in step 3.1.1. Then, it is sliced and concatenated according to the latent features output by the periodic slicing and embedding module to obtain a high-dimensional feature vector.
[0103]
[0104] In the formula, L represents the length of the sequence after pruning or extension under a certain latent period, p represents the number of sequences formed after slicing according to the latent period, d represents the model depth, and l represents the length of the latent period.
[0105] 3.2.2 Constructing a periodic multi-head cross-attention module:
[0106] The embedded high-dimensional feature vector and the encoder features are input into a periodic multi-head cross-attention module to obtain aggregated features. In the periodic multi-head cross-attention module, the embedded initial vector is passed through a fully connected layer to obtain several Q values, and the encoder features are passed through a fully connected layer to obtain K and V values.
[0107]
[0108]
[0109]
[0110] Where i represents the sequence block in the i-th sub-cycle, l and p represent the p-th cycle within a certain sub-cycle, t and s represent the timestamps within each cycle, and E represents the output depth of the fully connected layer. Then, for each Q, the corresponding time dimension in K is multiplied by the dot product to obtain a series of attention scores, such as... Figure 5 As shown:
[0111] Expressed as a formula:
[0112] Attn iltps =Q ilt ×K ips
[0113] In the formula, t = s. Next, the attention scores are proportionalized:
[0114]
[0115] Finally, the attention score is softmaxed, multiplied by the previously calculated value, and then summed to obtain the prediction value for this moment:
[0116] score = softmax(Attn′)
[0117]
[0118] The output of the periodic multi-head cross-attention module is obtained by repeating the above process several times without sharing parameters and taking the average value.
[0119] 3.2.3 Constructing a periodic fusion module:
[0120] The periodic fusion module forwards the aggregated features to obtain the final predicted value. In the periodic cross-attention module, the input is first pruned according to the corresponding sub-period length to obtain a series of sequences:
[0121] seq i =reshape(MPACout) i );
[0122] Next, these sequences are trimmed to the predicted length L and then concatenated into a cube:
[0123] cube = cat(seq) i );
[0124] Then, perform a 1D convolution on the cube along the time axis L to obtain the convolution result:
[0125] slice = conv1D(cube);
[0126] Finally, the convolution result is forward-propagated through a fully connected layer to obtain the final prediction result:
[0127] pred=outLinearProj(slice);
[0128] Step 4: Train the model:
[0129] Based on this model, the network is trained using the dataset established in step 1, as follows: Figure 6 As shown:
[0130] First, construct the L2 loss function, whose formula is:
[0131]
[0132] Secondly, the dataset is divided into training, test, and validation sets in a ratio of 0.7:0.2:0.1. Then, training is performed on the training set using L2 loss, and the loss is tested on the test set after each training round. Training stops when the loss increases for three consecutive rounds. Finally, the weight file with the minimum loss on the test set is stored.
[0133] Step 5: Real-time prediction of photovoltaic power generation:
[0134] This invention demonstrates accuracy and speed in practical applications. Deployed in a photovoltaic power generation equipment operation status evaluation system, it uploads field-collected information to the system to predict photovoltaic power generation. In algorithm testing, we predicted the photovoltaic power generation trend in a certain region, and the prediction results are as follows: Figure 7 As shown, the effect is good.
[0135] 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 foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A photovoltaic power generation prediction method based on a periodic attention mechanism, characterized in that: The prediction steps include the following: Step 1: Establish a dataset of photovoltaic power generation and corresponding solar irradiance. By summarizing historical data from photovoltaic power plants, collect multi-dimensional time-series data samples including total irradiance, direct irradiance, diffuse irradiance, temperature, air pressure, azimuth, wind speed, and actual power. Step 2: Clean and standardize the data. Fill missing values in the dataset due to hardware failure with the mean of the two values before and after the missing interval. Then standardize all values to a mean of 0 and a variance of 1. Step 3: Collect the sequence of photovoltaic power generation and input it into the encoder. The encoder encodes the historical data as feature values, calculates the potential period and outputs it, thus constructing a photovoltaic power generation prediction model with encoder and decoder: Step 3.1: Construct the encoder module, including periodic slicing and embedding, and periodic enhancement modules; Step 3.2: Construct the decoder module, which includes a Decoder slicing and embedding module, a periodic multi-head cross-attention module, and a periodic fusion module, to parse the features from the Encoder and output the predicted values; The specific method for constructing a periodic multi-head cross-attention module is as follows: The embedded high-dimensional feature vector and the encoder features are input into a periodic multi-head cross-attention module to obtain aggregated features. In the periodic multi-head cross-attention module, the embedded initial vector is passed through a fully connected layer to obtain several Q values, and the encoder features are passed through a fully connected layer to obtain K and V. The calculation formula is as follows: ; ; ; Where: i represents the sequence block under the i-th sub-cycle, l and p represent the p-th cycle within a certain sub-cycle, t and s represent the timestamps within each cycle, and E represents the output depth of the fully connected layer; For each Q value, the corresponding time dimension in K is multiplied by the dot product to obtain a series of attention scores, calculated using the following formula: ; In the formula, t = s; The attention score is proportionalized, and the calculation formula is as follows: ; The obtained attention score is processed using softmax, then multiplied by the previously calculated value and summed to obtain the predicted value for this moment. The calculation formula is as follows: ; ; After repeating the above steps several times without sharing parameters, the average value is taken to obtain the output of the periodic multi-head cross attention module. Step 4: Based on the constructed prediction model, train the network using the dataset established in Step 1; Step 5: Deploy the trained model in the photovoltaic power generation equipment operation status evaluation system, upload the information collected on site to the system, predict the trend of photovoltaic power generation, and obtain the prediction results.
2. The photovoltaic power generation prediction method based on periodic attention mechanism according to claim 1, characterized in that: The specific method for constructing the encoder module in step 3.1 is as follows: Step 3.1.1: Construct the periodic slice and embedding module: Perform a Fast Discrete Fourier Transform on the power properties of the historical sequence to obtain the amplitude and phase. The result is half the sequence length l plus 1, calculated using the following formula: ; In the formula: RFFT represents the first half of the classical fast discrete Fourier transform, Amp represents the magnitude, and Phase represents the phase; Select the indices of the top 3 amplitudes excluding the 0th frequency, divide the input length by the index, and obtain the potential period. The calculation formula is as follows: ; In the formula: K is 3, and top means finding the top few largest values; The original sequence is cyclically extended, and a sinusoidal sequence is generated from the extended result according to its length to distinguish positional information. This result is then passed through a convolutional layer, where a one-dimensional convolution with a kernel of 3 is performed on the time axis. The convolution result is added to the sinusoidal sequence to obtain the embedded vector. The calculation formula is as follows: ; ; In the formula: i represents the i-th sub-period sequence; padding represents the cyclic extension of the original sequence; positionalEmbedding represents positional embedding of a sequence, while tokenEmbedding represents word embedding of a sequence. Finally, the embedding results are sliced according to the latent periodicity and stacked vertically to obtain the output of the periodic slice and the embedding module. The calculation formula is as follows: ; In the formula: inception means slicing the sequence according to the period p, and trunc means stacking the results along the periodic direction; Step 3.1.2: Construct the cycle enhancement module: 2D convolutions are performed on the periodic slices and the embedded output features along the temporal and periodic order to obtain the potential relationship between the same period and adjacent periods. The result of convolution is standardized, activated by the ReLU activation function, and then randomly deactivated to prevent overfitting. The results of random deactivation are residually linked with the periodic slices and the features output by the embedding module to obtain the output of the periodic enhancement module, which is the output of the Encoder.
3. The photovoltaic power generation prediction method based on periodic attention mechanism according to claim 2, characterized in that: The specific method for constructing the decoder module in step 3.2 is as follows: Building Decoder slices and embedding modules: The initialized zero vector is mapped to a high-dimensional feature space. First, the initialized zero vector or the sequence composed of meteorological information is processed by position embedding and word embedding as described in step 3.1.
1. Then, the processed sequence is sliced and concatenated according to the latent features output by the periodic slicing and embedding module to obtain the high-dimensional feature vector. The calculation formula is as follows: ; In the formula: L represents the length of the sequence after pruning or extension under a certain latent period, p represents the number of sequences formed after slicing according to the latent period, d represents the model depth, and l represents the length of the latent period; The periodic fusion module is constructed to forward propagate the aggregated features to obtain the final predicted value: In the periodic cross-attention module, the input is pruned according to the corresponding sub-period length to obtain a series of sequences, and the calculation formula is as follows: ; These sequences are trimmed to the predicted length L and then concatenated into a cube. The calculation formula is as follows: ; Perform a 1D convolution on the cube along the time axis L to obtain the convolution result. The calculation formula is as follows: ; Finally, the convolution result is forward-propagated through a fully connected layer to obtain the final prediction result, calculated as follows: 。 4. The photovoltaic power generation prediction method based on periodic attention mechanism according to claim 3, characterized in that: The specific method for training the network in step 4 is as follows: Construct the L2 loss function, the function expression is: ; The dataset was divided into training, testing, and validation sets in a ratio of 0.7:0.2:0.
1. The training is performed on the training set using L2 loss, and the loss is tested on the test set after each training round. Training is stopped when the loss increases for three consecutive rounds, and the weight file with the minimum loss on the test set is stored at the end.
Citation Information
Patent Citations
Construction method of multivariable long-sequence time sequence prediction model based on Transform framework
CN114519469A
Short-term time sequence prediction method and system based on time and space attention
CN115081586A