A Photovoltaic Power Prediction Method Based on a Two-Branch Time-Series Graph Network

By constructing a photovoltaic power prediction method based on a bi-branch time series graph network, the problem of unutilized heterogeneous characteristics of historical photovoltaic observation data and numerical weather prediction data is solved, thereby improving the accuracy of photovoltaic power prediction.

CN123121535APending Publication Date: 2026-11-17ZHEJIANG SCI-TECH UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611627632.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-21
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing photovoltaic power prediction methods fail to effectively utilize the heterogeneous characteristics of historical photovoltaic observation data and numerical weather prediction data, resulting in low prediction accuracy.

Method used

A photovoltaic power prediction method based on a bi-branch time-series graph network is adopted. By constructing a bi-branch fusion module, a time-series neural network module, and an attention fusion module, historical observation features and weather forecast features are processed by convolution and graph neural networks, respectively, and feature fusion is performed to finally generate photovoltaic power prediction results.

Benefits of technology

It improves the accuracy of photovoltaic power prediction by making full use of complementary information from different data sources, thereby enhancing the accuracy of prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123121535A_ABST
    Figure CN123121535A_ABST
Patent Text Reader

Abstract

This invention relates to the field of photovoltaic power generation technology, specifically to a photovoltaic power prediction method based on a bi-branch time-series graph network. It includes: constructing historical observation feature vectors and weather forecast feature vectors for the period to be predicted; using a trained multi-step photovoltaic power prediction model to obtain the photovoltaic power prediction result for the target photovoltaic power plant during the period to be predicted; the multi-step photovoltaic power prediction model includes a bi-branch fusion module, a time-series neural network module, and an attention fusion module; the bi-branch fusion module is used to construct photovoltaic coding features and weather forecast coding features, and fuses these features to obtain the prediction output of the convolutional branch; the time-series neural network module is used to construct the prediction output of the time-series neural network branch; the attention fusion module is used to fuse the prediction output of the convolutional branch and the prediction output of the graph neural network branch to obtain the photovoltaic power prediction result for the target photovoltaic power plant during the period to be predicted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of photovoltaic power generation technology, and specifically to a photovoltaic power prediction method based on a dual-branch time series graph network. Background Technology

[0002] Photovoltaic power forecasting is one of the core tasks of dispatch planning for new energy power systems. Its output power is significantly non-stationary, exhibiting intermittent, fluctuating, and random characteristics due to the combined influence of various meteorological factors such as solar irradiance, cloud cover, temperature, and wind speed. Achieving high-precision power forecasting on ultra-short- to medium-term (hours to days) timescales has significant engineering value for formulating power generation plans, optimizing energy storage dispatch strategies, and reducing curtailment rates.

[0003] Because historical photovoltaic observation data and numerical weather prediction data have different sampling frequencies, feature dimensions, and physical meanings, existing methods often use simple time interpolation alignment followed by direct splicing, or perform naive feature connections at the input layer. They fail to design a targeted heterogeneous data fusion mechanism at the model architecture level, resulting in data of different resolutions being processed through the same encoding path. This ignores the time scale characteristics and semantic differences of their respective data sources, making it difficult for the model to fully utilize the complementary information from the two data sources, thus leading to low accuracy in photovoltaic power prediction. Summary of the Invention

[0004] To address the technical problem of inaccurate photovoltaic power prediction, the present invention aims to provide a photovoltaic power prediction method based on a two-branch time-series graph network. The specific technical solution adopted is as follows: This invention provides a photovoltaic power prediction method based on a two-branch time-series graph network, comprising the following steps: Based on the weather forecast data for the target photovoltaic power station during the forecast period and the historical observation data for a set period prior to the forecast period, a historical observation feature vector and a weather forecast feature vector for the forecast period are constructed. Based on the historical observation feature vector and weather forecast feature vector of the period to be predicted, the photovoltaic power prediction results of the target photovoltaic power station during the period to be predicted are obtained by using the trained photovoltaic power multi-step prediction model. The photovoltaic power multi-step prediction model includes a dual-branch fusion module, a time-graph neural network module, and an attention fusion module; The dual-branch fusion module is used to convolve historical observation feature vectors to obtain photovoltaic coding features, convolve weather forecast feature vectors to obtain weather forecast coding features, and fuse photovoltaic coding features and weather forecast coding features to obtain the prediction output of the convolution branch; The time-graph neural network module is used to construct the prediction output of the time-graph neural network branch based on historical observation feature vectors; The attention fusion module is used to determine the weights of the predicted outputs of the convolutional branch and the graph neural network branch, and then fuses the predicted outputs of the convolutional branch and the graph neural network branch to obtain the photovoltaic power prediction result for the target photovoltaic power plant during the prediction period.

[0005] Among some possible implementations, training methods for multi-step photovoltaic power prediction models include: Training data is constructed based on historical observation data and numerical weather prediction data of target photovoltaic power plants at a set time in the past. A loss function is constructed, and the photovoltaic power multi-step prediction model is trained using training data with the goal of minimizing the loss function, thus obtaining the trained photovoltaic power multi-step prediction model.

[0006] In some possible implementations, the photovoltaic power multi-step prediction model also includes a discrete regularization module; The discrete regularization module is used to construct a query vector based on the predicted output of the convolutional branch and the predicted output of the graph neural network branch; determine the quantization result based on the query vector; and calculate the regularization loss based on the quantization result.

