Electric power time sequence robustness enhancement and evaluation method based on GAN and multi-scale adversarial training
By using a GAN-based, multi-scale adversarial training method, adversarial examples are generated and combined with physical constraints, which improves the robustness of the power time series prediction model, solves the problems of disturbances and adversarial attacks in the power system, and ensures the safe and stable operation of the power grid.
Patent Information
- Application Number
- CN202511812146.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-04
- Publication Date
- 2026-03-06
AI Technical Summary
Existing power time series forecasting models are not robust enough in the face of abnormal disturbances and attacks, leading to biased prediction results or even failure in critical scenarios, which affects the safe and stable operation of the power grid.
We adopt a GAN-based, multi-scale adversarial training approach. By generating samples through a generative adversarial network and combining a stable adversarial training framework with multiple time scales and physical constraints, we improve the robustness and anti-interference ability of the model and design a multi-index evaluation system.
It significantly improves the prediction accuracy and anti-interference ability of the model in complex scenarios, ensures the safe and stable operation of the power system, and provides a robust learning framework that is interpretable and engineering-reliable.
Smart Images

Figure CN121614869A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of power time series prediction and robustness improvement of power artificial intelligence models, and particularly to a method for enhancing and evaluating the robustness of power time series based on GAN and multi-scale adversarial training. Background Technology
[0002] With the development of new power systems and the continuous expansion of power grid operation, monitoring data from power equipment exhibits characteristics of high dimensionality, multiple time series, and strong coupling. Deep learning-based power time series forecasting models are gradually becoming important tools for load forecasting, state estimation, and safety risk early warning. However, in real power system operation, various disturbances constantly arise, such as load fluctuations, measurement noise, equipment aging, abnormal operation, or sudden failures. These can all cause shifts or even abrupt changes in time series data, making deep forecasting models face more complex input distributions than conventional training scenarios.
[0003] Traditional power time series forecasting models are typically trained on clean historical data, focusing primarily on internal time-series correlations and equipment operating mechanisms, but lacking the ability to model external and malicious disturbances. When faced with input distribution shifts or adversarial disturbances, the prediction results exhibit significant biases, even being misled by minute disturbances, leading to failure in critical scenarios. Recent adversarial attack methods have demonstrated that even extremely small disturbances can cause severe model biases, and since power systems are safety-critical infrastructure, any erroneous predictions pose significant risks. Therefore, improving the robustness and stability of power time series forecasting models under abnormal inputs or malicious disturbances is a key technical issue for ensuring the safe and stable operation of the power grid. Summary of the Invention
[0004] This invention addresses the insufficient robustness of existing power time series prediction models under anomalous perturbations and adversarial examples by proposing a robust enhancement and evaluation method for power time series based on GAN and multi-scale adversarial training. This invention significantly improves the prediction accuracy and anti-interference capability of the model in complex real-world scenarios by establishing a structured perturbation generation model, constructing an adversarial attack mechanism that conforms to power physics constraints, and designing a stable adversarial training framework across multiple time scales.
[0005] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows:
[0006] A robust power temporal enhancement and evaluation method based on GAN and multi-scale adversarial training includes the following steps:
[0007] Step 1: Collect and preprocess the original power time series samples; input the original power time series samples into a generative adversarial network to generate generated samples for model robustness training;
[0008] Step 2: Input the generated samples into a stable multi-scale adversarial training model for training to generate weights for the enhanced model;
[0009] Step 3: Load the enhanced model weights into the original sample Transformer model; generate adversarial examples by performing a physical constraint-based projection gradient descent algorithm on the original power time series samples; input the adversarial examples into the original sample Transformer model for prediction to generate adversarial example prediction results;
[0010] Step 4: Calculate the robustness index based on the adversarial example prediction results;
[0011] Step 5: Compare and analyze the robustness indicators of the model prediction results under different strategies.
[0012] Preferably, step 2 includes:
[0013] In the multi-scale adversarial training model, the training loss includes clean sample loss, adversarial sample loss, gradient regularization, attention sparsity constraint, feature consistency constraint, mixed sample loss, and core prediction loss.
[0014] During training, the parameters of the multi-scale adversarial training model are updated through backpropagation and gradient pruning, and the performance is evaluated on the validation set. At the same time, the learning rate is dynamically adjusted according to the validation loss.
[0015] After training, the model weights that perform best on the validation set are saved as the weights of the augmented model.
[0016] Preferably, in step 3, the physical constraints include: power flow conservation constraints, power balance constraints, and time series smoothing constraints.
[0017] Preferably, the power flow conservation constraints include:
[0018] Let the input adversarial sample be X∈R B×T×F Where B is the batch size, T is the time step, and F is the feature dimension; the minimum value for each feature is min. f The maximum value is max. f .
[0019] The power flow conservation constraint loss is expressed as:
[0020]
[0021] Where, x i,t,f This represents the value of the f-th feature at the t-th time step for the i-th sample; max(0, x i,t,f -max f ) 2This represents the penalty for exceeding the upper bound; max(0,min) f -x i,t,f ) 2 This represents the penalty for samples falling below the lower bound; range_penalty is the mean of all samples, time steps, and features.
[0022] Preferably, the power balance constraint includes:
[0023] Suppose that the adversarial sample contains active power components and reactive power components, and the power balance constraint is expressed as:
[0024]
[0025] Among them, i p ( i,t) Let j represent the active power component of the i-th sample at time t; where j p ( i,t) Represents the active power component of the j-th sample at time step t; i q ( i,t) Represents the reactive power component of the i-th sample at time step t; j q ( i,t) This represents the reactive power component of the j-th sample at the t-th time step; this loss penalizes the deviation of active or reactive power to ensure power balance.
[0026] Preferably, the time series smoothing constraint includes:
[0027] Let the adversarial sample be X∈R B×T×F Where B is the batch size, T is the number of time steps, and F is the feature dimension; the smoothness constraint loss is expressed as:
[0028]
[0029] Where, x i,t,f x represents the value of the i-th sample, the t-th time step, and the f-th feature; t,t+1,f -x i,t,f The first-order difference between adjacent time steps is used; the square operation penalizes the part of the sequence with large abrupt changes, making the adversarial sample smoother in the time dimension.
[0030] Preferably, the power flow conservation constraint, the power balance constraint, and the time series smoothing constraint are combined to generate the total physical constraint loss:
[0031]
[0032] Where, λ flow ,λ power ,λ smooothThese are the weights of the power flow conservation constraint, the power balance constraint, and the time series smoothing constraint, respectively; the total loss. Used to constrain the generation of adversarial examples or to correct the physical plausibility of model inputs.
[0033] Preferably, the robustness metrics include the mean variance change against the perturbation, the mean time series change against the perturbation, the mean loss bias, and the adversarial sample recognition rate.
[0034] Preferably, the different strategy models include: the original model, the unimproved adversarial training model trained with original power time series samples, and the improved adversarial training model combining samples generated by generative adversarial networks.
[0035] Compared with the prior art, the beneficial effects of the present invention are reflected in:
[0036] Using the above technical solutions, this invention proposes a robust enhancement and evaluation method for power time series based on GAN and multi-scale adversarial training. A complete robust learning system is constructed, encompassing perturbation modeling, adversarial training, physical constraint attacks, and multi-index evaluation. By introducing generative adversarial networks to characterize multi-morphological perturbations in power time series, it breaks through the traditional gradient-based single perturbation approach, improving the diversity and cross-scale structured features of accessible samples during the training phase. Furthermore, a stable multi-scale adversarial training framework is designed, integrating multi-epsilon PGD, gradient regularization, feature consistency constraints, and sparse attention mechanisms, enabling the model to achieve balanced and robust robustness improvements across both short-term fluctuations and long-term trends.
[0037] To address the issue of physically unreasonable adversarial examples, this invention constructs a physically constrained PGD mechanism, incorporating power flow conservation, power boundaries, and time series smoothness into the optimization process. This ensures that attack examples are both adversarial and conform to the operating laws of power systems, thereby improving the engineering credibility of the assessment. Simultaneously, a multi-dimensional robustness evaluation index system, including ACAC, ACTC, ALDP, and ASR, is constructed to comprehensively quantify model performance from the perspectives of error variation, trend shift, disturbance amplitude, and attack success rate, overcoming the shortcomings of traditional single-index and weak representation capabilities. Overall, this invention forms a systematic method that significantly enhances the predictive stability and anti-attack capability of the model under complex disturbance environments, providing a robust learning framework with interpretability, engineering applicability, and universality for the safe operation of power systems. Attached Figure Description
[0038] Figure 1 This is a flowchart of the method in Embodiment 1 of the present invention;
[0039] Figure 2 The curve showing the change of loss with training rounds during the stable multi-scale adversarial training process of samples generated by the addition of a generative adversarial network in Embodiment 1 of the present invention.
[0040] Figure 3 The curves showing the changes of various indicators with perturbation intensity after stable multi-scale adversarial training of samples generated by the addition of a generative adversarial network in Embodiment 1 of the present invention.
[0041] Figure 4 The curves showing the attack success rate (ASR) as a function of perturbation intensity and the results of its robust / vulnerable interval variation are presented in the comparative experiment of three strategies in Embodiment 1 of the present invention. Detailed Implementation
[0042] To make the technical means, inventive features, objectives, and effects of the invention readily understandable, the invention is further described below with reference to specific illustrations. However, the invention is not limited to the embodiments described below.
[0043] It should be noted that the structures, proportions, sizes, etc., illustrated in the accompanying drawings of this specification are only used to complement the content disclosed in the specification for those skilled in the art to understand and read, and are not intended to limit the conditions under which the present invention can be implemented. Therefore, they have no substantial technical significance. Any modifications to the structure, changes in the proportions, or adjustments to the size, without affecting the effects and objectives that the present invention can produce, should still fall within the scope of the technical content disclosed in the present invention.
[0044] Example 1:
[0045] like Figure 1 The power temporal robustness enhancement and evaluation method based on GAN and multi-scale adversarial training, as shown, includes the following steps:
[0046] Step 1: Collect and preprocess the original power time series samples; input the original power time series samples into the generative adversarial network to generate generated samples for model robustness training;
[0047] Specifically, in this embodiment, the original power time series samples are first preprocessed, including standardization, normalization, and time encoding, and the processed data is saved in NumPy format for subsequent batch reading. Then, the processed samples are input into a generative adversarial network (GAN), where the generator G receives random noise z ~ N(0,1) and generates pseudo-samples, and the discriminator D distinguishes between real and generated samples. The generator is trained using an adversarial loss function and a reconstruction loss, ensuring that the generated samples retain both the original power time series characteristics and perturbation diversity. Multiple iterations are used during training, with each iteration traversing the entire dataset, updating the discriminator multiple times, and then updating the generator, ensuring that the generated samples can cover multiple forms of time series perturbation patterns. After training, the generated samples are batch-saved as .npy files, denormalized, and then converted to .csv files for subsequent stable multi-scale adversarial training, serving as training input to enhance the model's robustness.
[0048] The original power time series samples include line voltage, resistance, reactance, input active power, input reactive power, output active power, output reactive power, input and output nodes, and timestamp information; preprocessing includes standardization, time encoding, dataset partitioning, feature extraction, and parameter extraction.
[0049] Step 2: Input the generated samples into the stable multi-scale adversarial training model for training, and generate weights for the enhanced model;
[0050] Samples are generated and input into the model. The training loss consists of clean sample loss, adversarial sample loss, gradient regularization, attention sparsity constraints, feature consistency constraints, and mixed sample loss. The core prediction loss dominates the total loss, ensuring the model learns the main objective. During training, model parameters are updated through backpropagation and gradient pruning, and performance is evaluated on the validation set. The learning rate is dynamically adjusted based on the validation loss. After training, the weights of the best-performing model on the validation set are saved, resulting in the weight parameters of the time series prediction model enhanced through stable multi-scale adversarial training.
[0051] The enhanced model weights include all parameters of the backbone and decoder, specifically including patch bedding weights, projection weights and biases of each attention layer, convolutional layer weights and biases, normalization layer weights and biases, and final projection layer weights and biases.
[0052] Figure 2The curves show the variation of loss over training epochs during stable multi-scale adversarial training with samples generated by a generative adversarial network (GAN). These curves reveal that the clean sample loss is high in the initial training phase, then decreases rapidly, stabilizing within the range of 0.04–0.045 after 10 epochs. This trend demonstrates the model's continuously improving ability to fit unperturbed normal power samples during training, exhibiting rapid convergence in the early stages and stabilization in the later stages, reflecting the model's solid performance in learning from conventional samples. The adversarial sample loss is approximately 0.037 initially, then fluctuates. The fluctuations around 5–10 epochs in the early training phase indicate that the model's defense against adversarial perturbations is not yet fully established. However, as the number of training epochs increases, the adversarial sample loss gradually stabilizes within the 0.035–0.04 range. This reflects the gradual establishment and stabilization of the model's robustness against adversarial perturbations as it learns adversarial sample features, proving that the improved PAT adversarial training plays a crucial role in enhancing the model's adversarial defense capabilities. The total loss, which reflects both the clean sample loss and the adversarial sample loss, was approximately 0.053 in the initial stage. It then decreased rapidly and stabilized, eventually remaining within the range of 0.04 to 0.045. This overall decreasing and stabilizing trend indicates that the model's training performance continuously improved under the dual objectives of simultaneously fitting "clean samples" and "adversarial samples," ultimately reaching a good balance.
[0053] Based on the experimental process, this change in loss further validates the effectiveness of GAN samples for robust training. By generating adversarial examples that simulate abnormal power system patterns, the model is exposed to "perturbation scenarios" in the early stages of training, thereby accelerating the convergence of adversarial example loss. At the same time, stable multi-scale adversarial training also plays a role in the steady decrease of total loss. Together, they help the model find an efficient training path between conventional fitting and adversarial defense.
[0054] Step 3: Load the weights of the enhanced model into the original sample Transformer model; generate adversarial examples by performing a projection gradient descent algorithm with physical constraints on the original power time series samples; input the adversarial examples into the original sample Transformer model for prediction, and generate the adversarial example prediction results;
[0055] Specifically, in this embodiment, the time series prediction model is initialized, and the optimizer and learning rate scheduler are configured. During adversarial training, for each batch of samples, multi-ε projective gradient descent (PGD) adversarial examples are first generated based on the set multi-scale ε values to enhance sample diversity. To ensure the physical rationality of the generated adversarial examples or model input, three types of physical constraints are introduced: power flow conservation constraints, power balance constraints, and time series smoothing constraints. The specific steps are as follows:
[0056] Let the input adversarial sample be X∈R B×T×F Where B is the batch size, T is the time step, and F is the feature dimension; the minimum value for each feature is min. f The maximum value is max. f .
[0057] The power flow conservation constraint can then be expressed as:
[0058]
[0059] Where x i,t,f This represents the value of the f-th feature at the t-th time step for the i-th sample; max(0, x i,t,f -max f ) 2 This represents the penalty for exceeding the upper bound; max(0,min) f -x i,t,f ) 2 This represents the penalty for samples falling below the lower bound; range_penalty is the mean of all samples, time steps, and features.
[0060] If the adversarial sample contains active and reactive power components, then the power balance constraint can be expressed as:
[0061]
[0062] Where i p ( i,t) Let j represent the active power component of the i-th sample at time t; where j p ( i,t) Represents the active power component of the j-th sample at time step t; i q ( i,t) Represents the reactive power component of the i-th sample at time step t; j q ( i,t) This represents the reactive power component of the j-th sample at the t-th time step; this loss penalizes the deviation of active or reactive power to ensure power balance.
[0063] Let the adversarial sample be X∈R B×T×F Where B is the batch size, T is the number of time steps, and F is the feature dimension; to ensure the continuity of the sequence, a smoothness constraint loss is introduced:
[0064]
[0065] Where x i,t,f x represents the value of the i-th sample, the t-th time step, and the f-th feature; t,t+1,f -x i,t,fThe first-order difference between adjacent time steps is used; the square operation penalizes the parts of the sequence with large abrupt changes, making the adversarial examples smoother in the time dimension.
[0066] Finally, the three types of constraints are merged to form the total physical constraint loss:
[0067]
[0068] Where λ flow ,λ power ,λ smoooth These are the weights for power flow conservation, power balance, and smoothing constraints, respectively; total loss. It can be used to generate constrained adversarial examples or to correct the physical plausibility of model inputs.
[0069] Step 4: Calculate the robustness index based on the adversarial example prediction results;
[0070] Robustness metrics include ACAC (mean prediction error increment), ACTC (mean prediction offset magnitude), ALDP (mean perturbation strength measure), and ASR (adversarial example success rate).
[0071] Specifically, in this embodiment, the robustness index analysis based on the above calculations reveals the sensitivity and stability of the original sample Transformer model when facing adversarial examples, and the analysis shows the specific performance of different indices:
[0072] ACAC reveals the overall impact of adversarial disturbances on prediction error. ACAC includes:
[0073]
[0074] ACAC = MSE adv -MSE clean
[0075] Where `outputs_origin` represents the clean sample prediction output (i.e., the prediction result generated by the Transformer model from the original power time series samples), `outputs_adv` represents the adversarial sample prediction result, `cln_ys` represents the true label, N represents the total number of samples, and MSE... clean Mean squared error of clean samples, MSE adv This represents the adversarial sample mean squared error. ACTC reveals the degree to which time series predictions deviate from the expected value with disturbances. ACTC includes:
[0076]
[0077] Where adv_ys represents the adversarial sample prediction output, outputs_origin represents the clean sample prediction output, and N represents the total number of samples.
[0078] ALDP reveals the magnitude and intensity of perturbations in the feature space of constrained adversarial examples. ALDP includes:
[0079] pert = adv_xs - cln_xs
[0080]
[0081] L∞ I =max|pert i |
[0082] Where adv_xs represents adversarial examples, cln_xs represents the original power time series samples, pert represents adversarial perturbations, and L0 i Indicates perturbation sparsity, L2 i L∞ represents the perturbation-normalized Euclidean distance. I ε represents the maximum absolute value of the perturbation, preventing division by zero. The ASR reveals the attack success rate and the model's vulnerability; the ASR includes:
[0083] MSE cln =mean((outputs_origin-cln_ys) 2 )
[0084] MSE adv =mean((outputs_adv-cln_ys) 2 )
[0085]
[0086] Where `outputs_origin` represents the clean sample prediction output, `outputs_adv` represents the adversarial sample prediction output, `cln_ys` represents the ground truth label, `threshold` represents the proportional threshold, `abs_threshold` represents the absolute threshold, and `attack_success` represents the attack success rate. i This indicates whether the attack on the i-th sample was successful, and N represents the total number of samples.
[0087] Figure 3By selecting stable multi-scale adversarial training instances with samples generated by a generative adversarial network (GAN), and using four well-defined robustness metrics—ACAC, ACTC, ALDP, and ASR—and combining the core computational logic and physical meaning of each metric, the performance of the model in power system adversarial scenarios is comprehensively and accurately presented. From the trend of ACAC in the top chart, it gradually approaches 0 from an initial negative value and then turns positive, with the overall PGD attack intensity increasing. This clearly reflects that under low-intensity attacks, the adversarial samples have a weak interference with the prediction error, and even numerical fluctuations can lead to negative ACAC. However, as the attack intensity increases, the amplification effect of adversarial perturbations on the model's prediction error becomes increasingly prominent, and the difference between MSE_adv and MSE_clean continues to widen, indicating that the degree of damage to the model's prediction accuracy by the attack gradually intensifies. However, the overall value does not show a sharp increase, indicating that the model still has a certain effect in resisting error amplification. Correspondingly, ACTC steadily increases from pgd01 to pgd10 with the intensity of PGD attacks. This trend echoes ACAC: the lower the attack intensity, the smaller the deviation between adversarial prediction and original prediction, and the better the stability of the time series. As the attack intensity increases, the damage of the disturbance to the time series characteristics gradually accumulates, leading to a continuous expansion of the average absolute error between adversarial prediction and original prediction. The model's ability to capture the temporal correlation of power data is significantly interfered with. However, this deviation always shows a gradual increase without a sudden deterioration, reflecting the model's basic ability to maintain the stability of time series prediction. As can be seen from the charts, ALDP_ratio remained stable throughout, without fluctuating with the attack intensity. This indicates that under the constraints of the physical limitations of the power system, the overall relative magnitude of the adversarial disturbances remained within a controllable range and would not become unbalanced due to the increase in attack intensity. ALDP_mean remained near 0, indicating that the average disturbance magnitude of the adversarial samples was extremely small and would hardly have a disruptive impact on the overall prediction trend of the model. ALDP_max, on the other hand, continued to rise with the intensity of the PGD attack. This change clearly reveals the disturbance characteristics under extreme scenarios: even if the disturbances of most features are within a reasonable range, high-intensity attacks can still cause significant disturbances in some key features, thereby increasing the maximum deviation of load prediction. As can be seen from the figure, the ASR remains at 0% in PGD levels 1 to 3, indicating that within this attack intensity range, the strength of the adversarial perturbation has not reached the model's defense threshold, and all adversarial samples have failed to disrupt the model's prediction performance, demonstrating the model's complete defense capability. From level 4 onwards, the ASR gradually and slowly increases, reaching 3.6% in level 10. This indicates that when the attack intensity exceeds the critical threshold, some adversarial samples begin to meet the criteria for successful attack, but the overall success rate remains at a low level.This result fully verifies the model's core robustness: for the vast majority of low- and medium-intensity adversarial attacks, the model can effectively resist perturbations and ensure the accuracy of predictions; only under extremely high-intensity attacks will a small number of samples have their predictions disrupted, and the proportion of successful attacks is limited and will not have a serious impact on the overall usability of the model.
[0088] Based on the performance and underlying logic of the four indicators, it can be concluded that the model exhibits significant advantages in robustness under power system adversarial scenarios: the progressive growth of ACAC and ACTC demonstrates strong resistance to low- and medium-intensity attacks, with the increase in error and time series shift caused by adversarial disturbances remaining within a controllable range; the divergent performance of the ALDP indicator verifies the effective limitation of physical constraints on overall disturbances while also revealing the shortcomings in the anti-disturbance of key features under extreme scenarios; and the low-level growth of ASR directly proves the model's core defensive effect, with only a small number of successful attacks occurring under extremely high-intensity attacks, fully meeting the stringent requirements of power systems for prediction reliability. Further analysis of the indicator comparison logic reveals that the model fully demonstrates the effectiveness of the stable multi-scale adversarial training strategy, which incorporates generative adversarial networks to generate samples, in improving the robustness of large-scale power system models, providing reliable performance support for addressing potential adversarial disturbances in practical engineering deployments.
[0089] Step 5: Compare and analyze the robustness indicators of the model prediction results under different strategies.
[0090] Specifically, in this embodiment, the robustness of the prediction results of three strategies—"original model (no adversarial training)," "traditional PAT model trained with original power time series samples (original power time series samples trained with no improved adversarial training)," and "GAN+SM-EAT model (generative adversarial network generating samples combined with improved adversarial training model)"—is compared using the attack success rate metric.
[0091] Figure 4 The experiment comparing the attack success rate (ASR) of three strategies with the perturbation intensity shows the curves and results of its robust / vulnerable interval variation. Figure 4As shown, the ASR of the original model remains high as the PGD perturbation strength ε increases, reaching approximately 0.479 at ε = 0.10. This indicates that the original model has not undergone adversarial training, has extremely weak defense against adversarial perturbations, and its attack success rate remains high with increasing perturbation strength, making the model extremely vulnerable in adversarial scenarios. The ASR of the original PAT model shows a significant upward trend with increasing ε, reaching 0.307 at ε = 0.10. This indicates that while traditional PAT adversarial training can improve robustness to some extent, the attack success rate increases significantly as the perturbation strength exceeds a critical value (e.g., after ε > 0.05), limiting the improvement in robustness. The ASR of the GAN+SM-EAT model remains at an extremely low level throughout, even at ε = 0.10, it is only 0.036. This fully demonstrates the advantages of Generative Adversarial Networks (GANs) and stable multi-scale adversarial training strategies. By generating adversarial samples that simulate abnormal power system modes through GANs to expand the training set, and combined with the improved adversarial training mechanism, the model's ability to defend against adversarial disturbances is greatly enhanced. The attack success rate remains negligible, achieving strong robust coverage of disturbance intensity across the entire range. This fully meets the stringent requirements of power systems for adversarial attack defense and provides key technical support for the reliable operation of large power system models in adversarial scenarios.
[0092] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings, but the present invention is not limited to the described embodiments. For those skilled in the art, various changes, modifications, substitutions, and variations can be made to these embodiments, including components, without departing from the principles and spirit of the present invention, and these variations still fall within the protection scope of the present invention.
Claims
1. A power time series robust enhancement and evaluation method based on GAN and multi-scale adversarial training, characterized in that, The method comprises the following steps: Step 1, collecting and preprocessing original power time series samples; inputting the original power time series samples into a generative adversarial network to generate generated samples for model robustness training; Step 2, inputting the generated samples into a stable multi-scale adversarial training model for training to generate enhanced model weights; Step 3, loading the enhanced model weights into an original sample Transformer model; generating adversarial samples through a projection gradient descent algorithm with physical constraints on the original power time series samples; inputting the adversarial samples into the original sample Transformer model for prediction to generate adversarial sample prediction results; Step 4, calculating a robustness index according to the adversarial sample prediction results; Step 5, comparing and analyzing the robustness index of the model prediction results under different strategies.
2. The method of claim 1, wherein, Step 2 comprises: In the multi-scale adversarial training model, the training loss comprises a clean sample loss, an adversarial sample loss, gradient regularization, attention sparsification constraint, feature consistency constraint, mixed sample loss and core prediction loss; During the training process, the multi-scale adversarial training model parameters are updated through back propagation and gradient clipping, and the performance is evaluated on the validation set, and the learning rate is dynamically adjusted according to the validation loss; After the training is completed, the model weight with the best performance on the validation set is saved as the enhanced model weight.
3. The method of claim 1, wherein, In step 3, the physical constraints include power flow conservation constraints, power balance constraints and time series smoothing constraints.
4. The method of claim 3, wherein, The power flow conservation constraints comprise: Let the input of the adversarial sample be X ∈ R B×T×F , where B is the batch size, T is the time step, and F is the feature dimension; the minimum value of each feature is min f , and the maximum value is max f ; The power flow conservation constraint loss is represented as: where x i,t,f denotes the value of the i-th sample, t-th time step, f-th feature; max(0, x i,t,f - max f ) 2 denotes the penalty for exceeding the upper bound; max(0, min f - x i,t,f ) 2 denotes the penalty for falling below the lower bound; range_penalty is averaged over all samples, time steps, and features.
5. The method of claim 3, wherein, The power balance constraints comprise: Suppose the adversarial sample contains active power components and reactive power components, the power balance constraint is represented as: wherein i p ( i,t) represents the active power component of the i-th sample, t-th time step; wherein j p ( i,t) represents the active power component of the j-th sample, t-th time step; i q ( i,t) represents the reactive power component of the i-th sample, t-th time step; j q ( i,t) represents the reactive power component of the j-th sample, t-th time step.
6. The method of claim 3, wherein, The time series smoothing constraints comprise: Let the adversarial sample be X ∈ R B×T×F , where B is the batch size, T is the number of time steps, and F is the feature dimension; the smoothness constraint loss is represented as: where x i,t,f represents the value of the i-th sample, t-th time step, f-th feature; x t,t+1,f -x i,t,f is the first-order difference of adjacent time steps; the square operation punishes the large part of the mutation in the sequence, so that the adversarial sample is smoother in the time dimension.
7. The method of claim 3, wherein, Fusing the power flow conservation constraints, the power balance constraints and the time series smoothing constraints, a total physical constraint loss is generated: wherein λ flow , λ power , λ smoooth are weights of the power flow conservation constraint, the power balance constraint and the time series smoothing constraint, respectively; and total loss is used to constrain the generation of the adversarial sample or to correct the model input for physical reasonableness.
8. The method of claim 1, wherein, The robustness index comprises average variance change of adversarial disturbance, average time series change of adversarial disturbance, average loss deviation and adversarial sample recognition rate.
9. The method of claim 1, wherein, The different strategy models comprise an original model, an unimproved adversarial training model trained by original power time series samples and an improved adversarial training model combined with generated samples generated by a generative adversarial network.