Regional photovoltaic power prediction method based on SAX-MHA-GCN

By combining SAX, MHA and GCN technologies, a method for ultra-short-term power prediction of distributed photovoltaics was proposed, which solved the problem of insufficient mining of space-time coupling relationships and processing massive data in the existing technology, and achieved high-precision and efficient prediction effects.

CN119419798BActive Publication Date: 2025-04-29ELECTRIC POWER RES INST OF STATE GRID ZHEJIANG ELECTRIC POWER COMAPNY
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510019631.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-07
Publication Date
2025-04-29
Estimated Expiration
2045-01-07

AI Technical Summary

Technical Problem

The prior art has failed to fully explore the multi-dimensional complex space-time coupling relationship between regional stations in distributed photovoltaic ultra-short-term power prediction, and has insufficient processing capacity for massive data.

Method used

A regional photovoltaic power prediction method based on symbol aggregation approximation (SAX) algorithm-multi-head attention mechanism (MHA)-graph convolutional network (GCN) is proposed. The data is compressed by the SAX algorithm, and the MHA algorithm captures the data correlation, and uses the GCN model to mine the spatiotemporal features of the graph.

Benefits of technology

It realizes high-precision prediction of ultra-short-term power of distributed photovoltaics, improves the interpretability and generalization capabilities of the prediction model, and can effectively process multi-dimensional massive data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119419798B_ABST
    Figure CN119419798B_ABST
Patent Text Reader

Abstract

The present application is a regional photovoltaic power prediction method based on SAX‑MHA‑GCN, which belongs to the field of distributed photovoltaic ultra-short-term power prediction. In view of the technical problems of unsatisfactory prediction results and complex calculations in the prior art, the present application provides a distributed photovoltaic ultra-short-term power prediction method based on SAX‑MHAGCN, comprising the following steps: selecting recent distributed photovoltaic output time series data as the input feature set, and compressing it through the SAX algorithm to obtain a graph convolution SAX symbol feature matrix and a global SAX adjacency matrix; embedding the MHA algorithm into each GCN graph convolution block in the graph convolution network to construct an MHA‑GCN framework, and using the obtained graph convolution SAX symbol feature matrix and the global SAX adjacency matrix as the input of the MHA‑GCN framework to obtain a graph convolution output matrix; integrating the graph convolution output matrix and processing it through the SAX inverse process to obtain an ultra-short-term power prediction result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of distributed photovoltaic ultra-short-term power prediction, and in particular relates to a regional photovoltaic power prediction method based on SAX-MHA-GCN. Background Art

[0002] In recent years, with the high proportion of distributed photovoltaic power connected to the power grid, its strong volatility and uncertainty have a significant impact on the safe and stable operation of the power grid. Based on this, improving the accuracy of distributed photovoltaic power generation prediction is of great significance for power grid dispatching and management.

[0003] According to different time scales, photovoltaic power forecasting can usually be divided into ultra-short-term forecasting, short-term forecasting and medium- and long-term forecasting. Among them, ultra-short-term forecasting refers to the forecast of photovoltaic output in the next 15 minutes to 4 hours. With the development of the spot market trading mechanism of the power system under the high proportion of new energy access, the ultra-short-term power forecasting technology of distributed photovoltaics will also have a profound impact on the competition strategy of the power market. With the development of artificial intelligence technology, data-driven ultra-short-term power forecasting methods have gradually become a key research direction. Some scholars have effectively improved the ultra-short-term prediction accuracy of single distributed photovoltaic stations or regional distributed photovoltaic aggregates by improving neural networks and feature engineering methods. After that, with the development of many-to-many prediction algorithms, some scholars have proposed to explore the correlation of the output of regional distributed photovoltaic multi-stations from a time series or space perspective to achieve smoothing and optimization of prediction results. However, the above models do not fully explore the multi-dimensional complex spatiotemporal coupling relationship between regional stations, and lack the ability to efficiently process massive data.

[0004] In the field of traffic flow prediction, graph convolutional networks, as an effective model, have been successfully applied to capture complex spatiotemporal dependencies. This also provides new ideas and methods for ultra-short-term power prediction of distributed photovoltaic clusters. Based on this, in recent years, many researchers have used convolutional neural networks (CNN) and their improved algorithms to more effectively extract distributed photovoltaic prediction features based on grid information and process high-dimensional spatiotemporal data, and establish ultra-short-term prediction power prediction models for distributed photovoltaic clusters based on spatiotemporal graph convolutional networks. However, they usually use graph networks based on geographical location distribution and use time series power as a single feature for power prediction. The modeling process is relatively simple and the graph theory algorithm is not deeply integrated with the photovoltaic prediction field. In addition, some studies use the VMD algorithm to decompose the sequence into stationary components, and then construct a dynamic graph convolution ultra-short-term prediction model for each component, and superimpose them to obtain the final prediction value. This method mines the spatiotemporal correlation of multiple components, but has high computational complexity, poor interpretability, and is prone to overfitting. Summary of the invention

[0005] In view of the technical problems existing in the prior art, the purpose of this invention is to accurately predict the ultra-short-term power of distributed photovoltaics, and a regional photovoltaic power prediction method based on the symbolic aggregation approximation (SAX) algorithm-multi-head attention mechanism (MHA)-graph convolutional network (GCN) is proposed. The present invention aims to provide new ideas and methods for ultra-short-term prediction of regional or multi-site distributed photovoltaic power generation, which is conducive to the safe consumption and economic operation of distributed photovoltaic power generation.

[0006] In order to achieve the above object, the present invention adopts the following technical solution: a regional photovoltaic power prediction method based on SAX-MHA-GCN, comprising the following steps:

[0007] S1, select the recent distributed photovoltaic output time series data as the input feature set, and compress it through the SAX algorithm to obtain the graph convolution SAX symbol feature matrix and the global SAX adjacency matrix;