[0007] In some possible implementations, the loss function is obtained by fusing regularization loss and photovoltaic prediction loss.

[0008] Among some possible implementations, methods for obtaining photovoltaic coding features include: After mapping the historical observation feature vectors to the hidden dimension, feature extraction is performed using one-dimensional convolutional blocks and residual convolutional blocks. The extracted features are then downsampled using temporal downsampling convolutional layers to obtain photovoltaic encoded features.

[0009] Among some possible implementations, methods for obtaining weather forecast coding features include: After mapping the weather forecast feature vector to the hidden dimension, feature extraction is performed using one-dimensional convolutional blocks and residual convolutional blocks. The extracted features are then temporally upsampled using a temporally upsampled transposed convolutional layer to obtain the weather forecast coding features.

[0010] Among some possible implementations, methods for determining the weights of the predicted outputs of the convolutional branch and the graph neural network branch include: The predicted outputs of the convolutional branch and the graph neural network branch are stacked into a dual-branch feature sequence. Then, the dual-branch feature sequence is processed by multi-head self-attention calculation, residual connection, layer normalization and feedforward network. Finally, adaptive fusion weights for each time step are generated by linear projection.

[0011] Among some possible implementations, methods for determining the quantization result include: Calculate the distance between the query vector and each embedding vector in the codebook, and select the embedding vector with the smallest distance as the quantization result.

[0012] Among some possible implementations, the codebook construction methods include: The historical observation feature vectors of each sample in the training data are clustered to obtain the initialized codebook.

[0013] Among some possible implementations, methods for constructing historical observation feature vectors and weather forecast feature vectors for the period to be predicted include: Based on the weather forecast data for the target photovoltaic power station during the forecast period, the timestamps of historical observation data for a set period prior to the forecast period, and the latitude and longitude of the target photovoltaic power station, enhanced features of each data point are constructed. The enhanced features of each data point are then concatenated with the original data to obtain the historical observation feature vector and the weather forecast feature vector for the forecast period.

[0014] This invention has the following beneficial effects: It constructs historical observation feature vectors and weather forecast feature vectors for the period to be predicted; and utilizes a trained multi-step photovoltaic power prediction model to obtain the photovoltaic power prediction result for the target photovoltaic power station during the period to be predicted. The multi-step photovoltaic power prediction model includes a dual-branch fusion module, a time-graph neural network module, and an attention fusion module. The dual-branch fusion module is used to convolve the historical observation feature vectors to obtain photovoltaic coding features, and to convolve the weather forecast feature vectors to obtain weather forecast coding features. The photovoltaic coding features and the weather forecast coding features are then fused to obtain the prediction output of the convolutional branch. Feature extraction is performed on two different heterogeneous data through convolution, and then fusion is achieved to achieve complementarity between the two heterogeneous data. Furthermore, this invention utilizes the time-graph neural network module to construct the prediction output of the time-graph neural network branch. Finally, the attention fusion module is used to perform a secondary fusion of the prediction output of the convolutional branch obtained by fusing the two heterogeneous features with the prediction output of the graph neural network branch, thereby obtaining the photovoltaic power prediction result for the target photovoltaic power station during the period to be predicted, ultimately improving the prediction accuracy of photovoltaic power. Attached Figure Description

[0015] Figure 1 This is a flowchart illustrating the specific method for constructing training data according to an embodiment of the present invention; Figure 2 This is a structural diagram of the photovoltaic power multi-step prediction model according to an embodiment of the present invention; Figure 3 This is an internal structure diagram of the dual-branch 1D-CNN fusion module according to an embodiment of the present invention; Figure 4 This is a schematic diagram illustrating the connection established between each node and its adjacent time steps in an embodiment of the present invention. Figure 5 This is a flowchart illustrating the adaptive weighted fusion of dual-branch outputs according to an embodiment of the present invention; Figure 6 This is a flowchart of the method for initializing the codebook using K-Means clustering according to an embodiment of the present invention. Detailed Implementation

[0016] To clearly illustrate the technical features of this solution, the invention will be described in detail below through specific embodiments and in conjunction with the accompanying drawings.

[0017] The photovoltaic power prediction method based on a dual-branch time-series graph network of the present invention includes the following steps: Step 1: Obtain historical observation data and numerical weather prediction (NWP) data of the target photovoltaic power station over a specified period to construct training data. The specific method and process for constructing training data are as follows: Figure 1 As shown, it includes the following steps: Historical observation data and numerical weather prediction (NWP) data of the target photovoltaic power station at a set time in the past are obtained. Feature enhancement is constructed on the historical observation data and NWP data through feature engineering based on physical priors, thereby constructing historical observation feature vectors and weather forecast feature vectors. Training samples are constructed based on the historical observation feature vectors and weather forecast feature vectors. The training samples are divided into training set, validation set and test set, and standardized to obtain training data.

[0018] In this implementation, the past time period is set as the past 90 days.

[0019] In this embodiment, the historical observation data of the target photovoltaic power station includes the target photovoltaic power station's operational data, time data, and weather data. The target photovoltaic power station's operational data includes: the target photovoltaic power station's power output; the time data includes: the day of the year (the day of the year) and the sampling time (the sampling time of the day); and the weather data includes: actual irradiance, temperature, humidity, and wind speed.

