A photovoltaic power accurate prediction method considering global information and local information fusion

By combining a Long Short-Term Memory network and a Transformer dual-branch architecture, and utilizing time pattern attention and historical similarity time series matching methods, the problem of prediction inaccuracy in photovoltaic power generation systems is solved, achieving accurate prediction of photovoltaic power and improving the operating efficiency of the power system.

CN119721752BActive Publication Date: 2026-02-03HOHAI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411769339.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2024-11-27
Filing Date
2024-12-04
Publication Date
2026-02-03
Estimated Expiration
2044-12-04

AI Technical Summary

Technical Problem

The distributed, intermittent, and fluctuating nature of photovoltaic power generation systems makes it difficult to accurately predict power generation, affecting the operating efficiency and supply-demand balance of the power system.

Method used

A hybrid prediction model based on a dual-branch architecture of Long Short-Term Memory Network and Transformer is established. The global branch captures the long-term dependencies of time series, while the local branch captures the dependencies between the prediction period and nearby time nodes. The global and local information are integrated by using time pattern attention and historical similar time series matching methods.

Benefits of technology

It enables accurate prediction of photovoltaic power, improves the operating efficiency of the power system, and reduces the problem of power supply and demand imbalance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119721752B_ABST
    Figure CN119721752B_ABST
Patent Text Reader

Abstract

The present application relates to the field of photovoltaic power prediction, and is a photovoltaic power accurate prediction method considering global information and local information fusion. The method comprises the following steps: (1) establishing a bidirectional stacked long short-term memory model based on time mode attention as a global branch to process all input sequences and capture the long-term dependence of time series; (2) considering the use of historical similar information by the photovoltaic power prediction model to establish an improved Transformer model based on similar time series matching as a local branch to process local input sequences and capture the dependence between the prediction period and the nearby time nodes; (3) establishing a hybrid prediction model based on the dual-branch architecture of long short-term memory network and Transformer, designing two independent branches to extract global information and local information respectively, and integrating the two types of information through a special decoder module. Through example analysis, it is verified that the model can realize accurate prediction of photovoltaic power.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of photovoltaic power prediction, specifically a method for accurate photovoltaic power prediction that considers the fusion of global and local information. Background Technology

[0002] Photovoltaic (PV) power generation has become an important source of electricity, but the inherent characteristics of PV power generation systems, such as distribution, intermittency, and volatility, make accurate prediction of their power generation difficult. To improve the overall operating efficiency of the power system and address the power supply-demand imbalance caused by PV power fluctuations, this paper proposes a method for accurate PV power prediction that integrates global and local information. First, a bidirectional stacked long short-term memory (LSTM) model based on time pattern attention is established as the global branch to process all input sequences and capture long-term dependencies in the time series. Second, considering the utilization of historical similarity information in the PV power prediction model, an improved Transformer model based on similar time series matching is established as the local branch to process local input sequences and capture the dependencies between the prediction period and nearby time nodes. Finally, a hybrid prediction model based on a dual-branch architecture of LTM network and Transformer is established. Two independent branches are designed to extract global and local information respectively, and these two types of information are integrated through a dedicated decoder module to maximize their complementarity. Computational results show that the proposed model can achieve accurate prediction of PV power. Summary of the Invention

[0003] Objective: This invention aims to provide a method for accurate photovoltaic (PV) power prediction that integrates global and local information. A hybrid prediction model based on a dual-branch architecture using Long Short-Term Memory (LSTM) networks and Transformers is established. A global branch is designed to capture the long-term dependencies of time series data, while a local branch extracts the dependencies between the prediction period and nearby time nodes. A dedicated decoder module integrates these two types of information to maximize their complementarity, thus achieving accurate PV power prediction.

[0004] Technical solution: The specific steps of this invention are as follows:

[0005] S1: Construct a neural network architecture combining a temporal pattern attention (TPA) mechanism and a multi-directional long short-term memory (MBLSTM) network. This architecture includes an input layer, an MBLSTM layer, a TPA layer, a flattening layer, a fully connected layer (Dense), and an output layer. The input layer serializes time-series data, such as historical power and meteorological conditions, into the model. The MBLSTM layer focuses on extracting complex features from this input data. The TPA layer further processes the feature vectors generated by the MBLSTM layer, assigning temporal pattern attention weights to emphasize time periods that are more critical for prediction. The flattening layer transforms the multi-dimensional feature matrix output by the TPA layer into a one-dimensional array. Subsequently, through the fully connected layer and corresponding activation functions, these features are mapped to the final label space, thereby achieving the predicted output of photovoltaic power.

