Transient stability analysis method and device for power system

By adopting a deep learning neural network based on Transformer architecture in the transient stability analysis of power systems, the problems of difficult data collection and processing, many model parameters, large calculation amount, lack of transparency and explanatory in the existing technology are solved, and the problem of realization is achieved Real-time or near-real-time transient stability analysis of power systems and reduces the risk of overfitting.

CN119443160APending Publication Date: 2025-02-14ELECTRIC POWER RES INST CHINA SOUTHERN POWER GRID CO LTD +2
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411454689.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-17
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

In the prior art, data collection and processing in the transient stability analysis of power systems is difficult, model parameters are numerous, calculations are large, and there is a lack of transparency and explanatory nature, which makes the results difficult to explain and overfitting are prone to occur.

Method used

Transformer architecture is used to perform transient stability analysis. By obtaining transient stability sample data and transient instability sample data, the model is trained, and an encoder is built for transient stability analysis- The decoder architecture, combined with attention mechanism, realizes real-time or near-real-time transient stability analysis of the power system.

Benefits of technology

Real-time or near-real-time transient stable analysis of the power system is realized, which reduces the difficulty of data collection and processing, improves the transparency and interpretability of the model, and avoids the risk of overfitting.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119443160A_ABST
    Figure CN119443160A_ABST
Patent Text Reader

Abstract

The invention provides an electric power system transient stability analysis method and device. The method comprises the following steps: acquiring operation data of a to-be-analyzed electric power system; inputting the operation data into a transient stability analysis model to obtain a transient stability analysis result of the to-be-analyzed power system output by the transient stability analysis model; wherein the transient stability analysis model is obtained by training a deep learning neural network of a Transform architecture on the basis of sample data with transient stability and sample data with transient instability. According to the method, a neural network transient stability analysis model is constructed by combining a deep learning neural network of a Transform architecture aiming at the transient stability analysis problem under a stability domain concept, and compared with an existing transient stability analysis model, the calculation amount can be greatly reduced, and the real-time or near-real-time transient stability analysis requirement of a power system can be met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of power systems, and in particular to a method and device for analyzing transient stability of a power system. Background Art

[0002] Traditional transient stability analysis methods, such as time domain simulation, are computationally intensive and difficult to meet real-time or near-real-time analysis requirements. Neural networks, due to their excellent nonlinear mapping capabilities and fast computing advantages, are increasingly being used to build transient stability assessment models in order to achieve fast and accurate stability judgments.

[0003] At present, with the development of statistics and data-driven algorithms, scholars have begun to pay attention to the application of data-driven algorithms in transient stability analysis of power systems. In terms of data-driven algorithms, according to the selection of input features, it can be divided into two methods: using manually recalculated features and using the original features of the power system. The method based on manually calculated features mainly uses machine learning algorithms for research, while the original trajectory-based artificial intelligence model requires higher expression capabilities. Therefore, the method based on the original system features mainly uses deep learning algorithms for research.

[0004] However, when applying traditional machine learning models in transient stability analysis, the model performance is highly dependent on the quantity and quality of the data set, and data collection and processing are difficult. At the same time, highly complex machine learning models such as deep learning lack sufficient transparency and interpretability, making the results difficult to interpret, and the model often runs the risk of overfitting. Summary of the invention

[0005] The present invention provides a method and device for analyzing transient stability of an electric power system, which are used to solve the defects in the prior art such as the difficulty of data collection and processing, the large number of model parameters, the large amount of calculation, the lack of sufficient transparency and interpretability, and the difficulty in interpreting the results, so as to realize real-time or near real-time transient stability analysis of the electric power system.

[0006] The present invention provides a method for analyzing transient stability of a power system, comprising the following steps: Obtaining the operating data of the power system to be analyzed; Inputting the operating data into a transient stability analysis model to obtain a transient stability analysis result of the power system to be analyzed output by the transient stability analysis model; The transient stability analysis model is obtained by training a deep learning neural network of a Transformer architecture based on sample data with transient stability and sample data with transient instability.

[0007] According to the power system transient stability analysis method provided by the present invention, the training process of the transient stability analysis model includes: Build a deep learning neural network with Transformer architecture for transient stability analysis; Obtain sample data with transient stability and sample data with transient instability to construct a training sample data set; The deep learning neural network of the Transformer architecture is trained using the training sample data set to obtain a transient stability analysis model.

[0008] According to the power system transient stability analysis method provided by the present invention, the deep learning neural network of the Transformer architecture includes an encoder and a decoder; The encoder includes a linear embedding layer, a position encoding layer, a plurality of parallel encoder layers, and a pooling layer; The linear embedding layer is used to perform normalized preprocessing on input data of different shapes; The position encoding layer is used to add position encoding to each input feature to retain the temporal information of each input feature; Each encoder layer includes a multi-head attention sublayer and a bit-by-bit feedforward neural network sublayer connected in series, and residual connections and layer normalization operations are set at the output ends of the multi-head attention sublayer and the bit-by-bit feedforward neural network sublayer; the bit-by-bit feedforward neural network sublayer includes two fully connected layers and a ReLU activation function.

[0009] According to the power system transient stability analysis method provided by the present invention, the step of adding a position code to each input feature specifically includes: Each position of the input feature is numbered, and each number is represented by a vector to obtain the position code of each input feature.

[0010] According to the power system transient stability analysis method provided by the present invention, the step of representing each number with a vector specifically includes: The position vector is generated using sine and cosine functions of different frequencies. The expression is: ; ; Among them, PE represents position encoding; Indicates location, Represents dimension; Represents the dimension of the model vector.

