Efficient micro-grid vulnerability assessment method and device based on graph attention network

Through a graph attention network-based method, combined with Monte Carlo simulation and machine learning technology, the existing microgrid vulnerability assessment methods are solved, and the existing microgrid vulnerability assessment methods are low computational efficiency, insufficient accuracy and poor model interpretability are achieved, and the model interpretability is improved.

CN119885862AActive Publication Date: 2025-04-25NAT UNIV OF DEFENSE TECH
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202411931671.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2025-04-25
Estimated Expiration
2044-12-26

AI Technical Summary

Technical Problem

The existing microgrid vulnerability assessment methods have low computational efficiency, insufficient accuracy and poor model interpretability, making it difficult to quickly and accurately evaluate the vulnerability of microgrids.

Method used

Using a graph attention network-based method, combined with Monte Carlo simulation and machine learning technology, by constructing the radial topology of the microgrid, generating damage scenarios, solving optimal power flow problems, extracting key features, and building a neural network evaluation model for training to achieve real-time vulnerability assessment.

Benefits of technology

A fast and accurate microgrid vulnerability assessment is achieved, computing efficiency and model interpretability are improved, node weights can be dynamically allocated, and the contribution of key nodes to vulnerability is revealed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119885862A_ABST
    Figure CN119885862A_ABST
Patent Text Reader

Abstract

The invention discloses an efficient micro-grid vulnerability assessment method and device based on a graph attention network, and the method comprises the steps: building a radiation type topological structure of a micro-grid, and carrying out the initialization of the micro-grid; randomly generating a damage scene of the micro-grid according to the importance indexes of the nodes and the lines; obtaining an isolated region of the micro-grid according to the damaged radiation type topological structure; optimal power flow problem solving is carried out on the isolated region, vulnerability data are obtained, resampling and feature selection processing are carried out, and key features of nodes and lines are obtained; constructing a neural network evaluation model to train the neural network evaluation model to obtain a trained neural network evaluation model; and real-time vulnerability evaluation is carried out on the micro-grid in a set scene, and contribution of nodes in the micro-grid to vulnerability is output. According to the method, the problems of low calculation efficiency, insufficient accuracy and poor model interpretability in an existing microgrid vulnerability evaluation method are solved.
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 system assessment, and in particular to an efficient microgrid vulnerability assessment method and device based on a graph attention network. Background Art

[0002] As an independent power system, microgrids provide localized power supply for isolated islands and other scenarios by integrating distributed energy and loads. Vulnerability assessment of microgrids is crucial for optimal design and risk prevention and control. However, existing assessment methods have the following problems:

[0003] First, the traditional method based on Monte Carlo simulation (MCS) is computationally intensive and time-consuming, making it unsuitable for scenarios that require rapid response;

[0004] Second, although machine learning-based evaluation methods improve efficiency, they usually lack accuracy and interpretability, making them difficult for users to trust.

[0005] Third, data acquisition is difficult, especially limited labeled data for various destruction scenarios;

[0006] Fourth, existing methods do not adequately model the complex relationship between the structural and electrical characteristics of microgrids.

[0007] Therefore, how to invent an efficient, accurate and interpretable microgrid vulnerability assessment method has become an urgent problem to be solved. Summary of the invention

[0008] To this end, the present invention provides an efficient microgrid vulnerability assessment method and device based on graph attention network. The method solves the problems of low computational efficiency, insufficient accuracy and poor model interpretability existing in the existing microgrid vulnerability assessment methods by combining Monte Carlo simulation and machine learning technology.

[0009] In order to achieve the above object, the present invention provides the following technical solution: an efficient microgrid vulnerability assessment method based on a graph attention network, comprising:

[0010] Initialize the microgrid by building a radial topology of the microgrid and setting the electrical parameters of the nodes and lines;

[0011] According to the importance indexes of nodes and lines, randomly generate a destruction scenario of the microgrid; destroy the radial topology structure of the microgrid through the destruction scenario to obtain a destroyed radial topology structure;

[0012] According to the damaged radial topology, the microgrid is divided into regions to obtain isolated regions of the microgrid;

[0013] Solving the optimal power flow problem for the isolated area and calculating the expected load loss rate; using the expected load loss rate as a vulnerability indicator of the microgrid to obtain vulnerability data;

[0014] Resampling and feature selection are performed on the vulnerability data to obtain key features of nodes and lines;

[0015] Based on the graph attention network and self-attention pooling, a neural network evaluation model is constructed; the key features of the nodes and lines are taken as input, and the expected load loss rate value is a label, and the neural network evaluation model is trained to obtain the trained neural network evaluation model;

[0016] The trained neural network assessment model is used to perform real-time vulnerability assessment on the microgrid under the set scenario, and the contribution of the nodes in the microgrid to the vulnerability is output.

[0017] As a preferred solution of the efficient microgrid vulnerability assessment method based on graph attention network, in the process of constructing the radial topology of the microgrid, the radial topology is constructed by a random tree generation strategy; the constraints for constructing the radial topology include:

[0018] The topology of the microgrid is radial to avoid loop formation;

[0019] Node voltage amplitude constraints;

[0020] Power flow constraints for each line;

[0021] Power balance constraints for nodes.

[0022] As a preferred solution for an efficient microgrid vulnerability assessment method based on a graph attention network, in the process of randomly generating microgrid destruction scenarios according to the importance indicators of nodes and lines, the destruction probability is randomly assigned according to the importance indicators of nodes and lines, and nodes or lines are randomly selected for destruction to generate several destruction scenarios; the importance indicators include: degree centrality, betweenness centrality or eigenvector centrality.