[0006] S2: Design of historical similar time series matching method: First, the FCM clustering algorithm is used to process the historical photovoltaic power data, and the photovoltaic power data of each time period is classified into three weather patterns: "sunny", "partly cloudy" and "overcast". Based on the above clustering, the Pearson correlation coefficient of photovoltaic power curves of different daily search periods and the maximum mutual information number of NWP data curves of different daily prediction periods are calculated. The average value of the two is calculated and the n time series with the highest similarity are selected as the result of historical similar time series matching.

[0007] S3: Constructing an improved Transformer model based on similar time series matching: The Transformer model demonstrates significant advantages in handling long-distance dependencies, promoting the interaction of global information, and supporting parallel computation. In the encoder stage, the time series data of the search period for the day to be predicted and the search periods for similar days are first linearly transformed into feature vectors Q, K, and V. The feature vectors are then processed through a self-attention mechanism, and a unique feedforward channel is designed to reduce information loss and make the model output more stable. In the decoder stage, the data of the search periods for similar days are used as the input vector based on the similarity-weighted average. Two self-attention mechanisms are introduced to focus on the search period itself and the contextual information about similar periods, respectively.

[0008] S4: Constructing a hybrid prediction model based on a two-branch architecture of Long Short-Term Memory (LSTM) networks and Transformers: This model designs two independent branches to pass input data, each used to capture and extract different types of information: global information and local information. The upper branch, composed of a TPA-MBLSTM model, extracts global information, reflecting long-term dependencies in the sequence. The lower branch, composed of an improved Transformer model based on similar time series matching, focuses on capturing local information, reflecting the dependencies between the predicted time period and nearby time nodes. A unique decoder module is designed specifically to integrate these two types of information to maximize their complementarity.

[0009] S5: Design different experiments to analyze and verify the effectiveness of the proposed model: use the mean absolute error, root mean square error and coefficient of determination of the prediction results as the standard to measure the model performance, and compare the prediction results of the proposed model with different models on typical days and atypical days on the same dataset.

[0010] In step S1, a neural network architecture combining temporal pattern attention (TPA) mechanism and multidirectional long short-term memory (MBLSTM) network is constructed: the architecture mainly includes MBLSTM model and TPA layer, and its mathematical model is as follows.

[0011] (1) MBLSTM model

[0012] The MBLSTM prediction model is a deeper application and development of the BLSTM neural network. It combines a multi-layer forward LSTM architecture with a multi-layer backward LSTM architecture to form a more complex network structure, namely MBLSTM. In this model, each layer is built based on BLSTM, and each BLSTM layer receives output information from the previous BLSTM layer, which helps improve the accuracy of the prediction task. The mathematical model of MBLSTM is expressed as follows:

[0013]

[0014]

[0015] Where i represents the number of BLSTM layers; These are the hidden layer values ​​of the i-th layer of the BLSTM forward recurrent layer at time t and t-1, respectively. The values ​​of the hidden layers of the i-th layer of the BLSTM backward recurrent layer at time t and time t-1 are respectively; t Let V be the value of the output layer at time t. As can be seen from the BLSTM structure, the weights in the forward and backward computation processes are independent. During the forward computation, V... (i) U (i) W(i) V represents the connection weight matrix between each layer of the forward recurrent layer in the i-th BLSTM; during backward computation, V ′(i) U ′(i) W ′(i) and represent the connection weight matrices between each layer of the backward recurrent layer in the i-th layer of the BLSTM.

[0016] (2) TPA layer

[0017] Assume the hidden layer information generated by the MBLSTM network is H = {h} t-ω ,h t-ω+1 ,...,h t-1}, where h t Let H be the hidden layer information at time t; ω represents the length of the time sliding window used to select a certain length of time data; T represents the time length of interest to the time attention mechanism, which is generally equal to the window sliding length. Using k convolution kernels, the original hidden layer information H is convolved to produce an n*k dimensional matrix:

[0018]

[0019] For the next predicted h t Through its connection with The operations between them are used to calculate the weight α. i It indicates Each row in the text represents the h to be predicted. t The strength of the influence, i.e., the influence of each time series on h. t The magnitude of the influence, W α ∈R k×m The calculation process is as follows:

[0020]

[0021] in, H represents C The vector in the i-th row of the vector.

