Green electricity supply and demand matching prediction method and model based on transformer

By using a Transformer-based green electricity supply and demand matching forecasting method, the problem of green electricity supply and demand forecasting that is difficult to consider multiple factors simultaneously in existing technologies has been solved. This has enabled more reliable green electricity supply and demand matching and cross-regional collaborative consumption, thereby improving the capacity for green electricity trading and consumption.

CN122492275APending Publication Date: 2026-07-31STATE GRID JIANGSU ECONOMIC RES INST +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
STATE GRID JIANGSU ECONOMIC RES INST
Filing Date
2026-04-30
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing green electricity supply and demand forecasting methods cannot simultaneously consider multiple factors such as the characteristics of renewable energy output at the sending end, the differentiated growth trajectories of various types of loads at the receiving end, changes in users' green electricity consumption preferences, carbon emission constraints, and the available capacity of transmission channels. They cannot effectively capture the structural growth pattern of green electricity demand, and their forecasting deviations are large in cross-provincial supply and demand matching, making it difficult to support the expansion of green electricity trading scale and cross-regional collaborative consumption.

Method used

A green electricity supply and demand matching prediction method based on Transformer is adopted. Through multi-channel weak innovation coding, innovation discriminator constraint, Transformer cross-channel feature fusion, multi-channel decoding prediction and adversarial training, a green electricity supply and demand matching prediction model is constructed to achieve coordinated prediction of new energy output, multi-type loads in the province and user green electricity demand. Furthermore, a medium- and long-term green electricity collaborative consumption model is constructed based on cross-regional transmission capacity.

Benefits of technology

It significantly improves the stability and multivariate forecasting capability of green electricity supply and demand matching, and can generate more reliable and decision-making-valuable forecast results, supporting the improvement of green electricity trading mechanisms and cross-regional collaborative consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122492275A_ABST
    Figure CN122492275A_ABST
Patent Text Reader

Abstract

This invention discloses a Transformer-based method and model for predicting green electricity supply and demand matching. The method includes: constructing independent encoders for multiple types of time-series variables to reduce redundant noise in the original sequence, obtaining a weak innovation representation; using an innovation discriminator to constrain this representation to approach an ideal innovation sequence with Wasserstein distance; fusing features from a Transformer module using a cross-variable multi-head attention mechanism to obtain multi-variable coupled features; constructing a separate decoder for each type of variable, extracting specific features from the features and mapping them to a predicted sequence; using a reconstructed discriminator to constrain the distribution of the predicted sequence to approximate the true sequence distribution with Wasserstein distance; using an encoding, fusion, and decoding module as a generator, combined with two discriminators, to achieve adversarial training through alternating optimization; removing the discriminators during testing, inputting multi-source time series, encoding and fusing them, injecting random noise, and generating a predicted sequence. This invention can provide reliable and more decision-valuable prediction results for green electricity supply and demand matching and cross-provincial collaborative consumption.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of power system planning, and in particular relates to a green electricity supply and demand matching prediction method and model based on Transformer. Background Technology

[0002] With the continuous advancement of green and low-carbon development in my country, the installed capacity of renewable energy sources such as wind power and photovoltaics has expanded rapidly, and the scale of inter-provincial green electricity trading has shown a sustained growth trend. New energy sources exhibit significant intermittency, randomness, and seasonal fluctuations. Their output is greatly affected by meteorological conditions, resource endowment, and spatiotemporal environment, exhibiting a multi-timescale, multi-level coupled variation pattern. Against the backdrop of large-scale grid connection of new energy sources, sending provinces generally construct large-scale wind and solar clusters, whose output exhibits strong fluctuations, distinct diurnal periodicity with peaks and valleys, and significant seasonal differences. Receiving provinces, on the other hand, have diverse electricity demands, including industrial load, commercial load, and residential load. Influenced by factors such as industrial structure, economic development level, seasonal climate changes, and residents' behavior patterns, their load curves exhibit composite superposition, multi-peak characteristics, and significant differences between different types of loads.