[0008] S2, by embedding the MHA algorithm into each GCN graph convolution block in the graph convolution network to build the MHA-GCN framework, the obtained graph convolution SAX symbol feature matrix and the global SAX adjacency matrix are used as the input of the MHA-GCN framework to obtain the graph convolution output matrix;

[0009] S3, the graph convolution output matrix is ​​processed by integration and SAX inverse process to obtain the ultra-short-term power prediction result.

[0010] Considering the monitoring and collection level of distributed sites, distributed photovoltaic power prediction usually uses actual power generation as the input time series data set. Based on the ultra-short-term prediction scale, the present invention selects characteristic data selected under the recent period standard as the prediction input data set to characterize the real-time characteristics of the output.

[0011] Large-scale distributed photovoltaic data is a special time series data with complex and high-dimensional characteristics. Therefore, when extracting and representing data features, it is necessary to reduce the dimension and reduce the noise on the basis of maintaining and reflecting the data morphological characteristics and basic information as much as possible, so as to reduce the computing cost and improve the efficiency of data processing, mining and analysis. Among the many feature extraction and representation methods, the SAX algorithm is considered to be an effective symbolic representation technology. Compared with the currently commonly used node correlation calculation methods such as the Pearson coefficient, the SAX algorithm calculates the output similarity between nodes to characterize the node correlation, which can more effectively capture similar trends in time series.

[0012] Graph Neural Network (GNN) is the most widely used deep learning model on graph topology. Introducing convolution operation into GNN can obtain graph convolutional neural network GCN. At present, GCN has been gradually expanded from traffic flow prediction to distributed photovoltaic multi-station power prediction. The multi-head attention mechanism MHA improves the attention mechanism and adopts multiple information heads to more effectively capture data correlation and dynamic changes. It has been applied in the fields of offshore wind power anomaly detection, output prediction, electric vehicle load prediction and other spatiotemporal prediction fields.

[0013] This paper proposes an MHA-GCN model framework, which performs deep algorithm fusion compared to simple algorithm splicing, and realizes full mining and iterative optimization of regional spatiotemporal coupling characteristics.

[0014] Furthermore, the specific process of step S1 is as follows:

[0015] S1.1, converting the historical photovoltaic power generation into an initial photovoltaic power generation matrix, normalizing the initial photovoltaic power generation matrix to obtain a normalized historical photovoltaic power matrix;

[0016] S1.2, dividing the normalized historical photovoltaic power matrix into step-size compression segments, and performing piecewise aggregate approximation (PAA) to obtain a converted symbolic matrix;

[0017] S1.3, symbolize each element of the converted symbolized matrix to obtain the graph convolution SAX symbolic feature matrix;

[0018] S1.4, by calculating the distance between every two elements in the graph convolution SAX symbolic feature matrix, the output similarity between different nodes is obtained;

[0019] S1.5, calculate the spatial distance of nodes by longitude and latitude;

[0020] S1.6, based on output similarity and spatial distance, obtain the intermediate process matrix;

[0021] S1.7, normalize the off-diagonal values ​​of the global SAX adjacency matrix to obtain the global SAX adjacency matrix.

[0022] Furthermore, the specific formula of step S1 includes:

[0023] Assume that the initial photovoltaic power matrix at a certain time , N is the number of sites, L is the original time step, Indicates the site In time Historical PV power values ​​for each site , calculate its The average photovoltaic power in a period of time and standard deviation , and finally obtain the standardized historical photovoltaic power matrix , the specific formula is as follows:

[0024] (1);

[0025] (2);

[0026] (3);

[0027] in, Represents the standardized historical photovoltaic power matrix The element means site In time The normalized value of the historical photovoltaic power value;

[0028] The normalized power is divided into Step compression segments, calculate the average value of each segment, perform segment aggregation approximate conversion, and obtain the symbolic matrix :

[0029] (4);

[0030] in, h For each step label after compression, g It is an intermediate calculation variable in the symbolization process; For symbolic matrix Elements Indicates the site i In time g The standardized historical photovoltaic power value;

[0031] Divide the Gaussian probability density curve into Interval , , ensuring that the area under the curve in each interval is , when the mapping rule is hour, , the symbolized matrix Each element in Map to the corresponding symbol , get the graph convolution SAX symbol feature matrix ;

[0032] By computing the graph convolution SAX symbolic feature matrix for every two sitesi and j The distance between them is used to obtain the output similarity between different nodes. The formula is:

[0033] (5);

[0034] in, , Represents the convolution SAX symbolic feature matrix Two elements in ;

[0035] The spatial distance of the nodes is calculated by longitude and latitude. The formula is as follows:

[0036] (6);

[0037] (7);

[0038] Where: Indicates the latitude of the site; Indicates the longitude of the site; Indicates the site i With site j Inter-distance coefficient; Indicates the site i With site j The static space distance;

[0039] Based on output similarity and spatial distance, the intermediate process matrix is ​​obtained ; is defined as:

[0040] (8);

[0041] The intermediate process matrix Elements of

[0042] The intermediate process matrix The global SAX adjacency matrix is ​​obtained by normalizing the off-diagonal values ​​of .

[0043] Furthermore, the process of converting the historical photovoltaic power generation into the initial photovoltaic power generation matrix is ​​as follows: constructing graph structure data with vertices, edges and an edge-based undirected graph adjacency matrix, wherein each distributed photovoltaic site in the region serves as a vertex of the graph structure data, and the correlation between any two sites serves as an element of the edge-based undirected graph adjacency matrix, and converting the historical photovoltaic power generation data into the initial photovoltaic power generation matrix.

[0044] Furthermore, the specific process of step S2 is:

[0045] S2.1, the SAX symbolic feature matrix After batching and feature numbering operations, the model input data can be obtained as ,in B is the batch number, is the number of elements in a single batch, that is , is the number of features ,T is the compression step size , at this time ;

[0046] S2.2, input data to the model Perform multi-head temporal attention processing to obtain a multi-head temporal attention matrix ;

[0047] S2.3, based on multi-head temporal attention matrix , perform multi-head spatial attention processing and obtain the multi-head spatial attention matrix ;

[0048] S2.4, based on multi-head spatial attention matrix , combined with the global SAX adjacency matrix A , perform spatial graph convolution calculation to obtain the spatial graph convolution result ; Convolution of the spatial graph Perform time convolution processing to obtain time convolution results ;

[0049] S2.5, perform residual correlation processing on the spatial convolution result and the temporal convolution result to obtain the graph convolution output matrix Z.

[0050] The global SAX adjacency matrix After normalizing the off-diagonal values, we can get the adjacency matrix used by the final graph convolutional network. , describes the influence between adjacent nodes from a temporal perspective, and is used to characterize the implicit spatial relationship between non-adjacent nodes, thereby replacing the original and The adjacency matrix constructed.

[0051] Furthermore, the process of converting the historical photovoltaic power generation into the initial photovoltaic power generation matrix is ​​as follows: constructing graph structure data with vertices, edges and an edge-based undirected graph adjacency matrix, wherein each distributed photovoltaic site in the region serves as a vertex of the graph structure data, and the correlation between any two sites serves as an element of the edge-based undirected graph adjacency matrix, and converting the historical photovoltaic power generation data into the initial photovoltaic power generation matrix.

[0052] For each site, select LThe historical actual power generation data of steps is used as input to characterize the real-time transition of photovoltaic output. At this time, the original feature matrix can be expressed as .

[0053] Furthermore, the specific process of step S2 is:

[0054] S2.1, the SAX symbolic feature matrix After batching and feature numbering operations, the model input data can be obtained as ,in B is the batch number, is the number of elements in a single batch, that is , is the number of features ,T is the compression step size , at this time ;

[0055] S2.2, input data to the model Perform multi-head temporal attention processing to obtain a multi-head temporal attention matrix ;

[0056] S2.3, based on multi-head temporal attention matrix , perform multi-head spatial attention processing and obtain the multi-head spatial attention matrix ;

[0057] S2.4, based on multi-head spatial attention matrix , combined with the global SAX adjacency matrix A , perform spatial graph convolution calculation to obtain the spatial graph convolution result ; Convolution of the spatial graph Perform time convolution processing to obtain time convolution results ;

[0058] S2.5, perform residual correlation processing on the spatial convolution result and the temporal convolution result to obtain the graph convolution output matrix Z.

[0059] Furthermore, the process of step S2 is described by the formula:

[0060] S2.1, the SAX symbolic feature matrix After batching and feature numbering operations, the model input data can be obtained as ,in B is the batch number, is the number of elements (sites) in a single batch, that is , is the number of features ,TTo compress the step size, let the initial input sequence of the multi-head self-attention mechanism be expressed as , represents the sequence length (time steps or number of spatial nodes), Represents the input feature dimension, let the input be For each batch, n = N ', d model =T , .

[0061] By linearly changing Mapping to Query Q in ,key K in Sum V in The vector representation of , , Query Q in ,key K in ,value V in The linear transformation matrix of . Q in , K in , V in The calculation formula is as follows:

[0062] (9);

[0063] Then, the query, key, and value are divided according to the multi-head attention mechanism: let the number of heads of the multi-head attention mechanism be , then the query, key, and value dimensions of each header are , , ,right , , After shape adjustment, we get:

[0064] (10);

[0065] For Head ( ), attention score It is obtained by querying the dot product of Q and key K and normalizing it. The calculation formula is as follows:

[0066] (11);

[0067] in and They are The query and key of each head, Represents the transpose operation, divided by This is to normalize the attention scores to prevent the gradient of the Softmax function from disappearing or exploding in subsequent processing.

[0068] The attention scores of each head are normalized by the Softmax function to obtain the attention probability (Attention Probs) .

[0069] (12);

[0070] By taking the attention probability Multiply it by the value of the corresponding head (V) to get The context vector of each head (ContextVector) .

[0071] (13);