[0020] In this embodiment, the numerical weather forecast data includes: cumulative radiation or irradiance, outdoor temperature, outdoor relative humidity, dew point temperature, water vapor pressure, precipitation, wind speed, and wind direction.

[0021] In this embodiment, the method for feature enhancement of historical observation data and numerical weather forecast data includes: constructing enhanced features for each data point based on the timestamp of each original data point (historical observation data or numerical weather forecast data) and combining it with the latitude and longitude of the target photovoltaic power station; concatenating the enhanced features of each data point with each original data point and performing preprocessing to form feature vectors, thereby obtaining historical observation feature vectors and weather forecast feature vectors.

[0022] In this embodiment, the method for constructing feature enhancements from historical observation data includes: constructing solar geometric theoretical indicators, theoretical radiation indicators, weather-derived indicators, and time periodic codes based on the latitude and longitude, time information, and historical data of the target photovoltaic power station.

[0023] In this embodiment, the solar geometric theoretical parameters include: solar declination angle. Solar hour angle and solar altitude angle Methods for constructing solar geometric theoretical indices include: Solar declination angle: In the formula, The solar declination angle represents the angle between the sun's rays and the equatorial plane. The value of the obliquity of the ecliptic in radians. 284 is the year-end corresponding to the timestamp, and 284 is the time phase shift constant used to align the year-end corresponding to the current time with the vernal equinox (the 81st year-end of the year).

[0024] Solar hour angle: Solar hour angle This represents the angle between the local meridian and the solar time circle, starting at 0° at noon and changing every hour. The calculation requires a true solar time correction chain: first, the time difference EoT (Equation of Time) between true solar time and mean solar time is calculated using the classical approximation formula; then, the standard time zone time is converted to local true solar time; and finally, the solar hour angle is calculated.

[0025] The formula is expressed as follows: In the formula, For the sun's horn, It is the difference between the current day of the year and the vernal equinox. This represents the number of radians the Earth travels around the Sun each day. represents the time difference between true solar time and mean solar time, expressed in minutes. 9.87, 7.53, and 1.5 are empirical fitting constants for calculating this time difference. sin(2B) sin(B) are Fourier series harmonic terms characterizing the effects of Earth's orbital eccentricity and obliquity of the ecliptic. The mean solar time is the geographical location of the photovoltaic power station, expressed in hours. This refers to the true solar time at the geographical location of the photovoltaic power station, expressed in hours. This is the standard time zone time, in hours. 60 is the conversion constant between minutes and hours. It is the solar hour angle. The longitude of the target photovoltaic power station's geographical location. The longitude is the central longitude of the standard time zone where the target photovoltaic power station is located. 15 is the conversion factor between longitude and time, indicating that for every 15 degrees of longitude between the two locations, there is a one-hour time difference.

[0026] Solar altitude angle The angle between sunlight and the horizontal plane is represented by the following methods for calculation: The solar altitude angle directly determines the intensity of solar radiation reaching the Earth's surface and is the core physical driving factor for photovoltaic power generation.

[0027] Theoretical radiation index construction: In this embodiment, the theoretical radiation index includes: the maximum irradiance under clear sky conditions, calculated based on the solar altitude angle, and the specific calculation method includes: In the formula, The theoretical total irradiance at the horizontal plane, The solar constant, The overall atmospheric transparency coefficient. The theoretical normal irradiance under clear sky conditions. This represents the theoretical diffuse irradiance under clear sky conditions.

[0028] Weather-derived indicators construction: In this embodiment, weather-derived indicators include: Clear Sky Index. The Clear Sky Index characterizes the ratio of actual irradiance to the theoretical maximum irradiance, and its specific calculation method includes: In the formula, The clear sky index, This is the calculated value for the Clear Sky Index.

[0029] In this embodiment, when Set the clear sky index at 0:00 (nighttime or when the sun is below the horizon). The value is 0.

[0030] In this implementation, when the data is historical periodic data, The actual irradiance obtained from actual measurements is used. When the data is numerical weather forecast data, the clear sky index is calculated using the irradiance from the weather forecast.

[0031] When numerical weather prediction data does not directly include irradiance, the irradiance is obtained by dividing the difference in cumulative radiation between adjacent forecast times by the time interval, and then the clear sky index is calculated based on the irradiance.

[0032] Time-periodic encoding construction: To avoid overfitting the model to absolute time values ​​and to explicitly introduce the cyclical nature of daily and annual cycles, this embodiment constructs the time cycle encoding as follows: annual sine code, annual cosine code, daily sine code, and daily cosine code. Specific calculation methods include: In the formula, For annual cycle sine coding, Cosine encoding for the annual cycle, For daily cycle sine coding, This is the cosine encoding for the daily cycle. Represents the year-to-date in the data timestamp. This represents the minutes in the data timestamp.

[0033] In this embodiment, preprocessing includes: removing the timestamp column from the original data (historical observation data or weather forecast data), converting the numerical values ​​in the original data to floating-point format, and... and Multiple identical input features are concatenated along their respective dimensions to construct a three-dimensional tensor in BTC format, where C is the channel dimension corresponding to the number of input features (each input feature corresponds to one feature channel), and B represents the batch size (i.e., ...). T represents time (i.e.) C represents the feature channel (i.e., the input feature, with each input feature occupying one feature channel).