[0003] However, current green electricity supply and demand forecasting methods are mostly based on single load forecasting or renewable energy forecasting models, making it difficult to simultaneously consider multi-dimensional factors such as the output characteristics of renewable energy at the sending end, the differentiated growth trajectories of various types of loads at the receiving end, changes in user green electricity consumption preferences, carbon emission constraints, and the available capacity of transmission channels. Existing models generally lack the ability to uniformly model the multi-level characteristics of the supply and demand sides, and cannot extract the spatiotemporal coupling relationship between renewable energy and load, nor can they capture the structural growth patterns of green electricity demand from historical data. In addition, for cross-provincial supply and demand matching tasks, traditional models struggle to eliminate forecast biases and maintain output stability in high-dimensional and complex time-series data, which limits the expansion of green electricity trading scale and the improvement of cross-regional collaborative absorption capacity.

[0004] Against this backdrop, there is an urgent need to construct a green electricity supply and demand matching prediction model that can adapt to the characteristics of multi-source data both within and outside the province, systematically characterize the output patterns of new energy sources, and simultaneously consider the uncertainty of transmission channel capacity. By establishing vertically segmented characteristic models at both the sending and receiving ends, collaborative prediction of new energy output, various types of loads within the province, and user green electricity demand can be achieved. Furthermore, a medium- to long-term green electricity collaborative absorption model can be constructed based on cross-regional transmission capacity. This has significant engineering value and practical significance for supporting the improvement of my country's green electricity trading mechanism, enhancing green electricity absorption capacity, and realizing multi-province collaborative energy transformation. Summary of the Invention

[0005] To address the problems mentioned in the background section, this invention discloses a Transformer-based green energy supply and demand matching forecasting method, which can provide more reliable and decision-valuable forecasting results for green energy supply and demand matching and cross-provincial coordinated consumption. To achieve the above objectives, the technical solution adopted by this invention is as follows: A Transformer-based method for predicting the supply and demand of green electricity, characterized by the following steps: S1, Multi-channel Weak Innovation Coding: For multiple time-series variables in the green electricity supply and demand scenario, independent encoders are constructed for each variable. Through independent coding, redundancy and noise components in the original sequence are reduced, resulting in the potential sequence of weak innovation representations for each variable. ; S2, Innovation Discriminant Constraints; Constructing the Innovation Discriminant The weak innovation representation latent sequence is constrained by the Wasserstein distance as a metric. The distribution of this sequence guides it toward a pre-defined ideal innovation sequence. Approach; S3, Transformer cross-channel feature fusion; employing a Transformer module with a cross-variable multi-head attention mechanism, feature fusion is performed on the constrained latent representations of each channel to obtain a fused feature sequence containing a multivariable coupling structure; specifically including: For any time step, the innovative encoding vectors from each channel are treated as a set of variable nodes, forming the variable feature matrix at the current time step; multi-head attention is computed on the variable dimension, and each attention head learns the coupling relationship between variables in a different feature subspace; the outputs of multiple attention heads are concatenated and mapped on the feature dimension to obtain the fusion feature matrix at the current time step; the above process is repeated for all time steps to obtain the complete fusion feature sequence. S4, Multi-channel decoding prediction; A separate decoder is constructed for each type of time-series variable to extract the specific features of the corresponding variable in the fused feature sequence and map them into a prediction sequence; S5, Reconstructing the Discriminator Constraints, Constructing the Reconstructed Discriminator The predicted sequence is constrained by the Wasserstein distance as a metric. The distribution of the time series variable approximates the true sequence of the time series variable. The empirical distribution; S6, adversarial training: The multi-channel weak innovation coding module, the Transformer cross-channel fusion module, and the multi-channel decoding prediction module are integrated into a generator, and the innovation discriminator module and the reconstruction discriminator module are integrated into a discriminator. By alternately optimizing the parameters of the generator and the discriminator, the training convergence of the network parameters is achieved. S7, Test Prediction; Remove all discriminators, input multi-source time series data into the trained generator, encode and fuse features, inject random noise to generate a prediction sequence of green electricity supply and demand related variables, and realize green electricity supply and demand matching prediction.

[0006] Furthermore, the time-series variables in step S1 include at least one of new energy output, industrial load, commercial load, residential load, and green electricity demand. The redundancy and noise components include low-frequency drift components, cross-channel collinear noise, and random measurement noise. Before independent encoding, the components undergo sliding window smoothing and feature normalization preprocessing.

[0007] Furthermore, the ideal innovation sequence of step S2 Let be an independent and identically distributed uniform random variable on the interval [0, 1]. Based on the Kantorovich–Rubinstein dual form of the Wasserstein distance, its distribution is... and distribution The 1-Wasserstein distance between them can be written as:

[0008] in Require A novel discriminator based on the 1-Lipschitz function. That is, it is used to approximate the 1-Lipschitz function in the dual space; the loss function of the innovative discriminator also includes a gradient penalty term to ensure that the discriminator satisfies the 1-Lipschitz condition, for the th The innovation discriminant loss for each channel is constructed using the relevant formula:

[0009] The formula related to the gradient penalty term is: .

[0010] Furthermore, in step S5, a gradient penalty term is also set in the discriminator loss function to ensure that the discriminator satisfies the 1-Lipschitz condition, based on the Kantorovich–Rubinstein dual form of the Wasserstein distance. The reconstructed discriminant loss for each variable can be constructed as follows: , The relevant formula for the gradient penalty term is: .

[0011] Furthermore, in step S4, the b-th row of the fused feature sequence represents the deep fused representation of the b-th variable at time step t; a unique fused feature sub-sequence is constructed for each variable, which includes the variable's cross-time dynamic change characteristics, the influence pattern of other variables on the variable, and the unified statistical structure after being normalized by the innovation discriminator; each decoder learns its unique output behavior on its corresponding fused feature sub-sequence, achieving complete decoupling at the task level.

[0012] Furthermore, the alternating optimization of generator and discriminator parameters in step S6 includes: S61, with fixed generator parameters, only the discriminator parameters are updated. By maximizing the discriminator loss, the innovation discriminator can more accurately distinguish between weak innovation sequences and ideal innovation sequences, and the reconstruction discriminator can more accurately distinguish between real sequences and predicted sequences. S62: Fix the discriminator parameters and only update the generator parameters. By minimizing the generator loss, the distribution of weak innovation sequences is made closer to the distribution of ideal innovation sequences, and the distribution of predicted sequences is made closer to the distribution of true sequences. S63 innovates the discriminator loss and reconstructed discriminator loss to provide gradient information for the discriminator, while the generator continuously optimizes the parameters of the encoder, Transformer and multiple decoders by receiving the gradients backpropagated from the discriminator.

[0013] Furthermore, in step S7, the random noise is independent and identically distributed random noise sampled multiple times in Monte Carlo, injected into the weak innovation space after distribution calibration, and the prediction sequence includes a point prediction sequence and a probability prediction sequence.

[0014] This invention also discloses a green electricity supply and demand matching prediction model based on Transformer, characterized in that: A multi-channel weak innovation coding module is used to perform step S1 above; An innovative discriminator module is used to perform step S2 described above; The Transformer cross-channel feature fusion module is used to perform step S3 above; The multi-channel decoding prediction module is used to perform step S4 above; The discriminator reconstruction module is used to perform step S5 above; The adversarial training module is used to perform step S6 above; The test prediction module is used to perform step S7 as described above.

[0015] The present invention also discloses a computer-readable storage medium having a computer program stored thereon, characterized in that the program, when executed by a processor, implements the Transformer-based green electricity supply and demand matching prediction method of the invention.

[0016] The present invention also discloses a computer program product, including a computer program, characterized in that the computer program, when executed by a processor, implements the Transformer-based green electricity supply and demand matching prediction method of the invention.

[0017] The present invention adopts the above technical solution and has the following beneficial effects: The Transformer used in this invention fully extracts the deep correlation between new energy sources, load, and demand through a cross-variable attention mechanism, effectively capturing the coupling structure across time scales and regions, and significantly improving the stability and expressive power of multivariate prediction. At the output end, the multi-decoder structure of this invention enables independent modeling of different prediction tasks, and uses a reconstruction discriminator to constrain the statistical distribution of the prediction sequence, making the model output closer to the real data in terms of mean, variance, and fluctuation patterns. In the inference stage, a Monte Carlo sampling mechanism based on IID noise is introduced, which can generate diverse future scenarios while maintaining trend and structural consistency, expanding from single-value prediction to a complete probability prediction distribution. Compared with traditional methods, this invention has significant advantages in prediction accuracy, distribution consistency, and uncertainty expression, and can provide more reliable and decision-valuable prediction results for green electricity supply and demand matching and cross-provincial collaborative consumption. Attached Figure Description

[0018] Figure 1 The flowchart is shown in the specific embodiment of the green electricity supply and demand matching prediction method based on Transformer.