[0072] Finally, concatenate the context vectors of all heads to get the final output ( n = N ', d v =T ). By concatenating all channels of all batches, we can get the final output of the multi-head attention mechanism By permuting the dimensions, we get , and then calculate the average attention matrix , let the dimension of the average be (Corresponding to the number of spatial nodes Dimensions), In Dimension Take the average to get the attention matrix :

[0073] (14);

[0074] Indicates taking Middle elements in the spatial node dimension, and then for all Sum the elements and divide by , and the dimension is The matrix ;

[0075] Feed the model with data in batches With the average time attention matrix Perform matrix multiplication to obtain the multi-head time attention matrix .

[0076] The multi-head temporal attention matrix The dimension from Transformed to , and perform multi-head spatial attention processing to obtain a dimension of The multi-head spatial attention matrix .

[0077] According to the global SAX adjacency matrix Chengdi Chebyshev polynomial of order , will Chebyshev polynomial of order With the spatial attention matrix Multiply them together and you get ;

[0078] For each time step , , extract the graph signal of this time step , whose dimensions are ; Let the learnable parameter matrix , ,in Represents the output feature dimension;

[0079] (15);

[0080] Among them, first and Multiply to get , for The transpose of , is an intermediate variable and has no meaning; subsequently, With learnable parameters Multiply and add to Finally, the output of all time steps Splice them together according to the time dimension to get the spatial graph convolution result , whose dimensions are ; Spatial graph convolution results The expression is as follows:

[0081] (16);

[0082] Convolution results for spatial graphs Perform time convolution processing and set the weight matrix of the time convolution layer to be ,in Represents the output feature dimension after time convolution; through the time convolution operation, the time convolution result is obtained :

[0083] (17) .

[0084] For input data Perform residual convolution processing and set the weight matrix of the residual convolution layer to be , through the residual convolution operation, the output is obtained :

[0085] (18);

[0086] The time convolution result Add it to the output after residual convolution to get the graph convolution output matrix .

[0087] Taking the SAX global feature sequence matrix and adjacency matrix as the initial input, the spatiotemporal multi-head attention mechanism is first used in each GCN graph convolution block to accurately capture complex feature dependencies and improve the information extraction effect; then the spatial graph convolution operation and the temporal convolution operation are performed in sequence, and the output result of the graph convolution block is obtained through residual connection processing, and used as the input of the next convolution block to continuously iterate and optimize the prediction result; finally, the ultra-short-term power prediction value is calculated with the help of the fully connected layer and the SAX inversion process, realizing high-performance distributed photovoltaic ultra-short-term power prediction for regional multi-sites.

[0088] Furthermore, the specific process of step S3 is as follows:

[0089] Then Perform layer normalization and set the layer normalization function to be , get the normalized result of each graph convolution block ;

[0090] Suppose there are M graph convolution blocks, and the output of each graph convolution block is , then after all graph convolution blocks are processed, the final output is , the calculation process is:

[0091]

[0092] Assume the final convolution kernel size is ( ),right Perform the final convolution processing and then expand and SAX inverse process to obtain the ultra-short-term power prediction results .

[0093] Compared with the closest prior art, the present invention has the following beneficial effects:

[0094] This paper proposes a regional photovoltaic power prediction method based on SAX-MHA-GCN, which aims to efficiently process multi-dimensional massive data and fully explore the spatiotemporal network coupling characteristics of regional graphs to achieve variable weight multi-period characteristic characterization of distributed photovoltaic power generation. This method mainly improves and optimizes the prediction model's capture mechanism of spatiotemporal coupling of complex multi-dimensional data, enhances its interpretability and generalization, effectively improves the prediction accuracy and prediction timeliness, and provides a new idea for ultra-short-term prediction of regional or multi-station distributed photovoltaic power generation. BRIEF DESCRIPTION OF THE DRAWINGS

[0095] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0096] Figure 1 This is the architecture diagram of the regional distributed photovoltaic ultra-short-term power prediction model based on SAX-MHAGCN;

[0097] Figure 2 This is the 4h regional distributed photovoltaic power prediction curve under four typical weather conditions;

[0098] Figure 3 Radar charts of RMSE and MAPE for different months;

[0099] Figure 4 This is a typical day distributed photovoltaic power prediction curve for a single site with different models;

[0100] Figure 5 The following are sample graphs of the site SAX adjacency matrix and the MHA average attention matrix. DETAILED DESCRIPTION

[0101] The following description and the accompanying drawings fully illustrate specific embodiments of the present invention so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The examples represent possible changes only. Unless explicitly required, separate components and functions are optional, and the order of operation may vary. Parts and features of some embodiments may be included in or replace parts and features of other embodiments. The scope of the embodiments of the present invention includes the entire scope of the claims, and all available equivalents of the claims. These embodiments of the present invention may be represented individually or collectively by the term "invention", which is only for convenience, and if more than one invention is actually disclosed, it is not intended to automatically limit the scope of the application to any single invention or inventive concept. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and cannot be understood as limitations of the present invention.

[0102] Combination Figure 1 , the regional photovoltaic power prediction method based on the symbolic aggregation approximation (SAX) algorithm-multi-head attention mechanism (MHA)-graph convolutional network (GCN) proposed in this embodiment is described in detail, and the method steps are performed as follows:

[0103] S1, select the recent distributed photovoltaic output time series data as the input feature set, and compress it through the SAX algorithm to obtain the graph convolution SAX symbol feature matrix and the global SAX adjacency matrix;

[0104] This application will N Distributed photovoltaic is defined as graph structure data .in, V is the vertex, , characterizing each distributed PV site in the region; ε For the edge, A is the edge-based undirected graph adjacency matrix, Indicates the site i and Site j The correlation between them.

[0105] Considering the monitoring and collection level of distributed sites, distributed photovoltaic power prediction usually uses actual power generation as the input time series data set. Based on the ultra-short-term prediction scale, the present invention selects characteristic data selected under the recent period standard as the prediction input data set to characterize the real-time characteristics of the output.

[0106] For each site, select L The historical actual power generation data of steps is used as input to characterize the real-time transition of photovoltaic output. At this time, the original feature matrix can be expressed as .

[0107] Large-scale distributed photovoltaic data is a special time series data with complex and high-dimensional characteristics. Therefore, when extracting and representing data features, it is necessary to reduce the dimension and reduce the noise on the basis of maintaining and reflecting the data morphological characteristics and basic information as much as possible, so as to reduce the computing cost and improve the efficiency of data processing, mining and analysis. Among the many feature extraction and representation methods, SAX is considered to be an effective symbolic representation technology. Compared with the currently commonly used node correlation calculation methods such as the Pearson coefficient, SAX can more effectively capture similar trends in time series.

[0108] Step S1 specific process:

[0109] The historical photovoltaic power generation is converted into an initial photovoltaic power generation matrix, and the initial photovoltaic power generation matrix is ​​normalized to obtain a normalized historical photovoltaic power matrix: For each node , calculate its The average photovoltaic power in a period of time and standard deviation , and finally obtain the standardized historical photovoltaic power matrix The specific formula is as follows:

[0110] (1);

[0111] (2);

[0112] (3);

[0113] in, Represents the standardized historical photovoltaic power matrix The element means site In time The normalized value of the historical photovoltaic power value;