[0034] In this embodiment, for the historical observation feature vector, the input features include historical observation features and enhanced features; for the weather forecast feature vector, the input features include weather forecast features and enhanced features. The historical observation features include: target photovoltaic power station power, irradiance, wind speed, and temperature and humidity; the enhanced features include: solar geometric theoretical indicators, theoretical radiation indicators, weather-derived indicators, and time-periodic coding; the weather forecast features include: outdoor temperature, outdoor relative humidity, dew point temperature, water vapor pressure, precipitation, wind speed, and wind direction.

[0035] In this embodiment, the method for constructing samples includes: based on the preprocessed historical observation feature vector and weather forecast feature vector, by sliding a time window, the three-dimensional tensor of the corresponding time is truncated to obtain the sample quadruples of each time window, thereby obtaining multiple samples.

[0036] In this embodiment, the prediction duration is set to F (i.e., predicting the target photovoltaic power station power for the next F days each time), the time window width is set to H, the total number of days in the historical observation feature vector is T, and the number of sampling points per day is K. Specifically, the sliding time window method includes: Taking day i as an example, historical observation data and enhanced features are obtained from the historical observation feature vectors from day i to day i+H-1, resulting in a photovoltaic historical observation sequence including H*K historical observation feature vectors; weather forecast feature vectors are obtained from day i to day i+H-1, resulting in a historical weather forecast sequence including H*K weather forecast feature vectors; weather forecast feature vectors are obtained from day i+H to day i+H+F-1, resulting in a future weather forecast sequence including F*K weather forecast feature vectors; actual photovoltaic power data from day i+H to day i+H+F-1 is obtained, resulting in a photovoltaic power tag sequence from day i+H to day i+H+F-1. The photovoltaic historical observation sequence... Historical weather forecast sequence Future weather forecast sequence and photovoltaic power tag sequence This forms a sample quadruple ( , , , ).

[0037] It should be noted that the value of i ranges from 1 to THF. Therefore, by using the above method of collecting quadruples through a sliding window to construct training samples, a total of THF training samples are obtained.

[0038] In this embodiment, F=10, H=30, and T=90.

[0039] The constructed training samples are randomly shuffled and divided into training set, validation set and test set according to a set ratio.

[0040] In this implementation, the ratio is set to 80%:10%:10%; that is, the training set accounts for 80% of all training samples, and the validation set and test set each account for 10% of all training samples. The validation set is used to evaluate the model during training, guide learning rate adjustment, early stopping, and saving the optimal model, and does not participate in parameter updates. The test set is only used to evaluate generalization performance once the model is determined, and does not participate in training or model selection.

[0041] In this embodiment, the standardization process includes: Since different input features have differences in dimensions and orders of magnitude, which can affect the degree to which each input feature influences the prediction result, this embodiment performs standardization processing on each input feature in the training set to eliminate the dimensions of all input features and unify them to the same order of magnitude. The specific methods for standardization processing include: For any given feature channel, calculate the mean and standard deviation of all features for that channel in the training set, and then perform Z-score standardization on that feature to obtain the standardized feature. The specific method for Z-score standardization is as follows: In the formula, For the standardized features, These are the numerical values ​​for each characteristic. This is the mean of this feature. This represents the standard deviation of this feature.

[0042] It is important to emphasize that the parameters of the standardized processing and It is obtained using only the training set data, but this parameter is also used for the standardization of features input to the validation set, test set, and subsequent predictions.

[0043] Step 2: Construct a multi-step photovoltaic power prediction model.

[0044] In this embodiment, the photovoltaic power multi-step prediction model is a DTGN network model, and the model structure is as follows: Figure 2 As shown, it includes a dual-branch 1D-CNN (Convolutional Neural Network) fusion module (also known as a dual-branch fusion module), a temporal neural network module, an attention fusion module, and a VQ-VAE discrete regularization module. The specific structure, function, and principle of each module are explained below.

[0045] The internal structure of the dual-branch 1D-CNN fusion module is as follows: Figure 3 As shown: The dual-branch 1D-CNN fusion module contains two sub-encoders: the PV history encoder and the NWP encoder. They process input data with different time resolutions, respectively. The time dimensions of the two branches are aligned to the same target length through internal time downsampling and upsampling operations. Then, cross-modal fusion is achieved through channel concatenation and convolutional decoding.

[0046] The input to the PV history encoder is the photovoltaic historical observation sequence. First, the feature dimensions are mapped to the hidden dimensions through an input projection linear layer. Then, the 3D tensor in BTC format is transposed to BCT format to adapt to 1D convolution operations; subsequently, features are extracted sequentially through multiple 1D convolutional blocks Conv1DBlock and residual convolutional blocks ResConv1DBlock. The extracted features are then downsampled using temporal downsampling convolutional layers to compress the historical time steps to the target length. After downsampling, the features are smoothed by convolutional blocks to eliminate sampling artifacts. Finally, the features are transposed back to BTC format and obtained through an output projection linear layer to obtain PV encoded features (also known as photovoltaic historical encoded features).

[0047] Photovoltaic historical observation sequence The shape is Where B is the batch size. For historical time steps, The number of input features for each historical time step.

[0048] In this embodiment, the input projection linear layer maps the feature dimensions to the hidden dimensions. The specific methods include: the input projection linear layer is executed sharedly at each time step. ,in The shape is ×D, The shape is D, where D is the hidden dimension, therefore after projection... The shape is This linear layer only changes the feature channel dimension, not the batch dimension and the time dimension.