[0023] As a preferred scheme for an efficient microgrid vulnerability assessment method based on graph attention network, in the process of solving the optimal power flow problem in the isolated area, the optimization goal is to minimize load losses; the solution constraints include: power balance equation, line capacity limitation and node voltage amplitude limitation.

[0024] As a preferred solution for an efficient microgrid vulnerability assessment method based on a graph attention network, in the process of resampling and feature selection of the vulnerability data, the data distribution of several damage scenarios is balanced by resampling technology; the key features of nodes and lines are obtained by feature selection technology; the key features include: node voltage, load power, power generation power, node type and line impedance.

[0025] As a preferred solution of the efficient microgrid vulnerability assessment method based on graph attention network, the neural network assessment model includes: graph attention convolution layer, self-attention pooling layer and fully connected layer;

[0026] The complex relationship between nodes and their neighbors in the microgrid is captured by the graph attention convolution layer; the first layer of the graph attention convolution layer adopts a multi-head attention mechanism; the second layer of the graph attention convolution layer adopts a single-head attention mechanism;

[0027] The expression of the first-layer graph attention convolution layer is:

[0028]

[0029] Where H is the number of attention heads; σ is the nonlinear activation function; h j is the feature vector of node j; h ij For edge e ij The eigenvector of k and is the learnable weight matrix of the kth attention head; is the attention coefficient of the kth head, is the set of nodes adjacent to node i;

[0030] The expression of the second-layer graph attention convolution layer is:

[0031]

[0032] In the formula, h′ j The node embedding of node j obtained by optimizing the first GAT convolutional layer;

[0033] Dynamically aggregate node features through the self-attention pooling layer to generate a global graph-level representation;

[0034] The expression of the global graph level representation is:

[0035]

[0036] In the formula, Z graph is the global graph-level representation; Z i Embed the nodes after aggregation;

[0037] Outputting a vulnerability assessment value of the microgrid through the fully connected layer;

[0038] The vulnerability assessment value expression of the microgrid is:

[0039]

[0040] Where Sigmoid is the activation function of the linear layer; Relu is the activation function of the fully connected layer; W fc and W out is the learnable weight matrix of the fully connected layer, b fc and b out is the corresponding learnable bias parameter.

[0041] The present invention also provides an efficient microgrid vulnerability assessment device based on a graph attention network, based on the above efficient microgrid vulnerability assessment method based on a graph attention network, comprising:

[0042] A microgrid initialization module is used to initialize the microgrid by constructing a radial topology of the microgrid and setting electrical parameters of nodes and lines;

[0043] A destruction scenario generation and processing module is used to randomly generate a destruction scenario of the microgrid according to the importance indexes of nodes and lines; destroy the radial topology structure of the microgrid through the destruction scenario to obtain the destroyed radial topology structure;

[0044] A microgrid isolated area acquisition module, used to divide the microgrid into regions according to the damaged radial topology structure to obtain isolated areas of the microgrid;

[0045] A vulnerability data acquisition module is used to solve the optimal power flow problem for the isolated area and calculate the expected load loss rate; the expected load loss rate is used as a vulnerability indicator of the microgrid to obtain vulnerability data;

[0046] A node and line key feature acquisition module, used for resampling and feature selection processing the vulnerability data to obtain key features of nodes and lines;

[0047] A neural network evaluation model construction and training module is used to construct a neural network evaluation model based on a graph attention network and self-attention pooling; the key features of the nodes and lines are used as inputs, and the expected load loss rate value is a label, and the neural network evaluation model is trained to obtain the trained neural network evaluation model;

[0048] The microgrid vulnerability assessment module is used to perform real-time vulnerability assessment on the microgrid under a set scenario through the trained neural network assessment model, and output the contribution of the nodes in the microgrid to the vulnerability.

[0049] As a preferred solution of an efficient microgrid vulnerability assessment device based on a graph attention network, in the microgrid initialization module, in the process of constructing the radial topology of the microgrid, the radial topology is constructed by a random tree generation strategy; the constraints for constructing the radial topology include:

[0050] The topology of the microgrid is radial to avoid loop formation;

[0051] Node voltage amplitude constraints;

[0052] Power flow constraints for each line;

[0053] Power balance constraints for nodes.

[0054] As a preferred solution for an efficient microgrid vulnerability assessment device based on a graph attention network, in the destruction scenario generation and processing module, in the process of randomly generating microgrid destruction scenarios according to the importance indicators of nodes and lines, the destruction probability is randomly assigned according to the importance indicators of nodes and lines, and nodes or lines are randomly selected for destruction to generate several destruction scenarios; the importance indicators include: degree centrality, betweenness centrality or eigenvector centrality.

[0055] As a preferred solution for an efficient microgrid vulnerability assessment device based on a graph attention network, in the vulnerability data acquisition module, in the process of solving the optimal power flow problem in the isolated area, the optimization goal is to minimize load losses; the solution constraints include: power balance equation, line capacity limitation and node voltage amplitude limitation.

[0056] As a preferred solution for an efficient microgrid vulnerability assessment device based on a graph attention network, in the node and line key feature acquisition module, during the resampling and feature selection process of the vulnerability data, the data distribution of several damage scenarios is balanced by the resampling technology; the key features of the nodes and lines are obtained by selecting the feature selection technology; the key features include: node voltage, load power, power generation power, node type and line impedance.

[0057] As a preferred solution of an efficient microgrid vulnerability assessment device based on a graph attention network, in the neural network assessment model construction and training module, the neural network assessment model includes: a graph attention convolution layer, a self-attention pooling layer and a fully connected layer;

