1. Introduction
Transient stability assessment is an important research topic in power system security and stability analysis [
1,
2]. With the large-scale grid connection of renewable energy sources, the flexibility and complexity of power systems are increasing, and the shortcomings of traditional power system transient stability assessment methods, such as large computational volume and low computational efficiency, are becoming more and more prominent, and the search for more efficient and accurate transient stability assessment methods has become the focus of current research [
3,
4].
As new-generation artificial intelligence technologies like deep learning and deep reinforcement learning continue to advance, data-driven approaches have emerged as innovative methodologies for power system research [
5,
6,
7]. Artificial intelligence technology establishes the mapping relationship between power system operation characteristics and transient stability results from the data perspective to achieve fast and accurate end-to-end assessment [
8,
9,
10,
11]. Reference [
12] selects sample information features through mutual information and Pearson coefficients, and reference [
13] uses a random forest algorithm to assess the security of the system by filtering features through mutual information and Pearson coefficients. Reference [
14] proposed a dynamic security assessment (DSA) framework based on a conditional Bayesian deep autoencoder. Reference [
15] proposed a dynamic security assessment method based on integrated modeling. DSA is oriented towards transient stability preventive control, which refers to the ability of the power system operating state to withstand certain disturbances.
All of the above methods achieved high assessment accuracy. However, considering the low likelihood of accidents in real power systems, when artificial intelligence methods such as deep learning are used, they face the problem of an imbalance in the number of stabilized and unstable samples, which in turn affects the performance of the classifiers. To solve this problem, some researchers have introduced the generative adversarial network (GAN) [
16,
17,
18] into transient stability assessment with sample imbalance. Reference [
19] proposed an improved GAN algorithm to generate unstable data and reduce the impact of unbalanced datasets on model training. Reference [
20] uses conditional generative adversarial networks to expand the unstable samples and construct sample-balanced datasets. Considering that unsupervised learning GAN has the problem of generating uncontrollable samples, this paper introduces contrastive learning into transient stability assessment and proposes a transient stability assessment algorithm based on contrastive learning.
Contrastive learning is an emerging machine learning algorithm that trains models by maximizing the similarity of positive sample pairs while minimizing the similarity of negative sample pairs, which can effectively improve the model’s generalization ability on complex datasets. Since 2019, it has been widely used in several fields, including computer vision, natural language processing, and graph learning, and is recommended in several fields [
21,
22,
23]. Traditional supervised learning uses cross-entropy as the loss function, and although it performs well in most computations, it is susceptible to noise, less robust, and not applicable to high-risk application scenarios, such as class imbalance. Contrastive learning helps to enhance the expression ability of the model in the feature space by emphasizing the differences and similarities between the learning samples, which is especially suitable for the sample proportion imbalance scenario. In the field of power systems, the application of contrastive learning is still in the preliminary stage. Reference [
24] establishes a neural network-based line fault localization framework that applies contrastive learning to the classification of raw signals. Reference [
25] proposes a graph attention contrastive learning framework that utilizes instance-level contrast loss to characterize the similarity of models and enhance model evaluation.
In addition, existing data-driven transient stabilization studies rely on a complete sample library in the offline phase. When the grid operation mode or topology changes significantly, the model built based on the original topology is not applicable, and a new sample database is needed to train the model. Transfer learning is a machine learning method that utilizes existing knowledge to improve the performance of models in new scenarios [
26,
27,
28]. Transfer learning has proven effective in addressing model performance degradation caused by significant variations in operating conditions within the context of DSA. Reference [
29] uses transfer learning methods to improve model performance under new operating conditions, and reference [
30] uses fine-tuning methods in transfer learning to improve model generalizability by fixing the shallow parameters of the model while keeping the structure of the model unchanged and using the knowledge learned by the model in the source domain to assist in updating, thus reducing the updating cost. However, when the distribution difference between the source and target domains is large, the frozen source domain model parameters are not favorable for learning new feature representations in the target domain. To address the above issues, this paper combines active learning to further enhance the transferability of the model by selecting the most representative target domain samples for fine-tuning through active learning, a strategy that can better help the model learn the feature space distribution of the target domain with limited annotation resources.
This paper presents a real-time adaptive evaluation method for DSA that employs contrastive-active transfer learning. The offline phase uses contrastive learning to enhance the model’s generalization ability to unbalanced data, which in turn improves the DSA model’s performance. In the online assessment phase, when the operating conditions of the power system change, the active transfer strategy updates the model, thereby minimizing the number of samples needed for updating while maintaining transfer performance and effectively addressing the issue of small sample updates in the power system.
2. Real-Time Adaptive Assessment of Power System Transient Stability
The application of data-driven methods in the DSA of power systems mainly consists of two phases: offline training and online application. In the offline phase, the model learns and builds a prediction model for simulation data. Although the training process may be time-consuming, the time overhead in this phase does not directly affect the efficiency of the online application. In the online application, the sampling interval of the measurement device is 10 ms, and the system extracts features from the measurement data and inputs them into the model every 10 ms. The average prediction time of the model is at the millisecond level, which can satisfy the system’s demand for real-time response. Aiming at the imbalance of the ratio of stable and unstable samples and the problem of model generalizability in transient stability assessment. In this paper, we propose a real-time adaptive assessment method for DSA based on contrast-active transfer learning. In the offline phase, the model’s expressive ability in the face of unbalanced data is enhanced by contrastive learning. In the online phase, an active transfer strategy is used to enhance the model’s performance under new operating conditions. The overall framework is illustrated in
Figure 1.
2.1. Sample Set Construction
According to the DSA literature, DSA requires the grid to have the ability to withstand specific events, and in practice, the tolerable event is set to be a fault with a duration of 0.1 s. In order to ensure the comprehensiveness of the data, this paper considers the output fluctuations of wind power and photovoltaic units, generates samples by changing the proportion of the corresponding thermal power units, and performs dynamic “N-1” calibration on all fault lines and batch simulation.
In this paper, the transient stability index (TSI) is selected as the transient stability assessment index.
Where
is the maximum power angle difference between thermal power units, when
denotes transient stability,
denotes transient instability. Assuming that there are n lines for dynamic “N-1” verification, the sample label can be expressed as:
If the current mode of operation satisfies the dynamic “N-1” fault checks for all lines, the label is 1. Conversely, if one of the dynamic “N-1” checks fails, the label is 0.
2.2. Feature Extraction
Considering that the DSA in the pre-fault scenario pays more attention to the distribution of the system’s tidal current, this paper adopts the steady-state features as the input features of the model. Considering that feature selection in machine learning has an important impact on the performance of machine learning models, this paper constructs several feature subsets as alternative feature sets, from which the optimal feature subsets will be selected as model input features, as shown in
Table 1.
The filtered optimal subset will be used as feature input to the model, and in this paper, convolutional neural network (CNN), a classical deep learning model, is selected as the base classifier for transient stability assessment. Through convolution operation and pooling operation, CNN can significantly improve the feature extraction ability of the model on the input data. The convolutional operation enables the model to locally perceive the input data and capture local features, while the pooling operation helps to reduce the data dimensionality and improve the computational efficiency of the model. In addition, the horizon-sharing mechanism of CNN allows the model to share weight parameters at different locations, which reduces the number of parameters of the network and improves the generalization performance of the model.
4. Adaptive Updating Strategies Based on Active Transfer Learning
4.1. Transfer Learning
In the DSA problem, when offline-trained prediction models are applied to an online power system, problems such as insufficient model adaptation and reduced accuracy will occur once the online data distribution characteristics change. Transfer learning can improve the model adaptability by adjusting the model or feature space to fit the new data distribution. According to the different pathways, transfer learning is divided into methods, such as instance transfer, feature transfer, representation transfer, and parameter transfer. Instance transfer and parameter transfer are two commonly used algorithms, instance transfer can directly utilize the source domain samples to learn, and parameter transfer can be trained on the basis of existing parameters, which is conducive to rapid improvement of model performance. In this paper, we adopt a combination of instance transfer and parameter transfer to improve the performance of the model in new scenes. As shown in
Figure 3.
The goal of instance transfer is to expand the sample pool of the target domain to provide more data support for subsequent model training. The samples from the source domain that are most similar to the target domain and can be migrated are selected according to the minimum distance principle. Denote the source domain samples as
, the target domain samples as
, and the selected samples can be denoted as:
where
denotes the selected samples, and
θ is the distance threshold. The selected samples will be used as the first step of model updating.
In parameter transfer, fine-tuning is a common strategy that utilizes the features learned by the source domain model in the task of interest and adapts to the data distribution in the target domain by making a small amount of adjustments on the target domain. The feasibility of fine-tuning in deep neural networks is demonstrated in the literature [
33], where experiments discuss the characteristics and transferability of features extracted at each layer of the neural network, i.e., the feature extractors at the bottom layer usually capture generic features, while the classifiers at the top layer are more task-specific Relevance. This study provides a theoretical basis for the effectiveness of fine-tuning strategies.
4.2. Active Transfer Learning
Active learning improves the performance of the model by choosing to select the most informative samples to reduce the need for labeled samples. In active learning, the algorithm selects the most informative samples from unlabeled samples through some query strategy, sends them to experts for labeling to obtain their true labels, and then trains the model based on the labeled samples, updating the model through continuous iterative training until the target model reaches the preset performance.
Query strategy is the core element in active learning, which directly affects the quality of the selected samples. Uncertainty sampling is a commonly used sampling strategy, which can directly utilize the information entropy to quantify the uncertainty of the samples without additional distance metric calculation. The uncertainty metric prioritizes the samples with the largest information entropy, i.e., near the fuzzy classification boundary, which helps the model to distinguish the classification boundary between different samples.
where
is the uncertain sample and
denotes the probability that the sample
x belongs to the label
. In the active learning process, the samples will be selected from the unlabeled dataset
U each time to obtain the labels through a time-domain simulation, which will be used for model updating later.
4.3. Adaptive Update Strategy Based on Active Transfer Learning
The process of power system transient stability adaptive assessment utilizing contrastive learning-assisted training is depicted in
Figure 4. This process primarily consists of two components: offline training and online evaluation.
In the offline process, the model constructs the simulation database by batch setting the operation mode and fault conditions. These extracted features are then utilized to train the model. To further improve model generalization, this paper introduces a new contrastive learning assistance module. Firstly, data enhancement is performed on the feature vectors that satisfy the conditions to obtain more positive and negative samples. Then, the network parameters of the feature extraction module are trained with the objective of supervised contrastive learning loss function. The mapping spatial distance between positive and negative samples in the feature space is pulled apart by maximizing the similarity measure between pairs of similar samples and minimizing the similarity measure between pairs of dissimilar samples. The loss value is calculated by supervised comparison loss, and the model parameters are calculated based on gradient descent to obtain the CNN-based transient stability assessment model.
In the online process, the measured data from the synchronized phasor measurement unit (PMU) is used as the input data, and the prediction model needs to be updated on time when the topology and operation mode of the system change. First, instance transfer is utilized to obtain high-quality data, and the samples in the source domain that are most similar to the samples in the target domain and can be migrated are selected as the starting point for expanding the sample pool in the target domain. Then, shallow weights are frozen to fix the first few layers of the network structure and parameters of the source domain CNN model. Finally, the samples are selected using active learning, and the uncertainty sampling strategy is used to select high-value data, and the sample labels are obtained through time-domain simulation, and the parameters of the target-domain CNN model are fine-tuned based on the selected data, fixing the shallow network parameters and updating the network parameters of the last layer only to obtain better evaluation performance.
4.4. Evaluation Indicators
In the actual operation of the power system, the number of actual destabilization samples is much less than the actual stabilization samples. In order to accurately assess the classifier, a confusion matrix is introduced to define the relevant indexes of its accuracy, as shown in
Table 2. Where TP and TN represent the count of samples accurately predicted as stable and unstable by the model, respectively, while FP and FN indicate the count of unstable samples missed by it.
The evaluation metrics used in this paper contain
Acc,
TTP,
TTN, and
F1 4 metrics, which comprehensively reflect the model evaluation performance.
6. Conclusions and Future Work
Aiming at the problems of sample data imbalance and poor generalization in machine learning-based transient stability assessment, a real-time adaptive assessment method for transient stability with intelligent enhancement of models is proposed. It is validated on an IEEE39 node system, and the conclusions obtained are as follows:
(1) The training algorithm based on supervised contrastive learning helps the model to learn more robust feature representations, which can effectively improve the accuracy of the model in recognizing unbalanced samples and perform well under multiple unbalanced ratios. The t-SNE-based visualization indicates that the proposed method effectively captures the similarities and differences between the data, enhancing the representational capacity of the feature space.
(2) Active learning based on uncertainty sampling can quickly select a small number of the most informative samples. The joint training of active learning and transfer learning can significantly improve the generalization ability of the DSA model in new scenarios, while effectively reducing the cost of model updates.
The proposed method effectively improves the model’s ability to recognize unstable samples in the presence of sample imbalance. However, the current data-driven method still cannot completely eliminate the problem of misjudging unstable samples as stable samples, which limits its applicability in practical application scenarios. In addition, the common voltage instability problem in actual grid operation needs more attention. In future work, further in-depth exploration will be conducted in subsequent studies to enhance the applicability of the data-driven method.