Efficient microgrid vulnerability assessment method and device based on graph attention network

By constructing a radial topology structure and graph attention network of the microgrid, the problems of low computational efficiency and insufficient accuracy in microgrid vulnerability assessment are solved, a fast and accurate vulnerability assessment method is provided, and the contribution of key nodes is revealed, thereby improving data quality and model training efficiency.

CN119885862BActive Publication Date: 2025-09-05NAT UNIV OF DEFENSE TECH
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing microgrid vulnerability assessment methods have low computational efficiency, insufficient accuracy and lack of interpretability. Data acquisition is difficult, especially the limited labeled data for various damage scenarios. Existing methods also fail to model the complex relationship between the structure and electrical characteristics of microgrids.

Method used

By constructing a radial topology of the microgrid, setting the electrical parameters of nodes and lines, randomly generating damage scenarios, performing area division and solving the optimal power flow problem, and combining graph attention network and self-attention pooling to build a neural network evaluation model, training the key features of nodes and lines, dynamically assigning node weights, and revealing vulnerability contributions.

Benefits of technology

It achieves fast and accurate microgrid vulnerability assessment, improves data quality and model training efficiency, provides interpretable key node contribution analysis, and significantly improves assessment efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119885862B_ABST
    Figure CN119885862B_ABST
Patent Text Reader

Abstract

The present invention discloses an efficient microgrid vulnerability assessment method and device based on a graph attention network. The method initializes the microgrid by constructing a radial topology structure of the microgrid; randomly generates a microgrid damage scenario based on the importance indicators of nodes and lines; obtains isolated areas of the microgrid based on the damaged radial topology; solves the optimal power flow problem for the isolated areas to obtain vulnerability data, and performs resampling and feature selection processing to obtain key features of nodes and lines; constructs a neural network assessment model and trains the neural network assessment model to obtain a trained neural network assessment model; uses the neural network assessment model to perform real-time vulnerability assessment of the microgrid under a set scenario and outputs the contribution of nodes in the microgrid to the vulnerability. The present invention solves the problems of low computational efficiency, insufficient accuracy, and poor model interpretability in existing microgrid vulnerability assessment methods.
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 integrate distributed energy resources and loads to provide localized power supply for scenarios such as isolated islands. Microgrid vulnerability assessment is crucial for optimal design and risk prevention. 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 requiring rapid response.

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

[0005] Third, data acquisition is difficult, especially the limited labeled data for various damage 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. This method solves the problems of low computational efficiency, insufficient accuracy and poor model interpretability existing in existing microgrid vulnerability assessment methods by combining Monte Carlo simulation and machine learning technology.

[0009] To achieve the above objectives, the present invention provides the following technical solution: an efficient microgrid vulnerability assessment method based on 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] Randomly generate a destruction scenario of the microgrid according to the importance indexes of the nodes and lines; destroy the radial topology of the microgrid using the destruction scenario to obtain a radial topology after destruction;

[0012] According to the radial topology structure after the failure, 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 an 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 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;

[0016] The trained neural network evaluation 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, destruction probabilities are 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 solution for an efficient microgrid vulnerability assessment method based on graph attention networks, 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, during the resampling and feature selection process of the vulnerability data, the data distribution of several damage scenarios is balanced through resampling technology; and 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.

[0025] As a preferred solution for 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 through 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 k-th head, is the set of nodes adjacent to node i;

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

[0031]

[0032] Where 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] Where Z graph is the global graph-level representation; Z i is the node embedding 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, which is based on the above efficient microgrid vulnerability assessment method based on a graph attention network, including:

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

[0043] A destruction scenario generation and processing module is used to randomly generate a destruction scenario of the microgrid based on the importance indexes of the nodes and lines; destroy the radial topology of the microgrid using the destruction scenario to obtain the radial topology after destruction;

[0044] A microgrid isolated area acquisition module is used to divide the microgrid into regions according to the radial topology structure after the failure, and 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, configured to perform resampling and feature selection processing on 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 input, and the expected load loss rate value is used as a label to train the neural network evaluation model 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 based on the importance indicators of the nodes and lines, the destruction probability is randomly assigned based on 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.