[0058] The complex relationship between nodes and their neighbors in the microgrid is captured by the graph attention convolution layer; the first layer of the graph attention convolution layer adopts a multi-head attention mechanism; the second layer of the graph attention convolution layer adopts a single-head attention mechanism;

[0059] The expression of the first-layer graph attention convolution layer is:

[0060]

[0061] Where H is the number of attention heads; σ is the nonlinear activation function; h j is the feature vector of node j; h ij For edge e ij The eigenvector of k and is the learnable weight matrix of the kth attention head; is the attention coefficient of the kth head, is the set of nodes adjacent to node i;

[0062] The expression of the second-layer graph attention convolution layer is:

[0063]

[0064] In the formula, h′ j The node embedding of node j obtained by optimizing the first GAT convolutional layer;

[0065] Dynamically aggregate node features through the self-attention pooling layer to generate a global graph-level representation;

[0066] The expression of the global graph level representation is:

[0067]

[0068] In the formula, Z graph is the global graph-level representation; Z i Embed the nodes after aggregation;

[0069] Outputting a vulnerability assessment value of the microgrid through the fully connected layer;

[0070] The vulnerability assessment value expression of the microgrid is:

[0071]

[0072] Where Sigmoid is the activation function of the linear layer; Relu is the activation function of the fully connected layer; W fc and W out is the learnable weight matrix of the fully connected layer, b fc and b out is the corresponding learnable bias parameter.

[0073] The present invention has the following advantages: the present invention constructs a radial topology structure of a microgrid, sets electrical parameters of nodes and lines, and initializes the microgrid; randomly generates a destruction scenario of the microgrid according to the importance indexes of nodes and lines; destroys the radial topology structure of the microgrid through the destruction scenario to obtain a damaged radial topology structure; divides the microgrid into regions according to the damaged radial topology structure to obtain isolated regions of the microgrid; solves the optimal power flow problem for the isolated regions to calculate the expected load loss rate; uses the expected load loss rate as a vulnerability index of the microgrid to obtain vulnerability data; resamples and performs feature selection on the vulnerability data to obtain key features of nodes and lines; constructs a neural network evaluation model based on a graph attention network and self-attention pooling; uses the key features of the nodes and lines as inputs and the expected load loss rate value as a label to train the neural network evaluation model to obtain the trained neural network evaluation model; performs real-time vulnerability evaluation on the microgrid under a set scenario through the trained neural network evaluation model, and outputs the contribution of nodes in the microgrid to the vulnerability. This paper proposes an efficient vulnerability assessment framework combining Monte Carlo simulation and graph attention network, which can quickly and accurately assess the vulnerability of microgrids. This paper proposes a local interpretable neural network model GAT-S based on self-attention pooling, which can dynamically allocate node weights and reveal the contribution of key nodes in microgrids to vulnerability. This paper provides an efficient data generation and preprocessing process, which significantly improves data quality and model training efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] In order to more clearly illustrate the implementation methods of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for the implementation methods or the description of the prior art. Obviously, the drawings in the following description are only exemplary, and for ordinary technicians in this field, other implementation drawings can be derived from the provided drawings without creative work.

[0075] The structures, proportions, sizes, etc. illustrated in this specification are only used to match the contents disclosed in the specification so as to facilitate understanding and reading by persons familiar with the technology. They are not used to limit the conditions under which the present invention can be implemented, and therefore have no substantial technical significance. Any structural modification, change in proportion or adjustment of size shall still fall within the scope of the technical contents disclosed in the present invention without affecting the effects and purposes that can be achieved by the present invention.

[0076] Figure 1A schematic flow chart of an efficient microgrid vulnerability assessment method based on a graph attention network provided in Example 1 of the present invention;

[0077] Figure 2 A schematic diagram of a specific implementation process of the efficient microgrid vulnerability assessment method based on graph attention network provided in Example 1 of the present invention;

[0078] Figure 3 A schematic diagram of a neural network assessment model in an efficient microgrid vulnerability assessment method based on a graph attention network provided in Example 1 of the present invention;

[0079] Figure 4 This is a schematic diagram of the architecture of an efficient microgrid vulnerability assessment device based on a graph attention network provided in Example 2 of the present invention. DETAILED DESCRIPTION

[0080] The following is a description of the implementation of the present invention by specific embodiments. People familiar with the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. 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.

[0081] Example 1

[0082] See also Figure 1 and Figure 2 Embodiment 1 of the present invention provides an efficient microgrid vulnerability assessment method based on a graph attention network, comprising the following steps:

[0083] S1. Initialize the microgrid by constructing a radial topology of the microgrid and setting electrical parameters of nodes and lines;

[0084] S2. Randomly generate a destruction scenario of the microgrid according to the importance indexes of the nodes and lines; destroy the radial topology structure of the microgrid through the destruction scenario to obtain a destroyed radial topology structure;

[0085] S3. According to the damaged radial topology, the microgrid is divided into regions to obtain isolated regions of the microgrid;

[0086] S4, solving the optimal power flow problem for the isolated area, calculating and obtaining the expected load loss rate; using the expected load loss rate as a vulnerability indicator of the microgrid, and obtaining vulnerability data;

[0087] S5, resampling and feature selection processing the vulnerability data to obtain key features of nodes and lines;

[0088] S6. Based on the graph attention network and self-attention pooling, a neural network evaluation model is constructed; the key features of the nodes and lines are taken as input, and the expected load loss rate value is a label, and the neural network evaluation model is trained to obtain the trained neural network evaluation model;

[0089] S7. Perform real-time vulnerability assessment on the microgrid under the set scenario through the trained neural network assessment model, and output the contribution of the nodes in the microgrid to the vulnerability.