[0022] Then perform a weighted summation, v t It represents All rows for h t The overall impact, that is, the impact in terms of time:

[0023]

[0024] Finally, add v to the calculation. t The factors are used to arrive at the predicted value:

[0025] h t '=W h h t+W v v t

[0026] In step S2, a historical similar time series matching method is designed. First, the FCM clustering algorithm is used to process historical photovoltaic power data, classifying the photovoltaic power data of each time period into three weather patterns: "sunny," "partly cloudy," and "overcast." Based on the above clustering, the Pearson correlation coefficient of photovoltaic power curves for different daily search periods and the maximum mutual information number of NWP data curves for different daily prediction periods are calculated. The average of these two values ​​is then calculated, and the n time series with the highest similarity are selected as the results of historical similar time series matching. The above model is expressed in the following formula.

[0027] (1) FCM clustering algorithm

[0028] Traditional hard clustering methods require each data point to strictly belong to a single cluster, which performs well in scenarios where data points can be explicitly assigned to a unique cluster. However, these traditional methods fall short when dealing with noisy, fuzzy, and uncertain data. Fuzzy clustering fills this gap. Unlike hard clustering methods, fuzzy clustering allows samples to belong to multiple clusters with a certain probability or membership degree, rather than being explicitly assigned to a single cluster. This flexibility makes fuzzy clustering significantly advantageous when handling complex and uncertain data, providing more accurate clustering results for many practical scenarios. The basic steps of the FCM clustering algorithm are as follows:

[0029] Randomly select n samples as initial cluster centers, and assign initial membership degrees to each sample, typically values ​​within the range [0, 1]. Define the objective function for the fuzzy C-means, which is the objective to be minimized. The objective function represents the sum of weighted Euclidean distances between the membership degrees of samples to the cluster centers, defined as follows:

[0030]

[0031] Where: JU,C represents the objective function, m is the ambiguity parameter, and u ij It is sample x i Belongs to cluster c j Membership degree, ||x i -c j || 2 Indicates sample x i With cluster center c j The Euclidean distance between them.

[0032] Update the membership degree by calculating the membership degree of each sample to each cluster, using the following formula:

[0033]

[0034] Update the cluster centers C, and use the new membership matrix to calculate the center position of each cluster. The specific formula is as follows:

[0035]

[0036] Check if the changes in membership degree and cluster centers are small enough, or if the predetermined number of iterations has been reached. If the termination condition is met, the algorithm terminates. Otherwise, return to the step of updating membership degree and continue iterating.

[0037] (2) Pearson correlation coefficient

[0038] The Pearson correlation coefficient is a linear correlation coefficient used to reflect the degree of linear correlation between two variables. Its value is between -1 and 1. The larger the absolute value, the stronger the correlation. Its calculation formula is shown below.

[0039]

[0040] (3) Maximum mutual information

[0041] The maximum mutual information coefficient (MPI) is universally applicable; with a sufficiently large sample size, it can capture correlations between variables that are not limited to linear relationships, covering all functional relationships. Its main idea is to discretize the relationship between two variables in a two-dimensional space and represent it using a scatter plot. Then, certain intervals are drawn along the X and Y directions of this two-dimensional space, and the probability of a scatter point falling into each interval is observed. The calculation method is as follows:

[0042]

[0043] Where a and b are the number of cells on the x and y axes corresponding to the grid division, and B is an adjustable parameter, usually around 0.6 times the total data volume.

[0044] In step S3, an improved Transformer model based on similar time series matching is constructed. In the encoder stage, the time series data of the search period of the day to be predicted and the search period of similar days are first mapped to feature vectors Q, K and V through linear transformation. The feature vectors are then processed by a self-attention mechanism, and a unique feedforward channel is designed to reduce information loss and make the model output more stable. In the decoder stage, the data of the search period of similar days is used as the input vector based on the similarity weighted average. Two self-attention mechanisms are introduced to focus on the search period itself and the contextual information about similar periods, respectively.

[0045] (1) Transformer model encoder

[0046] First, this article needs to include the search time period data for the day to be predicted. Search time data for similar days Perform a linear transformation to obtain the query vector Q, the key vector K, and the numerical vector V.

[0047] V = Linear(p0) = W V p0+b V

[0048] Q = Linear(p0) = W Q p0+b Q

[0049] K = Linear(P) n ) = W K P n +b K

