Transient power angle stability detection model processing method, device and equipment of power system
By constructing a training sample dataset and utilizing techniques such as masking layers, word embedding layers, attention layers, and feedforward layers, the operating data of multi-source equipment in the power system are processed, solving the problem of insufficient generalization ability of traditional detection methods and achieving higher accuracy in transient power angle stability detection.
Patent Information
- Application Number
- CN202511684725.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-17
- Publication Date
- 2026-02-17
AI Technical Summary
Traditional methods for detecting transient power angle stability in power systems suffer from poor generalization ability due to model simplification and algorithm assumptions, resulting in decreased detection accuracy and making it difficult to meet actual operational requirements.
A training sample dataset is constructed. Multi-source device operation data is processed through the mask layer, word embedding layer, attention layer, feedforward layer and output layer of the initial transient power angle stability detection model. The target transient power angle stability detection model is obtained by iterative training to improve the model's generalization ability.
It enhances the accuracy of power system transient power angle stability detection, improves the model's generalization ability, and enables more accurate judgment of power system transient power angle stability.
Smart Images

Figure CN121542997A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of power system detection, in particular to a transient power angle stability detection model processing method of a power system, a transient power angle stability detection method, device and apparatus of a power system, a computer device, a computer readable storage medium and a computer program product. BACKGROUND
[0002] With the development of power systems, power systems increasingly exhibit characteristics of high new energy proportion, high power electronics, and high AC-DC coupling, and the operating characteristics of power systems are becoming increasingly complex.
[0003] Traditional power system transient power angle stability detection methods have poor generalization ability due to model simplification and algorithm assumptions, which greatly reduces the accuracy of power system transient power angle stability detection and makes it difficult to meet actual operating requirements. SUMMARY
[0004] Therefore, it is necessary to provide a transient power angle stability detection model processing method of a power system, a transient power angle stability detection method, device and apparatus of a power system, a computer device, a computer readable storage medium and a computer program product that can improve the accuracy of power system transient power angle stability detection.
[0005] In a first aspect, the present application provides a transient power angle stability detection model processing method of a power system, the method comprising:
[0006] Obtaining at least one multi-source device operating data of a power system; constructing a training sample data set according to the multi-source device operating data;
[0007] Obtaining masked data based on the training sample data in the training sample data set through a mask layer of an initial transient power angle stability detection model; obtaining word embedding vectors based on the masked data through a word embedding layer of the initial transient power angle stability detection model; performing position encoding on the masked data to obtain position encoding vectors; and obtaining target vectors based on the word embedding vectors and the position encoding vectors;
[0008] Obtaining attention feature vectors based on the target vectors through an attention layer of the initial transient power angle stability detection model; obtaining feature representation vectors based on the target vectors and the attention feature vectors through a feedforward layer of the initial transient power angle stability detection model; and obtaining transient power angle stability prediction results based on the feature representation vectors through an output layer of the initial transient power angle stability detection model;
[0009] Based on the transient power angle stability prediction results and the transient power angle stability label data of the power system, the initial transient power angle stability detection model is iteratively trained to obtain the target transient power angle stability detection model; the target transient power angle stability detection model is used to determine whether the transient power angle of the power system is stable.
[0010] In one embodiment, an attention feature vector is obtained based on the target vector through the attention layer of the initial transient power angle stability detection model, including:
[0011] Based on the preset global shared parameter matrix, the attention weights of the connection edges between each node in the network topology of the power system are calculated; the attention weights of the connection edges are normalized to obtain the normalized attention weights.
[0012] For each node in the network topology, the node features of the current node are updated based on the node features of the current node's neighboring nodes, the normalized attention weights, and the global shared parameter matrix, to obtain the updated node features.
[0013] The updated node features and target vector of each node are input into the attention layer of the initial transient power angle stability detection model to obtain the attention feature vector.
[0014] In one embodiment, the feedforward layer includes a first normalization layer, a fully connected layer, and a second normalization layer; through the feedforward layer of the initial transient power angle stability detection model, a feature representation vector is obtained based on the target vector and the attention feature vector, including:
[0015] The target vector and the attention feature vector are summed to obtain the first vector; the first vector is then input into the first normalization layer to obtain the first normalized vector.
[0016] The first-layer normalized vector is input into the fully connected layer to obtain the second vector;
[0017] The first normalized vector is summed with the second vector to obtain the third vector; the third vector is then input into the second normalized layer to obtain the feature representation vector.
[0018] In one embodiment, a training sample dataset is constructed based on multi-source device operating data, including:
[0019] Based on the operating data of multi-source devices, the node admittance matrix of the power system is obtained; based on the node admittance matrix and the node characteristics of each node in the network topology of the power system, the adjacency matrix of the power system is obtained; based on the node admittance matrix, the impedance matrix of the power system is obtained.
[0020] The system adds disturbances to the operating status of equipment in the power system to obtain multiple operating states after disturbances; it performs power flow calculations on each operating state after disturbances to obtain multiple power flow calculation results; it verifies the multiple power flow calculation results according to preset physical constraints, and determines the operating state after disturbances corresponding to the verified power flow calculation results as the target operating state.
[0021] Add faults to the power flow calculation results of the target operating state, and perform transient power angle stability simulation on the power flow calculation results of the target operating state after adding faults to obtain transient data and transient power angle stability simulation results.
[0022] A training sample dataset is constructed based on transient data, faults, transient power angle stability simulation results, adjacency matrix, and impedance matrix.
[0023] Secondly, this application also provides a method for detecting transient power angle stability in a power system, the method comprising:
[0024] Obtain current multi-source equipment operating data of the target power system;
[0025] The current operating data of the multi-source equipment is input into the target transient power angle stability detection model to obtain the transient power angle stability detection results of the target power system;
[0026] The target transient power angle stability detection model is trained using the power system transient power angle stability detection model processing method described above.
[0027] Thirdly, this application also provides a transient power angle stability detection model processing device for a power system, the device comprising:
[0028] A dataset construction module is used to acquire multi-source equipment operation data of at least one power system; and to construct a training sample dataset based on the multi-source equipment operation data.
[0029] The target vector acquisition module is used to input the training sample data from the training sample dataset into the masking layer of the initial transient power angle stability detection model to obtain the masked data; input the masked data into the word embedding layer of the initial transient power angle stability detection model to obtain the word embedding vector; perform position encoding on the masked data to obtain the position encoding vector; and obtain the target vector based on the word embedding vector and the position encoding vector.
[0030] The prediction result acquisition module is used to obtain the attention feature vector based on the target vector through the attention layer of the initial transient power angle stability detection model; and to obtain the transient power angle stability prediction result based on the target vector and the attention feature vector through the feedforward layer and the output layer of the initial transient power angle stability detection model.
[0031] The model training module is used to iteratively train the initial transient power angle stability detection model based on the transient power angle stability prediction results and transient power angle stability label data to obtain the target transient power angle stability detection model; the target transient power angle stability detection model is used to determine whether the transient power angle of the power system is stable.
[0032] Fourthly, this application also provides a transient power angle stability detection device for a power system, the device comprising:
[0033] The data acquisition module is used to acquire the current operating data of the multi-source equipment in the target power system;
[0034] The detection result acquisition module is used to input the current multi-source equipment operation data into the target transient power angle stability detection model to obtain the transient power angle stability detection result of the target power system;
[0035] The target transient power angle stability detection model is trained using the power system transient power angle stability detection model processing method described above.
[0036] Fifthly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method steps of the first or second aspect.
[0037] Sixthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method steps of the first or second aspect.
[0038] In a seventh aspect, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the method steps of the first or second aspect.
[0039] The aforementioned transient power angle stability detection model processing method, device, computer equipment, computer-readable storage medium, and computer program product for power systems involve: acquiring operating data from at least one multi-source device in a power system; constructing a training sample dataset based on the multi-source device operating data; obtaining masked data based on the training sample data in the training sample dataset through a masking layer of the initial transient power angle stability detection model; obtaining word embedding vectors based on the masked data through a word embedding layer of the initial transient power angle stability detection model; performing position encoding on the masked data to obtain position encoding vectors; and then applying the word embedding vectors and position encoding vectors... The initial transient power angle stability detection model is used to obtain a target vector. Then, through the attention layer of the initial transient power angle stability detection model, an attention feature vector is obtained based on the target vector. Next, through the feedforward layer of the initial transient power angle stability detection model, a feature representation vector is obtained based on the target vector and the attention feature vector. Finally, through the output layer of the initial transient power angle stability detection model, a transient power angle stability prediction result is obtained based on the feature representation vector. Based on the transient power angle stability prediction result and the transient power angle stability label data of the power system, the initial transient power angle stability detection model is iteratively trained to obtain a target transient power angle stability detection model. The target transient power angle stability detection model is used to determine whether the transient power angle of the power system is stable. As described above, this application integrates multi-source equipment operation data from multiple power systems to construct a training sample dataset. Through the mask layer, word embedding layer, attention layer, feedforward layer, and output layer of the initial transient power angle stability detection model, the features of the training sample data in the training sample dataset are fully exploited to train the initial transient power angle stability detection model, thereby obtaining the target transient power angle stability detection model. This enhances the model generalization ability of the target transient power angle stability detection model and improves the accuracy of transient power angle stability detection in power systems. Attached Figure Description
[0040] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0041] Figure 1 This is a diagram illustrating the application environment of a transient power angle stability detection model processing method for a power system in one embodiment.
[0042] Figure 2 This is a flowchart illustrating a transient power angle stability detection model processing method for a power system in one embodiment.
[0043] Figure 3This is a schematic diagram illustrating the process of constructing a training sample dataset in one embodiment;
[0044] Figure 4 This is a flowchart illustrating a transient power angle stability detection method for a power system in one embodiment.
[0045] Figure 5 This is a structural block diagram of a transient power angle stability detection model processing device for a power system in one embodiment.
[0046] Figure 6 This is a structural block diagram of a transient power angle stability detection device for a power system in one embodiment;
[0047] Figure 7 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0048] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0049] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.
[0050] The transient power angle stability detection model processing method for power systems provided in this application embodiment can be applied to, for example... Figure 1In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104, or it can be located in the cloud or on another network server. Terminal 102 acquires multi-source equipment operation data of at least one power system; constructs a training sample dataset based on the multi-source equipment operation data; obtains masked data based on the training sample data in the training sample dataset through the masking layer of the initial transient power angle stability detection model; obtains word embedding vectors based on the masked data through the word embedding layer of the initial transient power angle stability detection model; performs position encoding on the masked data to obtain position encoding vectors; obtains a target vector based on the word embedding vector and the position encoding vector; obtains an attention feature vector based on the target vector through the attention layer of the initial transient power angle stability detection model; obtains a feature representation vector based on the target vector and the attention feature vector through the feedforward layer of the initial transient power angle stability detection model; obtains a transient power angle stability prediction result based on the feature representation vector through the output layer of the initial transient power angle stability detection model; iteratively trains the initial transient power angle stability detection model based on the transient power angle stability prediction result and the transient power angle stability label data of the power system to obtain a target transient power angle stability detection model; the target transient power angle stability detection model is used to determine whether the transient power angle of the power system is stable. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, drones, low-altitude aircraft, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, and projection equipment. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted displays. Head-mounted displays can be virtual reality (VR) devices, augmented reality (AR) devices, and smart glasses. Server 104 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0051] In one embodiment, such as Figure 2 As shown, a method for processing transient power angle stability detection models in power systems is provided. This embodiment applies this method to... Figure 1 Taking terminal 102 as an example, the method includes the following steps:
[0052] Step S210: Obtain the operation data of at least one multi-source device in a power system; construct a training sample dataset based on the multi-source device operation data.
[0053] Among them, the operating data of multi-source equipment includes, but is not limited to, the voltage amplitude, voltage phase angle, active power, and reactive power of generator equipment and load equipment.
[0054] In this embodiment of the application, historical multi-source equipment operation data of multiple power systems and real-time multi-source equipment operation data of multiple power systems can be obtained, and the multi-source equipment operation data can be integrated to construct a training sample dataset.
[0055] Step S220: Obtain masked data based on training sample data in the training sample dataset through the masking layer of the initial transient power angle stability detection model; obtain word embedding vectors based on the masked data through the word embedding layer of the initial transient power angle stability detection model; perform position encoding on the masked data to obtain position encoding vectors; obtain the target vector based on the word embedding vectors and position encoding vectors.
[0056] In this embodiment of the application, in order to make the model pay more attention to the network topology of the power system, the data is masked during the data input, so that the model pays more attention to the important nodes and edges in the network topology, while ignoring some unimportant nodes and edges, thus making the model have a better convergence effect.
[0057] Optionally, to reduce the risk of model overfitting, during masking, some random additions, deletions, and local attention enhancements can be performed on the network topology to improve the model's generalization ability to the network topology.
[0058] To better perceive the temporal nature of the input data, positional encoding is introduced. The discrete input data is transformed into a dense vector (word embedding vector) of dimension d_model using word embeddings. Specifically,
[0059]
[0060] Where X is the dense vector after word embedding, Embedding() is the word embedding method function, R is the regular representation of the matrix, batch_size is the length of a training batch, seq_len is the length of the original input data, and d_model is the dimension of the word embedding.
[0061] Simultaneously, sine and cosine functions are used to generate unique positional codes for the input data, while maintaining consistency between the data dimension and the word embedding data dimension. Specifically,
[0062]
[0063]
[0064] Where pos is the position of the current data in the input data sequence (counting from 0). If the length of the input data sequence is 100, then the value of pos is 0, 1, 2, ..., 99; i∈[0,d_model / 2-1], ensuring that each pair of dimensions shares a scaling factor.
[0065] The target vector is obtained by summing the word embedding vector and the positional encoding vector. Specifically,
[0066]
[0067] Where Z represents the target vector.
[0068] Step S230: Obtain the attention feature vector based on the target vector through the attention layer of the initial transient power angle stability detection model; obtain the feature representation vector based on the target vector and the attention feature vector through the feedforward layer of the initial transient power angle stability detection model; obtain the transient power angle stability prediction result based on the feature representation vector through the output layer of the initial transient power angle stability detection model.
[0069] In this embodiment, the attention layer introduces a graph attention mechanism on the basis of the original attention mechanism. The main function of the attention mechanism is to perform three different linear transformations on the input data to form Q, K, and V matrices.
[0070]
[0071] Where Q, K, and V are matrices formed by applying different linear transformations to the input data Z. , , For different linear transformation matrices, the data dimensions satisfy... d_h is the number of heads in the attention mechanism.
[0072] The generated Q, K, and V matrices are summed to form the final attention mechanism.
[0073]
[0074] Here, softmax() is a non-linear variation function that normalizes the attention weights.
[0075] Feedforward layers are used to perform non-linear transformations on input features to extract higher-level abstract features. Feedforward layers can include layer normalization layers and fully connected layers.
[0076] The output layer maps the output of the feedforward layer to the target space (such as classification categories, regression values, etc.) to generate the final prediction. Specifically, , output represents the output of the feedforward layer.
[0077] Step S240: Based on the transient power angle stability prediction results and the transient power angle stability label data of the power system, the initial transient power angle stability detection model is iteratively trained to obtain the target transient power angle stability detection model; the target transient power angle stability detection model is used to determine whether the transient power angle of the power system is stable.
[0078] In this embodiment, the mean squared error (MSE) is used as the loss function for model training feedback. Specifically,
[0079]
[0080] Where y represents the transient work angle stable label data. For the transient work angle stability prediction results, This is the Euclidean norm representation.
[0081] The Adam optimizer is used to update model parameters during training. The initial learning rate is set to lr = 0.003, and cosine annealing is used to adjust the learning rate. Specifically,
[0082]
[0083] in, This is the minimum value for adjusting the learning rate. This is the maximum value of the learning rate adjustment. For the current calculation round, This refers to all rounds within a single cycle.
[0084] To prevent overfitting during training, an early stopping mechanism is used to suppress the training process. Training is terminated early when the model's performance in the validation set no longer improves.
[0085] The aforementioned method for processing transient power angle stability detection models in power systems involves: acquiring operational data from at least one multi-source device in the power system; constructing a training sample dataset based on the multi-source device operational data; obtaining masked data from the training sample dataset using a masking layer of the initial transient power angle stability detection model; obtaining word embedding vectors from the masked data using a word embedding layer of the initial transient power angle stability detection model; performing position encoding on the masked data to obtain position encoding vectors; obtaining the target vector based on the word embedding vectors and position encoding vectors; and finally, performing initial transient power angle stability detection... The model's attention layer obtains an attention feature vector based on the target vector. Through the feedforward layer of the initial transient power angle stability detection model, a feature representation vector is obtained based on the target vector and the attention feature vector. Through the output layer of the initial transient power angle stability detection model, a transient power angle stability prediction result is obtained based on the feature representation vector. Based on the transient power angle stability prediction result and the transient power angle stability label data of the power system, the initial transient power angle stability detection model is iteratively trained to obtain a target transient power angle stability detection model. The target transient power angle stability detection model is used to determine whether the transient power angle of the power system is stable. As can be seen from the above, this application integrates multi-source equipment operation data from multiple power systems to construct a training sample dataset. Through the mask layer, word embedding layer, attention layer, feedforward layer, and output layer of the initial transient power angle stability detection model, the features of the training sample data in the training sample dataset are fully mined to train the initial transient power angle stability detection model and obtain the target transient power angle stability detection model. This enhances the model's generalization ability and improves the accuracy of transient power angle stability detection in the power system.
[0086] In one embodiment, a training sample dataset is constructed based on multi-source device operational data, including:
[0087] Step S212: Obtain the node admittance matrix of the power system based on the multi-source equipment operation data; obtain the adjacency matrix of the power system based on the node admittance matrix and the node characteristics of each node in the network topology of the power system; obtain the impedance matrix of the power system based on the node admittance matrix.
[0088] The node admittance matrix is a complex square matrix describing the admittance relationships between nodes in a power system, and it forms the basis for power flow calculations and short-circuit analysis. The adjacency matrix represents the physical connections between nodes in a power system. The impedance matrix is the inverse of the node admittance matrix.
[0089] In this embodiment, an NxN node admittance matrix Y is obtained from the power system, an adjacency matrix is constructed, and the diagonal element matrix is processed as unconnected. Specifically,
[0090]
[0091] in, This represents the value in the i-th row and j-th column of the adjacency matrix. , Let i and j be the node features of the i-th and j-th nodes. Let be the value in the i-th row and j-th column of the admittance matrix.
[0092] Convert the node admittance matrix into an impedance matrix, and construct the edge weight matrix according to the electrical distance pairs.
[0093]
[0094] Where Z is the impedance matrix of the power system and Y is the nodal admittance matrix of the power system.
[0095] Step S214: Add disturbances to the operating status of the equipment in the power system to obtain multiple operating states after disturbances; perform power flow calculations on each operating state after disturbances to obtain multiple power flow calculation results; verify the multiple power flow calculation results according to preset physical constraints, and determine the disturbance state corresponding to the verified power flow calculation result as the target operating state.
[0096] The types of disturbances include, but are not limited to, generator disturbances and load disturbances. Specifically, this involves adjusting generator output and randomly or directionally increasing or decreasing the load.
[0097] Power flow calculation is a calculation method used in power systems to determine the voltage magnitude, phase angle, and power distribution of each node in steady state.
[0098] Among them, the preset physical constraints include, but are not limited to, voltage constraints, generator processing constraints, and line capacity constraints.
[0099] In this embodiment, based on obtaining the initial reference operating point of the power system, a large number of post-disturbance operating modes reflecting the uncertainties of actual operation are generated by randomly perturbing the generator output and load demand. Subsequently, power flow calculations are performed on each post-disturbance operating mode, and feasible operating states that meet physical constraints are selected, thereby constructing a diverse and high-fidelity set of operating scenarios for subsequent analysis. Specifically, the post-disturbance operating state can be represented as:
[0100]
[0101] in, Let be the initial active power output of the i-th generator. Let be the value of the active power output disturbance for the i-th generator; Let be the initial reactive power output of the i-th generator. Let be the value of the reactive power output disturbance for the i-th generator; For the initial reactive power of the j-th load, Let be the value of reactive power output disturbance for the j-th load; g represents all controllable generator equipment within the power system; l represents all controllable load equipment in the power system; u(a,b) represents uniform distribution. This refers to the random adjustment ratio value for different devices.
[0102] Step S216: Add faults to the power flow calculation results of the target operating state, and perform transient power angle stability simulation on the power flow calculation results of the target operating state after adding faults to obtain transient data and transient power angle stability simulation results.
[0103] In this embodiment of the application, N-1 faults are added to the massive number of power flow solutions that meet the physical feasible operating conditions. The fault types can be three-phase short-circuit ground faults or other fault types, generating random faults.
[0104]
[0105] Where F represents the set of fault types, including but not limited to three-phase short-circuit to ground faults and other types of faults. The fault types were randomly selected. The fault location was randomly selected. The time when the fault occurred. This is the time to clear the fault. The duration of the fault.
[0106] Perform transient power angle stability simulation of the power system, and determine whether the system is transiently stable based on the maximum relative power angle difference of all generators in the system.
[0107]
[0108] in, The evaluation result of the k-th simulation scenario is represented by a binary label (0 or 1) used to determine whether the scenario is "stable". Let represent the angle of force of node i at time t; Let be the power angle difference between any two generators i and j; The maximum relative power angle difference threshold between any two generators is 360° in this embodiment; tc is the fault clearing time, and Tsim is the total simulation duration. When L(K)=1, it indicates that within the entire observation time window from the fault clearing time tc to the simulation end time Tsim, the maximum value of the power angle difference between any two generators in the system is always less than the given critical power angle threshold. This indicates that the transient power angle of the k-th simulation scenario is stable.
[0109] Step S218: Construct a training sample dataset based on transient data, faults, transient power angle stability simulation results, adjacency matrix, and impedance matrix.
[0110] In this embodiment of the application, the data structure of the training sample dataset is as follows:
[0111]
[0112] in, This represents the final constructed training sample dataset. This represents the input state data of the i-th sample power system. In this embodiment, the input state data is defined as follows: , This represents the transient voltage of each node in the i-th sample power system. This represents the transient phase angle of the voltage at each node in the i-th sample power system. This represents the transient active power output of the generator in the i-th sample power system. This represents the transient reactive power output of the generator in the i-th sample power system. This represents the transient active power output of the load in the i-th sample power system. This represents the transient reactive power output of the load in the i-th sample; This indicates the fault set in the power system of the i-th sample; This indicates that the i-th sample power system experienced a fault. The subsequent transient power angle stability result (stable / unstable). This represents the network topology of the i-th sample power system. Let represent the impedance matrix of the i-th sample power system.
[0113] To facilitate understanding of the above steps S212~S218, as follows Figure 3 The diagram illustrates a process for constructing a training sample dataset. This includes determining the adjacency matrix and impedance matrix of the power system, adding initial power flow random disturbances, generating multiple post-disturbance states, determining the operable state (target operating state) from these states, adding N-1 faults to the massive number of power flow solutions satisfying the physically feasible operating state, and calculating the power angle transient stability of the power system.
[0114] In one embodiment, the attention feature vector is obtained based on the target vector through the attention layer of the initial transient power angle stability detection model, including:
[0115] Step S221: Calculate the attention weights of the connection edges between nodes in the network topology of the power system according to the preset global shared parameter matrix; normalize the attention weights of the connection edges to obtain the normalized attention weights.
[0116] In this embodiment, a globally shared parameter matrix is constructed to calculate and update the attention weights of the connection edges between nodes in the network topology. Specifically,
[0117]
[0118] in, Let represent the attention weights of the connection edge between nodes i and j, LeakyReLU() be the non-linear activation function, and W be the globally shared parameter matrix. Let be the learnable weight vector, and ni and nj be the node features of nodes i and j in the network topology.
[0119] right Normalization is performed to obtain the normalized attention weights. Specifically,
[0120]
[0121] in, This represents the attention weights after normalization.
[0122] Step S222: For each node in the network topology, update the node features of the current node based on the node features of the current node's neighboring nodes, the normalized attention weights, and the global shared parameter matrix to obtain the updated node features.
[0123] In this embodiment, the normalized attention weights are weighted and summed with the node features of neighboring nodes, and then processed using a non-linear activation function to achieve dynamic aggregation of node features. Specifically,
[0124]
[0125] in, () represents a nonlinear activation function.
[0126] Step S223: Input the updated node features and target vector of each node into the attention layer of the initial transient power angle stability detection model to obtain the attention feature vector.
[0127] In this embodiment, by modifying the original attention mechanism Attention(Z), the self-attention mechanism function with graph attention is modified as follows:
[0128]
[0129] To enhance the model's ability to extract and fuse feature data, and to focus on information from different spatial and temporal dimensions, feature data from multiple attention layers are integrated to form a complete attention layer. Specifically,
[0130]
[0131]
[0132] in, Represents the i-th attention mechanism, and Concat() represents feature fusion of n heads.
[0133] In one embodiment, the feedforward layer includes a first normalization layer, a fully connected layer, and a second normalization layer; through the feedforward layer of the initial transient power angle stability detection model, a feature representation vector is obtained based on the target vector and the attention feature vector, including:
[0134] Step S224: Summate the target vector and the attention feature vector to obtain the first vector; input the first vector into the first normalization layer to obtain the first normalized vector.
[0135] Step S225: Input the first layer normalized vector into the fully connected layer to obtain the second vector;
[0136] Step S226: Summing the first normalized vector with the second vector to obtain the third vector; inputting the third vector into the second normalized layer to obtain the feature representation vector.
[0137] In this embodiment, the data passing through the attention layer is processed using two independent normalization layers and one fully connected layer to obtain a feature representation vector. Specifically,
[0138]
[0139]
[0140]
[0141] Where Z represents the target vector. This represents the attention feature vector, layerNorm() represents the layer normalization layer, and FFN() represents the fully connected layer.
[0142] In one embodiment, such as Figure 4As shown, a transient power angle stability detection method for a power system is provided. This embodiment illustrates the application of this method to a terminal. It is understood that this method can also be applied to a server, and further to a system including both a terminal and a server, and is implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0143] Step S410: Obtain the current multi-source equipment operation data of the target power system;
[0144] Step S420: Input the current multi-source device operating data into the target transient power angle stability detection model to obtain the transient power angle stability detection result of the target power system;
[0145] The target transient power angle stability detection model was trained using the aforementioned power system transient power angle stability detection model processing method.
[0146] In this embodiment of the application, the transient power angle stability detection model is used to predict the transient power angle stability of the target power system and obtain the transient power angle stability detection result of the target power system.
[0147] The aforementioned method for detecting transient power angle stability in a power system involves acquiring current multi-source equipment operating data of the target power system; inputting this data into a target transient power angle stability detection model to obtain the detection result; wherein the target transient power angle stability detection model is trained using the aforementioned power system transient power angle stability detection model processing method. As can be seen from the above, the target transient power angle stability detection model predicts the transient power angle stability of the target power system, thus improving the accuracy of transient power angle stability detection.
[0148] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.
[0149] Based on the same inventive concept, this application also provides a transient power angle stability detection model processing device for power systems to implement the aforementioned transient power angle stability detection model processing method. The solution provided by this device is similar to the implementation scheme described in the above method. Therefore, the specific limitations in one or more embodiments of the transient power angle stability detection model processing device for power systems provided below can be found in the limitations of the large model inference request processing method above, and will not be repeated here.
[0150] In one exemplary embodiment, such as Figure 5 As shown, a transient power angle stability detection model processing device for a power system is provided. The device includes:
[0151] Dataset construction module 510 is used to acquire multi-source equipment operation data of at least one power system; and to construct a training sample dataset based on the multi-source equipment operation data.
[0152] The target vector acquisition module 520 is used to input the training sample data in the training sample dataset into the masking layer of the initial transient power angle stability detection model to obtain the masked data; input the masked data into the word embedding layer of the initial transient power angle stability detection model to obtain the word embedding vector; perform position encoding on the masked data to obtain the position encoding vector; and obtain the target vector based on the word embedding vector and the position encoding vector.
[0153] The prediction result acquisition module 530 is used to obtain the attention feature vector based on the target vector through the attention layer of the initial transient power angle stability detection model; and to obtain the transient power angle stability prediction result based on the target vector and the attention feature vector through the feedforward layer and the output layer of the initial transient power angle stability detection model.
[0154] The model training module 540 is used to iteratively train the initial transient power angle stability detection model based on the transient power angle stability prediction results and transient power angle stability label data to obtain the target transient power angle stability detection model; the target transient power angle stability detection model is used to determine whether the transient power angle of the power system is stable.
[0155] Each module in the aforementioned transient power angle stability detection model processing device for power systems can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the corresponding operations of each module.
[0156] In one exemplary embodiment, such as Figure 6 As shown, a transient power angle stability detection device for a power system is provided. The device includes:
[0157] Data acquisition module 610 is used to acquire the current multi-source equipment operation data of the target power system;
[0158] The detection result acquisition module 620 is used to input the current multi-source equipment operation data into the target transient power angle stability detection model to obtain the transient power angle stability detection result of the target power system;
[0159] The target transient power angle stability detection model was trained using the aforementioned power system transient power angle stability detection model processing method.
[0160] Each module in the aforementioned transient power angle stability detection device for power systems can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the computer device's memory as software, so that the processor can call and execute the corresponding operations of each module.
[0161] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows. Figure 7 As shown, the computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores transient power angle stability detection model processing data or transient power angle stability detection data of the power system. The I / O interfaces are used for information exchange between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements a transient power angle stability detection model processing method or a transient power angle stability detection method for the power system.
[0162] Those skilled in the art will understand that Figure 7The structures shown are merely block diagrams of some structures related to the present application and do not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than shown in the figures, or combine certain components, or have different component arrangements. In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, which, when executed by the processor, causes the processor to perform the steps of the aforementioned transient power angle stability detection model processing method for a large power system or a transient power angle stability detection method for a power system. The steps of the transient power angle stability detection model processing method for a power system or a transient power angle stability detection method for a power system described above can be steps from the transient power angle stability detection model processing method for a power system or a transient power angle stability detection method for a power system in the various embodiments described above.
[0163] In one embodiment, a computer-readable storage medium is provided, storing a computer program. When executed by a processor, the computer program causes the processor to perform the steps of the aforementioned transient power angle stability detection model processing method or transient power angle stability detection method for a power system. The steps of the transient power angle stability detection model processing method or transient power angle stability detection method for a power system described above can be the steps in the aforementioned transient power angle stability detection model processing method or transient power angle stability detection method for a power system.
[0164] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, causes the processor to perform the steps of the aforementioned transient power angle stability detection model processing method for a power system or a transient power angle stability detection method for a power system. Here, the steps of the transient power angle stability detection model processing method for a power system or a transient power angle stability detection method for a power system can be the steps in the aforementioned transient power angle stability detection model processing method for a power system or a transient power angle stability detection method for a power system.
[0165] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0166] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0167] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0168] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for processing transient power angle stability detection models in power systems, characterized in that, The method includes: Obtain operational data from multiple sources of equipment in at least one power system; construct a training sample dataset based on the operational data from these multiple sources of equipment; The masked data is obtained based on the training sample data in the training sample dataset through the masking layer of the initial transient power angle stability detection model; the word embedding vector is obtained based on the masked data through the word embedding layer of the initial transient power angle stability detection model; the masked data is positionally encoded to obtain the position encoding vector; and the target vector is obtained based on the word embedding vector and the position encoding vector. Through the attention layer of the initial transient power angle stability detection model, an attention feature vector is obtained based on the target vector; through the feedforward layer of the initial transient power angle stability detection model, a feature representation vector is obtained based on the target vector and the attention feature vector; through the output layer of the initial transient power angle stability detection model, a transient power angle stability prediction result is obtained based on the feature representation vector. Based on the transient power angle stability prediction results and the transient power angle stability label data of the power system, the initial transient power angle stability detection model is iteratively trained to obtain the target transient power angle stability detection model; the target transient power angle stability detection model is used to determine whether the transient power angle of the power system is stable.
2. The method according to claim 1, characterized in that, The attention layer of the initial transient power angle stability detection model obtains an attention feature vector based on the target vector, including: Based on a preset global shared parameter matrix, the attention weights of the connection edges between each node in the network topology of the power system are calculated; the attention weights of the connection edges are normalized to obtain normalized attention weights. For each node in the network topology, the node features of the current node are updated based on the node features of the current node's neighboring nodes, the normalized attention weights, and the global shared parameter matrix to obtain the updated node features. The updated node features of each node and the target vector are input into the attention layer of the initial transient power angle stability detection model to obtain the attention feature vector.
3. The method according to claim 1, characterized in that, The feedforward layer includes a first normalization layer, a fully connected layer, and a second normalization layer; the feedforward layer, based on the target vector and the attention feature vector, passes through the initial transient power angle stability detection model. Obtain the feature representation vector, including: The target vector and the attention feature vector are summed to obtain a first vector; the first vector is input into the first normalization layer to obtain a first normalized vector. The first layer normalized vector is input into the fully connected layer to obtain the second vector; The first normalized vector is summed with the second vector to obtain a third vector; the third vector is then input into the second normalized layer to obtain the feature representation vector.
4. The method according to claim 1, characterized in that, The step of constructing a training sample dataset based on the multi-source device operating data includes: Based on the operating data of the multi-source devices, the node admittance matrix of the power system is obtained; based on the node admittance matrix and the node characteristics of each node in the network topology of the power system, the adjacency matrix of the power system is obtained; based on the node admittance matrix, the impedance matrix of the power system is obtained. The operating state of the equipment in the power system is disturbed to obtain multiple operating states after disturbance; power flow calculation is performed on each of the operating states after disturbance to obtain multiple power flow calculation results; the multiple power flow calculation results are verified according to preset physical constraints, and the operating state after disturbance corresponding to the verified power flow calculation result is determined as the target operating state. Add faults to the power flow calculation results of the target operating state, and perform transient power angle stability simulation on the power flow calculation results of the target operating state after adding faults to obtain transient data and transient power angle stability simulation results. The training sample dataset is constructed based on the transient data, the fault, the transient power angle stability simulation results, the adjacency matrix, and the impedance matrix.
5. A method for detecting transient power angle stability in a power system, characterized in that, The method includes: Obtain current multi-source equipment operating data of the target power system; The current operating data of the multi-source equipment is input into the target transient power angle stability detection model to obtain the transient power angle stability detection result of the target power system; The target transient power angle stability detection model is trained using the power system transient power angle stability detection model processing method as described in any one of claims 1 to 4.
6. A transient power angle stability detection model processing device for a power system, characterized in that, The device includes: A dataset construction module is used to acquire multi-source equipment operation data of at least one power system; and to construct a training sample dataset based on the multi-source equipment operation data. The target vector acquisition module is used to input the training sample data in the training sample dataset into the masking layer of the initial transient power angle stability detection model to obtain masked data; input the masked data into the word embedding layer of the initial transient power angle stability detection model to obtain word embedding vectors; perform position encoding on the masked data to obtain position encoding vectors; and obtain the target vector based on the word embedding vectors and the position encoding vectors. The prediction result acquisition module is used to obtain an attention feature vector based on the target vector through the attention layer of the initial transient power angle stability detection model; and to obtain the transient power angle stability prediction result based on the target vector and the attention feature vector through the feedforward layer and output layer of the initial transient power angle stability detection model. The model training module is used to iteratively train the initial transient power angle stability detection model based on the transient power angle stability prediction results and transient power angle stability label data to obtain a target transient power angle stability detection model; the target transient power angle stability detection model is used to determine whether the transient power angle of the power system is stable.
7. A transient power angle stability detection device for a power system, characterized in that, The device includes: The data acquisition module is used to acquire the current operating data of the multi-source equipment in the target power system; The detection result acquisition module is used to input the current multi-source equipment operation data into the target transient power angle stability detection model to obtain the transient power angle stability detection result of the target power system; The target transient power angle stability detection model is trained using the power system transient power angle stability detection model processing method as described in any one of claims 1 to 4.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method described in any one of claims 1 to 4 or claim 5.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method described in any one of claims 1 to 4 or claim 5.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method described in any one of claims 1 to 4 or claim 5.