[0090] In this embodiment, in step S1, the microgrid is initialized by constructing a radial topology structure of the microgrid and setting electrical parameters of nodes and lines;

[0091] Specifically, the topology of the microgrid is constructed through a random tree generation strategy to meet the constraints of the radial topology. Specifically, starting from a node as the root node, the existing nodes are gradually randomly selected as parent nodes, and the new nodes are connected to the parent nodes until all nodes are included in the tree structure. Subsequently, the node and line parameters of the microgrid are initialized, and the active power injection of the generator is dynamically allocated according to the load demand. The line parameters include impedance and reactance, and the specific values ​​are set according to the design requirements of the actual microgrid. The initialized grid needs to meet the following electrical characteristic constraints:

[0092] The topology of the microgrid is radial to avoid loop formation;

[0093] |E|=|V|-1

[0094] Where E and V are the sets of buses and lines respectively;

[0095] Node voltage amplitude constraints;

[0096] |θ i -θ j |≤Δθ max ,

[0097] In the formula, θ i is the phase angle of bus i; θ j is the phase angle of bus j; Δθ max is the maximum phase angle limit;

[0098] Power flow constraints for each line;

[0099]

[0100] Where P ij and Q ij are the active and reactive power flows on the line respectively; V i is the ith line; is the maximum power limit;

[0101] Power balance constraints for nodes.

[0102]

[0103] In the formula, and are the active power and reactive power of the generator respectively; and are the active power and reactive power of the load respectively.

[0104] In this embodiment, in step S2, a destruction scenario of the microgrid is randomly generated according to the importance indexes of the nodes and lines; the radial topology structure of the microgrid is destroyed by the destruction scenario to obtain the destroyed radial topology structure;

[0105] Specifically, different from the traditional Nk attack mode, the present invention adopts a probabilistic attack model based on network importance, assigns normalized degree centrality to each node and line as the destruction probability, and randomly selects nodes or lines for destruction according to the assigned probability, thereby generating a variety of complex attack scenarios.

[0106] In this embodiment, in step S3, the microgrid is divided into regions according to the damaged radial topology structure to obtain isolated regions of the microgrid;

[0107] Specifically, after the attack, the isolated areas are divided according to the network topology to ensure that each isolated area meets the constraints of the radial topology.

[0108] In this embodiment, in step S4, the optimal power flow problem is solved for the isolated area to calculate the expected load loss rate; the expected load loss rate is used as a vulnerability indicator of the microgrid to obtain vulnerability data;

[0109] Specifically, the optimal power flow problem is solved for each isolated area to determine the power distribution of the remaining nodes and lines. The optimization goal is to minimize the load loss, and the constraints include the power balance equation and the line capacity limit. The calculated vulnerability index is the expected load loss rate, which is used to quantify the vulnerability of the microgrid.

[0110] In this embodiment, in step S5, the vulnerability data is subjected to resampling and feature selection processing to obtain key features of nodes and lines;

[0111] Specifically, in the microgrid attack scenario data generated by traditional Monte Carlo simulation (MCS), the sample distribution often has a significant imbalance problem. For example, the number of samples of some attack scenarios is much larger than that of other scenarios, which will lead to insufficient learning of a few sample scenarios during the training process, thereby reducing the generalization ability of the model. In order to solve this problem, the present invention adopts a probability-based resampling method to balance the data.

[0112] First, the data set is divided into several discrete intervals (bins) according to the average load value of the attack scenario (i.e., the load power of the microgrid after the attack), and the number of samples in each interval is counted. Assume that the data set contains N samples and the load value of the sample is L i (i=1,2,…,N), then the number of samples in each interval is n k It can be expressed as:

[0113]

[0114] In the formula, is the indicator function, when L i Falling into the interval Bin k When (L i ∈Bin k )=1, otherwise it is 0.

[0115] According to the number of samples in each interval n k Calculate the sampling weight w k , which is defined as:

[0116]

[0117] That is, intervals with fewer samples have larger sampling weights, while intervals with more samples have smaller sampling weights.

[0118] Assign sampling probability p to samples in the entire data set i :

[0119]

[0120] Where, L i ∈Bin k , K is the total number of intervals.

[0121] Finally, based on the above sampling probability p i The data set is randomly resampled, and a combination of oversampling and undersampling is used to balance the number of samples in each interval, thereby improving the model's ability to learn different attack scenarios.

[0122] After the data resampling is completed, the present invention further extracts and standardizes the key features of the microgrid to ensure that the model can fully capture the structure and electrical characteristics of the microgrid, while accelerating the model training process and improving the convergence of the model. The extracted features include the following categories:

[0123] 1. Node characteristics:

[0124] Node voltage amplitude V i : Represents the voltage of node i, in volts (V).

[0125] Load power P L,i : represents the load active power of node i, in kilowatts (kW).

[0126] Power generation P G,i : represents the active power generated by node i, in kilowatts (kW).

[0127] Node Type T i : Indicates the type of node i, with a value of 1 (generator) or 0 (load).

[0128] Node degree D i : represents the connectivity of node i, that is, the number of lines connected to node i.

[0129] 2. Line characteristics:

[0130] Line impedance R ij : Represents the resistance of the line between node i and node j, in ohms (Ω).

[0131] Line reactance X ij : Represents the reactance of the line between node i and node j, in ohms (Ω).

[0132] The above features are normalized to eliminate the differences between different feature dimensions, specifically using the Z-score normalization method. The normalized feature values ​​have zero mean and unit variance, which helps to accelerate the gradient descent process of the model and improve training stability.

