Photovoltaic power generation prediction method and system based on frequency domain decoupling and cross attention
By adopting the frequency domain decoupling and cross-attention method in photovoltaic power generation prediction, a prediction model including Top-K period selection module, time-mixed multi-layer perceptron module and cross-variable cross-attention module is constructed, which solves the problem of inaccurate prediction in the existing technology under rapidly changing weather conditions, and achieves more efficient and accurate photovoltaic power generation prediction.
Patent Information
- Application Number
- CN202411588223.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-08
- Publication Date
- 2025-02-28
AI Technical Summary
Existing photovoltaic power generation prediction methods are difficult to accurately reflect the dynamic relationship between historical data and future data under rapidly changing weather conditions, resulting in low decision-making efficiency and accuracy of the power scheduling system.
Using a photovoltaic power generation prediction method based on frequency domain decoupling and cross attention, a prediction model including Top-K periodic selection module, a time-mixed multi-layer perceptron module and a cross-variable cross attention module is constructed, which can accurately reflect the dynamic relationship between historical and future data under rapidly changing weather conditions.
It effectively improves the decision efficiency and accuracy of the power scheduling system, and can accurately predict photovoltaic power generation under rapidly changing weather conditions, improving the accuracy and reliability of prediction.
Smart Images

Figure CN119539160A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of photovoltaic power generation prediction, and in particular to a photovoltaic power generation prediction method and system based on frequency domain decoupling and cross attention. Background Art
[0003] At present, renewable energy provides strong support for achieving clean, sustainable and decarbonization goals, and photovoltaic power generation facilities are widely welcomed due to their easy installation and operation. Although the large-scale grid connection of photovoltaic renewable energy has brought significant environmental benefits, it has also brought new challenges to grid dispatch and operation. Generally speaking, solar photovoltaic power generation follows a certain daily cycle, but because weather conditions are difficult to accurately predict, photovoltaic power generation is still intermittent and undispatched. Therefore, improving the accuracy of photovoltaic power generation forecasts is crucial for power dispatch systems that rely on renewable energy.
[0004] With the widespread application of photovoltaic power generation technology, existing photovoltaic power generation prediction methods have gradually exposed their limitations. Taking simple statistical models or physical process-based modeling as an example, these methods have difficulty in dealing with complex nonlinear relationships and therefore perform poorly in long-term predictions. For example, in a typical photovoltaic power station, power generation is not only affected by light intensity, but also by multiple environmental factors such as temperature, humidity, and wind speed.
[0005] However, existing methods have difficulty in fully integrating and utilizing these high-dimensional meteorological data to improve forecast accuracy. For time series that may have short-term mutations, existing methods still have the problem of being unable to accurately reflect the potential dynamic relationship between historical data and future data when the weather forecast shows that there will be a series of rapidly changing weather conditions in the next few days (such as a sudden change from sunny to cloudy), resulting in low decision-making efficiency and accuracy of the power dispatching system. Summary of the invention
[0006] In order to overcome the problem that the existing photovoltaic power generation prediction technology cannot accurately reflect the potential dynamic relationship between historical data and future data under rapidly changing weather conditions, thereby resulting in low decision-making efficiency and accuracy of the power dispatching system, the present invention proposes a photovoltaic power generation prediction method and system based on frequency domain decoupling and cross-attention, which can accurately reflect the potential dynamic relationship between historical data and future data under rapidly changing weather conditions, thereby effectively improving the decision-making efficiency and accuracy of the power dispatching system.
[0007] To achieve the purpose of the present invention, the present invention adopts the following technical solutions:
[0008] A photovoltaic power generation prediction method based on frequency domain decoupling and cross attention, the method comprising the following steps:
[0009] Collecting historical photovoltaic power generation data and preprocessing the photovoltaic power generation data;
[0010] Constructing a photovoltaic power generation prediction model, and dividing the preprocessed photovoltaic power generation data into a training set and a test set, using the training set to perform photovoltaic power generation prediction training on the photovoltaic power generation prediction model, and using the test set to test the trained photovoltaic power generation prediction model, and obtaining a trained photovoltaic power generation prediction model after the test passes;
[0011] Use the trained photovoltaic power generation prediction model to predict photovoltaic power generation and output the prediction results.
[0012] In the above technical scheme, by preprocessing the collected historical photovoltaic power generation data, the practicality and reliability of the historical photovoltaic power generation data can be effectively improved; the constructed photovoltaic power generation prediction model can be trained with photovoltaic power generation prediction of the training set and tested with the test set to obtain a photovoltaic power generation prediction model that effectively grasps the changes in photovoltaic power generation data, so that photovoltaic power generation prediction can be performed through the photovoltaic power generation prediction model, which can effectively reflect the potential dynamic relationship between historical data and future data under rapidly changing weather conditions, thereby effectively improving the decision-making efficiency and accuracy of the power dispatching system.
[0013] Furthermore, the process of preprocessing the photovoltaic power generation data includes:
[0014] The maximum information coefficient is used to quantify the correlation between endogenous and exogenous variables in photovoltaic power generation data, and the sample space is divided into grids and the mutual information is calculated to capture the deep relationship characteristics between the variables. The expression is:
[0015]
[0016] Based on the deep relationship characteristics between the captured variables, the exogenous variables with MIC values greater than the preset threshold are extracted;
[0017] All endogenous variables and the extracted exogenous variables are combined into a historical multivariate sequence, expressed as:
[0018] x∈R M×L ;
[0019] Divide the historical multivariate sequence into training set and test set;
[0020] Among them, p(x,y) represents the joint probability of variables x and y, p(x) and p(y) represent the marginal probabilities of vectors x and y respectively, MIC represents the maximum information coefficient; M represents the total number of input variables, L represents the length of the historical multivariate sequence of each variable, the historical multivariate sequence is a univariate time series, i and j represent the indexes of endogenous variable i and exogenous variable j respectively.
[0021] In the above technical scheme, in addition to endogenous variables of photovoltaic power generation such as active power (Activate Power), the collected photovoltaic power generation data also includes many exogenous variables of meteorological factors, such as weather and daily rainfall (Weather DailyRainfall) and diffuse horizontal radiation (Diffuse Horizontal Radiation). Quantifying the correlation between endogenous and exogenous variables in photovoltaic power generation data, dividing the sample space into grids and calculating mutual information can effectively reduce the number of input variables, thereby reducing the computational complexity of the photovoltaic power generation prediction model, improving the training efficiency of the model, and more accurately capturing the deep relationship characteristics between variables, so as to improve the practicality and reliability of historical photovoltaic power generation data.
[0022] Furthermore, the process of performing photovoltaic power generation prediction training on the photovoltaic power generation prediction model using the training set includes:
[0023] The constructed photovoltaic power generation prediction model includes Top-K cycle selection module, time-mixed multi-layer perceptron module and cross-variable cross-attention module;
[0024] Setting several rounds of iterative training to perform photovoltaic power generation prediction training on the photovoltaic power generation prediction model;
[0025] The Top-K period selection module is used to decouple the univariate time series in the training set into several bivariate time series;
[0026] The time-mixed multi-layer perceptron module extracts local and global change features in the bivariate time series based on the extracted bivariate time series.
[0027] Based on the local change characteristics and global change characteristics, the cross-variable cross-attention module divides the bivariate time series into endogenous variables and exogenous variables of photovoltaic power generation, and predicts photovoltaic power generation based on the endogenous variables and exogenous variables of photovoltaic power generation, and outputs the results.
[0028] The test set is used to test the photovoltaic power generation prediction model after each round of training, and the loss function is set to optimize the parameters of the photovoltaic power generation prediction model in the training process. When the set iterative training round ends or the loss function converges, the trained photovoltaic power generation prediction model is obtained.
[0029] In the above technical scheme, the Top-K period selection module is used to decouple the univariate time series in the training set into several bivariate time series, which allows the analysis of periodicity at different scales in photovoltaic power generation data; the time-mixed multi-layer perceptron module can effectively capture local and global changes in the time series, extract local and global change features in the bivariate time series, so as to enhance the perception of sudden changes; finally, the cross-variable cross-attention module combines exogenous variables to provide additional background, which improves the long-term prediction accuracy of endogenous variables, and can effectively reflect the potential dynamic relationship between historical data and future data under rapidly changing weather conditions, thereby effectively improving the decision-making efficiency and accuracy of the power dispatching system.
[0030] Furthermore, the process of decoupling the univariate time series in the training set into several bivariate time series using the Top-K period selection module includes:
[0031] Fourier transform is used to convert each variable in the training set into the frequency domain, and the expression is:
[0032]
[0033] Extract the amplitude spectrum of the frequency components in each frequency domain, the expression is:
[0034]
[0035] |A avg [k]|=Avg(|A1[k]|+|A2[k]|+...+|A M [k]|);
[0036] According to the amplitude A in the amplitude spectrum i Sort each frequency by its size and select the top K frequencies for period calculation. The expression is:
[0037]
[0038] According to the period p i Let the univariate time series x∈R M×L Decoupled into k bivariate time series X, the expression is:
[0039]
[0040] Among them, X(f) is composed of multiple frequency domain components {f1,f2,...,f M}; k represents the frequency index, ranging from 0 to N / 2; Re{X(f)} and Im{X(f)} represent the real and imaginary parts of the Fourier transform, respectively; Avg(·) represents the average amplitude of all variables; A two-dimensional time series is a two-dimensional time series. Rows represent global changes and columns represent local changes. x(t) represents time domain data, X(f) represents frequency domain data, e represents the base of the natural logarithm function, Reshape represents the operation of changing the dimension of the input data, ti represents the number of two-dimensional rows, and Padding(x) represents zero padding for x. This operation is only used when the length L of the time series is not divisible by the period pi. It will pad L with zeros until it can be divided by pi. pi represents both the period and the number of columns after the one-dimensional time series dimension is converted to two-dimensional.
[0041] Furthermore, according to the period p i Let the univariate time series x∈R M×L The process of decoupling into k bivariate time series X includes:
[0042] Calculate the length L and period p of a univariate time series i Is it divisible?
[0043] If possible, change the dimension of the univariate time series from one-dimensional x i ∈R 1×L Convert to 2D Get a bivariate time series;
[0044] If not, fill in zeros after the length L until it can be consistent with the period p. i Divide by x, and change the dimension of the univariate time series from one dimension to i ∈R 1×L Convert to 2D Get a bivariate time series.
[0045] In the above technical scheme, each variable in the training set is converted into the frequency domain to effectively separate and remove high-frequency noise or irrelevant signals so as to accurately capture the main periodic characteristics of the time series; the amplitude spectrum of the frequency components in each frequency domain is extracted, so as to retain the positive frequency part in the frequency domain signal with conjugate symmetry to save computing resources; the univariate time series is decoupled into several two-dimensional bivariate time series to fully decouple the frequency domain components of the univariate time series, so as to facilitate the analysis of periodicity at different scales. At the same time, the two-dimensional representation can better reflect the dynamic change characteristics of the data, so as to facilitate the subsequent identification of data mutations.
[0046] Furthermore, the process of extracting local change features and global change features in the time series includes:
[0047] The time-mixed multilayer perceptron module contains several time-mixed multilayer perceptrons;
[0048] For several bivariate time series output from the Top-K period selection module, a time-mixed multilayer perceptron is used to extract the global change feature of one of the bivariate time series. The expression is:
[0049]
[0050] The bivariate time series after extracting the global change features is transposed, and a new time-mixed multi-layer perceptron is used to extract the local change features of the transposed bivariate time series. The expression is:
[0051]
[0052] Among them, σ and W i Represent the ReLU activation function and the learnable parameter matrix respectively, The subscript in indicates that the variable X is an input variable, and the superscript i indicates that it is the i-th variable.
[0053] In the above technical solution, by extracting local change features and global change features in the time series, the potential dynamic relationship between historical data and future data can be effectively captured, and the model's ability to perceive mutations can be enhanced.
[0054] Furthermore, the process of dividing the bivariate time series into endogenous and exogenous variables of photovoltaic power generation by the cross-variable cross-attention module includes:
[0055] The bivariate time series is divided into endogenous variables representing photovoltaic power generation, and the expression is:
[0056] X1∈R 1×t×p
[0057] The bivariate time series is divided into exogenous variables representing meteorological information, and the expression is:
[0058] X2∈R (M-1)×t×p .
[0059] Furthermore, the process of predicting photovoltaic power generation based on endogenous and exogenous variables of photovoltaic power generation includes:
[0060] The cross-variable cross-attention module includes a plurality of cross-variable cross-attention layers and a plurality of fully connected layers;
[0061] Endogenous variables are used as queries Q, and exogenous variables are mapped to keys K and values V;
[0062] The attention weights of endogenous and exogenous variables are calculated using the cross-variable cross-attention layer, expressed as:
[0063] X1, X2 = Split(X);
[0064] The information from the exogenous variables is integrated into the endogenous variables, and the attention weights output by the cross-variable cross-attention layer are concatenated with the endogenous variables by the fully connected layer to obtain the photovoltaic power generation prediction value x out , the process expression is:
[0065] Q, K, V = W Q X1, W k X2, W V X2;
[0066]
[0067] Among them, W Q , W k , W V Both represent linear transformation matrices, QK T represents the transpose of QK, Represents the dimension of the K vector.
[0068] In the above technical scheme, by dividing the bivariate time series into endogenous variables and exogenous variables of photovoltaic power generation, and utilizing the cooperation of several cross-variable cross-attention layers and several fully connected layers, the long-term prediction accuracy of endogenous variables can be effectively improved in photovoltaic power generation forecasting, and then the potential dynamic relationship between historical data and future data can be accurately reflected under rapidly changing weather conditions, thereby effectively improving the decision-making efficiency and accuracy of the power dispatching system.
[0069] Furthermore, the photovoltaic power generation prediction value x out Back-propagation is performed to the time-mixed multilayer perceptron module and the cross-variable cross-attention module respectively to update the model parameters, and the time-mixed multilayer perceptron module and the cross-variable cross-attention module are iteratively optimized until the set iterative training round ends or the loss function converges, and a trained photovoltaic power generation prediction model is obtained.
[0070] In the above technical solution, the photovoltaic power generation prediction value x out The model parameters are updated by backpropagating to the time-mixed multilayer perceptron module and the cross-variable cross-attention module respectively, and combined with the iterative optimization of the loss function, the photovoltaic power generation prediction model obtained by training can output the photovoltaic power generation prediction value in the process of photovoltaic power generation prediction to meet the expected effect.
[0071] A photovoltaic power generation prediction system based on frequency domain decoupling and cross attention, the system comprising:
[0072] Collection module, used to collect historical photovoltaic power generation data;
[0073] A processing module, used for preprocessing the photovoltaic power generation data;
[0074] A building module for building a photovoltaic power generation prediction model;
[0075] A model training module is used to divide the preprocessed photovoltaic power generation data into a training set and a test set, use the training set to perform photovoltaic power generation prediction training on the photovoltaic power generation prediction model, use the test set to test the trained photovoltaic power generation prediction model, and obtain a trained photovoltaic power generation prediction model after the test passes;
[0076] The photovoltaic power generation prediction module is used to use the trained photovoltaic power generation prediction model to predict photovoltaic power generation and output the prediction results.
[0077] Compared with the prior art, the present invention has the following beneficial effects:
[0078] The present invention proposes a photovoltaic power generation prediction method and system based on frequency domain decoupling and cross-attention, which can effectively improve the practicability and reliability of historical photovoltaic power generation data by preprocessing the collected historical photovoltaic power generation data; the constructed photovoltaic power generation prediction model can obtain a photovoltaic power generation prediction model that effectively grasps the changes in photovoltaic power generation data after photovoltaic power generation prediction training of a training set and testing of a test set, so that photovoltaic power generation prediction can be performed through the photovoltaic power generation prediction model, which can effectively reflect the potential dynamic relationship between historical data and future data under rapidly changing weather conditions, thereby effectively improving the decision-making efficiency and accuracy of the power dispatching system. BRIEF DESCRIPTION OF THE DRAWINGS
[0079] Figure 1 A flowchart of a photovoltaic power generation prediction method based on frequency domain decoupling and cross attention provided in an embodiment of the present application;
[0080] Figure 2 A schematic diagram of the structure of a photovoltaic power generation prediction model provided in an embodiment of the present application;
[0081] Figure 3 A schematic diagram of the internal data processing flow of the Top-K cycle selection module provided in an embodiment of the present application;
[0082] Figure 4 A schematic diagram of the internal data processing flow of the time-mixed multilayer perceptron module provided in an embodiment of the present application;
[0083] Figure 5 A schematic diagram of the data processing flow of a time-mixed multilayer perceptron provided in an embodiment of the present application;
[0084] Figure 6 A schematic diagram of the internal data processing flow of the cross-variable cross-attention module provided in an embodiment of the present application;
[0085] Figure 7 A schematic diagram of the structure of a photovoltaic power generation prediction system based on frequency domain decoupling and cross attention provided in an embodiment of the present application. DETAILED DESCRIPTION
[0086] In order to facilitate the understanding of the present invention, the present invention will be described more fully below with reference to the relevant drawings. Preferred embodiments of the present invention are provided in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present invention more thorough and comprehensive.
[0087] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more related listed items.
[0088] Embodiment 1:
[0089] This embodiment provides a photovoltaic power generation prediction method based on frequency domain decoupling and cross attention, see Figure 1 , the method comprises the following steps:
[0090] Step S1: collecting historical photovoltaic power generation data and preprocessing the photovoltaic power generation data;
[0091] Step S2: constructing a photovoltaic power generation prediction model, and dividing the preprocessed photovoltaic power generation data into a training set and a test set, using the training set to perform photovoltaic power generation prediction training on the photovoltaic power generation prediction model, and using the test set to test the trained photovoltaic power generation prediction model, and obtaining a trained photovoltaic power generation prediction model after the test passes;
[0092] Step S3: Use the trained photovoltaic power generation prediction model to predict photovoltaic power generation and output the prediction result.
[0093] In step S1, the process of preprocessing the photovoltaic power generation data includes:
[0094] The maximum information coefficient is used to quantify the correlation between endogenous and exogenous variables in photovoltaic power generation data, and the sample space is divided into grids and the mutual information is calculated to capture the deep relationship characteristics between the variables. The expression is:
[0095]
[0096] Based on the deep relationship characteristics between the captured variables, the exogenous variables with MIC values greater than the preset threshold are extracted;
[0097] All endogenous variables and the extracted exogenous variables are combined into a historical multivariate sequence, expressed as:
[0098] x∈R M×L
[0099] Divide the historical multivariate sequence into training set and test set;
[0100] Among them, p(x,y) represents the joint probability of variables x and y, p(x) and p(y) represent the marginal probabilities of vectors x and y respectively, MIC represents the maximum information coefficient; M represents the total number of input variables, L represents the length of the historical multivariate sequence of each variable, and the historical multivariate sequence is a univariate time series.
[0101] Specifically, it is assumed that the input variables (collected historical photovoltaic power generation data) have many exogenous meteorological variables in addition to endogenous photovoltaic power generation variables such as active power (ActivatePower), such as weather and daily rainfall (WeatherDaily Rainfall) and diffuse horizontal radiation (Diffuse Horizontal Radiation). Too many input variables will increase the computational complexity of the model and affect the training efficiency. The maximum information coefficient (MIC) is used to quantify the correlation between endogenous and exogenous variables. MIC can more accurately capture the complex relationship between variables by dividing the sample space into grids and calculating mutual information. The calculation of MIC is shown in the following formula:
[0102]
[0103] Among them, p(x,y) represents the joint probability of variables x and y, and p(x) and p(y) represent the marginal probabilities of vectors x and y, respectively. Exogenous variables that are significantly correlated with endogenous variables (generally, the MIC value is greater than 0.9, depending on the actual situation) are selected as inputs to subsequent models. Define the historical multivariate sequence composed of all selected variables (endogenous variables and selected exogenous variables) as x∈R M×L , where M represents the total number of input variables and L represents the length of the historical data sequence (historical multivariate sequence) of each variable. Based on these multivariate historical data, the photovoltaic power generation y∈R in the future is predicted. 1×L′ , L ′ Represents the time step that needs to be predicted at one time. Specifically, this multivariate time series x consists of multiple independent time series x i ∈R 1 ×L ,i∈{1,2,…,M}, where each x i Represents a specific variable.
[0104] It is understandable that in addition to endogenous variables of photovoltaic power generation such as active power, the collected photovoltaic power generation data also includes many exogenous variables of meteorological factors, such as weather and daily rainfall and diffuse horizontal radiation. Quantifying the correlation between endogenous and exogenous variables in photovoltaic power generation data, dividing the sample space into grids and calculating mutual information can effectively reduce the number of input variables, thereby reducing the computational complexity of the photovoltaic power generation prediction model, improving the training efficiency of the model, and more accurately capturing the deep relationship characteristics between variables, so as to improve the practicality and reliability of historical photovoltaic power generation data.
[0105] In step S2, the process of performing photovoltaic power generation prediction training on the photovoltaic power generation prediction model using the training set includes:
[0106] See also Figure 2 The constructed photovoltaic power generation prediction model includes Top-K Periodicity Selection Module (TPSM), Time-mixing MLP (TM-MLP) and Inter-variable Cross-Attention Module (IvCAM);
[0107] S21: setting several rounds of iterative training to perform photovoltaic power generation prediction training on the photovoltaic power generation prediction model;
[0108] S22: Use the Top-K period selection module to decouple the univariate time series in the training set into several bivariate time series;
[0109] S23: The time-mixed multilayer perceptron module extracts local change features and global change features in the bivariate time series based on the extracted several bivariate time series;
[0110] S24: Based on the local change characteristics and the global change characteristics, the cross-variable cross-attention module divides the bivariate time series into endogenous variables and exogenous variables of photovoltaic power generation, and predicts photovoltaic power generation based on the endogenous variables and exogenous variables of photovoltaic power generation, and outputs the results.
[0111] S25: Use the test set to test the photovoltaic power generation prediction model after each round of training, and set the loss function to optimize the parameters of the photovoltaic power generation prediction model in the training process. When the set iterative training round ends or the loss function converges, the trained photovoltaic power generation prediction model is obtained.
[0112] In this embodiment, the Top-K period selection module is used to decouple the univariate time series in the training set into several bivariate time series, which allows the analysis of periodicity at different scales in photovoltaic power generation data; the time-mixed multi-layer perceptron module can effectively capture local and global changes in the time series, extract local and global change features in the bivariate time series, so as to enhance the perception of mutations; finally, the cross-variable cross-attention module combines exogenous variables to provide additional background, improves the long-term prediction accuracy of endogenous variables, and can effectively reflect the potential dynamic relationship between historical data and future data under rapidly changing weather conditions, thereby effectively improving the decision-making efficiency and accuracy of the power dispatching system.
[0113] In step S22, see Figure 3 , the process of decoupling the univariate time series in the training set into several bivariate time series using the Top-K period selection module includes:
[0114] Fourier transform is used to convert each variable in the training set into the frequency domain, and the expression is:
[0115]
[0116] Extract the amplitude spectrum of the frequency components in each frequency domain, the expression is:
[0117]
[0118] |A avg [k]|=Avg(|A1[k]|+|A2[k]|+...+|A M [k]|);
[0119] For the entire |A avg [k]|, according to the amplitude A in the amplitude spectrum i The size of each frequency is sorted (it can be understood that one k represents a frequency with an amplitude), and the top K frequencies are selected for the cycle {p1, p2, ..., p k}Calculation, the expression is:
[0120]
[0121] According to the period p i Let the univariate time series x∈R M×L Decoupled into k bivariate time series X, the expression is:
[0122]
[0123] Among them, X(f) is composed of multiple frequency domain components {f1,f2,...,f M}; k represents the frequency index, ranging from 0 to N / 2; Re{X(f)} and Im{X(f)} represent the real and imaginary parts of the Fourier transform, respectively; Avg(·) represents the average amplitude of all variables; A bivariate time series is a two-dimensional time series where the rows represent global changes and the columns represent local changes.
[0124] Furthermore, according to the period p i Let the univariate time series x∈R M×L The process of decoupling into k bivariate time series X includes:
[0125] Calculate the length L and period p of a univariate time series i Is it divisible?
[0126] If possible, change the dimension of the univariate time series from one-dimensional x i ∈R 1 × L Convert to 2D Get a bivariate time series;
[0127] If not, fill in zeros after the length L until it can be consistent with the period p. i Divide by x, and change the dimension of the univariate time series from one dimension to i ∈R 1×L Convert to 2D Get a bivariate time series.
[0128] Specifically, the amplitude A i The higher the value, the more times the time segment of this frequency appears. In a time series of the same length, the more times a segment appears, the shorter the length of the segment must be. i The smaller it should be, the smaller the local changes are, and the fewer the number of columns should be. M×L , this step can be expressed as follows:
[0129]
[0130] in, For M time series, this module will convert them into K two-dimensional representations to fully decouple the frequency domain components of the univariate time series, facilitating the analysis of periodicity at different scales. At the same time, the two-dimensional representation can better reflect the dynamic change characteristics of the data, facilitating the subsequent identification of data mutations.
[0131] It can be understood that each variable in the training set is converted into the frequency domain to effectively separate and remove high-frequency noise or irrelevant signals to accurately capture the main periodic characteristics of the time series; the amplitude spectrum of the frequency components in each frequency domain is extracted, and the positive frequency part can be retained in the frequency domain signal with conjugate symmetry to save computing resources; the univariate time series is decoupled into several two-dimensional bivariate time series to fully decouple the frequency domain components of the univariate time series, which is convenient for analyzing the periodicity at different scales. At the same time, the two-dimensional representation can better reflect the dynamic change characteristics of the data, which is convenient for the subsequent identification of data mutations.
[0132] In step S23, see Figure 4 and Figure 5 ,The process of extracting local and global change features in time series includes:
[0133] The time-mixed multilayer perceptron module contains several time-mixed multilayer perceptrons;
[0134] For several bivariate time series output from the Top-K period selection module, a time-mixed multilayer perceptron is used to extract the global change feature of one of the bivariate time series. The expression is:
[0135]
[0136] The bivariate time series after extracting the global change features is transposed, and a new time-mixed multi-layer perceptron is used to extract the local change features of the transposed bivariate time series. The expression is:
[0137]
[0138] Among them, σ and W i Represent the ReLU activation function and the learnable parameter matrix respectively.
[0139] Specifically, since L is the same for each variable, the data processed by TPSM is considered to be K types, and the dimensions of the data of each variable of each type are the same. In this step, the data of all variables of each type are processed by the same TM-MLP. This step will train multiples of K TM-MLPs at one time. Take one type of input as an example, the input data X∈R M×t×p First, it is sent to an MLP for feature extraction, as follows:
[0140]
[0141] Among them, σ and W iRepresents the ReLU activation function and the learnable parameter matrix. This step is to extract the global change features, and the next step is to transpose and input it into a new MLP again to extract the local change features, as shown in the following two equations:
[0142]
[0143] The transposed TM-MLP effectively captures the potential dynamic relationship between historical data and future data by transposing the input data and extracting global change and local change features at the same time, thus enhancing the model's ability to perceive mutations.
[0144] It can be understood that by extracting local and global change features in time series, we can effectively capture the potential dynamic relationship between historical data and future data and enhance the model's ability to perceive mutations.
[0145] In step S24, see 6, the process of the cross-variable cross-attention module dividing the bivariate time series into endogenous variables and exogenous variables of photovoltaic power generation includes:
[0146] The bivariate time series is divided into endogenous variables representing photovoltaic power generation, and the expression is:
[0147] X1∈R 1×t×p ;
[0148] The bivariate time series is divided into exogenous variables representing meteorological information, and the expression is:
[0149] X2∈R (M-1)×t×p .
[0150] Furthermore, the process of predicting photovoltaic power generation based on endogenous and exogenous variables of photovoltaic power generation includes:
[0151] The cross-variable cross-attention module includes a plurality of cross-variable cross-attention layers and a plurality of fully connected layers;
[0152] Endogenous variables are used as queries Q, and exogenous variables are mapped to keys K and values V;
[0153] The attention weights of endogenous and exogenous variables are calculated using the cross-variable cross-attention layer, expressed as:
[0154] X1,X2=Split(X);
[0155] The information from the exogenous variables is integrated into the endogenous variables, and the attention weights output by the cross-variable cross-attention layer are concatenated with the endogenous variables by the fully connected layer to obtain the photovoltaic power generation prediction value x out , the process expression is:
[0156] Q,K,V=WQ X1,W k X2,W V X2;
[0157]
[0158] Among them, W Q , W k , W V Both represent linear transformation matrices, QK T represents the transpose of QK, Represents the dimension of the K vector.
[0159] Specifically, the cross-variable attention module receives the input data X∈R processed by TM-MLP M×t×p , and then split it into the endogenous variable X1∈R representing photovoltaic power generation 1×t×p and the exogenous variable X2∈R representing meteorological information (M - 1 ) ×t×p . The endogenous variables are used as queries Q, while the exogenous variables are mapped to keys K and values V. Next, the attention weights are calculated through the attention mechanism to perform a weighted combination of the values, integrating the information from the exogenous variables into the endogenous variables. Finally, the output of the cross-attention layer is concatenated with the endogenous variables. This process can be formalized as follows:
[0160] X1,X2=Split(X)
[0161] Q,K,V=W Q X1,W k X2,W V X2
[0162]
[0163] Among them, x out is the output of IvCAM, i.e. the predicted value of the photovoltaic power generation prediction model. Q ,W k ,W VIt is a linear transformation matrix responsible for mapping the input variables to queries, keys, and values. Here, the attention mechanism is supplemented. After obtaining QKV, the Q vector and the K vector are dot-producted (that is, the matrix multiplication of Q and K) to obtain an unnormalized attention score matrix. This score reflects the similarity or correlation between each Query and all Keys. In order to make the attention scores more interpretable and stable, these scores are usually normalized. The softmax function is used to convert the unnormalized attention scores into probability distributions, so that each score is in the range of [0,1] and the sum is 1; the normalized attention scores are weighted and summed with the corresponding V vectors. Specifically, each V vector is weighted according to its corresponding attention score, and then all weighted V vectors are added to obtain the final output vector. This output vector can be regarded as a weighted combination of the input sequence, where the weights are determined by the attention scores, and is the dimension of the K vector, which is used to scale the dot product result to prevent the gradient from vanishing or exploding. In the cross-variable cross-attention module, each type is processed with a cross-variable cross-attention layer, that is, a total of K cross-variable cross-attention layers are used. Then the K output vectors are dimensionally integrated, flattened and then concatenated into a vector, and then linearly feature extracted and reduced in dimension by the fully connected layer to obtain the predicted output; the dimension of the middle layer of the fully connected layer network can be set according to the specific application scenario, but the dimension of the last layer must be the same as the number of steps you want to predict at one time.
[0164] It can be understood that by dividing the bivariate time series into endogenous variables and exogenous variables of photovoltaic power generation, and utilizing the cooperation of several cross-variable cross-attention layers and several fully connected layers, the long-term prediction accuracy of endogenous variables can be effectively improved in photovoltaic power generation forecasting, and then the potential dynamic relationship between historical data and future data can be accurately reflected under rapidly changing weather conditions, thereby effectively improving the decision-making efficiency and accuracy of the power dispatching system.
[0165] As a preferred embodiment, the photovoltaic power generation prediction value x out Back-propagation is performed to the time-mixed multilayer perceptron module and the cross-variable cross-attention module respectively to update the model parameters, and the time-mixed multilayer perceptron module and the cross-variable cross-attention module are iteratively optimized until the set iterative training round ends or the loss function converges, and a trained photovoltaic power generation prediction model is obtained.
[0166] It is understandable that the photovoltaic power generation prediction value x outThe model parameters are updated by backpropagating to the time-mixed multilayer perceptron module and the cross-variable cross-attention module respectively, and combined with the iterative optimization of the loss function, the photovoltaic power generation prediction model obtained by training can output the photovoltaic power generation prediction value in the process of photovoltaic power generation prediction to meet the expected effect.
[0167] In this embodiment, by preprocessing the collected historical photovoltaic power generation data, the practicality and reliability of the historical photovoltaic power generation data can be effectively improved; the constructed photovoltaic power generation prediction model can obtain a photovoltaic power generation prediction model that effectively grasps the changes in photovoltaic power generation data after photovoltaic power generation prediction training of the training set and testing of the test set, so that photovoltaic power generation prediction can be performed through the photovoltaic power generation prediction model, which can effectively reflect the potential dynamic relationship between historical data and future data under rapidly changing weather conditions, thereby effectively improving the decision-making efficiency and accuracy of the power dispatching system.
[0168] Embodiment 2:
[0169] This example provides corresponding experimental data description based on the method described in Example 1, as follows:
[0170] Take the DKASC photovoltaic power generation dataset of Alice Springs, Australia as an example. The data collection time of this dataset is from 2010 to 2021. Each time step is 5 minutes, and it contains photovoltaic power generation data of multiple sites. Sites 35, 37 and 38 are selected for analysis, among which:
[0171] Site 35: Data collection time is from 9:00 am on September 24, 2015 to 9:30 am on December 13, 2015.
[0172] Site 37: Data collection time is from 11:00 a.m. on August 27, 2020 to 2:30 p.m. on November 20, 2020.
[0173] Site 38: Data collection period is from 6:30 a.m. on February 17, 2021 to 2:30 p.m. on April 25, 2021.
[0174] The variables included in this data set are: Active Power, Radiation Diffuse Tilted, Radiation Global Tilted, Weather Daily Rainfall, Wind Direction, Diffuse Horizontal Radiation, Global Horizontal Radiation, Weather Relative Humidity, Weather Temperature Celsius, and Performance Ratio. It can be found that active power is an endogenous variable, and the rest of the variables are exogenous variables.
[0175] The MIC values of each exogenous variable and endogenous variable at each station were calculated, and it was found that in the selected data set, all MIC values were either 1 or less than 0.4. Therefore, five meteorological information, namely, diffuse radiation tilt, global radiation tilt, diffuse horizontal radiation, global horizontal radiation and performance ratio, were selected as exogenous variables for subsequent input. After the five exogenous variables and one endogenous variable were input into the model, they would go through the following three modules:
[0176] Module 1 TPSM:
[0177] Step 1: The input sequence dimension at this time is x∈R 6×L , that is, an input matrix with 6 rows and L columns. Each row will first be converted into a frequency domain signal through Fourier transform. If the frequency domain signal is placed in a Cartesian coordinate system, the horizontal axis can be regarded as the frequency index, and the vertical axis can be regarded as the amplitude corresponding to each index.
[0178] Step 2: Next, average the six frequency domain signals to obtain an average signal with the average amplitude of the six variables, each amplitude is represented by |A avg [k]|.
[0179] Step 3: Sort each frequency by amplitude (it can be understood that one k represents one frequency and has one amplitude), and select the top K frequencies. Here, the top three amplitudes are selected to obtain A1, A2, and A3.
[0180] Step 4: Using the cycle formula We can get {p1,p2,p3}.
[0181] Step 5: For each row of the input matrix, its dimensions are reshaped according to {p1,p2,p3}. Line and p i If L and p i If it is not divisible, add zeros after L until it becomes divisible.
[0182] Step 6: At this time, each row of the input matrix is converted into a two-dimensional representation of three types (there are K types for the frequency of selecting TOP-K), where the columns represent local changes and the rows represent global changes. The output dimension of TPSM is
[0183] Module 2 TM-MLP:
[0184] Step 1: For all two-dimensional representations of each type, there are X i ∈R 6×t×p ,i∈{1,2,3}. Then six MLPs need to be initialized.
[0185] Step 2: First, X i ∈R 6×t×p Input into MLP to extract the feature of global change pattern of time series. Then transpose X i , and then sent to a new MLP for feature extraction of local change patterns.
[0186] Step 3: There are three types in total, so a total of 3*2=6 MLPs are needed. The output dimension of this module is still
[0187] Module Three IvCAM:
[0188] Step 1: The input dimension of IvCAM is For each type of two-dimensional representation, first divide it into endogenous variables X i1 ∈R 1×t×p and exogenous variable X i2 ∈R 5×t×p . Therefore, three IvCAMs are needed here.
[0189] Step 2: Map the endogenous variables to the query vector Q in the attention mechanism. Map the exogenous variables to the key vector K and value vector V in the attention mechanism.
[0190] Step 3: Calculate the attention weights through the attention mechanism to perform weighted combination of values and integrate information from exogenous variables into endogenous variables. Each IvCAM gets an output dimension of x out,i ∈R 6×t×p .
[0191] Module 4: Feature Integration:
[0192] Step 1: Flatten the high-dimensional outputs obtained by the three IvCAMs into three one-dimensional vectors, and then concatenate the three one-dimensional vectors.
[0193] Step 2: Further perform linear feature extraction and dimensionality reduction on the vector through the designed fully connected layer. The dimensions of the middle layer of the fully connected layer network can be set according to the specific scenario of the user's data, but the dimension of its last layer must be set to the time steps that the user needs to predict at the same time. For example, if you want the model to predict 32 time steps at a time, the dimension of the last layer of the fully connected layer network must be 32 dimensions.
[0194] Step 3: After dimensionality reduction, the model can complete the prediction of photovoltaic power generation time series.
[0195] Embodiment three:
[0196] This embodiment provides a photovoltaic power generation prediction system based on frequency domain decoupling and cross attention, see Figure 7 , the system comprising:
[0197] Collection module, used to collect historical photovoltaic power generation data;
[0198] A processing module, used for preprocessing the photovoltaic power generation data;
[0199] A building module for building a photovoltaic power generation prediction model;
[0200] A model training module is used to divide the preprocessed photovoltaic power generation data into a training set and a test set, use the training set to perform photovoltaic power generation prediction training on the photovoltaic power generation prediction model, use the test set to test the trained photovoltaic power generation prediction model, and obtain a trained photovoltaic power generation prediction model after the test passes;
[0201] The photovoltaic power generation prediction module is used to use the trained photovoltaic power generation prediction model to predict photovoltaic power generation and output the prediction results.
[0202] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A photovoltaic power generation prediction method based on frequency domain decoupling and cross attention, characterized in that: The method comprises the following steps: Collecting historical photovoltaic power generation data and preprocessing the photovoltaic power generation data; Constructing a photovoltaic power generation prediction model, and dividing the preprocessed photovoltaic power generation data into a training set and a test set, using the training set to perform photovoltaic power generation prediction training on the photovoltaic power generation prediction model, and using the test set to test the trained photovoltaic power generation prediction model, and obtaining a trained photovoltaic power generation prediction model after the test passes; Use the trained photovoltaic power generation prediction model to predict photovoltaic power generation and output the prediction results.
2. The photovoltaic power generation prediction method based on frequency domain decoupling and cross attention according to claim 1 is characterized in that: The process of preprocessing the photovoltaic power generation data includes: The maximum information coefficient is used to quantify the correlation between endogenous and exogenous variables in photovoltaic power generation data, and the sample space is divided into grids and the mutual information is calculated to capture the deep relationship characteristics between the variables. The expression is: Based on the deep relationship characteristics between the captured variables, the exogenous variables with MIC values greater than the preset threshold are extracted; All endogenous variables and the extracted exogenous variables are combined into a historical multivariate sequence, expressed as: x∈R M×L ; Divide the historical multivariate sequence into training set and test set; Among them, p(x,y) represents the joint probability of variables x and y, p(x) and p(y) represent the marginal probabilities of vectors x and y respectively, MIC represents the maximum information coefficient; M represents the total number of input variables, L represents the length of the historical multivariate sequence of each variable, the historical multivariate sequence is a univariate time series, i and j represent the indexes of endogenous variable i and exogenous variable j respectively.
3. The photovoltaic power generation prediction method based on frequency domain decoupling and cross attention according to claim 2 is characterized in that: The process of using the training set to train the photovoltaic power generation prediction model for photovoltaic power generation prediction includes: The constructed photovoltaic power generation prediction model includes Top-K cycle selection module, time-mixed multi-layer perceptron module and cross-variable cross-attention module; Setting several rounds of iterative training to perform photovoltaic power generation prediction training on the photovoltaic power generation prediction model; The Top-K period selection module is used to decouple the univariate time series in the training set into several bivariate time series; The time-mixed multi-layer perceptron module extracts local and global change features in the bivariate time series based on the extracted bivariate time series. Based on the local change characteristics and global change characteristics, the cross-variable cross-attention module divides the bivariate time series into endogenous variables and exogenous variables of photovoltaic power generation, and predicts photovoltaic power generation based on the endogenous variables and exogenous variables of photovoltaic power generation, and outputs the results. The test set is used to test the photovoltaic power generation prediction model after each round of training, and the loss function is set to optimize the parameters of the photovoltaic power generation prediction model in the training process. When the set iterative training round ends or the loss function converges, the trained photovoltaic power generation prediction model is obtained.
4. The photovoltaic power generation prediction method based on frequency domain decoupling and cross attention according to claim 3 is characterized in that: The process of decoupling the univariate time series in the training set into several bivariate time series using the Top-K period selection module includes: Fourier transform is used to convert each variable in the training set into the frequency domain, and the expression is: Extract the amplitude spectrum of the frequency components in each frequency domain, the expression is: |A avg [k]|=Avg(|A1[k]|+|A2[k]|+...+|A M [k]|); According to the amplitude A in the amplitude spectrum i Sort each frequency by its size and select the top K frequencies for period calculation. The expression is: According to the period p i Let the univariate time series x∈R M×L Decoupled into k bivariate time series X, the expression is: Among them, X(f) is composed of multiple frequency domain components {f1,f2,...,f M }; k represents the frequency index, ranging from 0 to N / 2; Re{X(f)} and Im{X(f)} represent the real and imaginary parts of the Fourier transform, respectively; Avg(·) represents the average amplitude of all variables; A bivariate time series is a two-dimensional time series. Rows represent global changes, columns represent local changes, x(t) represents time domain data, X(f) represents frequency domain data, e represents the base of the natural logarithm function, Reshape represents the operation of changing the dimension of the input data, ti represents the number of two-dimensional rows, and Padding(x) represents zero padding of x.
5. The photovoltaic power generation prediction method based on frequency domain decoupling and cross attention according to claim 4 is characterized in that: According to the period p i Let the univariate time series x∈R M×L The process of decoupling into k bivariate time series X includes: Calculate the length L and period p of a univariate time series i Is it divisible? If possible, change the dimension of the univariate time series from one-dimensional x i ∈R 1×L Convert to 2D Get a bivariate time series; If not, fill in zeros after the length L until it can be consistent with the period p. i Divide by x, and change the dimension of the univariate time series from one dimension to i ∈R 1×L Convert to 2D Get a bivariate time series.
6. The photovoltaic power generation prediction method based on frequency domain decoupling and cross attention according to claim 4 is characterized in that: The process of extracting local and global change features in time series includes: The time-mixed multilayer perceptron module contains several time-mixed multilayer perceptrons; For several bivariate time series output from the Top-K period selection module, a time-mixed multilayer perceptron is used to extract the global change feature of one of the bivariate time series. The expression is: The bivariate time series after extracting the global change features is transposed, and a new time-mixed multi-layer perceptron is used to extract the local change features of the transposed bivariate time series. The expression is: Among them, σ and W i Represent the ReLU activation function and the learnable parameter matrix respectively, The subscript in indicates that the variable X is an input variable, and the superscript i indicates that it is the i-th variable.
7. The photovoltaic power generation prediction method based on frequency domain decoupling and cross attention according to claim 6 is characterized in that: The process of dividing the bivariate time series into endogenous and exogenous variables of photovoltaic power generation by the cross-variable cross-attention module includes: The bivariate time series is divided into endogenous variables representing photovoltaic power generation, and the expression is: X1∈R 1×t×p ; The bivariate time series is divided into exogenous variables representing meteorological information, and the expression is: X2∈R (M-1)×t×p 。 8. The photovoltaic power generation prediction method based on frequency domain decoupling and cross attention according to claim 7 is characterized in that: The process of predicting photovoltaic power generation based on endogenous and exogenous variables of photovoltaic power generation includes: The cross-variable cross-attention module includes a plurality of cross-variable cross-attention layers and a plurality of fully connected layers; Endogenous variables are used as queries Q, and exogenous variables are mapped to keys K and values V; The attention weights of endogenous and exogenous variables are calculated using the cross-variable cross-attention layer, expressed as: X1,X2=Split(X); The information from the exogenous variables is integrated into the endogenous variables, and the attention weights output by the cross-variable cross-attention layer are concatenated with the endogenous variables by the fully connected layer to obtain the photovoltaic power generation prediction value x out , the process expression is: Q,K,V=W Q X1,W k X2,W V X2: Among them, W Q , W k , W V Both represent linear transformation matrices, QK T represents the transpose of QK, Represents the dimension of the K vector.
9. The photovoltaic power generation prediction method based on frequency domain decoupling and cross attention according to claim 8 is characterized in that: The photovoltaic power generation prediction value x out Back-propagation is performed to the time-mixed multilayer perceptron module and the cross-variable cross-attention module respectively to update the model parameters, and the time-mixed multilayer perceptron module and the cross-variable cross-attention module are iteratively optimized until the set iterative training round ends or the loss function converges, and a trained photovoltaic power generation prediction model is obtained.
10. A photovoltaic power generation prediction system based on frequency domain decoupling and cross attention, characterized in that: The system comprises: Collection module, used to collect historical photovoltaic power generation data; A processing module, used for preprocessing the photovoltaic power generation data; A building module for building a photovoltaic power generation prediction model; A model training module is used to divide the preprocessed photovoltaic power generation data into a training set and a test set, use the training set to perform photovoltaic power generation prediction training on the photovoltaic power generation prediction model, use the test set to test the trained photovoltaic power generation prediction model, and obtain a trained photovoltaic power generation prediction model after the test passes; The photovoltaic power generation prediction module is used to use the trained photovoltaic power generation prediction model to predict photovoltaic power generation and output the prediction results.
Citation Information
Cited By
Elevator maintenance period prediction method based on internally and externally generated variable multi-granularity embedding
CN119903971A
Photovoltaic power prediction method and system based on frequency domain decoupling and multi-cycle fusion
CN119965867A
Power system load prediction method and system based on hybrid deep learning architecture
CN121457847A
Power system load forecasting method and system based on hybrid deep learning architecture
CN121457847B