[0011] According to the power system transient stability analysis method provided by the present invention, the formula for the residual connection and layer normalization operation is: ; ; in, represents the input of multi-head attention, (·) represents the multi-head attention module, (·) represents the layer normalization operation, FFN(·) represents the bit-wise feed-forward neural network sublayer, and Represents the output after layer normalization operation.

[0012] According to the power system transient stability analysis method provided by the present invention, the calculation formula of the bit-by-bit feedforward neural network sublayer is: ; in, is the output of the bit-wise feedforward neural network sublayer, is the output of the previous layer, are learnable parameters.

[0013] According to the method for analyzing transient stability of a power system provided by the present invention, the decoder is an MLP network, and the MLP network is composed of a multilayer perceptron; The input of each neuron in the MLP network and output Satisfies the following formula: ; in: are weights and biases respectively, is a non-linear activation function.

[0014] According to the power system transient stability analysis method provided by the present invention, the MLP network includes an input layer, two hidden layers and an output layer; wherein the dimension of the input layer is the same as the output dimension of the encoder, the dimensions of the hidden layers are 128 and 64 respectively, and the dimension of the output layer is 2.

[0015] According to the method for analyzing transient stability of a power system provided by the present invention, the steps of obtaining sample data with transient stability and sample data with transient instability and constructing a training sample data set specifically include: Under normal operating conditions, random sampling of equipment status is performed within the upper and lower limits of active and reactive loads, node voltages, and active generation power; Determine the expected fault and randomly select the fault clearing time within the predetermined time period; Selecting a model input curve as a disturbed curve group of a predetermined time length from the occurrence of a fault to the removal of the fault, wherein the input curve is a combination of a comprehensive analysis curve, a generator power angle curve, a node voltage curve and a transmission line active power curve; Based on the equipment state, the expected fault and the model input curve, a transient simulation is performed to obtain a transient simulation result; An input curve group having a preset ratio of transient stability simulation results and transient instability simulation results is selected, and the input curve group is divided into a training set and a test set to obtain a training sample data set.

[0016] According to the power system transient stability analysis method provided by the present invention, the deep learning neural network of the Transformer architecture adopts binary cross entropy loss as the loss function.

[0017] According to the power system transient stability analysis method provided by the present invention, the network parameters of the deep learning neural network of the Transformer architecture are optimized by the Adam algorithm.

[0018] The present invention also provides a power system transient stability analysis device, comprising the following modules: An acquisition module, used for acquiring operation data of the power system to be analyzed; An analysis module, used for inputting the operation data into a transient stability analysis model to obtain a transient stability analysis result of the power system to be analyzed output by the transient stability analysis model; The transient stability analysis model is obtained by training a deep learning neural network of a Transformer architecture based on sample data with transient stability and sample data with transient instability.

[0019] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for transient stability analysis of a power system as described above is implemented.

[0020] The present invention also provides a non-transient computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the method for analyzing transient stability of a power system as described above is implemented.

[0021] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned methods for analyzing transient stability of a power system.

[0022] The method and device for transient stability analysis of a power system provided by the present invention obtain the operating data of the power system to be analyzed; input the operating data into a transient stability analysis model, and obtain the transient stability analysis result of the power system to be analyzed output by the transient stability analysis model, wherein the transient stability analysis model is obtained by training a deep learning neural network of a Transformer architecture based on sample data with transient stability and sample data with transient instability. Aiming at the problem of transient stability analysis under the concept of stable domain, the present invention combines the encoder-decoder architecture and attention mechanism of the Transformer model, constructs a neural network transient stability analysis model with an encoder-decoder architecture with a stack of n Transformer encoder layers as the main body and MLP as the decoder, and uses a new generation of Transformer models in transient stability analysis of power systems, solving the defects of the prior art in that data collection and processing are difficult, model parameters are numerous, calculation is large, lack of sufficient transparency and interpretability, and results are difficult to interpret, thereby realizing real-time or near real-time transient stability analysis of power systems. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0024] Figure 1 It is a flow chart of a method for analyzing transient stability of a power system provided by an embodiment of the present invention.

[0025] Figure 2 It is a structural diagram of a transient stability analysis model based on the Transformer architecture provided in an embodiment of the present invention.

[0026] Figure 3 It is a visual illustration of the position coding provided by an embodiment of the present invention.

[0027] Figure 4 It is a schematic diagram of the structure of the encoder layer provided by an embodiment of the present invention.

[0028] Figure 5 It is a schematic diagram of the structure of an encoder provided by an embodiment of the present invention.

[0029] Figure 6 It is a schematic diagram of the structure of a decoder provided by an embodiment of the present invention.

[0030] Figure 7It is a flowchart of the model training provided by an embodiment of the present invention.

[0031] Figure 8 It is a schematic diagram of a power angle curve of a sample provided in an embodiment of the present invention.

[0032] Fig. 9 Schematic diagram of a voltage curve of a sample provided by an embodiment of the present invention.

[0033] Fig.10 It is a schematic diagram of an active power curve of a sample provided in an embodiment of the present invention.

[0034] Fig.11 This is a loss function change curve during the 1w sample size model training process provided by an embodiment of the present invention.

[0035] Fig.12 This is a curve of the change of the loss function during the 80w sample size model training process provided by an embodiment of the present invention.

[0036] Fig.13 It is a structural schematic diagram of a power system transient stability analysis device provided in an embodiment of the present invention.