[0049] In this embodiment, each Conv1DBlock consists of a one-dimensional convolutional layer, a batch normalization layer (BatchNorm1d), and a ReLU activation function. The internal structure of each ResConv1DBlock is as follows: the input is processed through two sets of Conv1d-BN-ReLU sequences, and then the residuals are added to the input using an identity function. The crucial temporal downsampling operation achieves multiple downsampling through a one-dimensional convolutional layer with a stride greater than 1 (i.e., a temporal downsampling convolutional layer), compressing the historical time steps to the target length.

[0050] NWP encoder, input is future weather forecast sequence First, the feature dimensions are mapped to the hidden dimensions through an input projection linear layer. After being transposed to BCT format, features are extracted sequentially through multiple one-dimensional convolutional blocks (Conv1DBlock) and residual convolutional blocks (ResConv1DBlock). The extracted features are then input into a temporally upsampled transposed convolutional layer for temporal upsampling. After upsampling, the features are smoothed by convolutional blocks to improve the checkerboard artifacts that may be introduced by the transposed convolution. Finally, the features are transposed back to BTC format and passed through an output projection linear layer to obtain NWP encoded features (also known as weather forecast encoded features). The key temporal upsampling operation is achieved by using the upsampled transposed convolutional layer (ConvTranspose1d) to achieve multiple upsampling, ensuring that the temporal dimension of the NWP branch is precisely aligned with the downsampled temporal dimension of the PV branch.

[0051] The PV history encoder and NWP encoder map the input to the hidden dimension, respectively. They map the photovoltaic historical observation sequence and the future weather forecast sequence with different numbers of input features to the same hidden dimension, so that the channel dimension is the same. Then, through temporal upsampling and downsampling operations, the extracted features are aligned to the same length in the temporal dimension, which provides a foundation for subsequent feature fusion and decoding.

[0052] Fusion and Decoding: The outputs of the two encoders are transposed and concatenated along the channel dimension to obtain a fused feature tensor. This fused feature tensor is then subjected to cross-modal feature fusion through convolutional blocks and residual convolutional blocks. Finally, a multi-level pointwise convolutional output head gradually reduces the channel dimension to 1, yielding the prediction output of the CNN branch.

[0053] Time-graph neural network module: The temporal graph neural network module is used to map each historical time step in the historical observation enhancement feature sequence into a chain of graph nodes in parallel. Each node establishes connections with its preceding and following time steps. Neighborhood information is aggregated through multiple layers of local message passing graph convolutional layers. Features of the node itself, its predecessors, and its successors are sequentially concatenated, linearly transformed, and activated to output graph node features. These graph node features are then downsampled to the target time step number via temporal compression convolution, and decoded by residual convolutional blocks and fully connected layers to obtain the TGNN branch prediction output. A schematic diagram illustrating the connections between each node and its preceding and following time steps is shown below. Figure 4 As shown.

[0054] The temporal graph neural network module consists of an input projection layer, a graph convolutional layer, and a temporal modeling layer. The temporal graph neural network module processes historical observation enhancement feature sequences in the order of "input projection, chain graph construction, local message passing, and temporal modeling."

[0055] The input projection layer is used to map the original enhanced features at each time step to a unified hidden dimension, forming the initial features of the graph nodes, which are then input into the graph convolutional layer for neighborhood message passing; this layer only changes the feature dimension and does not change the time dimension.

[0056] Let the input tensor be The input projection layer performs a shared input projection at each time step. ,Will The original 3D features are mapped to D-dimensional node initial features; then... Each historical time step is constructed into a node. to And establish undirected edges between adjacent time steps. For any node, its neighbor set is... When i is 0 or When missing predecessor or successor node features are filled with D-dimensional zero vectors, the missing features are filled in. For example... Figure 4 As shown, the features of the node itself, its predecessor and successor are then concatenated and input into a multi-layer local message passing graph convolutional layer to obtain graph node features; finally, the temporal modeling layer compresses and decodes the graph node features into TGNN branch prediction outputs of the target time length.

[0057] Graph convolutional layers consist of multiple concatenated graph convolutional layers, each passed through a message-passing function. This method achieves neighborhood information aggregation. For each node, its own features, predecessor features, and successor features are concatenated along the feature dimension and fed into a message-passing function for linear transformation and ReLU activation. Unlike standard graph convolutional networks, the graph convolutional layer of this invention does not use the method of multiplying the symmetric normalized Laplacian matrix and the global adjacency matrix. Instead, it performs local message passing node by node, which avoids the storage and computational overhead of large-scale adjacency matrices while preserving graph structure information, making it suitable for ultra-long sequence scenarios.

[0058] The graph decoder (also known as the temporal modeling layer): The node features output by the graph convolution need to be decoded into a prediction vector of the target length. First, the feature dimensionality is increased through a node projection linear layer, then transposed to BCT format, and finally compressed to the target length through temporal compression convolution. After compression, the features are refined through residual convolution blocks, transposed back to BTC format, and then decoded sequentially through fully connected layers to obtain the prediction output of the TGNN (Temporal Graph Neural Network) branch.

[0059] Define message passing function For each layer of graph convolution, the nodes Aggregate neighborhood information: in and These represent the learnable weight matrix and bias term of the l-th layer, respectively. The model contains multiple cascaded graph convolutional layers. After each graph convolution, each node aggregates information from its neighbors, effectively expanding its receptive field.