[0114] The normalized power is divided into Step compression segments, calculate the average value of each segment, perform segment aggregation approximate conversion, and obtain the symbolic matrix :

[0115] (4);

[0116] in, h For each step label after compression, g It is an intermediate calculation variable in the symbolization process; For symbolic matrix Elements Indicates the site iIn time g The standardized historical photovoltaic power value;

[0117] Divide the Gaussian probability density curve into Interval ( ), ensuring that the area under the curve in each interval is , when the mapping rule is hour, , the symbolized matrix Each element in Map to the corresponding symbol , get the graph convolution SAX symbol feature matrix .

[0118] By computing the graph convolution SAX symbolic feature matrix for every two sites i and j The distance between them is used to obtain the output similarity between different nodes. The formula is:

[0119] (5);

[0120] in, , Represents the convolution SAX symbolic feature matrix Two elements in ;

[0121] The spatial distance of the nodes is calculated by longitude and latitude. The formula is as follows:

[0122] (6);

[0123] (7);

[0124] Where: Indicates the latitude of the site; Indicates the longitude of the site; Indicates the site i With site j Inter-distance coefficient; Indicates the site i With site j The static space distance;

[0125] Based on output similarity and spatial distance, the intermediate process matrix is ​​obtained ; is defined as:

[0126] (8);

[0127] The intermediate process matrix Elements of

[0128] The intermediate process matrix The global SAX adjacency matrix is ​​obtained by normalizing the off-diagonal values ​​of . It describes the influence between adjacent nodes from a temporal perspective and is used to characterize the implicit spatial relationship between non-adjacent nodes, thereby replacing the original and The adjacency matrix constructed.

[0129] S2, by embedding the MHA algorithm into each GCN graph convolution block in the graph convolution network to build the MHA-GCN framework, the obtained graph convolution SAX symbol feature matrix and the global SAX adjacency matrix are used as the input of the MHA-GCN framework to obtain the graph convolution output matrix;

[0130] Specific process:

[0131] S2.1, the SAX symbolic feature matrix After batching and feature numbering operations, the model input data can be obtained as ,in B is the batch number, is the number of elements (sites) in a single batch, that is , is the number of features ,T To compress the step size, let the initial input sequence of the multi-head self-attention mechanism be expressed as , represents the sequence length (time steps or number of spatial nodes), Represents the input feature dimension, let the input be For each batch, n = N ', d model =T , .

[0132] By linearly changing Mapping to Query Q in ,key K in Sum V in The vector representation of , , Query Q in ,key K in ,value V in The linear transformation matrix of . Qin , K in , V in The calculation formula is as follows:

[0133] (9);

[0134] Then, the query, key, and value are divided according to the multi-head attention mechanism: let the number of heads of the multi-head attention mechanism be , then the query, key, and value dimensions of each header are , , ,right , , After shape adjustment, we get:

[0135] (10);

[0136] For Head ( ), attention score It is obtained by querying the dot product of Q and key K and normalizing it. The calculation formula is as follows:

[0137] (11);

[0138] in and They are The query and key of each head, represents the transpose operation, divided by This is to normalize the attention scores to prevent the gradient of the Softmax function from disappearing or exploding in subsequent processing.

[0139] The attention scores of each head are normalized by the Softmax function to obtain the attention probability (Attention Probs) .

[0140] (12);

[0141] By taking the attention probability Multiply it by the value of the corresponding head (V) to get The context vector of each head (ContextVector) .

[0142] (13);