[0037] Fig.14 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0038] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0039] In practical applications, the transient stability of the power system is a necessary condition for the safe and stable operation of the power system. The transient stability of the power system refers to the ability of the system to recover to a stable state in a short time after suffering a large instantaneous disturbance (such as system failure, line disconnection, sudden increase or decrease of large load, etc.). That is, the transient stability of the power system means that the power system can still operate synchronously and stably after being disturbed, and the transient instability of the power system is prone to cause accidents. The transient stability analysis of the power system can be divided into two categories. One is to predict the transient stability based on the system trajectory when the system fails or under the expected fault. The other is to establish the relationship between the transient stability after the fault and the flow distribution before the fault before the system fails.

[0040] At present, transient stability analysis usually adopts time domain simulation method, direct method and data driven method. Among them, the time domain simulation method first needs to establish a mathematical model of the system, including generators, transformers, transmission lines, loads and the topological relationship between each component. In particular, the dynamic model of the generator needs to include dynamic processes such as rotor angle, speed, electromagnetic transient, and then define the disturbance types and parameters that the system may encounter, such as short circuit type, location and duration of fault. According to the mathematical model, a set of differential algebraic equations (DAE) describing the transient process of the whole system is listed. Finally, the differential equations of the dynamic behavior of the system are solved by numerical integration method, so as to calculate the rotor angle of each generator in the transient process, and then judge the transient stability of the system according to the rotor angle of the generator. Time domain simulation usually requires a lot of computing resources, especially for large and complex power grids. Due to the need for long-term dynamic simulation, especially when considering various possible disturbance scenarios, time domain simulation can be very time-consuming. This is not conducive to the new requirements of transient stability analysis of power systems today. The direct method is mainly based on Lyapunov stability theory, using state variables such as generator power angle and rotor angular velocity to construct a transient energy function (TEF) that meets Lyapunov stability conditions, and uses the energy function to determine the stability of the system. At present, the main problem of the direct method is that the calculation results are not accurate and the algorithm reliability is poor. Moreover, for large-scale cross-regional interconnected power grids, the calculation of critical energy by methods such as dominant unstable equilibrium points also faces problems such as large amount of calculation, poor speed response, and failure to meet real-time analysis requirements. Transient stability analysis based on data-driven algorithms mainly includes three processes: constructing a data set, using the data set to train and test the data-driven model, and using the obtained model for online transient stability analysis. The advantages of applying machine learning methods in transient stability analysis include fast speed and strong adaptability to complex systems. However, the performance of machine learning models is highly dependent on the quantity and quality of data sets, and data collection and processing are difficult. At the same time, highly complex machine learning models (such as deep learning) lack sufficient transparency and interpretability, making the results difficult to interpret. Models often also have the risk of overfitting.

[0041] In view of this, an embodiment of the present invention provides a method and device for analyzing transient stability of a power system to solve the above-mentioned problem.

[0042] The present invention will be described in detail below in conjunction with specific implementation modes.

[0043] In some specific embodiments of the present invention, Figure 1 As shown, this scheme provides a method for transient stability analysis of a power system, including: Step 100: Obtaining operation data of the power system to be analyzed; Step 200: input the operating data into a transient stability analysis model to obtain a transient stability analysis result of the power system to be analyzed output by the transient stability analysis model; The transient stability analysis model is obtained by training a deep learning neural network of a Transformer architecture based on sample data with transient stability and sample data with transient instability.

[0044] It should be noted that the existing transient stability analysis schemes have complex model parameters and usually require a large amount of computing resources and a large amount of calculation, especially for large and complex power grids. Since long-term dynamic analysis is required, it is very time-consuming when considering various possible disturbance scenarios, so real-time analysis of the power system cannot be achieved.

[0045] Therefore, the present invention aims at the transient stability analysis problem under the concept of stable domain, combines the deep learning neural network of Transformer architecture, and constructs a neural network transient stability analysis model. By analyzing the operating data, the real-time transient stability analysis results of the power system are determined. The transient stability analysis results include two states: transient stability and transient instability.

[0046] Specifically, an important application of neural network models is classification. Transient stability analysis is to determine whether a power system operation sample is stable, so this can be regarded as a binary classification problem.

[0047] Use the formula represents the neural network model, where represents the input of the model, is the number of inputs, is the data length, is the network parameter. The output of the neural network model satisfies .Pick For transient stability, It is transient instability, so the transient stability analysis realized by neural network can be expressed as the following mapping function: (1)

[0048] Define the training set as D, with: (2)

[0049] Where N represents the total number of samples, Indicates the corresponding sample The true label, so there is The transient stability analysis model is trained by supervised learning. First, an error function is defined , the error function represents the difference between the predicted value of the neural network and its true label. The gradient value of the error function is solved and back-propagated, thereby updating the parameters of the neural network until the target number of training steps is reached or the loss function no longer decreases. The ultimate goal is to minimize the error of the transient stability prediction result by updating the parameters. Therefore, it is expressed as the following optimization problem: (3)

[0050] Where: Represents the time when the loss function is minimized Solve the above optimization problem The iteration process of the value is to train and update the neural network parameters process.

[0051] Generally, the binary cross entropy loss function can be used as the error function in binary classification problems. The binary cross entropy loss function is expressed as follows: (4)

[0052] After the model is trained, the corresponding power system parameter trajectory can be input to output the transient stability judgment result. When inferring new data in the online application stage, the parameters of the given model need to be And the model input , calculate the probabilities of stability and instability, and choose the larger probability as the output.

[0053] (5)