[0019] Figure 2 This is a diagram of the adversarial training network architecture as described in a specific embodiment.

[0020] Figure 3 This is a network architecture diagram for the testing phase as described in a specific embodiment. Detailed Implementation

[0021] To facilitate understanding by those skilled in the art, the present invention will be further described below in conjunction with embodiments and accompanying drawings.

[0022] This embodiment provides a Transformer-based green energy supply and demand matching prediction model to implement a Transformer-based green energy supply and demand matching prediction method. The method flow is described in [reference needed]. Figure 1 The model includes: Multi-channel weak innovation coding module (a) Independent encoder structure For ease of explanation, let the prediction window length be . The system contains For time-series variables, such as renewable energy output, industrial load, commercial load, residential load, and green electricity demand, the general form is as follows: The timing variables of each channel can be denoted as: For each time series variable, a separate encoder is constructed. This forms an encoder set: Each encoder receives the raw input sequence for its corresponding channel. The output length is Potential representation sequence: .

[0023] (b) Feature aliasing problem caused by multi-channel heterogeneity In practical applications, the statistical distributions of the original sequences from different channels differ significantly. For example, renewable energy output typically exhibits strong seasonality coupled with short-term random fluctuations, while residential load shows a stable daily cycle, and industrial load is smoother but more affected by holidays. Directly concatenating these sequences with vastly different distributions and inputting them into a unified model often results in feature aliasing, amplifying cross-channel collinearity noise and weakening the model's ability to identify key dynamic features of each variable. Therefore, this model first maps the original sequence of each channel to its dedicated latent space using independent encoding, enabling the model to perform adaptive feature extraction "within the channel," rather than processing the highly messy data structure "after channel mixing."

[0024] (c) The role of weak innovation coding After the latent representations are generated by independent encoders, these latent sequences exhibit a "weak innovation" characteristic in their structure. This means that while retaining the main dynamic components of the original time series, redundant trend terms, low-frequency drift components, and collinear noise across channels are significantly reduced. Weak innovation representations do not require complete independent and identically distributed (i.i.d.) distributions. Instead, through feature extraction by the encoders, the dynamic driving structure of each channel in the latent space becomes clearer, more stable, and less affected by other variables. Through this process, the model can effectively reduce noise coupling and trend shifts between different channels, making the latent representations more consistent and usable in statistical structure. This provides high-quality, low-noise input for subsequent cross-channel Transformer fusion and multi-task prediction.

[0025] Innovation Discriminator Module: After completing the multi-channel weak innovation coding, although the latent representations of each channel have reduced redundancy and collinear noise to some extent, their statistical characteristics still inherit some of the original time series correlation structure and cannot yet be regarded as strictly independent and identically distributed (IID) sequences. In order to further improve the statistical regularity of the latent representations and provide more standardized inputs for subsequent cross-channel unified modeling, it is necessary to further constrain the above weak innovation coding sequences to be ideal innovation variable sequences that are close to IID.

[0026] Therefore, this model uses the Wasserstein distance as a metric and constructs an innovation discriminator. To approximate the latent representation sequence With the ideal innovation sequence The 1-Wasserstein distance between them is minimized during training, making The distribution gradually towards To converge. To establish an ideal innovation sequence: Let be independent and identically distributed uniform random variables on the interval [0,1]. According to the Kantorovich–Rubinstein dual form of the Wasserstein distance, the distribution... and distribution The 1-Wasserstein distance between them can be written as:

[0027] in Require A novel discriminator based on the 1-Lipschitz function. This is used to approximate the 1-Lipschitz function in the dual space, thus obtaining a trainable Wasserstein distance estimate. Based on this, for the ... The innovation discriminant loss for each channel is constructed as follows: ;

[0028] The formula related to the gradient penalty term is as follows: ;

[0029] This is used to ensure that the discriminator satisfies the 1-Lipschitz condition.

[0030] Transformer cross-channel feature fusion module: After distribution normalization by the innovation discriminator, the latent representations of each channel tend to be homogeneous, possessing statistical structures that can be directly aligned. However, in the scenario of green electricity supply and demand forecasting, there are significant coupling relationships between different variables. This coupling typically manifests as cross-regional linkages, cross-industry collaborative changes, and trends driven by common seasonal factors. If each variable is predicted independently, it is difficult to capture this multivariate correlation at the same time scale. Therefore, this model employs the Transformer module with a cross-variable attention mechanism to perform correlation modeling on the multi-channel innovation coding sequences at the same time step, thereby learning the deep interaction structure between variables.