[0055] As a preferred solution for an efficient microgrid vulnerability assessment device based on a graph attention network, in the vulnerability data acquisition module, when 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 limit and node voltage amplitude limit.

[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 through resampling technology; and the key features of the nodes and lines are selected through feature selection technology; the key features include: node voltage, load power, generated power, node type and line impedance.

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

[0058] The complex relationship between nodes and their neighbors in the microgrid is captured through 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 k-th head, is the set of nodes adjacent to node i;

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

[0063]

[0064] Where 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] Where Z graph is the global graph-level representation; Z i is the node embedding 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 index of the nodes and lines; destroys the radial topology structure of the microgrid through the destruction scenario to obtain a radial topology structure after destruction; divides the microgrid into regions according to the radial topology structure after destruction 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 indicator of the microgrid to obtain vulnerability data; resamples and performs feature selection processing 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 input 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; uses the trained neural network evaluation model to perform real-time vulnerability evaluation on the microgrid under the set scenario and outputs the contribution of the nodes in the microgrid to the vulnerability. This paper proposes an efficient vulnerability assessment framework that combines Monte Carlo simulation and graph attention networks, enabling rapid and accurate assessment of microgrid vulnerability. It also proposes a locally interpretable neural network model (GAT-S) based on self-attention pooling, which dynamically assigns node weights and reveals the contribution of key nodes in a microgrid to vulnerability. This paper also provides an efficient data generation and preprocessing process, significantly improving data quality and model training efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] To more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for the embodiments or the description of the prior art. Obviously, the drawings described below are merely exemplary, and those skilled in the art can, without inventive effort, derive other implementation drawings based on the provided drawings.

[0075] The structures, proportions, sizes, etc. illustrated in this specification are intended solely to complement the contents disclosed herein and to facilitate understanding and reading by persons skilled in the art. They are not intended to limit the conditions under which the present invention may be implemented and therefore have no substantive technical significance. Any structural modifications, changes in proportions, or adjustments in sizes, without affecting the efficacy and objectives of the present invention, shall remain within the scope of the technical contents disclosed herein.

[0076] Figure 1This is a 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 This is 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 Schematic diagram of a neural network assessment model in the efficient microgrid vulnerability assessment method based on 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 describes the implementation of the present invention using specific embodiments. Those skilled in the art will readily understand the other advantages and benefits of the present invention from the disclosure herein. Obviously, the embodiments described are only a portion of the present invention, not all of it. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without inventive effort are intended to fall 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 building a radial topology of the microgrid and setting the electrical parameters of the nodes and lines.

[0084] S2. randomly generating a destruction scenario of the microgrid based on the importance indexes of the nodes and lines; destroying the radial topology of the microgrid using the destruction scenario to obtain a radial topology after destruction;

[0085] S3. Divide the microgrid into regions according to the radial topology structure after the failure to obtain isolated regions of the microgrid;

[0086] S4. Solving the optimal power flow problem for the isolated area to calculate an expected load loss rate; using the expected load loss rate as a vulnerability indicator of the microgrid to obtain vulnerability data;

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

[0088] S6. Construct a neural network evaluation model based on a graph attention network and self-attention pooling; take the key features of the nodes and lines as input, and the expected load loss rate value as a label, and train the neural network evaluation model 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 of the microgrid and setting electrical parameters of nodes and lines;

[0091] Specifically, the topology of the microgrid is constructed using a random tree generation strategy to meet the constraints of the radial topology. Specifically, starting with a node as the root node, existing nodes are randomly selected as parent nodes, and 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 actual design requirements of the 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] Where θ 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 i-th line; is the maximum power limit;

[0101] Power balance constraints for nodes.

[0102]

[0103] Where, 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 of the microgrid is destroyed by the destruction scenario to obtain a radial topology after destruction;

[0105] Specifically, unlike 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 radial topology structure after the failure to obtain isolated regions of the microgrid;