[0054] Considering the conservativeness of transient stability analysis, a transient instability judgment threshold can be defined: .

[0055] (6).

[0056] In some possible implementations of the present invention, the training process of the transient stability analysis model includes: Build a deep learning neural network with Transformer architecture for transient stability analysis; Obtain sample data with transient stability and sample data with transient instability to construct a training sample data set; The deep learning neural network of the Transformer architecture is trained using the training sample data set to obtain a transient stability analysis model.

[0057] Specifically, this embodiment provides an implementation method for training a transient stability analysis model by constructing a deep learning neural network of a Transformer architecture and performing training based on acquired sample data with transient stability and sample data with transient instability.

[0058] In some possible implementations of the present invention, the deep learning neural network of the Transformer architecture includes an encoder and a decoder; The encoder includes a linear embedding layer, a position encoding layer, a plurality of parallel encoder layers, and a pooling layer; The linear embedding layer is used to perform normalized preprocessing on input data of different shapes; The position encoding layer is used to add position encoding to each input feature to retain the temporal information of each input feature; Each encoder layer includes a multi-head attention sublayer and a bit-by-bit feedforward neural network sublayer connected in series, and residual connections and layer normalization operations are set at the output ends of the multi-head attention sublayer and the bit-by-bit feedforward neural network sublayer; the bit-by-bit feedforward neural network sublayer includes two fully connected layers and a ReLU activation function.

[0059] Specifically, this embodiment provides an implementation method of a deep learning neural network with a Transformer architecture. Through the encoder-decoder architecture and attention mechanism of the Transformer model, an encoder with multiple Transformer encoder layers stacked as the main body is constructed.

[0060] Specifically, the Transformer model uses an encoder-decoder architecture that is more competitive in sequence data processing. The core of the Transformer model is completely based on the self-attention mechanism. Self-attention mainly includes three parts: query, key, and value. The special attention mechanism constructed by the Transformer model is scaled dot product attention. The output result of scaled dot product attention is shown in the following formula: (7)

[0061] Based on the scaled dot product attention, the Transformer model proposes a multi-head attention mechanism. The multi-head attention mechanism uses different linear mappings to obtain h-dimensional vector representations of queries, keys, and values, and then executes the Attention function in parallel, concatenating the generated outputs and re-mapping them to obtain a final value.

[0062] In some possible implementations of the present invention, the decoder is an MLP network, and the MLP network is composed of a multi-layer perceptron.

[0063] In a possible embodiment, the transient stability analysis model based on the Transformer architecture is constructed based on the encoder-decoder architecture and multi-head self-attention mechanism of the Transformer model. Figure 2 The structure of the transient stability analysis model based on the Transformer architecture is shown in Figure 2 As shown in the figure, the transient stability analysis model is also divided into two parts: encoder and decoder. The encoder part is a feature extractor. The purpose is to extract and represent the input power system dynamic features and project them into a high-dimensional stable feature space, and strengthen the representation of features that are more relevant to the transient stability of the power system. The decoder part is a classifier implemented by a multi-layer perceptron. The purpose is to transform each feature in the high-dimensional stable feature space through nonlinear transformation of multiple hidden layers and finally reach the output layer for binary classification operation, so as to obtain the transient stability evaluation.

[0064] Specifically, for the structure of the encoder, the input of the model is Represented as n, where n is the dimension of the input feature and T is the length of the input feature. First, a linear embedding layer is used to transform the input shape into , Represents the dimension of the model vector. The main purpose of the linear embedding layer is to ensure that the model can perform standardized preprocessing on input data of various shapes and improve the application range of the model.

[0065] In some possible implementations of the present invention, the step of adding a position code to each input feature specifically includes: Each position of the input feature is numbered, and each number is represented by a vector to obtain the position code of each input feature.

[0066] Specifically, this embodiment provides an implementation method for adding position coding to each input feature. By numbering each position of the input feature and then representing each number with a vector, the position coding of each input feature is obtained.

[0067] Specifically, although the multi-head attention mechanism in the Transformer model can extract the dependencies between the nodes of the input data, it cannot extract the absolute position or relative position relationship of the nodes of the time series data. If the order of the keys and values ​​is disrupted, the attention result is still the same, which is not conducive to obtaining information about time series data such as the input feature trajectory of the power system. Therefore, in order to solve the above problem, position encoding is added to retain the time series information. Each position of the input feature is numbered, and each number is represented by a vector. The vector is added to the feature data at the corresponding position, which introduces the time series information.

[0068] In a possible embodiment, the step of representing each number with a vector specifically includes: The position vector is generated using sine and cosine functions of different frequencies. The expression is: (8)

[0069] (9)

[0070] Among them, PE represents position encoding; Indicates location, Represents dimension; Represents the dimension of the model vector.

[0071] That is to say, the model uses sine and cosine functions of different frequencies to generate position vectors, and the expressions are (7) and (8) respectively.

[0072] Through the above expression, the model can learn the relative position relationship in the time series data. The formula used is as follows: (10)

[0073] (11)

[0074] Furthermore, the position-encoded value can be visualized. In a specific embodiment, Figure 3 As shown, the position encoding values ​​in the above embodiment are visualized, each row corresponds to the position encoding of a vector, each row contains 64 values, and each value ranges between -1 and 1.

[0075] Based on the above embodiment, the input and the position code are added and then enter the encoder layer. The specific structure of the encoder layer is as follows: Figure 4 As shown in the figure, the multi-head attention sublayer is a core component that allows the model to learn information in parallel in different representation subspaces, which can increase the model's ability to process different types of information and improve the model's expressiveness. The calculation process corresponding to the multi-head attention mechanism is as follows: (12)