[0031] The Transformer is a deep learning model built on an attention mechanism, initially used for sequence modeling tasks. Its core characteristic is that it does not rely on recurrent or convolutional structures, but instead directly models the dependencies between positions in a sequence through an attention mechanism. A typical Transformer model mainly consists of an input embedding layer, a positional encoding module, and a multi-layered stacked encoder and decoder structure. Each encoder layer typically includes a multi-head self-attention sublayer and a feedforward neural network sublayer, combined with residual connections and layer normalization mechanisms to improve training stability and model expressive power.

[0032] Self-attention is the core of the Transformer model. Its basic idea is to dynamically weight the input information by calculating the correlation between different positions in the sequence. For the input feature sequence, the query matrix is ​​first obtained through linear transformation. Key matrix Sum matrix These are used to represent the query features of the current element, the context index of all elements, and the information representation to be aggregated, respectively. Subsequently, attention weights are obtained by calculating the similarity between the query and the key (usually in the form of a scaled dot product), and the corresponding values ​​are weighted and summed to obtain the context-enhanced representation of each position.

[0033] Specifically, for any time step The innovative encoding vectors from each channel Considered as a set of "variable nodes", they constitute the variable feature matrix at the current moment. The Transformer's attention is not expanded along time, but rather computed along the variable dimension. Furthermore, considering that a single attention head can only compute the correlation between variables in a specific linear subspace, its expressive power is limited and it is prone to missing important structural information at different scales and under different association patterns, this model employs a multi-head attention mechanism to learn the coupling relationships between variables in distinct feature subspaces. For the ... Each attention head is used to construct the query, key, and value matrices respectively:

[0034] Each row vector corresponds to the projection representation of a specific variable channel at the current time step into the feature subspace defined by the attention head. The cross-variable attention weights are obtained by scaling the dot product.

[0035] in This is the dimension used to scale the key vector. When multiple attention heads exist... At that time, the outputs of all heads are concatenated along the feature dimension and transformed using the output transformation matrix. Mapping back to a unified dimension yields the fused feature matrix at the current time step:

[0036] Repeating the above process for all time steps yields the complete fused feature sequence. In this way, the model explicitly models the coupling structure between multiple variables at each time scale and encodes this coupling into shared deep features. Subsequent multi-decoder modules will then... As input, predictions are made for renewable energy output, various loads and green electricity demand, but they share the same set of fusion features obtained by cross-variable attention, thus ensuring consistency in physical meaning and statistical structure between different prediction tasks.

[0037] Multi-channel decoding prediction module: After processing with the intervariate attention mechanism, the resulting fused feature sequence encodes the autocorrelation structure and intervariate coupling relationships of each channel into a unified deep feature space. Although the fused features contain the important correlations between all variables, different types of variables have completely different physical meanings, statistical distributions, and demand-side behaviors in practical applications. Therefore, a single unified decoding network cannot directly recover the prediction sequence of all variables. Using a single decoder would cause the outputs of different variables to interfere with each other, leading to mixed distributions, prediction shifts, and even model instability. Therefore, this method constructs a separate decoder for each variable. To form a decoder set , of which Each decoder is only responsible for recovering the first feature from the fused features. The prediction sequence of each variable achieves complete decoupling at the task level.

[0038] (a) Decoder input Due to the fusion feature sequence The OK Indicates the first Each variable at time step The fusion deep representation allows for the construction of a unique fusion feature subsequence for each variable. The sequence contains three aspects of information at the feature level: first, the cross-time dynamic change features extracted by the encoder from the original sequence; second, the influence pattern of other variables captured and fused by the cross-variable attention mechanism on the variable; and third, the unified statistical structure formed after the standardization of the innovative discriminator, which makes the potential features of different variables more fusionable.

[0039] Based on this, each decoder can learn its unique output behavior in a completely independent feature subspace specific to its own variable, thereby ensuring that the subsequent prediction process utilizes global fusion information while maintaining the functional independence between variables.

[0040] (b) Decoder mapping