[0107] Specifically, after the attack, 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, an optimal power flow problem is solved for each isolated region to determine the power distribution among the remaining nodes and lines. The optimization objective is to minimize load loss, subject to constraints such as the power balance equation and line capacity limits. The resulting vulnerability index, the expected load loss rate, 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, the sample distribution of microgrid attack scenario data generated by traditional Monte Carlo simulation (MCS) often suffers from significant imbalance. For example, some attack scenarios have far more samples than others. This can lead to insufficient learning of a small number of sample scenarios during training, thereby reducing the model's generalization ability. To address this issue, this paper adopts a probability-based resampling method to balance the data.

[0112] First, the dataset 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 dataset 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] Where, is the indicator function, when L i Falling into the Bin interval 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, the interval with a smaller number of samples has a larger sampling weight, while the interval with a larger number of samples has a smaller sampling weight.

[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 dataset is randomly resampled, using a combination of oversampling and undersampling to balance the number of samples in each interval, thereby improving the model's ability to learn different attack scenarios.

[0122] After 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 structural 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 differences in feature dimensions using the Z-score method. The normalized features have zero mean and unit variance, which helps accelerate the model's gradient descent and improve training stability.

[0133] In this embodiment, in step S6, a neural network evaluation model is constructed based on a 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 used as a label, and the neural network evaluation model is trained to obtain the trained neural network evaluation model;

[0134] Specifically, such as Figure 3As shown in Figure 3, the model structure includes two graph attention convolutional layers, a self-attention pooling layer, and a fully connected layer. The first graph attention convolutional layer uses a multi-head attention mechanism to update node embeddings by aggregating features of neighboring nodes and edges; the second graph attention convolutional layer uses a single-head attention mechanism to further extract global features. Each layer includes 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 into 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 adjacent 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 k-th 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] Where 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 via supervised learning, with model parameters updated via gradient descent. The loss function measures the difference between the predicted output and the labels obtained through Monte Carlo simulation. The GAT-S model integrates a graph attention network and self-attention pooling 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 neural network evaluation model is trained using supervised learning, using the node and edge features of the microgrid as input and the expected load loss rate generated by Monte Carlo simulation as the label. The optimization algorithm is the Adam optimizer, and the learning rate is set to 0.001. The loss function of the model is 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 assessment model is trained, the GAT-S model can assess the vulnerability of microgrids in any given scenario in real time. By analyzing attention weights, the contribution of key nodes to microgrid vulnerability can be revealed, thereby improving the model's interpretability.

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

[0169] The experiments were conducted on a computer equipped with an AMD Ryzen 75800H CPU (3.2GHz) and an RTX 3060 GPU. All code was implemented in Python. The constructed case included 100 microgrid instances with 33, 66, and 100 nodes. The load power of each node was randomly distributed in the interval [0.1MW, 0.5MW]. 15% of the nodes were randomly assigned generators, with the total generator power capped at 120% of the total load to ensure power balance. The microgrid's line topology was generated using a random tree method to ensure that the radial topology constraints were met.

[0170] The GAT-S model takes as input the node characteristics, line characteristics, and adjacency matrix of the microgrid, and outputs a predicted vulnerability value for the microgrid. The loss function is the mean squared error. For each experimental instance (33, 66, and 100 nodes), 1000 training samples and 100 test samples are generated, respectively. Training lasts for 100 epochs, and the model converges after 50 epochs. The experiment uses the microgrid vulnerability simulated by the MCS as a baseline to calculate the mean squared error (MSE) of the GAT-S prediction results. The experiment also compares several other advanced machine learning methods, including deep neural networks (DNNs), Bayesian additive regression trees (BARTs), and graph neural networks (GNNs).