[0076] in,

[0077] (13)

[0078] In the above formula, we have: as well as .

[0079] The Position-wise Feed-Forward Networks (FFN) in the encoder layer is a sublayer that implements nonlinear activation and contains two fully connected layers and a ReLU activation function. The FFN layer can introduce nonlinearity through the ReLU activation function to enhance the nonlinear expression ability of the model, thereby helping the model learn complex data patterns.

[0080] In a possible embodiment, the calculation formula of the bit-by-bit feedforward neural network sublayer FFN is: (14)

[0081] in, is the output of the bit-wise feedforward neural network sublayer, is the output of the previous layer, are learnable parameters.

[0082] In order to increase the expressive power of the model, residual connection and layer normalization operations are performed after each sub-layer.

[0083] In a possible embodiment, the formula for the residual connection and layer normalization operation is: (15)

[0084] (16)

[0085] in, represents the input of multi-head attention, (·) represents the multi-head attention module, (·) represents the layer normalization operation, FFN(·) represents the bit-wise feed-forward neural network sublayer, and Represents the output after layer normalization operation.

[0086] Specifically, the role of residual connection is to solve the problem of network degradation and prevent problems such as gradient disappearance or gradient explosion. Layer normalization is to stabilize the network training process, unify the distribution of different features, and improve the generalization ability of the model.

[0087] On this basis, a complete Transformer encoder is constructed by stacking n such encoder layers. The calculation formula is as follows: (17)

[0088] in, (·) represents a Transformer encoder with n encoder layers stacked, represents the input after the dimension is changed by the linear embedding layer, PE represents the position encoding, Represents the output of the Transformer encoder, and has .

[0089] A pooling layer is added after the output of the Transformer encoder. The purpose is to make the model pay more attention to the global information of the features through dimensionality reduction and facilitate the calculation of subsequent classifiers. Commonly used pooling methods include maximum pooling and average pooling. Here, average pooling is selected in the length dimension of the input. The calculation formula of the pooling layer is as follows: (18)

[0090] in, represents the output after the pooling layer, Pooling(·) represents the pooling layer, and there is .

[0091] Based on the above embodiment, the structure of the entire model encoder can be Figure 5 Shown, as Figure 5 As shown, the encoder encodes the input of the model and then outputs it. The encoder can be expressed as follows: (19)

[0092] in Represents the input of the encoder, that is, the input of the entire model, Encoder(·) represents the encoder, represents the output of the encoder. And , .

[0093] In some possible implementations of the present invention, the decoder of the model is composed of a multilayer perceptron using an MLP as a classifier. Each feature encoded by the encoder is subjected to nonlinear transformation of multiple hidden layers and finally reaches the output layer for binary classification, thereby obtaining an evaluation of transient stability.

[0094] In a possible embodiment, Figure 6 is a schematic diagram of the structure of a decoder provided by an embodiment of the present invention, such as Figure 6 As shown, the input of each neuron in the MLP network and output Satisfies the following formula: (20)

[0095] in: are weights and biases respectively, is a non-linear activation function.

[0096] Specifically, see Figure 6 ,The MLP network consists of an input layer, two hidden layers and an output layer.

[0097] In a possible embodiment,

[0098] The dimension of the input layer is the same as the output dimension of the encoder, the dimensions of the hidden layer are 128 and 64 respectively, and the dimension of the output layer is 2. The MLP network has two hidden layers, with dimensions of 128 and 64 respectively. The dimension of the input layer is the same as the dimension of the encoder output, that is, The dimension of the output layer is 2, which is a binary classification result considering whether the output is transiently stable or not. Represents the probability of classification category 0, i.e. transient stability, represents the probability of classification category 1, i.e. transient instability, and .Pick and The larger one between the two is taken as the prediction result of transient stability, or determined according to formula (6). .

[0099] The entire decoder can be expressed as follows: (twenty one)

[0100] in represents the output of the decoder, Represents a decoder, Represents the input of the decoder, which is also the output of the encoder.

[0101] In some possible implementations of the present invention, the network parameters of the deep learning neural network of the Transformer architecture are optimized by the Adam algorithm.

[0102] Specifically, when training the transient stability analysis model, the supervised learning method is used, and the Adam (Adaptive Moment Estimation) optimization algorithm is applied to update the parameters of the neural network by back-propagating the error, thereby gradually reducing the error.

[0103] Specifically, the Adam optimization algorithm is an adaptive learning rate optimization algorithm that can effectively control the direction and speed of gradient updates, thereby improving the stability of the optimization process. The Adam optimization algorithm can be expressed by the following calculation formula: (twenty two)

[0104] (twenty three)

[0105] in: is the first moment of the current gradient; is the second-order moment of the current gradient; is the current gradient; is the first-order moment exponential decay rate, generally taken as is the second-order moment exponential decay rate, generally taken as 0.999.

[0106] because and The initial value of is 0, so the initial value of the attenuation rate will also be greatly affected, so deviation correction is required, the formula is as follows: (twenty four)

[0107] (25)

[0108] in: is the modified first-order moment estimator; is the modified second-order moment estimator.

[0109] According to the corrected estimated variables and learning rate , update the model parameters.

[0110] (26)

[0111] in: A very small amount is used to avoid division by zero errors. is the learning rate, which controls the speed of updating parameters in the network.

[0112] In some possible implementations of the present invention, the deep learning neural network of the Transformer architecture adopts binary cross entropy loss as the loss function.