[0041] For the 1 variable, its decoder Responsible for fusing feature subsequences Mapped to the corresponding predicted sequence Each of them This represents the predicted output value of the variable at time step t, with its dimension consistent with the original dimension of the variable. For ease of expression, this mapping can be uniformly written as...

[0042] decoder During training, parameters Backpropagation automatically updates the predictions, enabling them to best fit the true historical sequence.

[0043] Reconstructing the discriminator module: After multiple decoders generate predicted sequences for each variable, although the prediction results can numerically fit the main trend and short-term dynamics of the original sequence, the strong randomness, multimodality, and complex fluctuations across time scales of real data mean that relying solely on reconstruction errors (such as MSE or MAE) cannot guarantee that the predicted sequence will maintain statistical consistency with the true sequence. Therefore, it is necessary to introduce a reconstruction discriminator during training. By applying adversarial constraints at the distribution level, the predicted sequence can be... The distribution gradually approximates the true sequence. The empirical distribution is used to obtain a more statistically consistent decoder output.

[0044] To measure the difference in probability distribution between the predicted and true sequences, the innovation constraint also uses the Wasserstein distance as a measure of distributional similarity. Based on the Kantorovich–Rubinstein dual form of the Wasserstein distance mentioned above, for the ... The reconstructed discriminant loss for each variable can be constructed as follows:

[0045] Gradient penalty term

[0046] This is used to ensure that the discriminator satisfies the 1-Lipschitz condition.

[0047] See the adversarial training module. Figure 2 : (a) Adversarial training network structure During the training phase, this model treats the multi-channel encoder, the transvariable Transformer, and the multi-decoder as a single generator network, using a set of parameters. Indication; Innovation Discriminator and reconstruction discriminator These together constitute the discriminator network, using a parameter set. The discriminator network's task is to maximize the Wasserstein distance difference between the real and generated distributions, enabling it to distinguish the statistical differences between real innovative sequences and latent innovative sequences generated by the encoder, as well as the distributional differences between real observed sequences and reconstructed sequences output by the decoder. The generator network's task is to minimize this Wasserstein distance, ensuring that the sequences generated by the encoder-transformer-decoder system statistically approximate the real distribution, thus making them indistinguishable by the discriminator. The adversarial training network framework is as follows: Figure 2 As shown.

[0048] In the specific adversarial training process, the parameters of the generator network are first fixed, and only the discriminator parameters are updated. By maximizing the discriminator loss, the innovative discriminator is made more efficient. To more accurately distinguish between weak innovation sequences and ideal innovation sequences, enabling the reconstruction discriminant. This process more accurately distinguishes between real and reconstructed samples. Then, with the discriminator network parameters fixed, only the generator parameters are updated. By minimizing the generator loss, potential weak innovation sequences gradually approach the ideal, independent, and identically distributed innovation sequences, and the decoded multivariate reconstructed sequences gradually approximate the real data distribution. The generator and discriminator continuously engage in a game of strategy during this alternating optimization process. The innovation discriminator loss and the reconstruction discriminator loss provide gradient information to the discriminator, while the generator continuously optimizes the encoder, Transformer, and multi-decoder parameters by receiving gradients from the discriminator's backpropagation.

[0049] (b) Adversarial training loss function In terms of loss design, for the first The losses of the innovative discriminator and the reconstruction discriminator are denoted as follows: (1 channel, denoted by...) and Its form has been given in the preceding two subsections. Based on this, the total loss on the discriminator side is defined as:

[0050] in These are learnable weights. By maximizing... To update the discriminator parameters This enables the innovation discriminator to more accurately estimate the Wasserstein distance between the latent representation and the ideal innovation sequence, while also enabling the reconstruction discriminator to more accurately characterize the distribution difference between the true output and the predicted output, providing a reliable adversarial signal for subsequent generator optimization.

[0051] Correspondingly, multiple encoders, Transformers, and decoders are treated as a single generator, with the goal of "deceiving" the two discriminators so that they cannot distinguish between real and generated samples. The total loss on the generator side is the same as that on the discriminator side, and is still defined as:

[0052] in These are learnable weights. The optimization objective of the generator network is to minimize this loss to update the generator parameters. That is, to shrink in the potential space and The distribution differences reduce the size of the reconstructed space. and The distribution differences drive the encoder output to gradually approach the IID innovation distribution, and make the decoder output statistically approach the real data distribution.

