Power system frequency security assessment method and system based on improved gan and transformer
By using improved GAN and Transformer models for data augmentation and feature analysis, the problems of scarce samples and weak interpretability in power system frequency security assessment are solved, achieving a frequency security assessment with high accuracy and robustness.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI UNIVERSITY OF ELECTRIC POWER
- Filing Date
- 2025-12-17
- Publication Date
- 2026-04-14
AI Technical Summary
Existing technologies face challenges in power system frequency security assessment, including scarce sample data, poor model generalization ability, and weak interpretability, making it difficult to achieve effective assessment, especially under small sample conditions.
An improved generative adversarial network (GAN) is used for data augmentation to generate synthetic samples, which are then trained using a Transformer model to construct a frequency security assessment model. The SHAP method is also used for feature contribution analysis.
It improves the evaluation accuracy and robustness of the model under small sample conditions, enhances the interpretability of the model, maintains good evaluation performance in noisy environments, and identifies key features that affect frequency security.
Smart Images

Figure CN121353019B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of power system security assessment technology, and in particular to a power system frequency security assessment method and system based on an improved Generative Adversarial Network (GAN) and Transformer. Background Technology
[0002] With the rapid development of renewable energy, the safety of power systems faces new challenges. The widespread use of power electronic equipment has significantly reduced system inertia, making it difficult for the power system to maintain frequency stability. When the system experiences a major disturbance, if timely assessment and emergency measures are not taken, frequency instability can easily occur, leading to widespread power outages, causing socio-economic losses, and even endangering personal safety. Therefore, for power systems with a high proportion of renewable energy, rapidly and effectively assessing the system's frequency security is of great practical significance for maintaining stable power system operation and ensuring socio-economic security.
[0003] Traditional frequency security assessment methods mainly include time-domain simulation, linearized modeling, direct methods, and single-machine equivalent modeling. However, the proportion of new energy sources in the power system will continue to rise, and renewable energy exhibits strong volatility and uncertainty, posing a significant challenge to system frequency stability. Traditional analytical methods are increasingly unable to meet the current needs of power system frequency security assessment. Deep learning methods, with their unique feature analysis paradigm, offer a completely new research path for power system security analysis.
[0004] In deep learning applications, a large amount of data samples is typically required to support the training of predictive models. However, in actual power system frequency security assessment research, the available real-world data is often very limited, especially fault data. When the amount of data is insufficient to meet the model's training needs, the training results are easily unsatisfactory. Therefore, how to train a frequency security assessment model using small sample data becomes a crucial issue.
[0005] Since the development of deep learning, numerous data augmentation methods have been proposed. Commonly used data augmentation methods include spatial geometric transformation, color transformation, and time-frequency transformation. These three types of methods are mostly used for learning image, signal, or speech data, and are not suitable for data samples from power systems.
[0006] In summary, there is currently a lack of a power system frequency security assessment method and system to solve or partially solve the aforementioned problems. Summary of the Invention
[0007] The purpose of this invention is to overcome the shortcomings of the existing technology by providing an improved GAN and Transformer-based power system frequency security assessment method and system, so as to solve or partially solve the problems of scarce sample data, poor model generalization ability, and weak interpretability of existing methods.
[0008] The objective of this invention can be achieved through the following technical solutions:
[0009] One aspect of the present invention provides a power system frequency security assessment method based on an improved GAN and Transformer, comprising the following steps:
[0010] Obtain the original frequency time-series training dataset of the power system;
[0011] An improved generative adversarial network is used to augment the time-series training dataset to generate synthetic samples, forming an augmented training dataset.
[0012] A Transformer model based on a convolutional neural network module is constructed and trained using the enhanced training dataset to obtain a trained frequency security assessment model.
[0013] The system acquires real-time or simulated time-series data of the power system to be evaluated, inputs it into the trained frequency security assessment model, and outputs the evaluation results of the frequency security level, thereby realizing the evaluation of the frequency security of the power system.
[0014] As a preferred technical solution, the following steps are also included:
[0015] The SHAP (SHapley Additive exPlanation) method is used to analyze the feature contribution of the evaluation results output by the frequency security assessment model, and to identify the key features affecting frequency security.
[0016] As a preferred technical solution, the process of obtaining the original frequency time series training dataset of the power system includes the following steps:
[0017] Establish a power system simulation model that includes wind turbine units;
[0018] In the power system simulation model, multiple types of operating conditions and active power disturbances are set to simulate the real operating scenarios of the power system and obtain the original frequency and time series training dataset of the power system. The active power disturbances include generator disconnection disturbances and active power disturbances of different load nodes and generators.
[0019] As a preferred technical solution, the process of using an improved generative adversarial network to augment the time-series training dataset and generate synthetic samples includes the following steps:
[0020] An improved generative adversarial network is obtained by constructing a generator based on a recurrent neural network and a discriminator based on a convolutional neural network.
[0021] The generator is used to obtain generated samples, which are then mixed with real samples in the original frequency time series training dataset. The discriminator is used to determine whether a sample is a real sample or a generated sample. The generator and discriminator are trained based on the Wasserstein distance between the generated sample and the real sample.
[0022] Synthetic samples are generated using a post-training generator.
[0023] As a preferred technical solution, the Transformer model includes three encoders, a linear layer and a classification layer. Each encoder includes a multi-head self-attention layer and a convolutional neural network.
[0024] As a preferred technical solution, the convolution calculation model in the Transformer model is as follows:
[0025]
[0026] in, and For the first Layer outputs and inputs; Indicates the activation function; Represents convolution calculation, for Layers and Layer feature mapping and The connection weights, Indicates the bias value; This indicates the number of feature maps in the previous layer.
[0027] As a preferred technical solution, the self-attention mechanism in the Transformer model is modeled as follows:
[0028]
[0029] in, This represents a self-attention operation; , , These are the query matrix, key matrix, and value matrix obtained by linear transformation of the input features, respectively. It is a scaling factor; For activation function, T This indicates transpose.
[0030] As a preferred technical solution, the multi-head attention mechanism in the Transformer model is modeled as follows:
[0031]
[0032] in, Indicates the first i The output of a self-attention head; , , Here is the weight matrix for each self-attention head; This represents the output of multi-head attention; The number of self-attention heads; This is the weight matrix for multi-head self-attention; This indicates matrix concatenation.
[0033] As a preferred technical solution, after obtaining the original frequency time series training dataset of the power system, the normalization process is also performed on each sample in the dataset.
[0034] Another aspect of the present invention provides a power system frequency security assessment system based on an improved GAN and Transformer, for implementing the aforementioned power system frequency security assessment method, the system comprising:
[0035] The data augmentation module is used to acquire the original frequency time-series training dataset of the power system, and to augment the time-series training dataset using an improved generative adversarial network to generate synthetic samples, thus forming an augmented training dataset.
[0036] The frequency security assessment model training module is used to construct a Transformer model based on a convolutional neural network module, and to train it using the enhanced training dataset to obtain a trained frequency security assessment model.
[0037] The frequency security assessment module is used to acquire real-time or simulated time-series data of the power system to be assessed, input the trained frequency security assessment model, and output the assessment results of the frequency security level, thereby realizing the assessment of the frequency security of the power system.
[0038] Compared with the prior art, the present invention has at least one of the following beneficial effects:
[0039] (1) Overcoming the scarcity of sample data and poor model generalization ability: This invention uses an improved generative adversarial network to augment the time-series training dataset, generate synthetic samples, and form an augmented training dataset. The improved generative adversarial network is trained based on the Wasserstein distance between the generated samples and the real samples, as well as the cross-entropy loss of the discrimination results. It can achieve frequency security assessment in small sample scenarios. In tests of different deep learning methods, the evaluation model after data augmentation has improved the performance in terms of accuracy, reliability and evaluation stability to varying degrees, indicating that data augmentation based on the improved GAN can effectively improve the performance of deep learning models.
[0040] (2) Improving the evaluation accuracy of the model: This invention constructs a Transformer model based on a convolutional neural network module, and trains it using the enhanced training dataset to obtain a well-trained frequency-safe evaluation model, thereby enhancing its feature extraction capability. Comparative tests with different deep learning methods demonstrate that this method can effectively improve the model evaluation accuracy. Furthermore, its performance in accuracy, reliability, and stability is superior to other conventional deep learning methods.
[0041] (3) Strong anti-interference ability: To verify the robustness of the evaluation method proposed in this invention, multiple sets of noise interference experiments were set up for testing. The results show that even when the noise interference accounts for 40%, the evaluation model based on the improved GAN and Transformer still has good accuracy and robustness.
[0042] (4) Strong interpretability: Based on the SHAP method, this invention performs feature contribution analysis on the evaluation results output by the frequency security assessment model, identifies key features affecting frequency security, and concludes that factors such as the total active power of the system, the active power difference, and the spinning reserve capacity have a significant impact on the prediction results. This is consistent with the physical characteristics related to frequency security, proving that this method has a certain degree of interpretability. Attached Figure Description
[0043] Figure 1 This is a flowchart illustrating the power system frequency security assessment method based on the improved GAN and Transformer in the embodiment.
[0044] Figure 2 This is a schematic diagram of the improved WGAN structure in the embodiment;
[0045] Figure 3 This is a schematic diagram of the improved Transformer model architecture in the embodiment;
[0046] Figure 4 This is a schematic diagram of the dataset sample distribution in the example;
[0047] Figure 5 A schematic diagram of the existing WGAN training loss function;
[0048] Figure 6 This is a schematic diagram illustrating the improved WGAN training loss function in the embodiment;
[0049] Figure 7 This is a schematic diagram of the SHAP contribution analysis results in the example;
[0050] Figure 8 This is a schematic diagram of a power system frequency security assessment system based on an improved GAN and Transformer, as shown in the embodiment. Detailed Implementation
[0051] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0052] Example 1
[0053] To address the aforementioned problems in existing technologies, this embodiment provides a power system frequency security assessment method based on an improved GAN and Transformer. This method solves or partially solves the problems of insufficient model training due to small sample data in power system frequency security assessment, poor robustness of the assessment model in noisy environments, weak model interpretability, and insufficient speed and accuracy of system frequency security early warning. Specifically, the improved GAN model is mainly used to address the problem of insufficient data in small sample scenarios, while the Transformer model is used to construct the frequency security assessment mechanism. Combining the two enables highly accurate frequency security assessments even in small sample scenarios.
[0054] For details, see Figure 1 The power system frequency security assessment framework proposed in this method consists of four main parts: dataset construction, data augmentation, model training, and evaluation testing. Each part will be explained in detail below.
[0055] Step S1, Dataset Construction: After constructing the power simulation model, an experimental dataset is constructed using time-domain simulation samples.
[0056] A power system simulation model was established using simulation software. Based on power system frequency security issues, experimental datasets were obtained by setting different disturbance or fault types. This dataset will be used for data augmentation and directly for deep learning training.
[0057] Specifically, this embodiment selects the IEEE 10-machine 39-bus system and the Illinois 200-bus system for case studies. To make the frequency security assessment model applicable to new power systems, wind turbines are added to the case study model, and the renewable energy penetration rate is set to 30%. Time-domain simulation is performed using simulation software to simulate the frequency response process of the system after disturbance.
[0058] By designing different operating conditions and active power disturbances, the actual operating scenarios of the power system are simulated. Regarding active power disturbances, generator disconnection disturbances and active power disturbances at different load nodes and generators are included. To simulate the evaluation effect under small sample conditions, time-domain simulation was used, obtaining 6578 samples in the IEEE 39-bus system and 6630 samples in the Illinois 200-bus system. According to the frequency security warning level classification standard, the data sample distribution is as follows: Figure 4 As shown.
[0059] Step S2, Data Augmentation: After normalizing the experimental dataset and establishing the original dataset, data augmentation is performed.
[0060] To improve the training performance of deep learning and data augmentation modules, the samples in the dataset undergo data preprocessing, including normalization.
[0061] An improved Wasserstein GAN (WGAN) is constructed as the primary model for sample generation. Building upon the traditional WGAN, a recurrent neural network (RNN) is used to construct the generator, and a convolutional neural network (CNN) is used to construct the discriminator, making the WGAN more suitable for feature recognition of time-series data. Once the adversarial training between the discriminator and generator stabilizes, the generator can be used to generate samples, providing more data for the training of the evaluation model. Data augmentation techniques are employed to increase the amount of data samples, stabilize the deep learning training effect, and ultimately improve the accuracy of the evaluation model.
[0062] Traditional GAN training often suffers from numerous problems, frequently resulting in model crashes during training. To address this, this step involves data augmentation of the simulation experimental data using an improved WGAN. For comparative testing, data augmentation experiments were conducted on both the pre- and post-improvement GAN models. The data augmented using the WGAN model is integrated into the WGAN dataset, and the data augmented using the improved WGAN is defined as the improved WGAN dataset.
[0063] For details, see Figure 1 This step may include the following sub-steps:
[0064] 1. Data augmentation based on improved GAN;
[0065] 2. The discriminator reads the original data and the fake data generated by the generator;
[0066] 3. Output the discrimination results and training data;
[0067] 4. Determine if the set conditions are met. If not, the generator produces false data and returns to step 2. If yes, proceed to step 5.
[0068] 5. Generate samples based on a generator;
[0069] 6. Save data to enhance the dataset.
[0070] This step uses an improved WGAN to augment the data. Based on the WGAN model, to make it suitable for data augmentation tasks involving sequence data, the original structure is modified. An RNN is used to build the generator, while a CNN architecture is adopted for the discriminator. Figure 2 As shown. The loss is calculated based on the Wasserstein distance, using the following formula:
[0071]
[0072] In the formula, Represents the Wasserstein distance; This represents the true sample distribution; This refers to the sample distribution generated by the generator; The joint distribution of real data and generated data; Indicates that all margins are and The joint distribution set; Indicates the infimum; Expressing expectations; Represents norm operations; x and y are Two samples in the sample.
[0073] The data augmentation training loss curve is as follows: Figures 5-6 As shown, (a) and (b) represent the loss curves of the discriminator and generator, respectively, for D_loss and G_loss. After multiple iterations of training, the loss values of the discriminator and generator in the GAN will tend to stabilize. This indicates that the adversarial relationship between the two is in a relatively balanced state. At this point, the generator can be used to produce samples to expand the dataset. By augmenting the original dataset with the generator, the new dataset becomes twice the size of the original dataset, and the number of samples in each class is basically the same. This makes the sample distribution more uniform, which is beneficial to improving the accuracy and generalization ability of the evaluation model.
[0074] This step improves the WGAN model structure to make it more suitable for processing sequence data features and trains stable features to generate high-quality samples, solving the problems of sample scarcity and imbalanced distribution, and providing sufficient and high-quality training data for subsequent deep learning models.
[0075] Step S3, Model Training: After preprocessing and constructing the experimental dataset, extract the training set and train the model.
[0076] To improve the training performance of deep learning and data augmentation modules, the training set samples also need to undergo data preprocessing such as normalization.
[0077] This embodiment constructs an improved Transformer as the primary evaluation model. Based on the Transformer, a CNN module is introduced to enhance the model's feature extraction capability for high-dimensional data. Iterative training is performed using the training set data to reduce the training loss and improve evaluation accuracy. Once the training conditions are met, the current network parameters are saved.
[0078] In this model, CNN is responsible for extracting local, short-term feature dependencies from the input time-series data, such as abrupt frequency changes, while the Transformer's multi-head self-attention mechanism is responsible for capturing global, long-term time-series dependencies. This combination significantly improves the model's feature parsing ability and evaluation accuracy for the frequency dynamics of power systems.
[0079] For details, see Figure 1 This step includes the following sub-steps:
[0080] 1. Based on the data augmentation dataset after expanding the training samples in step S2 and the extracted training set, construct a training evaluation model based on deep learning;
[0081] 2. Construct an improved Transformer evaluation model;
[0082] 3. Determine the category of frequency security warning;
[0083] 4. Calculate training accuracy, loss value, and other data;
[0084] 5. Determine if the set conditions are met. If not, return to 1 and proceed with iterative training.
[0085] 6. Save the model parameters;
[0086] 7. Obtain the trained frequency security assessment model.
[0087] This step introduces a convolutional module to improve the Transformer architecture, replacing the traditional feedforward neural network with a convolutional module. The key to this combination is that convolution matches the input and output parameters of the convolutional neural network with the Transformer architecture. This is primarily based on the input feature dimensions of the original data and relevant data such as the kernel size of the convolutional neural network, calculating the output dimension of each network layer to adjust the model parameters and improve the model's adaptability. It is also necessary to select the appropriate number of convolutional layers and Transformer encoders for frequency security warning classification and evaluation. This step uses a combination of 5 convolutional layers and three encoders, enhancing the feature recognition capability of the traditional model and improving the classification accuracy of frequency warnings. The main structure is as follows: Figure 3 As shown. In addition, in the evaluation model construction, the convolution kernel size was set to 5, the number of attention heads to 4, the regularization probability to 0.1, the learning rate to 0.001, the batch training size to 64, and the number of iterations to 100.
[0088] This improved Transformer architecture mainly consists of multiple Transformer decoders with embedded convolutional modules to enhance the model's feature extraction capabilities. The convolutional computation is represented as:
[0089]
[0090] in, and For the first Layer outputs and inputs; Indicates the activation function; Represents convolution calculation, for Layers and Layer feature mapping and The connection weights, Indicates the bias value; This indicates the number of feature maps in the previous layer.
[0091] Furthermore, to incorporate the temporal relationships between data into model training, positional encodings are overlaid on the input data for attention mechanism computation. The self-attention mechanism is a core component of the Transformer model, better addressing long-range dependencies, and can be represented as:
[0092]
[0093] in, This represents a self-attention operation; , , These are the query matrix, key matrix, and value matrix obtained by linear transformation of the input features, respectively. It is a scaling factor; For activation function, T This indicates transpose.
[0094] Multi-head self-attention mechanisms are based on attention and improve model performance by increasing the number of attention heads. This can be represented as:
[0095]
[0096] in, Indicates the output of the self-attention head; , , Here is the weight matrix for each self-attention head; This represents the output of multi-head attention; The number of self-attention heads; This is the weight matrix for multi-head self-attention; This indicates matrix concatenation.
[0097] In summary, the GAN data augmentation module in step S2 and the improved Transformer evaluation module in step S3 are systematically integrated to form a complete and automated evaluation process, creating a dedicated solution for small sample scenarios.
[0098] Step S4, Evaluation and Testing: After preprocessing the experimental dataset and constructing the dataset, extract the test set and test the model.
[0099] To improve the training performance of deep learning and data augmentation modules, the samples in the test set also need to undergo data preprocessing such as normalization.
[0100] The model is converted into an evaluation mode, and frequency security classification tests are conducted using test set data. Based on the evaluation indicators of the evaluation model, test results such as evaluation accuracy are obtained to verify the merits of the evaluation model.
[0101] This step connects the results of the deep learning black-box model with the physical principles of the power system, which not only verifies the rationality of the model's decision-making, but also provides operators with the theoretical basis for issuing warnings, greatly enhancing the engineering practical value and credibility of the method.
[0102] For details, see Figure 1 This step includes the following sub-steps:
[0103] 1. Transform the trained frequency security assessment model obtained in step S3 into an assessment model, and conduct frequency security early warning classification tests based on the extracted test set.
[0104] 2. Evaluate the frequency security assessment model.
[0105] 3. Calculate and evaluate the performance indicators of the model.
[0106] 4. Obtain the frequency security assessment model and test data after testing.
[0107] This step divides the frequency fluctuation range after the system is disturbed into three warning levels. The evaluation model predicts the warning level of frequency security based on the input characteristics, as shown in Table 1.
[0108] Table 1 Power System Frequency Security Early Warning Standards
[0109]
[0110] Set accuracy ( A cc ),reliability( R e ), accuracy rate of security detection ( P r ), early warning sensitivity ( S e ) and assess stability ( A s Five evaluation indicators are used to quantify the quality of the frequency security assessment model. Among them, accuracy and reliability can effectively reflect the accuracy of the model's assessment and can be expressed as:
[0111]
[0112] In the formula, T W To predict the number of samples that are correctly identified for the early warning sample, T S To assess the correct number of samples in the safe sample, N W The total number of samples for early warning. N S To ensure a safe total number of samples, C W This is the number of samples that confuse warning levels I and II.
[0113] The precision of safety detection and the sensitivity of early warning can reflect the accuracy of the evaluation model in predicting safety samples and early warning samples, and can be expressed as:
[0114]
[0115] Stability is assessed using the geometric mean of the safety precision and the early warning sensitivity:
[0116]
[0117] To verify the impact of data augmentation on the evaluation model and improve the evaluation performance of Transformer in this embodiment, the evaluation model was trained using datasets before and after sample augmentation. Model training was implemented using the PyTorch platform, with each iteration set to 100.
[0118] In both the IEEE 39 and Illinois 200 systems, the training accuracy of the evaluation model improved after using WGAN and improved WGAN data augmentation. This demonstrates that data augmentation techniques can effectively improve the training accuracy of the evaluation model. Based on the frequency security evaluation model evaluation metrics, the test results of the evaluation model are shown in Tables 2 and 3.
[0119] Table 2 Test results based on IEEE 39 system
[0120]
[0121] Table 3. Test results based on the Illinois 2000 system
[0122]
[0123] After augmenting the original dataset with data augmentation, the performance of the evaluation model based on the improved Transformer improved across all evaluation metrics. The evaluation accuracy reached over 99% in the IEEE 39 system and exceeded 98% in the Illinois 200 system. This demonstrates that the method of this embodiment can effectively evaluate power system frequency security with good accuracy.
[0124] To verify the effectiveness and performance of the proposed method in this embodiment, several deep learning methods were selected for comparative testing, including LeNet, ResNet18, LSTM, and the conventional Transformer, with 100 iterations set for each. Comparative tests were conducted on both the original dataset and the data-augmented dataset. The test results, using accuracy, reliability, and evaluation stability as evaluation metrics, are shown in Tables 4-9. It can be seen that data augmentation improves the accuracy of each model to varying degrees. Furthermore, the Transformer model improved with the convolutional module also demonstrates excellent performance in evaluation accuracy.
[0125] Table 4 Comparative Test Based on Raw Data from IEEE 39 System
[0126]
[0127] Table 5 Comparative Test Based on IEEE 39 System WGAN Data
[0128]
[0129] Table 6 Comparative Tests of the Improved WGAN Dataset Based on the IEEE 39 System
[0130]
[0131] Table 7 Comparative Test Based on Raw Data from the 200-Node System
[0132]
[0133] Table 8 Comparative Test Based on WGAN Data from a 200-Node System
[0134]
[0135] Table 9 Comparative Tests of the Improved WGAN Dataset Based on the 200-Node System
[0136]
[0137] The results above show that data augmentation of the improved WGAN can effectively improve the model's evaluation performance in most models. Furthermore, the improvement effect of the structurally improved WGAN is higher than that of the original WGAN, indicating the effectiveness of the model improvement. The Transformer model improved with CNN outperforms other conventional deep learning models in terms of accuracy and stability, demonstrating excellent evaluation performance.
[0138] This embodiment includes a noise interference experiment. In tests based on the IEEE 39 model, when the noise interference accounts for as much as 40%, the evaluation accuracy after WGAN data augmentation can reach over 97%. In the Illinois 2000 system, the evaluation accuracy after data augmentation also consistently remains above 96%, indicating that this method has strong anti-interference capabilities.
[0139] Based on the SHAP contribution analysis method, an interpretability analysis is performed on the frequency security assessment model. In this embodiment, the data sample covers nine feature types: generator electromagnetic power, generator mechanical power, generator bus voltage, generator bus phase angle, load power, total system active power, total active power consumption, spinning reserve capacity, and system power difference. After SHAP contribution analysis, the contribution values of each feature can be obtained, such as... Figure 7 As shown.
[0140] As shown in the figure, the contributions of total active power and power difference are significantly higher than other factors in this evaluation model. Since system frequency is mainly related to active power, and frequency fluctuations are usually caused by an increase in the active power difference, this is also confirmed in the SHAP analysis. Furthermore, the system's spinning reserve capacity is closely related to the strength of the system's frequency regulation capability and also has a high contribution. The generator bus voltage and phase angle have relatively low contributions, indicating that these factors have a smaller impact on frequency security. In conclusion, the SHAP-based contribution analysis method can reflect the impact of different feature types on the prediction results of the evaluation model, improving the model's interpretability to a certain extent and providing more comprehensive data support for the analysis of frequency security issues.
[0141] In summary, this method constructs an integrated solution of "data augmentation-model evaluation-interpretable analysis", which deeply integrates generative adversarial networks with improved Transformer models, effectively solving the three major problems of poor model training, weak generalization ability and poor interpretability caused by small sample data in power system frequency security assessment.
[0142] Example 2
[0143] Building upon Example 1, this example provides a power system frequency security assessment system based on an improved GAN and Transformer, used to implement the power system frequency security assessment method of Example 1. (See [link to example]). Figure 8 The system includes:
[0144] (1) Data augmentation module, used to obtain the original frequency time series training dataset of the power system, and use generative adversarial network to augment the time series training dataset to generate synthetic samples and form an augmented training dataset.
[0145] (2) Frequency security assessment model training module, used to construct a Transformer model based on a convolutional neural network module, and to train it using the enhanced training dataset to obtain a trained frequency security assessment model.
[0146] (3) Frequency security assessment module, used to acquire real-time or simulated time series data of the power system to be assessed, input the trained frequency security assessment model, output the assessment result of frequency security level, and realize the assessment of power system frequency security.
[0147] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A power system frequency security assessment method based on an improved GAN and Transformer, characterized in that, Includes the following steps: A power system simulation model is established, and based on power system frequency security-related issues, the original frequency time series training dataset of the power system is obtained by setting different disturbance or fault types. The time-series training dataset is augmented using an improved generative adversarial network based on Wasserstein distance to generate synthetic samples, forming an augmented training dataset. High-quality samples are generated by leveraging the stable training characteristics of the improved generative adversarial network, and the sample distribution is optimized. A Transformer model based on a convolutional neural network module is constructed and trained using the enhanced training dataset to obtain a trained frequency safety evaluation model. The Transformer model includes three encoders, a linear layer, and a classification layer. For each encoder, there is a multi-head self-attention layer and a convolutional neural network. The convolutional neural network replaces the feedforward neural network in the Transformer. The convolutional neural network module is used to extract local and short-term feature dependencies in the input temporal data, and the multi-head self-attention mechanism of the Transformer is used to capture global and long-term temporal dependencies. The system acquires real-time or simulated time-series data of the power system to be evaluated, inputs it into the trained frequency security assessment model, and outputs the evaluation results of the frequency security level, thereby realizing the assessment of frequency security of power systems containing renewable energy. The SHAP method is used to analyze the feature contribution of the evaluation results output by the frequency security assessment model to identify key features affecting frequency security. The process of obtaining the original frequency time series training dataset of the power system includes the following steps: Establish a power system simulation model that includes wind turbine units; In the power system simulation model, multiple types of operating conditions and active power disturbances are set to simulate the real operating scenarios of the power system and obtain the original frequency time series training dataset of the power system. The active power disturbances include generator disconnection disturbances and active power disturbances from different load nodes and generators. The process of using an improved generative adversarial network to augment the time series training dataset and generate synthetic samples includes the following steps: An improved generative adversarial network is obtained by constructing a generator based on a recurrent neural network and a discriminator based on a convolutional neural network. The generator is used to obtain generated samples, which are then mixed with real samples in the original frequency time series training dataset. The discriminator is used to determine whether a sample is a real sample or a generated sample. The generator and discriminator are trained based on the Wasserstein distance between the generated sample and the real sample. Synthetic samples are generated using a post-training generator.
2. The power system frequency security assessment method based on improved GAN and Transformer as described in claim 1, characterized in that, In the Transformer model described above, convolution calculation is modeled as follows: in, and For the first Layer outputs and inputs; Indicates the activation function; Represents convolution calculation, for Layers and Layer feature mapping and The connection weights, Indicates the bias value; This indicates the number of feature maps in the previous layer.
3. The power system frequency security assessment method based on improved GAN and Transformer according to claim 1, characterized in that, In the Transformer model described above, the self-attention mechanism is modeled as follows: in, This represents a self-attention operation; , , These are the query matrix, key matrix, and value matrix obtained by linear transformation of the input features, respectively. It is a scaling factor; For activation function, T This indicates transpose.
4. The power system frequency security assessment method based on improved GAN and Transformer according to claim 3, characterized in that, In the Transformer model described above, the multi-head attention mechanism is modeled as follows: in, Indicates the first i The output of a self-attention head; , , Here is the weight matrix for each self-attention head; This represents the output of multi-head attention; The number of self-attention heads; This is the weight matrix for multi-head self-attention; This indicates matrix concatenation.
5. The power system frequency security assessment method based on improved GAN and Transformer according to claim 1, characterized in that, After obtaining the original frequency and time series training dataset of the power system, the process also includes normalizing each sample in the dataset.
6. A power system frequency security assessment system based on an improved GAN and Transformer, characterized in that, For implementing the power system frequency security assessment method as described in any one of claims 1-5, the system comprises: The data augmentation module is used to acquire the original frequency time-series training dataset of the power system, and to augment the time-series training dataset using an improved generative adversarial network to generate synthetic samples, thus forming an augmented training dataset. The frequency security assessment model training module is used to construct a Transformer model based on a convolutional neural network module, and to train it using the enhanced training dataset to obtain a trained frequency security assessment model. The frequency security assessment module is used to acquire real-time or simulated time-series data of the power system to be assessed, input the trained frequency security assessment model, and output the assessment results of the frequency security level, thereby realizing the assessment of the frequency security of the power system.
Citation Information
Patent Citations
Transformer fault case generation method based on strategy gradient and GAN
CN114254559A
Time series data analysis method, device and equipment based on improved Transform and medium
CN120653923A