[0113] Specifically, Figure 7 is a flow chart of the model training provided by an embodiment of the present invention, such as Figure 7 As shown in the figure, for the transient stability analysis neural network model that has been constructed , assuming the true transient stability label of the input is , the prediction value of the binary classification output of the neural network is . Use binary cross entropy loss as the loss function to calculate and The specific calculation formula of the binary cross entropy function is: (27)

[0114] Due to the loss of Joint decision, so that Written as . Then the current gradient in the Adam optimization algorithm can be defined as follows: (28)

[0115] Furthermore, the network parameters are updated according to the Adam optimization algorithm. The specific calculation formula can be found in formulas (22) to (26).

[0116] For all N samples of input , all the above operations are performed, which is regarded as a training step. Until the maximum number of training steps is reached or the loss function has dropped to a certain range, the model is considered to have completed training.

[0117] In some possible implementations of the present invention, the steps of obtaining sample data with transient stability and sample data with transient instability and constructing a training sample data set specifically include: Under normal operating conditions, random sampling of equipment status is performed within the upper and lower limits of active and reactive loads, node voltages, and active generation power; Determine the expected fault and randomly select the fault clearing time within the predetermined time period; Selecting a model input curve as a disturbed curve group of a predetermined time length from the occurrence of a fault to the removal of the fault, wherein the input curve is a combination of a comprehensive analysis curve, a generator power angle curve, a node voltage curve and a transmission line active power curve; Based on the equipment state, the expected fault and the model input curve, a transient simulation is performed to obtain a transient simulation result; An input curve group having a preset ratio of transient stability simulation results and transient instability simulation results is selected, and the input curve group is divided into a training set and a test set to obtain a training sample data set.

[0118] Specifically, this embodiment provides an implementation method for constructing a training sample data set by randomly sampling the equipment status and determining the expected fault and model input curve. On this basis, transient simulation is performed to obtain transient simulation results, and based on the transient simulation results, a training sample data set is constructed.

[0119] In a possible embodiment, the open source Py-PSOPS simulation tool is used as a simulation program to generate samples required for model training on the IEEE-39 standard test system. The Py-PSOPS simulation tool is a power system transient simulator that can solve power flow through the Newton-Raphson method and perform transient simulation using the implicit gradient method. The sample generation function is applied to generate samples. Consider the initial topology changes, including the original topology, N-1 and N-2 topologies. The equipment state is randomly sampled under normal operating conditions, that is, sampling is performed within the upper and lower limits of active and reactive loads, node voltages and active power generation. The expected fault is a three-phase short circuit fault, and the fault clearing time is randomly selected between 0.08s-0.20s. The model input curve is a disturbed curve with a length of 0.15s from the occurrence of the fault to the removal, and the length of each curve is 31. The input curve includes 5 comprehensive analysis curves, 10 generator power angle curves, 39 node voltage curves and 34 transmission line active power curves, a total of 88. In this way, a data set that can be used for learning is obtained, which takes into account the uncertainty of topology changes, power flow distribution changes, fault location changes and fault duration changes. Initially, 10,000 sets of transient simulation results were generated, of which 5,000 sets simulated transient stability and 5,000 sets simulated transient instability. 80% were used as training sets and 20% as test sets. In subsequent experiments, a data set with a sample size of 80w was used for training and testing, of which 60w groups simulated transient stability and 20w groups simulated transient instability, in order to further improve the performance of the model. For example, the power angle curve, voltage curve and active power curve of one of the samples x are as follows Figure 8 , 9 , as shown in 10.

[0120] It is worth noting that the five comprehensive analysis curves mentioned in this embodiment include the minimum voltage curve, the maximum voltage curve, the maximum power angle difference curve, the minimum frequency curve, the maximum frequency curve, etc. of the power system, and the comprehensive analysis curve can be obtained by numerical calculation of the curves of the above-mentioned specific physical properties. For example, the minimum voltage curve can be obtained by selecting the minimum voltage at each node at each moment, and the maximum power angle difference can be obtained by subtracting the power angles of the generators at each moment and then selecting the maximum difference.

[0121] Furthermore, this embodiment is based on the generator power angle The transient stability index (TSI) describes the stability of the system. As a criterion for the stability of the system, the index is defined as follows: (29)

[0122] Where: is the maximum power angle difference between any two generators. When , the system is transiently stable; otherwise, the system is unstable. In this paper, in order to ensure a certain transient stability margin, it is determined When , that is, the maximum power angle difference between any two generators is less than 180°, the system is transiently stable.

[0123] When constructing the data set, the power angle curves of each generator in the system are obtained through simulation, and the The value of the indicator, for The sample is labeled as 0, which means it is a transient stable sample. The sample is labeled as 1, which means transient instability.

[0124] On this basis, this embodiment uses a confusion matrix, and the classification results and indicators can be clearly obtained from the confusion matrix for analysis and judgment. Each column of the confusion matrix represents the predicted category, and each row represents the true category of the data. Among them, True Positive (TP) means the true category, indicating that the classification result and the true result are both positive categories. The definition of other categories is the same.

[0125] A more advanced classification index can be obtained in the confusion matrix. In this embodiment, three commonly used classification indexes in this field are selected, namely, accuracy, false positive rate, and missed positive rate. The calculation formula of each classification index is given by the following formula: (30)

[0126] (31)

[0127] (32)