[0060] Unlike standard graph convolutional networks, this module employs a node-by-node local message passing strategy, resulting in a computational complexity of O(log n). This avoids building and storage Adjacency matrix The overhead is suitable for modeling very long sequences.

[0061] Attention Fusion Module: The attention fusion module receives the outputs of the CNN branch and the TGNN branch, and learns the optimal branch fusion weights for each time step through a multi-head self-attention mechanism to achieve adaptive dual-branch weighted fusion.

[0062] The process of adaptive weighted fusion of the two-branch outputs by the attention fusion module is as follows: Figure 5 As shown, it includes the following steps: The dual-branch outputs are stacked into a dual-branch feature sequence. After processing through multi-head self-attention calculation, residual connections, layer normalization, and a feedforward network, adaptive fusion weights for each time step are generated by linear projection and Softmax normalization. The prediction results of the two branches are then weighted and summed to obtain the final multi-step direct prediction sequence. The specific method in this embodiment includes: Stacking the outputs of the two branches along the last dimension yields the input tensor of the fusion module. , where the two elements of Z in the last dimension are the CNN branch prediction output and the TGNN branch prediction output, respectively. Then, the following calculations are performed using three sets of linear projection parameters shared across each time step: In the formula, , , , , , , Hidden dimensions for attention. Q, K, and V are uniformly divided along the hidden dimensions. There are 1 attention head, and each head has 1 dimension. ; Calculate scaled dot product attention in each attention head. Specific calculation methods include: In the formula, , and The first The query, key, and value matrix of each attention head; This indicates the correlation between each target time step, divided by To prevent the inner product value from becoming excessively large as the dimensionality increases, Softmax normalizes the correlation to an attention coefficient, and then... The weighted sum is used to obtain the output of this header.

[0063] The outputs of each attention head are concatenated and linearly projected, then residual connections and layer normalization are performed to obtain the features after the attention layer. Features after attention layer The data is fed into a feedforward network (FFN), and then a second set of residual connections and layer normalization are performed to obtain the feedforward features. Specific methods include: In the formula, Presentation layer normalization processing, This represents the features after the attention layer. This represents the activation function. and From Mapped to The first linear layer parameters of dimension, and From Dimension Mapping Back The second linear layer parameters of the dimension; The features are those of the feedforward network and the second set of residual connections.

[0064] Features after feedforward By mapping the linear layers to logarithms of the weights and performing a Softmax operation along the last dimension, a normalized fused weight vector is obtained. Finally, the weights are used. The predictions from the two branches are weighted and summed step-by-step to obtain the final fused prediction result. Specific methods include: Features after feedforward Calculation via output projection layer ,in , , Let be the logarithm of the weights of the two branches. For each batch b and prediction time step t, according to... Calculate the normalized fusion weight vector ,in Corresponding to the CNN branch, This corresponds to the TGNN branch. Therefore... Both weights are non-negative. Finally, these weights are used to perform a time-step weighted summation of the two branch predictions to obtain the final fused prediction result: In the formula, This indicates the final prediction result. , For the predicted output of the CNN branch, , This is the predicted output of the TGNN branch. , This indicates element-wise multiplication by batch and time step. and These are the fusion weights for the corresponding two branches. This calculation allows for the automatic allocation of weights at each prediction time step based on the representations of the two branches at that moment.

[0065] In this embodiment, the feedforward network consists of two linear transformation layers and a ReLU activation function.

[0066] VQ-VAE Discrete Regularization Module: The VQ-VAE discrete regularization module is used to suppress model overfitting in small sample scenarios and to impose discrete constraints on the latent space. The VQ-VAE discrete regularization module does not perform reconstruction tasks, but instead imposes discretization constraints on the intermediate representation of the bi-branch output, forcing the model's latent vectors to be close to the finite discrete codebook embedding, forming a "hard" regularization effect.

[0067] The VQ-VAE discrete regularization module stacks and projects the output features of the CNN and TGNN branches into latent vectors. Vector quantization maps continuous latent vectors to the nearest-neighbor embedding vectors in the codebook. The codebook parameters are updated using an exponential moving average, and the commitment loss is calculated as a regularization term to constrain the latent space distribution. The codebook initialization uses K-Means clustering results from historical NWP data, which are then randomly linearly projected onto the codebook embedding dimension, ensuring that the codebook embeddings contain prior knowledge of typical meteorological patterns from the early stages of training. Specifically, the following steps are included: In this implementation, historical weather forecast sequences are used before training begins. The codebook is initialized using K-Means clustering, replacing the default random initialization. The process for initializing the codebook using K-Means clustering is as follows: Figure 6 As shown, it includes the following steps: Obtain the historical weather forecast sequences of all samples after standardization. The data is flattened into a two-dimensional matrix along the sample and time dimensions. K-Means clustering is then performed on the flattened data, with the number of clusters matching the codebook size, resulting in K cluster center matrices C.

[0068] Since the dimension of the K-Means cluster centers does not match the dimension of the codebook embeddings, a random projection matrix P is generated, whose elements are independently and identically distributed according to a normal distribution with a mean of 0. The initial values ​​of the codebook embeddings are then calculated. : This operation maps cluster centers to the codebook embedding space via random linear projection, adapting the codebook dimension while approximately preserving the relative distance structure between cluster centers. Simultaneously, the learnable embedding weights and exponential moving average (EMA) weights of the vector quantization module are written to complete the K-Means clustering initialization of the codebook, resulting in an initialized codebook. The initialized codebook includes multiple embedding vectors.