[0053] Test prediction module: After the model training is complete and reaches stable convergence, all discriminators will be completely removed during the testing phase. The entire system will consist only of the trained multi-channel encoder, transvariable Transformer, and multi-decoder. The specific testing framework is as follows: Figure 3 As shown, the multi-source time series inputs are first fed into their respective encoders, forming structured and trained-normalized latent representations in the weak innovation space. Subsequently, these weak innovation representations are fused within the Transformer according to the cross-variable attention weights learned during training, thereby extracting the deep coupling relationships and collaborative change structures between variables. Based on this, to construct a realistic probability prediction distribution, this model injects Monte Carlo-sampled IID random noise into the feature matrix after the Transformer's fused output and before it enters the decoder. Since the weak innovation space has been calibrated to match the statistical structure of real data during training, these noise perturbations can provide prediction diversity while maintaining interpretability, making the multiple sampling results statistically approximate the possible distribution of the real future, achieving probabilistic predictions of renewable energy output, load, and green electricity demand. Finally, each decoder generates its point prediction and multiple sampling probability sequences based on the task-specific mapping of the corresponding variable, completing the entire inference process from multi-source input to multivariate prediction distribution.

[0054] Because strict Wasserstein distribution consistency constraints are imposed on the weak innovation space and the output reconstruction space through the innovation discriminator and reconstruction discriminator, respectively, during the training phase, the weak innovation representation output by the encoder is normalized to approximately independent and identically distributed latent variables. The predicted sequence output by the decoder also approximates the true sequence in terms of overall distribution, local fluctuations, and long-term trends. Therefore, even if the discriminator is removed during the testing phase, the model can still maintain stable and consistent predictive behavior. Simultaneously, since random noise is injected into the distribution-calibrated weak innovation space, its perturbation does not disrupt the physical structure of the sequence or the intervariate cooperative relationships. This ensures that the sequences obtained from multiple samplings reflect true randomness without structural distortion or prediction divergence. This combined mechanism of "normalized innovation space + noise perturbation + multiple decoding" allows the model to naturally generate a probabilistic set of future scenarios during the testing phase, providing rich information such as mean prediction, distribution range, and fluctuation risk.

[0055] The above embodiments are merely illustrative of the technical concept of the present invention and should not be construed as limiting the scope of protection of the present invention. Any modifications made to the technical solution based on the technical concept proposed in this invention shall fall within the scope of protection of this invention.

Claims

1. A Transformer-based method for predicting the supply and demand of green electricity, characterized in that, The method includes the following steps: S1, Multi-channel Weak Innovation Coding: For multiple time-series variables in the green electricity supply and demand scenario, independent encoders are constructed for each variable. Through independent coding, redundancy and noise components in the original sequence are reduced, resulting in the potential sequence of weak innovation representations for each variable. ; S2, Innovation Discriminant Constraints; Constructing the Innovation Discriminant The weak innovation representation latent sequence is constrained by the Wasserstein distance as a metric. The distribution of this sequence guides it toward a pre-defined ideal innovation sequence. Approach; S3, Transformer cross-channel feature fusion; employing a Transformer module with a cross-variable multi-head attention mechanism, feature fusion is performed on the constrained latent representations of each channel to obtain a fused feature sequence containing a multivariable coupling structure; specifically including: For any time step, the innovative encoding vectors from each channel are treated as a set of variable nodes, forming the variable feature matrix at the current time step; multi-head attention is computed on the variable dimension, and each attention head learns the coupling relationship between variables in a different feature subspace; the outputs of multiple attention heads are concatenated and mapped on the feature dimension to obtain the fusion feature matrix at the current time step; the above process is repeated for all time steps to obtain the complete fusion feature sequence. S4, Multi-channel decoding prediction; A separate decoder is constructed for each type of time-series variable to extract the specific features of the corresponding variable in the fused feature sequence and map them into a prediction sequence; S5, Reconstructing the Discriminator Constraints, Constructing the Reconstructed Discriminator The predicted sequence is constrained by the Wasserstein distance as a metric. The distribution of the time series variable approximates the true sequence of the time series variable. The empirical distribution; S6, adversarial training: The multi-channel weak innovation coding module, the Transformer cross-channel fusion module, and the multi-channel decoding prediction module are integrated into a generator, and the innovation discriminator module and the reconstruction discriminator module are integrated into a discriminator. By alternately optimizing the parameters of the generator and the discriminator, the training convergence of the network parameters is achieved. S7, Test Prediction; Remove all discriminators, input multi-source time series data into the trained generator, encode and fuse features, inject random noise to generate a prediction sequence of green electricity supply and demand related variables, and realize green electricity supply and demand matching prediction.