[0133] In this embodiment, in step S6, a neural network evaluation model is constructed based on the graph attention network and self-attention pooling; the key features of the nodes and lines are taken as input, and the expected load loss rate value is a label, and the neural network evaluation model is trained to obtain the trained neural network evaluation model;

[0134] Specifically, Figure 3As shown in the figure, the model structure includes two layers of graph attention convolutional layers, self-attention pooling layers and fully connected layers. The first layer of graph attention convolutional layer adopts a multi-head attention mechanism to update the node embedding by aggregating the features of neighboring nodes and edges; the second layer of graph attention convolutional layer adopts a single-head attention mechanism to further extract global features. Each layer contains residual connections and layer normalization to improve training efficiency and stability. The self-attention pooling layer aggregates node features into a global graph-level representation by dynamically assigning node weights. Specifically, a learnable attention weight is assigned to each node, and the node embeddings are weighted summed according to the attention weights to generate a global graph-level feature representation. Finally, the fully connected layer maps the global graph-level features to the final vulnerability assessment value.

[0135] Specifically, the first GAT convolutional layer adopts a multi-head attention mechanism to update the node embedding by aggregating information from neighboring nodes and edges. Specifically, for each node i, the updated embedding is calculated as follows:

[0136]

[0137] Where H is the number of attention heads; σ is the nonlinear activation function; h j is the feature vector of node j; h ij For edge e ij The eigenvector of k and is the learnable weight matrix of the kth attention head; is the attention coefficient of the kth head;

[0138]

[0139] Among them, the attention score Defined as:

[0140]

[0141] Where a is the attention weight vector and [·‖·] represents concatenation. The attention mechanism allows the model to focus on the most relevant neighbor and edge features of each node.

[0142] In order to improve training stability and prevent gradient disappearance, residual connection ResidualFC is added and layer normalization LayerNorm is applied:

[0143] h′ i =LayerNorm(h′ i +ResidualFC(h i ))

[0144] The second GAT convolutional layer optimizes the node embeddings generated by the first layer. Unlike the first layer, it uses a single attention head. The updated node embeddings are calculated as follows:

[0145]

[0146] In the formula, h′ j The node embedding of node j obtained by optimizing the first GAT convolutional layer;

[0147] Among them, the attention coefficient α ij The calculation method of is similar to the first layer. Residual connection and layer normalization are applied again:

[0148] h″ i =LayerNorm(h″) i +ResidualFC(h′ i ))

[0149] After the GAT convolutional layer, the self-attention pooling mechanism aggregates node embeddings into a graph-level representation. Unlike traditional pooling methods (e.g., average pooling or max pooling), this mechanism assigns learnable importance weights to each node, enabling the model to focus on the nodes most relevant to the task. For each node i, its query, key, and value vectors are calculated as:

[0150] Q i =W q h″ i ,K i =W k h″ i ,V i =W v h″ i

[0151] Where W q , ,W k and W v is a learnable weight matrix.

[0152] The attention score between nodes is calculated as follows:

[0153]

[0154] The node embeddings are then aggregated as:

[0155]

[0156] The graph-level representation is obtained by averaging the aggregated node embeddings:

[0157]

[0158] Graph-level representation Zgraph It passes through a fully connected layer with a Relu activation function, followed by a final linear layer with a Sigmoid activation function to produce the output:

[0159]

[0160] Where Sigmoid is the activation function of the linear layer; Relu is the activation function of the fully connected layer; W fc and W out is the learnable weight matrix of the fully connected layer, b fc and b out is the corresponding learnable bias parameter.

[0161] The neural network assessment model is trained through supervised learning and the model parameters are updated through gradient descent. The loss function measures the difference between the predicted output and the label obtained by Monte Carlo simulation. The GAT-S model integrates a graph attention network and a self-attention pool to effectively learn node-level and graph-level representations. Its multi-level attention mechanism captures complex relationships in graph-structured data, thereby providing accurate and interpretable predictions for microgrid vulnerability assessment.

[0162] In this embodiment, the parameter design of the neural network assessment model includes: the input dimension of the first graph attention convolution layer is (4,64), the activation function is ReLU, and the Dropout probability is 0.2; the input dimension of the second graph attention convolution layer is (64,64), the activation function is ReLU, and the Dropout probability is 0.2; the input dimension of the self-attention pooling layer is (64,32), and the output is the global graph-level feature; the input dimension of the fully connected layer is (32,1), and the output is a single vulnerability assessment value.

[0163] In this embodiment, the training process of the neural network evaluation model takes the node and edge features of the microgrid as input, and the expected load loss rate generated by Monte Carlo simulation as the label, and is trained through supervised learning. The optimization algorithm is the Adam optimizer, and the learning rate is set to 0.001. The loss function of the model uses the mean squared error (MSE), which is defined as:

[0164]

[0165] Where N is the number of training samples; y i is the benchmark value label of the i-th sample (generated by MCS); is the predicted value of the model.

[0166] In this embodiment, in step S7, the trained neural network assessment model is used to perform real-time vulnerability assessment on the microgrid under the set scenario, and the contribution of the nodes in the microgrid to the vulnerability is output.

[0167] Specifically, after the neural network evaluation model is trained, the GAT-S model can evaluate the vulnerability of the microgrid in any given scenario in real time. By analyzing the attention weights, the contribution of key nodes to the vulnerability of the microgrid can be revealed, thereby improving the interpretability of the model.

[0168] In a possible embodiment, a simulation experiment example is provided as follows:

[0169] The experiment was conducted on a computer equipped with an AMD Ryzen 75800H CPU (3.2GHz) and an RTX 3060 GPU, and all codes were implemented in Python. The constructed case contains 100 microgrid instances with 33, 66, and 100 nodes. The load power of each node is randomly distributed in the interval [0.1MW, 0.5MW], and 15% of the nodes are randomly assigned with generators. The total power limit of the generator is set to 120% of the total load to ensure power balance. The line topology of the microgrid is generated by the random tree method to ensure that the radial topology constraints are met.

[0170] The GAT-S model inputs the node characteristics, line characteristics and adjacency matrix of the microgrid, and outputs the predicted value of the vulnerability of the microgrid; the loss function is the mean square error; the data scale is to generate 1000 training samples and 100 test samples for each experimental instance (33, 66 and 100 nodes); the training process lasts for 100 epochs, and the model converges after 50 epochs. The experiment uses the microgrid vulnerability simulated by MCS as the benchmark value to calculate the mean square error (MSE) of the prediction results of the GAT-S method. The experiment also compares several other advanced machine learning methods, such as deep neural network DNN, Bayesian additive regression tree BART and graph neural network GNN.

[0171]

[0172] Table 1 Comparison of experimental results

[0173] The experimental results are shown in Table 1. It can be seen that the mean square error of the GAT-S model in all test instances is lower than that of other methods, with the lowest reaching 0.001, which is significantly better than other machine learning models. In addition, the calculation can be completed within 1 second in all experimental cases.

[0174] Experimental results show that the proposed microgrid vulnerability assessment framework based on GAT-S is superior to existing methods in terms of accuracy, efficiency and interpretability. Compared with the traditional Monte Carlo simulation method, the proposed method significantly reduces the computational cost and provides important support for the design optimization and risk prevention of microgrids.

[0175] In summary, the present invention constructs a radial topology structure of a microgrid, sets electrical parameters of nodes and lines, and initializes the microgrid; randomly generates a destruction scenario of the microgrid according to the importance indexes of nodes and lines; destroys the radial topology structure of the microgrid through the destruction scenario to obtain a damaged radial topology structure; divides the microgrid into regions according to the damaged radial topology structure to obtain isolated areas of the microgrid; solves the optimal power flow problem for the isolated areas and calculates the expected load loss rate; uses the expected load loss rate as a vulnerability index of the microgrid to obtain vulnerability data; resamples and performs feature selection on the vulnerability data to obtain key features of nodes and lines; constructs a neural network evaluation model based on a graph attention network and self-attention pooling; uses the key features of the nodes and lines as inputs and the expected load loss rate value as a label to train the neural network evaluation model to obtain the trained neural network evaluation model; performs real-time vulnerability evaluation on the microgrid under the set scenario through the trained neural network evaluation model, and outputs the contribution of the nodes in the microgrid to the vulnerability. This paper proposes an efficient vulnerability assessment framework combining Monte Carlo simulation and graph attention network, which can quickly and accurately assess the vulnerability of microgrids. This paper proposes a local interpretable neural network model GAT-S based on self-attention pooling, which can dynamically allocate node weights and reveal the contribution of key nodes in microgrids to vulnerability. This paper provides an efficient data generation and preprocessing process, which significantly improves data quality and model training efficiency.

[0176] It should be noted that the method of the embodiment of the present disclosure can be performed by a single device, such as a computer or a server. The method of the present embodiment can also be applied in a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present disclosure, and the multiple devices will interact with each other to complete the described method.

[0177] It should be noted that the above describes some embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0178] Example 2

[0179] See also Figure 4 Embodiment 2 of the present invention also provides an efficient microgrid vulnerability assessment device based on a graph attention network, including:

[0180] The microgrid initialization module 001 is used to initialize the microgrid by constructing a radial topology structure of the microgrid and setting electrical parameters of nodes and lines;

[0181] The destruction scenario generation and processing module 002 is used to randomly generate a destruction scenario of the microgrid according to the importance indexes of the nodes and lines; destroy the radial topology structure of the microgrid through the destruction scenario to obtain the destroyed radial topology structure;

[0182] A microgrid isolated area acquisition module 003 is used to divide the microgrid into regions according to the damaged radial topology structure to obtain isolated areas of the microgrid;

[0183] The vulnerability data acquisition module 004 is used to solve the optimal power flow problem for the isolated area and calculate the expected load loss rate; the expected load loss rate is used as the vulnerability index of the microgrid to obtain vulnerability data;

[0184] The node and line key feature acquisition module 005 is used to resample and perform feature selection processing on the vulnerability data to obtain the key features of the nodes and lines;

[0185] The neural network evaluation model construction and training module 006 is used to construct a neural network evaluation model based on the graph attention network and self-attention pooling; the key features of the nodes and lines are used as input, and the expected load loss rate value is a label, and the neural network evaluation model is trained to obtain the trained neural network evaluation model;

[0186] The microgrid vulnerability assessment module 007 is used to perform real-time vulnerability assessment on the microgrid under a set scenario through the trained neural network assessment model, and output the contribution of the nodes in the microgrid to the vulnerability.

[0187] In this embodiment, in the microgrid initialization module 001, in the process of constructing the radial topology of the microgrid, the radial topology is constructed by a random tree generation strategy; the constraints for constructing the radial topology include:

[0188] The topology of the microgrid is radial to avoid loop formation;

[0189] Node voltage amplitude constraints;

[0190] Power flow constraints for each line;

[0191] Power balance constraints for nodes.

[0192] In this embodiment, in the destruction scenario generation and processing module 002, in the process of randomly generating destruction scenarios of the microgrid according to the importance indicators of the nodes and lines, the destruction probability is randomly allocated according to the importance indicators of the nodes and lines, and the nodes or lines are randomly selected for destruction to generate several destruction scenarios; the importance indicators include: degree centrality, betweenness centrality or eigenvector centrality.