[0069] In this implementation, the principle of using historical weather forecasts to initialize the codebook is that the meteorological conditions recorded in the weather forecast data are the driving factors for photovoltaic power generation, and PV power is the power generation result under the influence of meteorological conditions. Initializing the codebook with the statistical clustering structure of the meteorological data is equivalent to embedding multiple typical meteorological model priors into the codebook before training begins, so that the model has a causal mapping foundation from meteorological models to power shape from the early stage of training.

[0070] In this implementation, the VQ-VAE discrete regularization module is used to stack the predicted outputs of the CNN branch and the TGNN branch, and then combine them with the initialized codebook to determine the discrete quantization result. The specific method includes: flattening the stacked outputs of the two branches along the channel dimension, mapping them to the codebook embedding dimension through a linear projection layer, and then transforming them into a tensor format suitable for quantization through a reshape operation to obtain the query vector. For each query vector, the Euclidean distance between it and all embedded vectors in the codebook is calculated, and the embedding with the smallest distance is taken as the quantization result. The predicted outputs of the two branches and Stacking along the channel dimension yields Then flatten it along the batch and time dimensions into Two-dimensional vectors Calculated by querying the projection layer ,in , D is the codebook embedding dimension, which yields the query vector. Then, the N query vectors are reshaped as follows: The tensor format. Let the codebook be... Where K is the codebook size, For the embedding of the k-th codebook, k Calculate for each query vector and order ,by As the corresponding quantification result .

[0071] Calculate the regularization loss based on the query vector and quantization results. The encoder output is forced to be close to the quantized codebook embedding, preventing latent vectors from drifting unconstrainedly in continuous space. Since the argmin operation is non-differentiable, the gradient is directly copied from the quantized result to the encoder output through a pass-through estimator during backpropagation, allowing the encoder to be optimized via gradient descent.

[0072] In this implementation, the VQ regularization loss is calculated using the commitment loss: in The commitment loss coefficient, This indicates that the gradient operator is stopped. It is used during forward propagation. As the quantized latent vector; due to right The gradient is an identity mapping, and during backpropagation, the gradient of the quantized result can be passed to the query projection layer and the preorder network through the pass-through estimator. This regularization loss only participates in the total loss calculation during the training phase.

[0073] During training, an exponential moving average strategy is used to update the codebook embeddings to avoid training instability caused by using gradient descent to update the codebook.

[0074] In this embodiment, the effective utilization rate of the codebook is also reflected by calculating the codebook usage perplexity. Specific methods include: Calculate the perplexity by counting the frequency of each embedded selection within a batch to reflect the effective utilization of the codebook: For N query vectors in a training batch, first... Calculate the frequency at which the k-th embedding is selected, where ; then calculate the degree of confusion . The value ranges from 1 to K, and is used to reflect the number of codebook embeddings that are actually used effectively within the batch.

[0075] A perplexity close to the codebook size indicates high utilization, while a perplexity close to 1 indicates that only a few embeddings are used.

[0076] Step 3: Construct the loss function, train the DTGN network model based on the training data to obtain the trained DTGN network model, and test it using standardized samples in the test set.

[0077] The goal is to minimize the weighted sum of the prediction mean squared error loss and the VQ regularization loss. A DTGN network model is trained using training data, employing the Adam optimizer and an adaptive learning rate decay strategy, combined with an early stopping mechanism to save the optimal model with the lowest validation loss, resulting in the final trained DTGN network model. The DTGN network model is then tested using standardized samples obtained from the test set.

[0078] In this embodiment, the training process of the model is strictly executed in the following order: loading the configuration file and reading all hyperparameters; initializing the log system; fixing the global random seed to ensure reproducibility; setting up the computing device; performing data loading and preprocessing; building the DTGN model; performing codebook K-Means initialization; and initializing the loss function, optimizer, and learning rate scheduler.

[0079] In this implementation, the total loss is a weighted average of the prediction loss and the VQ regularization loss, and the constructed total loss function is as follows: In the formula, For the output of the attention fusion module, For the standardized true power label, the predicted loss is , That is, the aforementioned , where is the average squared distance between the query vector and the corresponding quantized embedding after stopping the gradient. To predict loss weights, These are the VQ regularization loss weights; both are hyperparameters set in the configuration file before training. The MSE loss is calculated in the normalization domain to ensure that power values ​​across different numerical ranges have a uniform loss magnitude; during backpropagation... For scalar objectives, the Adam optimizer is used to update learnable parameters other than the EMA codebook. The MSE loss is calculated in the normalization domain, ensuring that power values ​​across different numerical ranges have a uniform loss magnitude. Weights for predicting loss, The weights for the regularization loss.

[0080] Since the model also includes a discrete regularization module in this embodiment, the total loss function in this embodiment is a weighted sum of the prediction loss and the VQ regularization loss. In other embodiments, the model may only include a two-branch fusion module, a time-graph neural network module, and an attention fusion module, without including a discrete regularization module. In this case, the total loss consists only of the prediction loss.