[0143] Finally, concatenate the context vectors of all heads to get the final output (n = N ', d v =T) By concatenating all channels of all batches, we can get the final output of the multi-head attention mechanism By permuting the dimensions, we get , and then calculate the average attention matrix , let the dimension of the average be (Corresponding to the number of spatial nodes Dimensions), In Dimension Take the average to get the attention matrix :

[0144] (14);

[0145] Indicates taking Middle elements in the spatial node dimension, and then for all Sum the elements and divide by , and the dimension is The matrix ;

[0146] S2.2, feed the model with data in batches With the average time attention matrix Perform matrix multiplication to obtain the multi-head time attention matrix .

[0147] S2.3, multi-head temporal attention matrix The dimension from Transformed to , and multi-head spatial attention processing is performed to obtain a dimension of The multi-head spatial attention matrix .

[0148] S2.4, based on multi-head spatial attention matrix , combined with the global SAX adjacency matrix A , perform spatial graph convolution calculation to obtain the spatial graph convolution result ; Convolution of the spatial graph Perform time convolution processing to obtain time convolution results :

[0149] According to the global SAX adjacency matrix Chengdi Chebyshev polynomial of order , will Chebyshev polynomial of order With the spatial attention matrix Multiply them together and you get ;

[0150] For each time step ( ), extract the graph signal of this time step , whose dimensions are ; Let the learnable parameter matrix ( ),in Represents the output feature dimension;

[0151] For The combination of the Chebyshev polynomial of order θ and the spatial attention matrix is ​​calculated as follows:

[0152] (15);

[0153] Among them, first and Multiply to get , for The transpose of , is an intermediate variable and has no meaning; subsequently, With learnable parameters Multiply and add to Finally, the output of all time steps Splice them together according to the time dimension to get the spatial graph convolution result , whose dimensions are ; Spatial graph convolution results The expression is as follows:

[0154] (16);

[0155] Convolution results for spatial graphs Perform time convolution processing and set the weight matrix of the time convolution layer to be ,in Represents the output feature dimension after time convolution; through the time convolution operation, the time convolution result is obtained :

[0156] (17) .

[0157] S2.5, perform residual correlation processing on the spatial convolution result and the temporal convolution result to obtain the graph convolution output matrix Z: Perform residual convolution processing and set the weight matrix of the residual convolution layer to be , through the residual convolution operation, the output is obtained :

[0158] (18);

[0159] The output after time convolution Add it to the output after residual convolution to get the graph convolution output matrix .

[0160] S3, the graph convolution output matrix is ​​integrated and processed by SAX inverse process to obtain the ultra-short-term power prediction result. The specific process is as follows:

[0161] Then the graph convolution output matrix Perform layer normalization and set the layer normalization function to be , get the normalized result of each graph convolution block ;

[0162] Suppose there are M graph convolution blocks, and the output of each graph convolution block is , then after all graph convolution blocks are processed, the final output is , the calculation process is:

[0163]

[0164] Assume the final convolution kernel size is ( ),right Perform the final convolution processing and then expand and SAX inverse process to obtain the ultra-short-term power prediction results .

[0165] Graph Neural Network (GNN) is the most widely used deep learning model on graph topology. Introducing convolution operation into GNN can obtain graph convolutional neural network GCN. At present, GCN has been gradually expanded from traffic flow prediction to distributed photovoltaic multi-station power prediction. The multi-head attention mechanism MHA improves the attention mechanism and adopts multiple information heads to more effectively capture data correlation and dynamic changes. It has been applied in the fields of offshore wind power anomaly detection, output prediction, electric vehicle load prediction and other spatiotemporal prediction fields.

[0166] Considering the characteristics of the GCN algorithm and the MHA mechanism, this application proposes an MHA-GCN framework, which embeds MHA into each GCN graph convolution block. Compared with simple algorithm splicing, it performs deep algorithm fusion to fully explore and iteratively optimize the regional spatiotemporal coupling features.

[0167] In each GCN graph convolution block, the spatiotemporal multi-head attention mechanism is first used to accurately capture complex feature dependencies and improve the information extraction effect; then the spatial graph convolution operation and the temporal convolution operation are performed in sequence, and the output result of the graph convolution block is obtained through residual connection processing, and used as the input of the next convolution block to continuously iterate and optimize the prediction result; finally, the ultra-short-term power prediction value is calculated with the help of the fully connected layer and the SAX inversion process, realizing high-performance distributed photovoltaic ultra-short-term power prediction for regional multi-sites.

[0168] Application Examples

[0169] The method proposed in the present invention is applied to a distributed photovoltaic cluster in a certain region with a total of 109 distributed photovoltaic sites and a total installed capacity of 44.24Mwp. The experimental data includes site parameters and historical measured power generation data. Among them, the sampling period of historical measured power generation data is 15min, 96 groups per day. The experiment uses the data from January 1, 2022 to December 31, 2022 as the training set, and conducts regional distributed photovoltaic ultra-short-term power forecasting for the whole year of 2023. The experimental platform conditions are Windows11X64 operating system, AMD R9-78445HX, using python language, and the deep learning framework is built by pytorch.

[0170] Considering that a single indicator cannot accurately evaluate the quality of the point prediction model, the present invention selects the root mean square error (RMSE) and the mean absolute percentage error (MAPE) as indicators, and the calculation formula is as follows:

[0171] (19);

[0172] (20);

[0173] Where: M p To predict the total number of points; is the true value; is the predicted value.

[0174] The number of heads of MHA is 3, the order of Chebyshev polynomial is 3, and all graph convolution layers use 32 convolution kernels; the model prediction output step size is 16, that is, predicting the power of the next 4 hours; the input step size is 16, and the SAX compression step size is 4. During the training process, the batch size is 32, the initial learning rate is 0.001, and the number of training rounds is 100.

[0175] In order to comprehensively evaluate the prediction effect of the method of the present invention, the present invention selects several typical prediction methods such as GRU, LSTM, XGBoost, GNN, and STGCN for comparative analysis experiments. Among them, GRU, LSTM and XGBoost are prediction methods for a single object, which adopt the method of adding after single-station modeling prediction; GNN and STGCN are prediction methods based on graph networks, which adopt a many-to-many prediction architecture and directly perform regional multi-station predictions. The regional prediction results are also obtained after addition. The adjacency matrices of GNN and STGCN both use the correlation matrix that has not been symbolically compressed by SAX, and the construction method is the normalized matrix of the power similarity between stations divided by the distance.

[0176] Figure 2 The 4h photovoltaic power prediction comparison curves of each model under four typical weather conditions in typical months of each season are shown. Figure 2 It can be seen from (a), (e), (i), and (m) in that on sunny days, the regional prediction curves of all models are relatively smooth and the trend is most obvious. At this time, the predicted value of the method of the present invention is most consistent with the actual value. In cloudy and overcast conditions, the randomness and volatility of distributed photovoltaic output increase, which is specifically reflected in: the output peak is lower and the fluctuation is smaller on cloudy days; while in cloudy weather, the obstruction and movement of clouds cause drastic fluctuations in photovoltaic power, and the difficulty of prediction increases. It can be seen from the relevant curves in the figure that the prediction curve of the method of the present invention has a smaller lag in cloudy weather and tracks the trend of the real photovoltaic power most closely; in cloudy conditions, the method of the present invention does not have a large offset and has the best smoothing effect on regional output. The output curve on rainy days is similar to that on cloudy days, and the method of the present invention also achieves the best prediction effect. In particular, GNN, STGCN and the method of the present invention, which extract the spatiotemporal output characteristics of the graph network, have higher accuracy than the independent prediction models of GRU, LSTM and XGBoost, indicating that capturing the spatiotemporal coupling characteristic relationship of regional output will directly affect its prediction effect. Among the graph network-based models, the method of the present invention has the strongest generalization ability and the highest prediction accuracy when dealing with diverse weather conditions.

[0177] Figure 3 The following is a radar chart of the prediction evaluation indicators of each model under four typical weather conditions in different months of 2023. It can be clearly seen from the figure that the method of the present invention has the smallest error, indicating that it has more advantages in accuracy and stability, especially in complex weather conditions such as cloudy weather. Compared with the best STGCN model among the comparison models, this method has reduced the RMSE and MAPE indicators by an average of 12.05% and 2.12% respectively in 12 months.

[0178] In order to further compare the impact of the capture effect of the complex spatiotemporal coupling characteristics of regional output on the prediction results, typical stations were selected for prediction effect comparison. Among them, the GRU, LSTM and XGBoost models are single-station predictions, while the GNN, STGCN and the method of the present invention use the station results of regional prediction output. Figure 4 The comparison curves of the ultra-short-term power forecast for the site on different typical days are shown. Figure 4 (a) is a typical sunny day prediction curve. Figure 4 (b) is a typical cloudy day prediction curve. Figure 4 (c) Typical cloudy forecast curve, Figure 4 (d) in the figure is a typical rainy day prediction curve. Figure 4 It can be seen that in the site-side predictions under four typical weather conditions, this method, compared with the other five methods, also reduces the lag in the ultra-short-term power generation trend prediction, can follow the changes well when there are huge fluctuations in output, and make accurate predictions on future power generation.

[0179] Table 1 shows the evaluation indicators of the average prediction results of all stations in different models in each quarter. As can be seen from Table 1, the average prediction accuracy is higher in the first and fourth quarters because there are fewer cloudy days and the photovoltaic output trend is relatively stable; while in the second and third quarters, although the average daily sunshine hours are more, the difficulty of output prediction increases due to the influence of weather such as plum rain and typhoon, so the average prediction accuracy is slightly lower. Compared with other methods, the method of the present invention has improved the indicators in each quarter. The average station RMSE index has decreased by more than 14.7%, and the MAPE index has decreased by at least 2.15%, which verifies the superiority of the proposed method. In addition, the prediction results of the multi-station model based on the graph network are better than the prediction results for a single station, indicating that the full exploration of the spatiotemporal coupling of the regional multi-station output will also capture the changing laws of short-term atmospheric movement, thereby significantly improving the prediction accuracy of each station.

[0180] Table 1 Evaluation index of average prediction results of all stations in different models in each quarter

[0181]

[0182] In addition to improving the prediction effect, considering the prediction as an ultra-short-term scale, the present invention compresses the feature dimension through the SAX algorithm, reducing the 16-dimensional feature matrix originally set according to the time step to 4 dimensions, effectively improving the model training and prediction efficiency. In addition, the method also quickly calculates the ultra-short-term predicted power of all stations at one time based on the MHA-GCN model based on the many-to-many prediction framework, with a duration similar to that of single-station prediction, achieving the high-performance prediction goal, verifying that the proposed method has both theoretical innovation and practicality in engineering application.

[0183] In order to intuitively demonstrate the role of SAX and MHA algorithms in the model of the present invention, the present invention selects 9 distributed photovoltaic sites and displays the symbolic adjacency matrix and average attention matrix between these sites during training. Figure 5 (a) in the figure is the SAX symbolized adjacency matrix. Figure 5 (b) in is the average attention matrix of the graph convolution block based on MHA. In the above two matrices, i Rows represent each site and i The degree of association between sites. Figure 5 (a) and Figure 5 It can be seen from (b) that, in addition to itself, the second site is closely related to the third and seventh sites; and the fifth site is closely related to the sixth site. In addition, Figure 5 (b) in Figure 1 also shows that due to the similarity of spatial meteorology, there is a considerable coupling relationship between the outputs of regional distributed photovoltaic sites, which can be mined more finely using the MHA attention matrix. According to the geographical distribution, these sites with strong correlation are also relatively close in the real map space. Therefore, the method of the present invention not only achieves the best prediction performance, but also has better interpretability.

Claims

1. A regional photovoltaic power prediction method based on SAX-MHA-GCN, characterized in that: The following steps are involved: S1, select the recent distributed photovoltaic output time series data as the input feature set, and compress it through the SAX algorithm to obtain the graph convolution SAX symbol feature matrix and the global SAX adjacency matrix; the specific process is: S1.1, converting the historical photovoltaic power generation into an initial photovoltaic power generation matrix, normalizing the initial photovoltaic power generation matrix to obtain a normalized historical photovoltaic power matrix; S1.2, dividing the normalized historical photovoltaic power matrix into step-size compression segments, and performing segmented aggregation approximation to obtain a converted symbolic matrix; S1.3, symbolize each element of the converted symbolized matrix to obtain the graph convolution SAX symbolic feature matrix; S1.4, by calculating the distance between every two elements in the graph convolution SAX symbolic feature matrix, the output similarity between different nodes is obtained; S1.5, calculate the spatial distance of nodes by longitude and latitude; S1.6, based on output similarity and spatial distance, obtain the intermediate process matrix; S1.7, normalizing the off-diagonal values ​​of the global SAX adjacency matrix to obtain the global SAX adjacency matrix; S2, by embedding the MHA algorithm into each GCN graph convolution block in the graph convolution network to build the MHA-GCN framework, the obtained graph convolution SAX symbol feature matrix and the global SAX adjacency matrix are used as the input of the MHA-GCN framework to obtain the graph convolution output matrix; S3, the graph convolution output matrix is ​​processed by integration and SAX inverse process to obtain the ultra-short-term power prediction result.

2. The regional photovoltaic power prediction method based on SAX-MHA-GCN according to claim 1 is characterized in that: The specific formula of step S1 includes: Assume that the initial photovoltaic power matrix , N is the number of sites, L is the original time step, Indicates the site In time Historical PV power values ​​for each site , calculate its The average photovoltaic power in a period of time and standard deviation , and finally obtain the standardized historical photovoltaic power matrix , the specific formula is as follows: (1); (2); (3); in, Represents the standardized historical photovoltaic power matrix The element means site In time The normalized value of the historical photovoltaic power value; The normalized historical PV power matrix is ​​divided into Step compression segments, calculate the average value of each segment, perform segment aggregation approximate conversion, and obtain the symbolic matrix : (4); in, h For each step label after compression, g It is an intermediate calculation variable in the symbolization process; For symbolic matrix Elements Indicates the site i In time g The standardized historical photovoltaic power value; Divide the Gaussian probability density curve into Interval , , ensuring that the area under the curve in each interval is , when the mapping rule is hour, , the symbolized matrix Each element in Map to the corresponding symbol , get the graph convolution SAX symbol feature matrix ; By computing the graph convolution SAX symbolic feature matrix for every two sites i and j The distance between them is used to obtain the output similarity between different nodes. The formula is: (5); in, , Represents the convolution SAX symbolic feature matrix Two elements in ; The spatial distance of the nodes is calculated by longitude and latitude. The formula is as follows: (6); (7); Where: Indicates the latitude of the site; Indicates the longitude of the site; Indicates the site i With site j Inter-distance coefficient; Indicates the site i With site j The static space distance of Based on output similarity and spatial distance, the intermediate process matrix is ​​obtained ; is defined as: (8); The intermediate process matrix Elements of The intermediate process matrix The global SAX adjacency matrix is ​​obtained by normalizing the off-diagonal values ​​of .

3. The regional photovoltaic power prediction method based on SAX-MHA-GCN according to claim 1 or 2, characterized in that: The process of converting historical photovoltaic power generation into the initial photovoltaic power generation matrix is ​​as follows: constructing graph structure data with vertices, edges and an edge-based undirected graph adjacency matrix, wherein each distributed photovoltaic site in the region is used as a vertex of the graph structure data, and the correlation between any two sites is used as an element of the edge-based undirected graph adjacency matrix to convert the historical photovoltaic power generation data into the initial photovoltaic power generation matrix.

4. The regional photovoltaic power prediction method based on SAX-MHA-GCN according to claim 2 is characterized in that: Specific process of step S2: S2.1, after batching and feature numbering operations on the SAX symbolic feature matrix, the model input data is obtained; S2.2, perform multi-head temporal attention processing on the model input data to obtain a multi-head temporal attention matrix; S2.3, based on the multi-head temporal attention matrix, perform multi-head spatial attention processing to obtain the multi-head spatial attention matrix ; S2.4, based on the multi-head spatial attention matrix and combined with the global SAX adjacency matrix, perform spatial graph convolution calculation to obtain the spatial graph convolution result; perform temporal convolution processing on the spatial graph convolution result to obtain the temporal convolution result; S2.5, perform residual correlation processing on the spatial convolution result and the temporal convolution result to obtain the graph convolution output matrix.

5. The regional photovoltaic power prediction method based on SAX-MHA-GCN according to claim 4 is characterized in that: The formula of multi-head time attention matrix is: Feeding the model with data The dimension from Transformed to ,in, B is the batch number, is the number of elements in a single batch, that is , is the number of features ,T To compress the step size, the multi-head attention mechanism is used to obtain the output , by permuting the dimensions we get the permutation matrix , let the dimension of the average be , that is, the number of spatial nodes The dimension of the permutation matrix In Dimension Take the average to get the attention matrix : (14); Indicates taking Middle elements in the spatial node dimension, and then for all Sum the elements and divide by , and the dimension is The matrix ; Feed the model with data in batches With the average time attention matrix Perform matrix multiplication to obtain the multi-head time attention matrix .

6. The regional photovoltaic power prediction method based on SAX-MHA-GCN according to claim 5 is characterized in that: The formula of multi-head spatial attention matrix is: The multi-head temporal attention matrix The dimension from Transformed to , and perform multi-head spatial attention processing to obtain a dimension of The multi-head spatial attention matrix .

7. The regional photovoltaic power prediction method based on SAX-MHA-GCN according to claim 6 is characterized in that: The formula expression of time convolution result is: According to the global SAX adjacency matrix Chengdi Chebyshev polynomial of order , will Chebyshev polynomial of order With the spatial attention matrix Multiply them together and you get ; For each time step , , extract the graph signal of this time step , whose dimensions are ; Let the learnable parameter matrix , ,in Represents the output feature dimension; For The combination of the Chebyshev polynomial of order θ and the spatial attention matrix is ​​calculated as follows: (15); Among them, first and Multiply to get , for The transpose of , is an intermediate variable and has no meaning; subsequently, With learnable parameters Multiply and add to Finally, the output of all time steps Splice them together according to the time dimension to get the spatial graph convolution result , whose dimensions are ; Spatial graph convolution results The expression is as follows: (16); Convolution results for spatial graphs Perform time convolution processing and set the weight matrix of the time convolution layer to be ,in Represents the output feature dimension after time convolution; through the time convolution operation, the time convolution result is obtained : (17) 。 8. The regional photovoltaic power prediction method based on SAX-MHA-GCN according to claim 7 is characterized in that: For input data Perform residual convolution processing and set the weight matrix of the residual convolution layer to be , through the residual convolution operation, the output is obtained : (18); The time convolution result Add it to the output after residual convolution to get the graph convolution output matrix .

9. The regional photovoltaic power prediction method based on SAX-MHA-GCN according to claim 8, characterized in that: The specific process of step S3 is: Then the graph convolution output matrix Perform layer normalization and set the layer normalization function to be , get the normalized result of each graph convolution block ; Suppose there are M graph convolution blocks, and the output of each graph convolution block is , then after all graph convolution blocks are processed, the final output is , the calculation process is: Assume the final convolution kernel size is ( ),right Perform the final convolution processing and then expand and SAX inverse process to obtain the ultra-short-term power prediction results .

Citation Information

Patent Citations

  • Multi-view fusion space-time dynamic graph convolutional network urban traffic flow prediction method

    CN116935649A