[0128] For a dataset of 10,000 samples, after tuning and optimizing the model, a set of hyperparameters with good performance was obtained. The training step length is 100 epochs, each batch contains 32 samples, the model embedding layer dimension is 256, the Transformer encoder dropout rate is 0.10, and the MLP classifier dropout rate is 0.05. The initial learning rate is 0.00006, and a fixed step learning rate decay strategy is adopted. The learning rate is multiplied by a decay factor of 0.7 every 10 training steps.

[0129] The transient stability analysis neural network model is trained and the following is obtained: Fig.11The loss function changes shown in the figure. It can be seen that the loss function of the training set has been decreasing within 100 training steps. However, the loss function of the test set began to rise around the 20th training step, indicating that the model has overfitting. Therefore, the model after 20 training steps is selected as the model that has completed the training. The confusion matrix and related performance indicators of the model are shown in Table 1. Table 1 shows the confusion matrix and performance indicators of the training model of the 10,000 sample data set.

[0130] Table 1

[0131] As you can see, the accuracy of the model on the training set is 94.15%, and the accuracy on the test set is 88.94%. Due to overfitting, the generalization ability of the model is not strong. Therefore, we first consider increasing the amount of data to try to alleviate the overfitting phenomenon and improve the expression and generalization ability of the model.

[0132] For a dataset of 800,000 samples, after tuning and optimizing the model, a set of hyperparameters with good performance was obtained. Among them, the training step length epoch is 100, each batch contains 128 samples, the model embedding layer dimension is 256, the Transformer encoder dropout rate is 0.10, and the MLP classifier dropout rate is 0.05. The initial learning rate is 0.00008, and a fixed step learning rate decay strategy is adopted. The learning rate is multiplied by a decay factor of 0.9 every 5 training steps.

[0133] The transient stability analysis neural network model is trained accordingly, and the loss function changes on the training set and the test set are as follows: Fig.12 shown.

[0134] It can be seen that for the transient stability analysis model of the data set with a sample size of 80w, the training set loss function has been decreasing within 100 training steps. However, the test set loss function began to rise at about the 25th training step, and the model also showed overfitting. Therefore, the model after 25 steps of training was selected as the model to complete the training. However, compared with the model trained with a sample size of 1w, the loss function has a significant decrease. This shows that the expression ability and generalization ability of the model have been improved to varying degrees. The confusion matrix and related performance indicators of the model are shown in Table 2. Table 2 shows the confusion matrix and performance indicators of the model trained with a sample size of 80w.

[0135] Table 2

[0136] As can be seen from Table 2, the accuracy of the model trained with a dataset of 800,000 samples is 97.68% on the training set and 95.67% on the test set. It can be seen that increasing the sample size of the dataset can improve the performance of the model.

[0137] The method for transient stability analysis of power systems provided in an embodiment of the present invention focuses on the transient stability analysis problem under the concept of stable domain, and combines the encoder-decoder architecture and attention mechanism of the Transformer model to construct a neural network transient stability analysis model with an encoder-decoder architecture with n Transformer encoder layers stacked as the main body and MLP as the decoder. The open source Py-PSOPS simulation tool is used as a simulation program to generate samples required for model training on the IEEE-39 standard test system to form a data set. The Adam optimization algorithm is used to train the model and update the parameters. A model with good expression ability is trained for two data sets with a sample size of 10,000 and a sample size of 80w, which can be used for the analysis of transient stability of power systems and related research work.

[0138] The power system transient stability analysis device provided by the present invention is described below. The power system transient stability analysis device described below and the power system transient stability analysis method described above can be referred to each other.

[0139] Fig.13 is a schematic diagram of the structure of a power system transient stability analysis device provided by an embodiment of the present invention, such as Fig.13 As shown, the power system transient stability analysis device includes: An acquisition module 131 is used to acquire the operation data of the power system to be analyzed; An analysis module 132, configured to input the operation data into a transient stability analysis model to obtain a transient stability analysis result of the power system to be analyzed output by the transient stability analysis model; The transient stability analysis model is obtained by training a deep learning neural network of a Transformer architecture based on sample data with transient stability and sample data with transient instability.

[0140] The implementation principle and beneficial effects of the power system transient stability analysis device provided in the embodiment of the present invention are similar to the implementation principle and beneficial effects of the power system transient stability analysis method shown in the above embodiment. Please refer to the implementation principle and beneficial effects of the power system transient stability analysis method shown in the above embodiment, and no further details will be given here.

[0141] Fig.14 An example of a physical structure diagram of an electronic device is shown in FIG. Fig.14As shown, the electronic device may include: a processor 1410, a communication interface 1420, a memory 1430 and a communication bus 1440, wherein the processor 1410, the communication interface 1420 and the memory 1430 communicate with each other through the communication bus 1440. The processor 1410 may call the logic instructions in the memory 1430 to execute the transient stability analysis method of the power system, the method comprising: obtaining the operation data of the power system to be analyzed; inputting the operation data into the transient stability analysis model to obtain the transient stability analysis result of the power system to be analyzed output by the transient stability analysis model; wherein the transient stability analysis model is obtained by training the deep learning neural network of the Transformer architecture based on the sample data with transient stability and the sample data with transient instability.

[0142] In addition, the logic instructions in the above-mentioned memory 1430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk.

[0143] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the power system transient stability analysis method provided by the above methods, and the method includes: obtaining operating data of the power system to be analyzed; inputting the operating data into a transient stability analysis model to obtain a transient stability analysis result of the power system to be analyzed output by the transient stability analysis model; wherein the transient stability analysis model is obtained by training a deep learning neural network with a Transformer architecture based on sample data with transient stability and sample data with transient instability.