2. The Transformer-based green electricity supply and demand matching prediction method according to claim 1, characterized in that, The time-series variables in step S1 include at least one of new energy output, industrial load, commercial load, residential load, and green electricity demand. The redundancy and noise components include low-frequency drift components, cross-channel collinear noise, and random measurement noise. Before independent encoding, the components undergo sliding window smoothing and feature normalization preprocessing.

3. The green electricity supply and demand matching prediction method based on Transformer according to claim 1, characterized in that, The ideal innovation sequence of step S2 Let be an independent and identically distributed uniform random variable on the interval [0, 1]. Based on the Kantorovich–Rubinstein dual form of the Wasserstein distance, its distribution is... and distribution The 1-Wasserstein distance between them can be written as: ; in Require A novel discriminator based on the 1-Lipschitz function. That is, it is used to approximate the 1-Lipschitz function in the dual space; the loss function of the innovative discriminator also includes a gradient penalty term to ensure that the discriminator satisfies the 1-Lipschitz condition, for the th The innovation discriminant loss for each channel is constructed using the relevant formula: ; The formula related to the gradient penalty term is: 。 4. The green electricity supply and demand matching prediction method based on Transformer according to claim 1, characterized in that, In step S5, a gradient penalty term is also set in the discriminator loss function to ensure that the discriminator satisfies the 1-Lipschitz condition, based on the Kantorovich–Rubinstein dual form of Wasserstein distance. The reconstructed discriminant loss for each variable can be constructed as follows: , The relevant formula for the gradient penalty term is: 。 5. The green electricity supply and demand matching prediction method based on Transformer according to claim 1, characterized in that, In step S4, the b-th row of the fused feature sequence represents the deep fused representation of the b-th variable at time step t; a unique fused feature sub-sequence is constructed for each variable, which includes the variable's cross-time dynamic change characteristics, the influence pattern of other variables on the variable, and the unified statistical structure after being normalized by the innovation discriminator; each decoder learns its unique output behavior on its corresponding fused feature sub-sequence, achieving complete decoupling at the task level.

6. The green electricity supply and demand matching prediction method based on Transformer according to claim 1, characterized in that, The alternating optimization of generator and discriminator parameters in step S6 includes: S61, with fixed generator parameters, only the discriminator parameters are updated. By maximizing the discriminator loss, the innovation discriminator can more accurately distinguish between weak innovation sequences and ideal innovation sequences, and the reconstruction discriminator can more accurately distinguish between real sequences and predicted sequences. S62: Fix the discriminator parameters and only update the generator parameters. By minimizing the generator loss, the distribution of weak innovation sequences is made closer to the distribution of ideal innovation sequences, and the distribution of predicted sequences is made closer to the distribution of true sequences. S63 innovates the discriminator loss and reconstructed discriminator loss to provide gradient information for the discriminator, while the generator continuously optimizes the parameters of the encoder, Transformer and multiple decoders by receiving the gradients backpropagated from the discriminator.

7. The green electricity supply and demand matching prediction method based on Transformer according to claim 1, characterized in that, In step S7, the random noise is independent and identically distributed random noise sampled multiple times in Monte Carlo, which is injected into the weak innovation space after distribution calibration. The prediction sequence includes a point prediction sequence and a probability prediction sequence.

8. A Transformer-based green electricity supply and demand matching prediction model, characterized in that: A multi-channel weak innovation coding module is used to perform step S1 as described in claim 1; An innovative discriminator module is used to perform step S2 as described in claim 1; The Transformer cross-channel feature fusion module is used to perform step S3 as described in claim 1; A multi-channel decoding prediction module is used to perform step S4 as described in claim 1; A reconstruction discriminator module is used to perform step S5 as described in claim 1; An adversarial training module is used to perform step S6 as described in claim 1; A test prediction module is used to perform step S7 as described in claim 1.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the Transformer-based green electricity supply and demand matching prediction method as described in any one of claims 1-7.

10. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the Transformer-based green electricity supply and demand matching prediction method as described in any one of claims 1-7.