[0081] In this implementation, the model is trained using a cyclic training method. In each training round, the training set is first traversed through each batch during the training phase. For each batch, forward propagation is performed to obtain the predicted value and VQ loss. After calculating the total loss, backpropagation is used to update the parameters. Then, during the validation phase, the validation loss and evaluation metric are calculated for the validation set. Subsequently, the learning rate scheduler adjusts the learning rate based on the validation loss. Finally, an early stopping condition is determined: if the current validation loss is lower than the historical best value, the optimal model checkpoint is saved and the patience counter is reset; otherwise, the counter is incremented by 1. When the counter reaches the set value, early stopping is triggered to terminate the training.

[0082] Step 4: Determine the forecast period for the target photovoltaic power station (taking the next 10 days as an example), and obtain historical observation data for the set time period before the forecast period (taking the past 30 days as an example) and weather forecast data for the forecast period. After feature enhancement, obtain the historical observation feature vector and weather forecast feature vector, and after preprocessing and standardization, input them into the DTGN network model to obtain the prediction results.

[0083] The methods for feature enhancement, preprocessing, and normalization have been introduced earlier and will not be repeated here.

Claims

1. A photovoltaic power prediction method based on a two-branch time-series graph network, characterized in that, Includes the following steps: Based on the weather forecast data for the target photovoltaic power station during the forecast period and the historical observation data for a set period prior to the forecast period, a historical observation feature vector and a weather forecast feature vector for the forecast period are constructed. Based on the historical observation feature vector and weather forecast feature vector of the period to be predicted, the photovoltaic power prediction results of the target photovoltaic power station during the period to be predicted are obtained by using the trained photovoltaic power multi-step prediction model. The photovoltaic power multi-step prediction model includes a dual-branch fusion module, a time-graph neural network module, and an attention fusion module; The dual-branch fusion module is used to convolve historical observation feature vectors to obtain photovoltaic coding features, convolve weather forecast feature vectors to obtain weather forecast coding features, and fuse photovoltaic coding features and weather forecast coding features to obtain the prediction output of the convolution branch; The time-graph neural network module is used to construct the prediction output of the time-graph neural network branch based on historical observation feature vectors; The attention fusion module is used to determine the weights of the predicted outputs of the convolutional branch and the graph neural network branch, and then fuses the predicted outputs of the convolutional branch and the graph neural network branch to obtain the photovoltaic power prediction result for the target photovoltaic power plant during the prediction period.

2. The photovoltaic power prediction method based on a dual-branch time-series graph network according to claim 1, characterized in that, Training methods for multi-step photovoltaic power prediction models include: Training data is constructed based on historical observation data and numerical weather prediction data of target photovoltaic power plants at a set time in the past. A loss function is constructed, and the photovoltaic power multi-step prediction model is trained using training data with the goal of minimizing the loss function, thus obtaining the trained photovoltaic power multi-step prediction model.

3. The photovoltaic power prediction method based on a dual-branch time-series graph network according to claim 2, characterized in that, The photovoltaic power multi-step prediction model also includes a discrete regularization module; The discrete regularization module is used to construct query vectors based on the predicted outputs of convolutional branches and graph neural network branches; The quantization result is determined based on the query vector; the regularization loss is calculated based on the quantization result.

4. The photovoltaic power prediction method based on a dual-branch time-series graph network according to claim 3, characterized in that, The loss function is obtained by fusing regularization loss and photovoltaic prediction loss.

5. The photovoltaic power prediction method based on a dual-branch time-series graph network according to claim 1, characterized in that, Methods for obtaining photovoltaic coding features include: After mapping the historical observation feature vectors to the hidden dimension, feature extraction is performed using one-dimensional convolutional blocks and residual convolutional blocks. The extracted features are then downsampled using temporal downsampling convolutional layers to obtain photovoltaic encoded features.

6. The photovoltaic power prediction method based on a dual-branch time-series graph network according to claim 1, characterized in that, Methods for obtaining weather forecast coding features include: After mapping the weather forecast feature vector to the hidden dimension, feature extraction is performed using one-dimensional convolutional blocks and residual convolutional blocks. The extracted features are then temporally upsampled using a temporally upsampled transposed convolutional layer to obtain the weather forecast coding features.

7. The photovoltaic power prediction method based on a dual-branch time-series graph network according to claim 1, characterized in that, Methods for determining the weights of the predicted outputs of convolutional branches and graph neural network branches include: The predicted outputs of the convolutional branch and the graph neural network branch are stacked into a dual-branch feature sequence. Then, the dual-branch feature sequence is processed by multi-head self-attention calculation, residual connection, layer normalization and feedforward network. Finally, adaptive fusion weights for each time step are generated by linear projection.

8. The photovoltaic power prediction method based on a dual-branch time-series graph network according to claim 3, characterized in that, Methods for determining quantification results include: Calculate the distance between the query vector and each embedding vector in the codebook, and select the embedding vector with the smallest distance as the quantization result.

9. The photovoltaic power prediction method based on a dual-branch time-series graph network according to claim 8, characterized in that, The codebook construction methods include: The historical observation feature vectors of each sample in the training data are clustered to obtain the initialized codebook.

10. The photovoltaic power prediction method based on a dual-branch time-series graph network according to claim 1, characterized in that, Methods for constructing historical observation feature vectors and weather forecast feature vectors for the period to be predicted include: Based on the weather forecast data for the target photovoltaic power station during the forecast period, the timestamps of historical observation data for a set period prior to the forecast period, and the latitude and longitude of the target photovoltaic power station, enhanced features of each data point are constructed. The enhanced features of each data point are then concatenated with the original data to obtain the historical observation feature vector and the weather forecast feature vector for the forecast period.