[0050] Among them, W V W Q W K It is the weight matrix of the linear transformation, b V ,b Q ,b K It is a bias term

[0051] Next, this paper uses an attention mechanism to compute the feature vector X3. The core of the attention mechanism is to calculate the similarity between the query vector Q and the key vector K, and then perform a weighted summation of the numerical vector V based on the similarity.

[0052]

[0053] The vector X3 calculated by the attention mechanism is compared with QK. T The results are added together to obtain the final encoder output.

[0054] X4 = X3 + QK T

[0055] (2) Transformer model decoder

[0056] Data of the time period to be predicted from similar time periods The input vector X5 is obtained by weighted averaging the similarities calculated in step S2. The first attention mechanism uses X5 as the query vector Q, key vector K, and value vector V for self-attention calculation.

[0057]

[0058] The second attention mechanism uses the encoder output X4 as the query vector Q and the key vector K, and the output X6 of the first attention mechanism as the numerical vector V for cross-attention calculation, which is the final output of the model.

[0059]

[0060] In step S4, a hybrid prediction model based on a two-branch architecture of Long Short-Term Memory (LSTM) network and Transformer is constructed. The upper branch consists of a TPA-MBLSTM model, used to extract global information, reflecting long-term dependencies in the sequence. The lower branch consists of an improved Transformer model based on similar time series matching, focusing on capturing local information, reflecting the dependencies between the time period to be predicted and nearby time nodes. A unique decoder module is designed specifically to integrate these two types of information to maximize their complementarity. Its mathematical model is as follows.

[0061] (1) Hybrid model encoder

[0062] In the encoder section, there are two parallel branches. The upper branch, consisting of a TPA-MBLSTM model, is used to extract global information z. global It reflects the long-term dependencies present in the sequence. The lower branch consists of an improved Transformer model based on similar time period analysis, focusing on capturing local information z. local It reflects the dependency between the time period to be predicted and nearby time nodes.

[0063] z global =Branch global (X)

[0064] z local =Branch local (X)

[0065] (2) Hybrid Model Decoder

[0066] In the decoder section, to enhance the utilization of global and local information, the decoder module designed in this section will incorporate global information (z... global ) and local information (z local The data is combined and the prediction results are output. The decoder module mainly contains a cross-attention module, which aims to ensure that historical information in the time series is effectively represented. This paper maps global and local information to hidden dimensions, and then uses global information as the query vector (q), local information as the key vector (k), and numerical vector (v).

[0067] q = MLP(z) global )

[0068] k = MLP(z) local ),v=MLP(z local )

[0069] By using local information to query global information, global and local information can be effectively integrated.

[0070]

[0071] (3) RevIN normalization method

[0072] RevIN is a data normalization method specifically designed for time series forecasting tasks. This method normalizes time series data by removing statistical properties such as mean and variance, and restores the series to its original scale after forecasting, thereby improving the performance of the prediction model. Because it can be inserted as a standalone component into models like the Transformer, it is called a "plug-and-play" method. To address the distribution shift between training and test data, the RevIN method is used to enhance the model's robustness. This paper first calculates the values ​​for each set of input data... Mean and standard deviation:

[0073]

[0074] Using this data, this paper can use learnable affine parameter vectors. Normalize the input data:

[0075]

[0076] The normalized data is then fed into the model for prediction. Finally, by reversing the initial normalization process, this paper obtains the prediction results.

[0077] In step S5, different experiments are designed to analyze and verify the effectiveness of the proposed model: the mean absolute error, root mean square error and coefficient of determination of the prediction results are used as the standard to measure the performance of the model. The prediction results of the proposed model and different models on typical days and atypical days are compared on the same dataset.

[0078] (1) Mean Absolute Error

[0079] MAE measures the mean absolute difference between predicted and actual values. It is a linear measure, meaning all individual differences are treated equally. The MAE formula is as follows:

[0080]

[0081] (2) Root mean square error

[0082] RMSE measures the square root of the mean of the squared differences between the predicted and actual values. It is more sensitive to larger errors because the errors are squared first. The RMSE formula is as follows:

[0083]

[0084] (3) Coefficient of determination

[0085] R 2 This represents the proportion of variability explained by the model, i.e., the portion of the total data variability explained by the model. R 2 The closer R is to 1, the better the model fits. 2 The calculation formula is as follows:

[0086]

[0087] Experimental results:

[0088] To improve the overall operating efficiency of the power system and address the power supply-demand imbalance caused by photovoltaic (PV) power fluctuations, a method for accurate PV power prediction considering the fusion of global and local information is proposed. First, a bidirectional stacked long short-term memory (LSTM) model based on time-pattern attention is established as the global branch to process all input sequences and capture long-term dependencies in the time series. Second, considering the utilization of historical similarity information in the PV power prediction model, an improved Transformer model based on similar time series matching is established as the local branch to process local input sequences and capture the dependencies between the prediction period and nearby time nodes. Finally, a hybrid prediction model based on a dual-branch architecture of LTM network and Transformer is established. Two independent branches are designed to extract global and local information respectively, and these two types of information are integrated through a dedicated decoder module to maximize their complementarity. Computational results show that the proposed model can achieve accurate PV power prediction. Attached Figure Description

[0089] Figure 1 This is a diagram of historical similar time series matching methods.

[0090] Figure 2 It is an improved Transformer encoder model structure diagram.

[0091] Figure 3 This is an improved Transformer decoder model structure diagram.

[0092] Figure 4 This is a diagram of the hybrid prediction model with a dual-branch architecture. Detailed Implementation

[0093] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0094] A method for accurate photovoltaic power prediction that considers the fusion of global and local information includes the following steps:

[0095] S1: Construct a neural network architecture combining a temporal pattern attention (TPA) mechanism and a multi-directional long short-term memory (MBLSTM) network. This architecture includes an input layer, an MBLSTM layer, a TPA layer, a flattening layer, a fully connected layer (Dense), and an output layer. The input layer serializes time-series data, such as historical power and meteorological conditions, into the model. The MBLSTM layer focuses on extracting complex features from this input data. The TPA layer further processes the feature vectors generated by the MBLSTM layer, assigning temporal pattern attention weights to emphasize time periods that are more critical for prediction. The flattening layer transforms the multi-dimensional feature matrix output by the TPA layer into a one-dimensional array. Subsequently, through the fully connected layer and corresponding activation functions, these features are mapped to the final label space, thereby achieving the predicted output of photovoltaic power.

[0096] S2: Design of historical similar time series matching method: First, the FCM clustering algorithm is used to process the historical photovoltaic power data, and the photovoltaic power data of each time period is classified into three weather patterns: "sunny", "partly cloudy" and "overcast". Based on the above clustering, the Pearson correlation coefficient of photovoltaic power curves of different daily search periods and the maximum mutual information number of NWP data curves of different daily prediction periods are calculated. The average value of the two is calculated and the n time series with the highest similarity are selected as the result of historical similar time series matching.

[0097] S3: Constructing an improved Transformer model based on similar time series matching: The Transformer model demonstrates significant advantages in handling long-distance dependencies, promoting the interaction of global information, and supporting parallel computation. In the encoder stage, the time series data of the search period for the day to be predicted and the search periods for similar days are first linearly transformed into feature vectors Q, K, and V. The feature vectors are then processed through a self-attention mechanism, and a unique feedforward channel is designed to reduce information loss and make the model output more stable. In the decoder stage, the data of the search periods for similar days are used as the input vector based on the similarity-weighted average. Two self-attention mechanisms are introduced to focus on the search period itself and the contextual information about similar periods, respectively.

[0098] S4: Constructing a hybrid prediction model based on a two-branch architecture of Long Short-Term Memory (LSTM) networks and Transformers: This model designs two independent branches to pass input data, each used to capture and extract different types of information: global information and local information. The upper branch, composed of a TPA-MBLSTM model, extracts global information, reflecting long-term dependencies in the sequence. The lower branch, composed of an improved Transformer model based on similar time series matching, focuses on capturing local information, reflecting the dependencies between the predicted time period and nearby time nodes. A unique decoder module is designed specifically to integrate these two types of information to maximize their complementarity.

[0099] S5: Design different experiments to analyze and verify the effectiveness of the proposed model: Use the mean absolute error, root mean square error and coefficient of determination of the prediction results as the standard to measure the model performance. Compare the prediction results of the proposed model and different models on typical days and atypical days on the same dataset; compare the mean absolute error of the proposed model and different models over a day with time to reflect the prediction error of the model in different time periods.