[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, significantly outperforming other machine learning models. In addition, the calculation can be completed within 1 second in all experimental cases.

[0174] Experimental results demonstrate that the proposed GAT-S-based microgrid vulnerability assessment framework outperforms existing methods in terms of accuracy, efficiency, and interpretability. Compared to traditional Monte Carlo simulation methods, this approach significantly reduces computational costs, providing important support for microgrid design optimization and risk prevention.

[0175] In summary, the present invention initializes the microgrid by constructing a radial topology structure of a microgrid, setting electrical parameters of nodes and lines; randomly generating a destruction scenario of the microgrid according to the importance indexes of nodes and lines; destroying the radial topology structure of the microgrid through the destruction scenario to obtain a damaged radial topology structure; dividing the microgrid into regions according to the damaged radial topology structure to obtain isolated areas of the microgrid; solving the optimal power flow problem for the isolated areas to calculate 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 processing of the vulnerability data to obtain key features of nodes and lines; constructing a neural network evaluation model based on graph attention network and self-attention pooling; using the key features of the nodes and lines as input 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; performing real-time vulnerability evaluation on the microgrid under the set scenario through the trained neural network evaluation model, and outputting the contribution of the nodes in the microgrid to the vulnerability. This paper proposes an efficient vulnerability assessment framework that combines Monte Carlo simulation and graph attention networks, enabling rapid and accurate assessment of microgrid vulnerability. It also proposes a locally interpretable neural network model (GAT-S) based on self-attention pooling, which dynamically assigns node weights and reveals the contribution of key nodes in a microgrid to vulnerability. This paper also provides an efficient data generation and preprocessing process, significantly improving data quality and model training efficiency.

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

[0177] It should be noted that the above description is limited to some embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in an order different from that described in the above embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In certain 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, comprising:

[0180] The microgrid initialization module 001 is used to initialize the microgrid by constructing a radial topology 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 based on the importance indexes of the nodes and lines; destroy the radial topology of the microgrid using the destruction scenario to obtain the radial topology after destruction;

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

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

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

[0185] A neural network evaluation model construction and training module 006 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;

[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, during the process of constructing the radial topology of the microgrid, the radial topology is constructed using 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 based on the importance indicators of the nodes and lines, the destruction probability is randomly assigned based on 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.

[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 through resampling technology; and the key features of the nodes and lines are obtained through feature selection technology. The key features include: node voltage, load power, generated power, 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 through 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 k-th head, is the set of nodes adjacent to node i;

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

[0201]

[0202] Where 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] Where Z graph is the global graph-level representation; Z i is the node embedding 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, etc. 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 no further details will be given 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. The program code includes instructions for executing the efficient microgrid vulnerability assessment method based on a graph attention network of embodiment 1 or any possible implementation thereof.

[0214] Computer-readable storage media can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).

[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, which is implemented by reading software code stored in a memory. The memory can be integrated into the processor or 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 one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode.

[0220] Obviously, those skilled in the art will appreciate that the various modules or steps of the present invention described above can be implemented using a general-purpose computing system. They can be centralized on a single computing system or distributed across a network of multiple computing systems. Alternatively, they can be implemented using program code executable by a computing system, and thus, they can be stored in a storage system and executed by the computing system. In some cases, the steps shown or described herein can be performed in a different order than that shown, or they can be fabricated into separate integrated circuit modules, or multiple modules or steps can be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.

[0221] Although the present invention has been described in detail above using general descriptions and specific embodiments, it will be apparent to those skilled in the art that modifications and improvements may be made thereto. Therefore, such modifications and improvements, without departing from the spirit of the present invention, are intended to be within the scope of protection claimed herein.

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 of the microgrid through the destruction scenario to obtain a damaged radial topology; According to the radial topology structure after the failure, 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 an 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 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; The trained neural network evaluation 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 microgrid destruction scenarios based on the importance indicators of nodes and lines, destruction probabilities are randomly assigned based on 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.

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 in 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.

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 using 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 through 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 k-th head, is the set of nodes adjacent to node i; The expression of the second-layer graph attention convolution layer is: Where 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: Where Z graph is the global graph-level representation; Z i is the node embedding 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 the efficient microgrid vulnerability assessment method based on a graph attention network according to any one of claims 1 to 6, characterized in that: include: The microgrid initialization module is used to initialize the microgrid by building a radial topology of the microgrid and setting the electrical parameters of the nodes and lines; The destruction scenario generation and processing module is used to randomly generate microgrid destruction scenarios based on the importance indicators of nodes and lines; Destroying the radial topology of the microgrid through the destruction scenario to obtain a damaged radial topology; A microgrid isolated area acquisition module is used to divide the microgrid into regions according to the radial topology structure after the failure, and 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, configured to perform resampling and feature selection processing on 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 input, and the expected load loss rate value is used as a label to train the neural network evaluation model 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 based on the importance indicators of the nodes and lines, destruction probabilities are randomly assigned based on 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 is 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.