[0193] In this embodiment, in the vulnerability data acquisition module 004, in the process of solving the optimal power flow problem for the isolated area, the optimization goal is to minimize load loss; the solution constraints include: power balance equation, line capacity limit and node voltage amplitude limit.

[0194] In this embodiment, in the node and line key feature acquisition module 005, during the resampling and feature selection process of the vulnerability data, the data distribution of several damage scenarios is balanced by the resampling technology; the key features of the nodes and lines are obtained by the feature selection technology; the key features include: node voltage, load power, power generation, node type and line impedance.

[0195] In this embodiment, in the neural network evaluation model construction and training module 006, the neural network evaluation model includes: a graph attention convolution layer, a self-attention pooling layer and a fully connected layer;

[0196] The complex relationship between nodes and their neighbors in the microgrid is captured by the graph attention convolution layer; the first layer of the graph attention convolution layer adopts a multi-head attention mechanism; the second layer of the graph attention convolution layer adopts a single-head attention mechanism;

[0197] The expression of the first-layer graph attention convolution layer is:

[0198]

[0199] Where H is the number of attention heads; σ is the nonlinear activation function; hj is the feature vector of node j; h ij For edge e ij The eigenvector of k and is the learnable weight matrix of the kth attention head; is the attention coefficient of the kth head, is the set of nodes adjacent to node i;

[0200] The expression of the second-layer graph attention convolution layer is:

[0201]

[0202] In the formula, h′ j The node embedding of node j obtained by optimizing the first GAT convolutional layer;

[0203] Dynamically aggregate node features through the self-attention pooling layer to generate a global graph-level representation;

[0204] The expression of the global graph level representation is:

[0205]

[0206] In the formula, Z graph is the global graph-level representation; Z i Embed the nodes after aggregation;

[0207] Outputting a vulnerability assessment value of the microgrid through the fully connected layer;

[0208] The vulnerability assessment value expression of the microgrid is:

[0209]

[0210] Where Sigmoid is the activation function of the linear layer; Relu is the activation function of the fully connected layer; W fc and W out is the learnable weight matrix of the fully connected layer, b fc and b out is the corresponding learnable bias parameter.

[0211] It should be noted that the information interaction, execution process and other contents between the modules of the above-mentioned system are based on the same concept as the method embodiment in Example 1 of the present application, and the technical effects they bring are the same as those of the method embodiment of the present application. For specific contents, please refer to the description in the method embodiment shown above in the present application, and will not be repeated here.

[0212] Example 3

[0213] Embodiment 3 of the present invention provides a non-transitory computer-readable storage medium, in which a program code of an efficient microgrid vulnerability assessment method based on a graph attention network is stored, and the program code includes instructions for executing embodiment 1 or any possible implementation method of the efficient microgrid vulnerability assessment method based on a graph attention network.

[0214] The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more available media. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).

[0215] Example 4

[0216] Embodiment 4 of the present invention provides an electronic device, including: a memory and a processor;

[0217] The processor and the memory communicate with each other via a bus; the memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to execute the efficient microgrid vulnerability assessment method based on a graph attention network of Example 1 or any possible implementation thereof.

[0218] Specifically, the processor can be implemented by hardware or by software. When implemented by hardware, the processor can be a logic circuit, an integrated circuit, etc.; when implemented by software, the processor can be a general-purpose processor implemented by reading software codes stored in a memory. The memory can be integrated in the processor or can be located outside the processor and exist independently.

[0219] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable systems. The computer instructions can be stored in a computer-readable storage medium, or transmitted from a computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center.

[0220] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing system, they can be concentrated on a single computing system, or distributed on a network composed of multiple computing systems, and optionally, they can be implemented by a program code executable by a computing system, so that they can be stored in a storage system and executed by the computing system, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0221] Although the present invention has been described in detail above by general description and specific embodiments, it is obvious to those skilled in the art that some modifications or improvements can be made to the present invention. Therefore, these modifications or improvements made without departing from the spirit of the present invention all belong to the scope of protection claimed by the present invention.

Claims

1. An efficient microgrid vulnerability assessment method based on graph attention network, characterized by: include: Initialize the microgrid by building a radial topology of the microgrid and setting the electrical parameters of the nodes and lines; Randomly generate microgrid destruction scenarios based on node and line importance indicators; Destroying the radial topology structure of the microgrid through the destruction scenario to obtain a damaged radial topology structure; According to the damaged radial topology, the microgrid is divided into regions to obtain isolated regions of the microgrid; Solving the optimal power flow problem for the isolated area and calculating the expected load loss rate; using the expected load loss rate as a vulnerability indicator of the microgrid to obtain vulnerability data; Resampling and feature selection are performed on the vulnerability data to obtain key features of nodes and lines; Based on the graph attention network and self-attention pooling, a neural network evaluation model is constructed; the key features of the nodes and lines are taken as input, and the expected load loss rate value is a label, and the neural network evaluation model is trained to obtain the trained neural network evaluation model; The trained neural network assessment model is used to perform real-time vulnerability assessment on the microgrid under the set scenario, and the contribution of the nodes in the microgrid to the vulnerability is output.

2. The efficient microgrid vulnerability assessment method based on graph attention network according to claim 1 is characterized in that: In the process of constructing the radial topology of the microgrid, the radial topology is constructed by a random tree generation strategy; the constraints for constructing the radial topology include: The topology of the microgrid is radial to avoid loop formation; Node voltage amplitude constraints; Power flow constraints for each line; Power balance constraints for nodes.