[0100] Finally, it should be noted that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for accurate photovoltaic power prediction that considers the fusion of global and local information, characterized in that: Includes the following steps: S1: Construct a neural network architecture combining a temporal pattern attention (TPA) mechanism and a multi-directional long short-term memory (MBLSTM) network. This architecture includes an input layer, an MBLSTM layer, a TPA layer, a flattening layer, a fully connected layer (Dense), and an output layer. The input layer serializes time-series data, including historical power and meteorological conditions, into the model. The MBLSTM layer focuses on extracting complex features from these input data. The TPA layer further processes the feature vectors generated by the MBLSTM layer, assigning temporal pattern attention weights to them to emphasize time periods that are more critical for prediction. The flattening layer transforms the multi-dimensional feature matrix output by the TPA layer into a one-dimensional array. Subsequently, through the fully connected layer and the corresponding activation function, these features are mapped to the final label space, thereby achieving the predicted output of photovoltaic power. S2: Design of historical similar time series matching method: First, the FCM clustering algorithm is used to process the historical photovoltaic power data, and the photovoltaic power data of each time period is classified into three weather patterns: "sunny", "partly cloudy" and "overcast". Based on the above clustering, the Pearson correlation coefficient of photovoltaic power curves of different daily search periods and the maximum mutual information number of NWP data curves of different daily prediction periods are calculated. The average value of the two is calculated and the n time series with the highest similarity are selected as the result of historical similar time series matching. S3: Constructing an improved Transformer model based on similar time series matching: The Transformer model shows more significant advantages in handling long-distance dependencies, promoting the interaction of global information, and supporting parallel computing. In the encoder stage, the time series data of the search period of the day to be predicted and the search period of similar days are first mapped to feature vectors Q, K, and V through linear transformation. The feature vectors are then processed by a self-attention mechanism, and a unique feedforward channel is designed to reduce information loss and make the model output more stable. In the decoder stage, the data of the search period of similar days is used as the input vector based on the similarity weighted average. Two self-attention mechanisms are introduced to focus on the search period itself and the contextual information about similar periods, respectively. The improved Transformer model based on similar time series matching first transforms the time series data of the search period of the day to be predicted and the search period of similar days into feature vectors Q, K and V through linear transformation in the encoder stage. The feature vectors are then processed by a self-attention mechanism, and a unique feedforward channel is designed to reduce information loss and make the model output more stable. In the decoder stage, the data of the search period of similar days is used as the input vector by the result of the similarity weighted average. Two self-attention mechanisms are introduced to focus on the search period itself and the contextual information about similar periods, respectively. (1) Transformer model encoder First, the search time period data for the day to be predicted needs to be obtained. Search time data for similar days Perform a linear transformation to obtain the query vector Q, the key vector K, and the numerical vector V; V=Linear(p0)=W V p0+b V Q=Linear(p0)=W Q p0+b Q K=Linear(P n )=W K P n +b K Among them, W V W Q W K It is the weight matrix of the linear transformation, b V ,b Q ,b K It is a bias term (case-sensitive); Next, the attention mechanism is used to calculate the feature vector X3. The core of the attention mechanism is to calculate the similarity between the query vector Q and the key vector K, and then perform a weighted summation on the numerical vector V based on the similarity. The vector X3 calculated by the attention mechanism is compared with QK. T The results are added together to obtain the final encoder output: X4=X3+QK T (2) Transformer model decoder Data of the time period to be predicted from similar time periods The input vector X5 is obtained by weighted averaging the similarities calculated in step S2. The first attention mechanism uses X5 as the query vector Q, key vector K, and value vector V for self-attention calculation. The second attention mechanism uses the encoder output X4 as the query vector Q and the key vector K, and the output X6 of the first attention mechanism as the numerical vector V for cross-attention calculation, which is the final output of the model. S4: Construct a hybrid prediction model based on a two-branch architecture of Long Short-Term Memory Network and Transformer. This model is designed with two independent branches to pass input data. The two branches are used to capture and extract different types of information: global information and local information. The upper branch is composed of a TPA-MBLSTM model to extract global information, which reflects the long-term dependencies in the sequence. The lower branch is composed of an improved Transformer model based on similar time series matching, which focuses on capturing local information, which reflects the dependencies between the time period to be predicted and nearby time nodes. A unique decoder module is designed specifically to integrate these two types of information to maximize their complementarity. S5: Design different experiments to analyze and verify the effectiveness of the proposed model: use the mean absolute error, root mean square error and coefficient of determination of the prediction results as the standard to measure the model performance, and compare the prediction results of the proposed model with different models on typical days and atypical days on the same dataset.