[0144] On the other hand, the present invention also provides a non-transient computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the power system transient stability analysis method provided by the above-mentioned methods, the method comprising: obtaining operating data of the power system to be analyzed; inputting the operating data into a transient stability analysis model to obtain a transient stability analysis result of the power system to be analyzed output by the transient stability analysis model; wherein the transient stability analysis model is obtained by training a deep learning neural network with a Transformer architecture based on sample data with transient stability and sample data with transient instability.

[0145] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative effort.

[0146] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0147] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for analyzing transient stability of a power system, characterized in that: include: Obtaining the operating data of the power system to be analyzed; Inputting the operating data into a transient stability analysis model to obtain a transient stability analysis result of the power system to be analyzed output by the transient stability analysis model; The transient stability analysis model is obtained by training a deep learning neural network of a Transformer architecture based on sample data with transient stability and sample data with transient instability.

2. The method for analyzing transient stability of a power system according to claim 1, characterized in that: The training process of the transient stability analysis model includes: Build a deep learning neural network with Transformer architecture for transient stability analysis; Obtain sample data with transient stability and sample data with transient instability to construct a training sample data set; The deep learning neural network of the Transformer architecture is trained using the training sample data set to obtain a transient stability analysis model.

3. The method for analyzing transient stability of a power system according to claim 2, characterized in that: The deep learning neural network of the Transformer architecture includes an encoder and a decoder; The encoder includes a linear embedding layer, a position encoding layer, a plurality of parallel encoder layers, and a pooling layer; The linear embedding layer is used to perform normalized preprocessing on input data of different shapes; The position encoding layer is used to add position encoding to each input feature to retain the temporal information of each input feature; Each encoder layer includes a multi-head attention sublayer and a bit-by-bit feedforward neural network sublayer connected in series, and residual connections and layer normalization operations are set at the output ends of the multi-head attention sublayer and the bit-by-bit feedforward neural network sublayer; the bit-by-bit feedforward neural network sublayer includes two fully connected layers and a ReLU activation function.

4. The method for analyzing transient stability of a power system according to claim 3, characterized in that: The steps of adding position encoding to each input feature include: Each position of the input feature is numbered, and each number is represented by a vector to obtain the position code of each input feature.

5. The method for analyzing transient stability of a power system according to claim 4, characterized in that: The steps of representing each number with a vector include: The position vector is generated using sine and cosine functions of different frequencies. The expression is: ; ; Among them, PE represents position encoding; Indicates location, Represents dimension; Represents the dimension of the model vector.

6. The method for analyzing transient stability of a power system according to claim 3, characterized in that: The formula for the residual connection and layer normalization operation is: ; ; in, represents the input of multi-head attention, (·) represents the multi-head attention module, (·) represents the layer normalization operation, FFN(·) represents the bit-wise feed-forward neural network sublayer, and Represents the output after layer normalization operation.

7. The method for analyzing transient stability of a power system according to claim 6, characterized in that: The calculation formula of the bit-by-bit feedforward neural network sublayer is: ; in, is the output of the bit-wise feedforward neural network sublayer, is the output of the previous layer, are learnable parameters.

8. The method for analyzing transient stability of a power system according to claim 3, characterized in that: The decoder is an MLP network, and the MLP network is composed of a multi-layer perceptron; The input of each neuron in the MLP network and output Satisfies the following formula: ; in: are weights and biases respectively, is a non-linear activation function.

9. The method for analyzing transient stability of a power system according to claim 8, characterized in that: The MLP network includes an input layer, two hidden layers and an output layer; wherein the dimension of the input layer is the same as the output dimension of the encoder, the dimensions of the hidden layers are 128 and 64 respectively, and the dimension of the output layer is 2.

10. The method for analyzing transient stability of a power system according to claim 2, characterized in that: The steps of obtaining sample data with transient stability and sample data with transient instability and constructing a training sample data set specifically include: Under normal operating conditions, random sampling of equipment status is performed within the upper and lower limits of active and reactive loads, node voltages, and active generation power; Determine the expected fault and randomly select the fault clearing time within the predetermined time period; Selecting a model input curve as a disturbed curve group of a predetermined time length from the occurrence of a fault to the removal of the fault, wherein the input curve is a combination of a comprehensive analysis curve, a generator power angle curve, a node voltage curve and a transmission line active power curve; Based on the equipment state, the expected fault and the model input curve, a transient simulation is performed to obtain a transient simulation result; An input curve group having a preset ratio of transient stability simulation results and transient instability simulation results is selected, and the input curve group is divided into a training set and a test set to obtain a training sample data set.

11. The method for analyzing transient stability of a power system according to any one of claims 1 to 10, characterized in that: The deep learning neural network of the Transformer architecture adopts binary cross entropy loss as the loss function.

12. The method for analyzing transient stability of a power system according to any one of claims 1 to 10, characterized in that: The network parameters of the deep learning neural network of the Transformer architecture are optimized by the Adam algorithm.

13. A power system transient stability analysis device, characterized in that: include: An acquisition module, used for acquiring operation data of the power system to be analyzed; An analysis module, used for inputting the operation data into a transient stability analysis model to obtain a transient stability analysis result of the power system to be analyzed output by the transient stability analysis model; The transient stability analysis model is obtained by training a deep learning neural network of a Transformer architecture based on sample data with transient stability and sample data with transient instability.

Citation Information

Cited By

  • Power system multi-scene adaptive transient stability assessment method based on active transfer learning

    CN120851390A