3. The efficient microgrid vulnerability assessment method based on graph attention network according to claim 2 is characterized in that: In the process of randomly generating destruction scenarios of the microgrid according to the importance indicators of the nodes and lines, the destruction probability is randomly assigned according to the importance indicators of the nodes and lines, and nodes or lines are randomly selected for destruction to generate several destruction scenarios; the importance indicators include: degree centrality, betweenness centrality or eigenvector centrality.

4. The efficient microgrid vulnerability assessment method based on graph attention network according to claim 3 is characterized in that: In the process of solving the optimal power flow problem for the isolated area, the optimization goal is to minimize load loss; the solution constraints include: power balance equation, line capacity limitation and node voltage amplitude limitation.

5. The efficient microgrid vulnerability assessment method based on graph attention network according to claim 4 is characterized in that: In the process of resampling and feature selection of the vulnerability data, the data distribution of several damage scenarios is balanced by resampling technology; The key features of nodes and lines are obtained through feature selection technology; The key features include: node voltage, load power, generated power, node type and line impedance.

6. The efficient microgrid vulnerability assessment method based on graph attention network according to claim 5 is characterized in that: The neural network evaluation model includes: a graph attention convolution layer, a self-attention pooling layer and a fully connected layer; The complex relationship between nodes and their neighbors in the microgrid is captured by the graph attention convolution layer; the first layer of the graph attention convolution layer adopts a multi-head attention mechanism; the second layer of the graph attention convolution layer adopts a single-head attention mechanism; The expression of the first-layer graph attention convolution layer is: Where H is the number of attention heads; σ is the nonlinear activation function; h j is the feature vector of node j; h ij For edge e ij The eigenvector of k and is the learnable weight matrix of the kth attention head; is the attention coefficient of the kth head, is the set of nodes adjacent to node i; The expression of the second-layer graph attention convolution layer is: In the formula, h′ j The node embedding of node j obtained by optimizing the first GAT convolutional layer; Dynamically aggregate node features through the self-attention pooling layer to generate a global graph-level representation; The expression of the global graph level representation is: In the formula, Z graph is the global graph-level representation; Z i Embed the nodes after aggregation; Outputting a vulnerability assessment value of the microgrid through the fully connected layer; The vulnerability assessment value expression of the microgrid is: Where Sigmoid is the activation function of the linear layer; Relu is the activation function of the fully connected layer; W fc and W out is the learnable weight matrix of the fully connected layer, b fc and b out is the corresponding learnable bias parameter.

7. An efficient microgrid vulnerability assessment device based on a graph attention network, adopting an efficient microgrid vulnerability assessment method based on a graph attention network according to any one of claims 1 to 6, characterized in that: include: A microgrid initialization module is used to initialize the microgrid by constructing a radial topology of the microgrid and setting electrical parameters of nodes and lines; A destruction scenario generation and processing module is used to randomly generate destruction scenarios of the microgrid according to the importance indicators of nodes and lines; Destroying the radial topology structure of the microgrid through the destruction scenario to obtain a damaged radial topology structure; A microgrid isolated area acquisition module, used to divide the microgrid into regions according to the damaged radial topology structure to obtain isolated areas of the microgrid; A vulnerability data acquisition module is used to solve the optimal power flow problem for the isolated area and calculate the expected load loss rate; the expected load loss rate is used as a vulnerability indicator of the microgrid to obtain vulnerability data; A node and line key feature acquisition module, used for resampling and feature selection processing the vulnerability data to obtain key features of nodes and lines; A neural network evaluation model construction and training module is used to construct a neural network evaluation model based on a graph attention network and self-attention pooling; the key features of the nodes and lines are used as inputs, and the expected load loss rate value is a label, and the neural network evaluation model is trained to obtain the trained neural network evaluation model; The microgrid vulnerability assessment module is used to perform real-time vulnerability assessment on the microgrid under a set scenario through the trained neural network assessment model, and output the contribution of the nodes in the microgrid to the vulnerability.

8. The efficient microgrid vulnerability assessment device based on graph attention network according to claim 7 is characterized in that: In the microgrid initialization module, in the process of constructing the radial topology of the microgrid, the radial topology is constructed by a random tree generation strategy; the constraints for constructing the radial topology include: The topology of the microgrid is radial to avoid loop formation; Node voltage amplitude constraints; Power flow constraints for each line; Power balance constraints for nodes.

9. The efficient microgrid vulnerability assessment device based on graph attention network according to claim 8 is characterized in that: In the destruction scenario generation and processing module, in the process of randomly generating destruction scenarios of the microgrid according to the importance indicators of the nodes and lines, the destruction probability is randomly allocated according to the importance indicators of the nodes and lines, and nodes or lines are randomly selected for destruction to generate several destruction scenarios; the importance indicators include: degree centrality, betweenness centrality or eigenvector centrality.

10. The efficient microgrid vulnerability assessment device based on graph attention network according to claim 9, characterized in that: In the vulnerability data acquisition module, in the process of solving the optimal power flow problem for the isolated area, the optimization goal is to minimize load loss; the solution constraints include: power balance equation, line capacity limit and node voltage amplitude limit.

Citation Information

Patent Citations

  • System and method for structure learning for graph neural networks

    CA3131843A1

  • Large power grid vulnerability evaluation method based on tide betweenness

    CN111160716A

  • Power network node vulnerability assessment method based on BP neural network

    CN115659833A

  • Power distribution network reconstruction capability evaluation and optimization method and system

    CN116628993A

  • Renewable energy source access micro-grid vulnerability assessment method under information attack

    CN117061380A