2. The photovoltaic power accurate prediction method considering the fusion of global and local information according to claim 1, characterized in that: In step S1, a neural network architecture combining Temporal Pattern Attention (TPA) and Multidirectional Long Short-Term Memory (MBLSTM) networks is constructed. This architecture mainly consists of an MBLSTM model and a TPA layer, and its mathematical model is as follows: (1) MBLSTM model The MBLSTM prediction model is a deeper application and development of the BLSTM neural network. It combines a multi-layer forward LSTM architecture with a multi-layer backward LSTM architecture to form a more complex network structure, namely MBLSTM. In this model, each layer is built based on BLSTM, and each BLSTM layer receives output information from the previous BLSTM layer. This helps improve the accuracy of the prediction task. The mathematical model of MBLSTM is expressed as follows: Where i represents the number of BLSTM layers; These are the hidden layer values ​​of the i-th layer of the BLSTM forward recurrent layer at time t and t-1, respectively. The values ​​of the hidden layers of the i-th layer of the BLSTM backward recurrent layer at time t and time t-1 are respectively; t Let V be the value of the output layer at time t. As can be seen from the BLSTM structure, the weights in the forward and backward computation processes are independent. During the forward computation, V... (i) U (i) W (i) V′ represents the connection weight matrix between each layer of the forward recurrent layer in the i-th BLSTM; during backward computation, V′ (i) 、U′ (i) 、W′ (i) These represent the connection weight matrices between each layer of the backward recurrent layer in the i-th layer of the BLSTM; (2) TPA layer Assume the hidden layer information generated by the MBLSTM network is H = {h} t-ω ,h t-ω+1 ,…,h t-1 }, where h t Let H be the hidden layer information at time t; ω represents the length of the time sliding window used to select a certain length of time data; T represents the time length that the time attention mechanism is concerned with, which is generally equal to the window sliding length; using k convolution kernels, the original hidden layer information H is convolved to produce an n*k dimensional matrix: For the next predicted h t Through its connection with The operations between them are used to calculate the weight α. i It indicates Each row in the text represents the h to be predicted. t The strength of the influence, i.e., the influence of each time series on h. t The magnitude of the influence, W α ∈R k×m The calculation process is as follows: in, H represents C The vector in the i-th row; Then perform a weighted summation, v t It represents All rows for h t The overall impact, that is, the impact in terms of time: Finally, add v to the calculation. t The factors are used to arrive at the predicted value: h′ t =W h h t +W v v t 。 3. The photovoltaic power accurate prediction method considering the fusion of global and local information according to claim 1, characterized in that: In step S2, a historical similar time series matching method is designed. First, the FCM clustering algorithm is used to process historical photovoltaic power data, classifying the photovoltaic power data of each time period into three weather patterns: "sunny", "partly cloudy", and "overcast". Based on the above clustering, the Pearson correlation coefficient of photovoltaic power curves for different daily search periods and the maximum mutual information number of NWP data curves for different daily prediction periods are calculated. The average of the two is calculated, and the n time series with the highest similarity are selected as the results of historical similar time series matching. The above model is expressed by the following formula: (1) FCM clustering algorithm Traditional hard clustering methods require each data point to strictly belong to a single cluster, which performs well in scenarios where data points can be explicitly assigned to a unique cluster. However, these traditional methods fall short when dealing with noisy, fuzzy, and uncertain data. The introduction of fuzzy clustering fills this gap. Unlike hard clustering methods, fuzzy clustering allows samples to belong to multiple clusters with a certain probability or membership degree, rather than being explicitly assigned to a specific cluster. This flexibility makes fuzzy clustering significantly advantageous when dealing with complex and uncertain data, providing more accurate clustering results for many practical scenarios. The basic steps of the FCM clustering algorithm are as follows: Randomly select n samples as initial cluster centers, and assign initial membership degrees to each sample, typically values ​​within the range [0, 1]. Define the objective function for the fuzzy C-means, which is the objective to be minimized. The objective function represents the sum of weighted Euclidean distances between the membership degrees of a sample and its cluster center, defined as follows: Where: JU,C represents the objective function, m is the ambiguity parameter, and u ij It is sample x i Belongs to cluster c j Membership degree, ||x i -c j || 2 Indicates sample x i With cluster center c j The Euclidean distance between them; Update the membership degree by calculating the membership degree of each sample to each cluster, using the following formula: Update the cluster centers C, and use the new membership matrix to calculate the center position of each cluster. The specific formula is as follows: Check if the changes in membership degree and cluster center are small enough, or if the predetermined number of iterations has been reached; if the termination condition is met, the algorithm ends; otherwise, return to the step of updating membership degree and continue iterating; (2) Pearson correlation coefficient The Pearson correlation coefficient is a linear correlation coefficient used to reflect the degree of linear correlation between two variables. Its value ranges from -1 to 1, and the larger the absolute value, the stronger the correlation. Its calculation formula is shown below: (3) Maximum mutual information The maximum mutual information coefficient (MFI) is universally applicable. When the sample size is large enough, it can capture correlations between variables that are not limited to linear relationships and can cover all functional relationships. Its main idea is to discretize the relationship between two variables in a two-dimensional space and represent it with a scatter plot. Then, certain intervals are drawn along the X and Y directions of this two-dimensional space, and the probability of the scatter points falling into the intervals is observed. The calculation method is as follows: Where a and b are the number of cells on the x and y axes corresponding to the grid division, and B is an adjustable parameter, usually around 0.6 times the total data volume.

4. The photovoltaic power accurate prediction method considering the fusion of global and local information according to claim 1, characterized in that: Step S4 constructs a hybrid prediction model based on a dual-branch architecture of Long Short-Term Memory (LSTM) network and Transformer. The upper branch consists of a TPA-MBLSTM model, used to extract global information, reflecting long-term dependencies in the sequence. The lower branch consists of an improved Transformer model based on similar time series matching, focusing on capturing local information, reflecting the dependencies between the time period to be predicted and nearby time nodes. A unique decoder module is designed specifically to integrate these two types of information to maximize their complementarity. Its mathematical model is as follows: (1) Hybrid model encoder In the encoder section, there are two parallel branches: the upper branch consists of a TPA-MBLSTM model, used to extract global information z. global It reflects the long-term dependencies that exist in the sequence; The lower branch consists of an improved Transformer model based on similar time period analysis, focusing on capturing local information z. local It reflects the dependency between the time period to be predicted and nearby time nodes: z global =Branch global (X) z local =Branch local (X) (2) Hybrid Model Decoder In the decoder section, to enhance the utilization of global and local information, the decoder module designed in this section will incorporate global information (z... global ) and local information (z local Combine and output the prediction results; The decoder module mainly includes a cross-attention module, designed to ensure that historical information in the time series is effectively represented; it maps global and local information to hidden dimensions, and then uses global information as the query vector (q), and local information as the key vector (k) and value vector (v): q=MLP(z global ) k=MLP(z local ),v=MLP(z local ) By using local information to query global information, global and local information can be effectively integrated: (3) RevIN normalization method RevIN is a data normalization method specifically designed for time series forecasting tasks. This method normalizes time series data by removing statistical properties such as mean and variance, and restores the series to its original scale after forecasting, thereby improving the performance of the prediction model. Because it can be inserted as a standalone component into models like the Transformer, it is called a "plug-and-play" method. To address the distribution shift between training and test data, RevIN is used to enhance the model's robustness. First, it calculates the distribution of each set of input data... Mean and standard deviation: Using this data, learnable affine parameter vectors can be used. Normalize the input data: The normalized data is then fed into the model for prediction; finally, the normalization process is reversed by inverting the initial normalization process to obtain the prediction result.

5. The photovoltaic power accurate prediction method considering the fusion of global and local information according to claim 1, characterized in that: Step S5 involves designing different experiments to analyze and verify the effectiveness of the proposed model. The mean absolute error, root mean square error, and coefficient of determination of the prediction results are used as standards to measure the model's performance. The prediction results of the proposed model and different models are compared on the same dataset on typical and atypical days. (1) Mean Absolute Error MAE measures the mean absolute difference between predicted and actual values. It is a linear measure, meaning that all individual differences are treated equally. The MAE formula is as follows: (2) Root mean square error RMSE measures the square root of the mean of the squared differences between the predicted and actual values. It is more sensitive to larger errors because the error is squared first. The RMSE formula is as follows: (3) Coefficient of determination R 2 R represents the proportion of variability explained by the model, i.e., the portion of the total data variability explained by the model; 2 The closer R is to 1, the better the model fits. 2 The calculation formula is as follows:

Citation Information

Patent Citations

  • Photovoltaic power generation power prediction method based on multi-view adaptive feature fusion

    CN115829126A

  • Short-term wind power prediction method and system based on hybrid clustering

    CN118521172A