Robustness Analysis of AI Models in Critical Energy Systems

Pantelis Dogoulis    Matthieu Jimenez    Salah Ghamizi    Maxime Cordy    Yves Le Traon
Abstract

This paper analyzes the robustness of state-of-the-art AI-based models for power grid operations under the N1𝑁1N-1italic_N - 1 security criterion. While these models perform well in regular grid settings, our results highlight a significant loss in accuracy following the disconnection of a line.Using graph theory-based analysis, we demonstrate the impact of node connectivity on this loss. Our findings emphasize the need for practical scenario considerations in develo** AI methodologies for critical infrastructure.

Machine Learning, ICML

1 Introduction

The application of AI models has seen substantial growth across various industrial sectors, including manufacturing, transportation, and electricity. These models aim to replace costly traditional methods and improve computational efficiency. However, their deployment remains challenging due to unmet or unverified industrial criteria (Leyli Abadi et al., 2022). The deployment of unreliable AI models in critical infrastructure poses significant risks, potentially leading to severe or catastrophic failures with dire economic and societal consequences. In this paper, we study the robustness of state-of-the-art AI-based models in the context of power grids. Operating power grids requires a continuous assessment of their state, which can be costly especially the computation of power flow through grid lines. For Alternative Current (AC) grids, this problem is referred to as AC power flow and is traditionally addressed using the Newton-Raphson method, a classical numerical approach (Sereeter et al., 2019). This method yields results with negligible error but is rather slow and lacks flexibility with regard to grid evolution.

The AC power flow problem can be characterized by a system of nonlinear equations depending on the network configuration at each time point. The network configuration encompasses the loads, generations, and topology of the network, as well as, some intrinsic characteristics of the lines (i.e. reactance, resistance). Highly trained engineers (i.e. dispatchers) can simulate the state of the power grid using these methodologies to ensure operational security, maintaining current flow within specified thresholds.

Yet, as grid size increases, the computational complexity of this problem escalates. Adding to this, modern grids incorporate a growing amount of renewable energy sources, such as wind and solar, whose profiles are highly variable and dependent on factors like weather, leading to significant uncertainties and further complicating the problem (Aslam et al., 2021; Marot et al., 2020; Donnot et al., 2017).

Refer to caption
Figure 1: Example of a toy power grid featuring two generators and three loads. In the upper section of the image, an overflow in the transmission lines is depicted. To address this issue, the overloaded line is disconnected from the grid causing a topological change and necessitating a recalculation of the grid’s state.

Therefore, researchers have naturally started to investigate AI-based approaches to address the complexity of power flow prediction problems. This effort has been further motivated by the rise of Physics-Informed Machine Learning (Karniadakis et al., 2021), which enables a finer integration of physical laws involved in power flow within the models (Hu et al., 2020; Pagnier & Chertkov, 2021). Nevertheless, these studies lack focus on practical scenarios, resulting in inadequate frameworks for deploying these methods. Consequently, AI methods cannot yet be deemed industry-ready, as they have been minimally tested in industrial settings and are not suitable for real-time applications.

In the context of power grids, one critical assessment is the N1𝑁1N-1italic_N - 1 security criterion. This criterion is a fundamental reliability standard used in the operation of power grids. It ensures that the grid can withstand the failure of any single transmission line, without causing widespread outages or instability. Under this criterion, the power grid is expected to continue operating even after the loss of one of its lines (Figure 1). This necessitates sufficient redundancy and flexibility within the system to handle such contingencies. N1𝑁1N-1italic_N - 1 is crucial for maintaining the stability and reliability of power grids, as it helps prevent cascading failures and large-scale blackouts. Evaluating AI-based methods against it is thus essential to ensure their applicability and robustness in real-world scenarios. In real-time operating grids, the number of possible topological configurations increases significantly, making it computationally intensive to evaluate every potential state of the grid. While the Newton-Raphson method achieves negligible error in the N1𝑁1N-1italic_N - 1 scenario (0absent0\approx 0≈ 0), it becomes computationally inefficient as grid size increases, due to significantly longer computation times. Conversely, machine learning models provide rapid and reliable predictions for grids without any topological modification, leveraging only inference time and achieving speeds approximately 145 times faster on large grids (Lin et al., 2023). However, in the area of grid digitization, these models must also demonstrate robustness to topological modifications within the grid to ensure its security and reliable operation.
In this paper, we first demonstrate the safety limitation of recent AI-based approaches for powerflow computation and then conduct an error analysis based on node connectivity.

2 Background

2.1 Problem Description

First, we can think of the grid as a graph. The nodes represent the grid’s buses, which are connected through edges, i.e. the transmission lines. The buses are categorized into three primary types: PV, PQ, and slack bus. The PV buses represent grid generators that produce and inject energy, including renewable energy (RE) generators that introduce significant uncertainties into power grid control. The PQ buses represent the grid’s loads, which are modules that consume energy. The slack bus serves as a reference point for the grid operation, where the voltage angle θ𝜃\thetaitalic_θ is known.

The objective of the power flow prediction problem is to determine the current flowing through each transmission line based on inputs from the buses and the grid’s topology. Specifically, for generator buses, the active power (Pgsubscript𝑃𝑔P_{g}italic_P start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT) and voltage magnitude (Vmsubscript𝑉𝑚V_{m}italic_V start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT) are provided, whereas, for load buses, the active (Plsubscript𝑃𝑙P_{l}italic_P start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT) and reactive (Qlsubscript𝑄𝑙Q_{l}italic_Q start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT) powers are known. Mathematically, the problem can be expressed through the Kirchhoff’s equations.

{Pi=Vik=1nVk(Gikcos(θiθk)+Biksin(θiθk))Qi=Vik=1nVk(Giksin(θiθk)Bikcos(θiθk))casessubscript𝑃𝑖subscript𝑉𝑖superscriptsubscript𝑘1𝑛subscript𝑉𝑘subscript𝐺𝑖𝑘subscript𝜃𝑖subscript𝜃𝑘subscript𝐵𝑖𝑘subscript𝜃𝑖subscript𝜃𝑘otherwisesubscript𝑄𝑖subscript𝑉𝑖superscriptsubscript𝑘1𝑛subscript𝑉𝑘subscript𝐺𝑖𝑘subscript𝜃𝑖subscript𝜃𝑘subscript𝐵𝑖𝑘subscript𝜃𝑖subscript𝜃𝑘otherwise\begin{cases}P_{i}=V_{i}\sum_{k=1}^{n}V_{k}\left(G_{ik}\cos(\theta_{i}-\theta_% {k})+B_{ik}\sin(\theta_{i}-\theta_{k})\right)\\ Q_{i}=V_{i}\sum_{k=1}^{n}V_{k}\left(G_{ik}\sin(\theta_{i}-\theta_{k})-B_{ik}% \cos(\theta_{i}-\theta_{k})\right)\end{cases}{ start_ROW start_CELL italic_P start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = italic_V start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∑ start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT italic_V start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ( italic_G start_POSTSUBSCRIPT italic_i italic_k end_POSTSUBSCRIPT roman_cos ( italic_θ start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT - italic_θ start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ) + italic_B start_POSTSUBSCRIPT italic_i italic_k end_POSTSUBSCRIPT roman_sin ( italic_θ start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT - italic_θ start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ) ) end_CELL start_CELL end_CELL end_ROW start_ROW start_CELL italic_Q start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = italic_V start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∑ start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT italic_V start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ( italic_G start_POSTSUBSCRIPT italic_i italic_k end_POSTSUBSCRIPT roman_sin ( italic_θ start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT - italic_θ start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ) - italic_B start_POSTSUBSCRIPT italic_i italic_k end_POSTSUBSCRIPT roman_cos ( italic_θ start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT - italic_θ start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ) ) end_CELL start_CELL end_CELL end_ROW

(1)

In the above equations, the index denotes the buses of the grid and does not follow the aforementioned notation, where the index denotes the type of the bus. However the variables remain the same, so for example Pisubscript𝑃𝑖P_{i}italic_P start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT denotes the active power of the i𝑖iitalic_i-th bus regardless of its type (i.e. generator, load, slack). Moreover Giksubscript𝐺𝑖𝑘G_{ik}italic_G start_POSTSUBSCRIPT italic_i italic_k end_POSTSUBSCRIPT and Biksubscript𝐵𝑖𝑘B_{ik}italic_B start_POSTSUBSCRIPT italic_i italic_k end_POSTSUBSCRIPT denote two physical line properties, the conductance and susceptance respectively. Based on this system of equations, the current that flows from bus i𝑖iitalic_i to bus k𝑘kitalic_k is then calculated through a basic physic’s equation (Ohm’s Law):

Iik=Yik(ViVk)subscript𝐼𝑖𝑘subscript𝑌𝑖𝑘subscript𝑉𝑖subscript𝑉𝑘I_{ik}=Y_{ik}(V_{i}-V_{k})italic_I start_POSTSUBSCRIPT italic_i italic_k end_POSTSUBSCRIPT = italic_Y start_POSTSUBSCRIPT italic_i italic_k end_POSTSUBSCRIPT ( italic_V start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT - italic_V start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ) (2)

while the current injected in bus i𝑖iitalic_i, is calculated based on:

Ii=k=1nYikVksubscript𝐼𝑖superscriptsubscript𝑘1𝑛subscript𝑌𝑖𝑘subscript𝑉𝑘I_{i}=\sum_{k=1}^{n}Y_{ik}V_{k}italic_I start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = ∑ start_POSTSUBSCRIPT italic_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT italic_Y start_POSTSUBSCRIPT italic_i italic_k end_POSTSUBSCRIPT italic_V start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT (3)

In Eqs. 2 and 3, Yiksubscript𝑌𝑖𝑘Y_{ik}italic_Y start_POSTSUBSCRIPT italic_i italic_k end_POSTSUBSCRIPT is the element in the (i,k)𝑖𝑘(i,k)( italic_i , italic_k ) position of the admittance matrix Y𝑌Yitalic_Y. This matrix consists of the admittance values (i.e. physical characteristics of the transmission lines) between different nodes in the power grid.

Newton-Raphson method

Traditionally, AC power flow problem solvers use the Newton-Raphson method, linearizing power flow equations around an initial guess, 𝐱0superscript𝐱0\mathbf{x}^{0}bold_x start_POSTSUPERSCRIPT 0 end_POSTSUPERSCRIPT. The equations are represented as:

𝐅(𝐱)=[PiPiappr(𝐱)QiQiappr(𝐱)]=𝟎,𝐅𝐱matrixsubscript𝑃𝑖superscriptsubscript𝑃𝑖appr𝐱subscript𝑄𝑖superscriptsubscript𝑄𝑖appr𝐱0\mathbf{F}(\mathbf{x})=\begin{bmatrix}P_{i}-P_{i}^{\text{appr}}(\mathbf{x})\\ Q_{i}-Q_{i}^{\text{appr}}(\mathbf{x})\end{bmatrix}=\mathbf{0},bold_F ( bold_x ) = [ start_ARG start_ROW start_CELL italic_P start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT - italic_P start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT appr end_POSTSUPERSCRIPT ( bold_x ) end_CELL end_ROW start_ROW start_CELL italic_Q start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT - italic_Q start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT appr end_POSTSUPERSCRIPT ( bold_x ) end_CELL end_ROW end_ARG ] = bold_0 , (4)

where Pisubscript𝑃𝑖P_{i}italic_P start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT and Qisubscript𝑄𝑖Q_{i}italic_Q start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT are the specified active and reactive powers for each bus i𝑖iitalic_i, and Piapprsuperscriptsubscript𝑃𝑖apprP_{i}^{\text{appr}}italic_P start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT appr end_POSTSUPERSCRIPT and Qiapprsuperscriptsubscript𝑄𝑖apprQ_{i}^{\text{appr}}italic_Q start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT appr end_POSTSUPERSCRIPT are the calculated powers based on the state vector 𝐱𝐱\mathbf{x}bold_x (voltage magnitudes and angles). The iterative update is given by:

𝐱(k+1)=𝐱(k)𝐉1(𝐱(k))𝐅(𝐱(k)),superscript𝐱𝑘1superscript𝐱𝑘superscript𝐉1superscript𝐱𝑘𝐅superscript𝐱𝑘\mathbf{x}^{(k+1)}=\mathbf{x}^{(k)}-\mathbf{J}^{-1}(\mathbf{x}^{(k)})\mathbf{F% }(\mathbf{x}^{(k)}),bold_x start_POSTSUPERSCRIPT ( italic_k + 1 ) end_POSTSUPERSCRIPT = bold_x start_POSTSUPERSCRIPT ( italic_k ) end_POSTSUPERSCRIPT - bold_J start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT ( bold_x start_POSTSUPERSCRIPT ( italic_k ) end_POSTSUPERSCRIPT ) bold_F ( bold_x start_POSTSUPERSCRIPT ( italic_k ) end_POSTSUPERSCRIPT ) , (5)

where 𝐉𝐉\mathbf{J}bold_J is the Jacobian matrix of partial derivatives of 𝐅𝐅\mathbf{F}bold_F with respect to 𝐱𝐱\mathbf{x}bold_x. This process is repeated until reaching the convergence threshold defined by the user.
Unlike traditional numerical approaches, machine learning methods aim to predict current flows based on bus inputs and grid topology. These methods estimate the function f𝑓fitalic_f that:

f:(X,τ)I:𝑓𝑋𝜏𝐼f:(X,\tau)\rightarrow Iitalic_f : ( italic_X , italic_τ ) → italic_I (6)

where X𝑋Xitalic_X denotes the space of the inputs of the buses, τ𝜏\tauitalic_τ denotes the space of the grid’s topology and I𝐼Iitalic_I denotes the the output space.
The dimension of I𝐼Iitalic_I varies across studies and depends on the framework employed. Some research predicts the vector (Pi(P_{i}( italic_P start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, Qisubscript𝑄𝑖Q_{i}italic_Q start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, Visubscript𝑉𝑖V_{i}italic_V start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, θi)\theta_{i})italic_θ start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) for each bus, while others predict directly the vector (Ii,Iik)subscript𝐼𝑖subscript𝐼𝑖𝑘(I_{i},I_{ik})( italic_I start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT , italic_I start_POSTSUBSCRIPT italic_i italic_k end_POSTSUBSCRIPT ). Although using the Eqs. 2 and 3, one can infer the former vector from the latter and vice versa.

2.2 Related Work

In recent years, the demand for faster and more robust power grid simulators has increased due to the growing complexity of grid control problems and traditional simulation approaches (Sereeter et al., 2019; Kulworawanichpong, 2010; D’orto et al., 2021; Coffrin & Van Hentenryck, 2014; Capitanescu, 2016) have started to open the path for AI-based ones to meet rising computational requirements and the integration of renewable energy. One of the primary approaches was introduced by (Donon et al., 2020a) where the authors suggested a graph neural network architecture capable of calculating power flow and generalizing to small and medium-sized grids. The originality exists in the direct incorporation of Kirchhoff’s law into the optimization objective. Similarly, (Lin et al., 2023) introduced a graph-based architecture that also integrates Kirchhoff’s law into the loss function and employs a message-passing mechanism for feature propagation during training. Other relevant approaches include the work of (Bolz et al., 2019; Ghamizi et al., 2024), who suggested a graph-based convolutional neural network. (Donnot et al., 2018) also proposed a novel dropout mechanism (Srivastava et al., 2014) within a simple feed-forward neural network to train the model using N1𝑁1N-1italic_N - 1 instances. Building on this approach, (Donon et al., 2020b) proposed an architecture inspired by the aforementioned dropout technique. Their model incorporates an additional block designed to handle topological changes, and the training process includes both instances with the original topology (N𝑁Nitalic_N case) and N1𝑁1N-1italic_N - 1 cases, enhancing the model’s adaptability and robustness.

3 Experimental Setup

Our aim is to evaluate the recently suggested AI-based approaches for power flow prediction on the N1𝑁1N-1italic_N - 1 security criterion, thus assessing their industrial readiness. In particular, we perform evaluations over two datasets of N1𝑁1N-1italic_N - 1 cases and explore whether: (a) the degree of connectivity of a node for which a line has been disconnected impacts the robustness of the approach to N1𝑁1N-1italic_N - 1, (b) prior exposure of the model to certain N1𝑁1N-1italic_N - 1 instances enhances its robustness.

3.1 Datasets

To perform our experiments, we rely on two standard datasets across the Power Engineering community, namely IEEE 14 and IEEE 118. These datasets contain one instance of the grid, with the nominal values for each bus. They consist of 14 and 118 busses respectively.
To approach the problem from a machine learning perspective, it is required to augment these datasets to generate new iid data instances. For this purpose, we employed two distinct strategies: (a) Constrained Sampling and (b) Random Agent Cutting.

Regarding (a), we sampled new data instances for PQ buses based on a normal distribution around their nominal values while for the generators based on Dirichlet simplex sampling. Mathematically we express the process as:
PlN(|Pl|,0.01)similar-tosubscript𝑃𝑙𝑁subscript𝑃𝑙0.01P_{l}\sim N(|P_{l}|,0.01)italic_P start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT ∼ italic_N ( | italic_P start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT | , 0.01 ), VmN(|Vm|,0.01)similar-tosubscript𝑉𝑚𝑁subscript𝑉𝑚0.01V_{m}\sim N(|V_{m}|,0.01)italic_V start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT ∼ italic_N ( | italic_V start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT | , 0.01 ),
QlN(|Ql|,0.01)similar-tosubscript𝑄𝑙𝑁subscript𝑄𝑙0.01Q_{l}\sim N(|Q_{l}|,0.01)italic_Q start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT ∼ italic_N ( | italic_Q start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT | , 0.01 ) and PgDir(G)similar-tosubscript𝑃𝑔𝐷𝑖𝑟𝐺P_{g}\sim Dir(G)italic_P start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT ∼ italic_D italic_i italic_r ( italic_G ),
where G𝐺Gitalic_G denotes the total amount of generation.

We use Dirichlet sampling for the generators, since the total amount of generation should be constant among all the data instances, and is predefined in the grid’s configuration. Then, we utilize Newton-Raphson method to calculate the outputs of the power flow problem (ground truth). The output is a vector (Pi,Qi,Vi,θi)subscript𝑃𝑖subscript𝑄𝑖subscript𝑉𝑖subscript𝜃𝑖(P_{i},Q_{i},V_{i},\theta_{i})( italic_P start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT , italic_Q start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT , italic_V start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT , italic_θ start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) for each bus i𝑖iitalic_i of the generated power grid instance.

For the second strategy (b), a grid agent was initialized and tasked with randomly cutting one line of the grid, based on a probability p𝑝pitalic_p. The new state of the grid was computed using the Newton-Raphson method (same as before), and the resulting data instance was recorded.

3.2 Models

We chose 3 state-of-the-art models namely: PowerFlowNet (Lin et al., 2023), LeapNet (Donon et al., 2020b) and ResNet (Donon et al., 2020b). The models relies on the same inputs X𝑋Xitalic_X which are the known values of each bus, but differ in their outputs differ. Hence, PowerFlowNet outputs the vector (Pi,Qi,Vi,θi)subscript𝑃𝑖subscript𝑄𝑖subscript𝑉𝑖subscript𝜃𝑖(P_{i},Q_{i},V_{i},\theta_{i})( italic_P start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT , italic_Q start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT , italic_V start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT , italic_θ start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) for each bus i𝑖iitalic_i, while LeapNet and Resnet outputs the vector (Ii,Iik)subscript𝐼𝑖subscript𝐼𝑖𝑘(I_{i},I_{ik})( italic_I start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT , italic_I start_POSTSUBSCRIPT italic_i italic_k end_POSTSUBSCRIPT ). Both vectors can be converted into the other using Eqs. 2 and 3.

3.3 Evaluation Protocol

Firstly, we utilized the pretrained PowerFlowNet models in the aforementioned datasets and we evaluated them in the N1𝑁1N-1italic_N - 1 cases. We note that these models were originally trained exclusively on N𝑁Nitalic_N cases, meaning they had no exposure to topological changes in the grid during training. We also trained a modified version of ResNet111This is not the classical version of ResNet as defined in (He et al., 2016). Instead, we adopt the implementation detailed in (Donon et al., 2020b), where the authors refer to their model as ResNet, inspired by the incorporation of residual connections., with the final linear layer replaced with one that projects the data into 2superscript2\mathbb{R}^{2}blackboard_R start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT to match the dimensions of the output I. We then applied the N1𝑁1N-1italic_N - 1 criterion to assess the robustness of these models in real and critical scenarios. Moreover, training with instances of N1𝑁1N-1italic_N - 1 was performed in order to enhance the robustness of the models. For this, we also used LeapNet which integrates a module into its architecture that tracks the topological changes of the grid.

3.4 Metric

To evaluate the performance of the models, we used the traditional Mean Squared Error (MSE) metric. For the ResNet and LeapNet models, performance was assessed by averaging the MSE of the outputs Iisubscript𝐼𝑖I_{i}italic_I start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT and Iiksubscript𝐼𝑖𝑘I_{ik}italic_I start_POSTSUBSCRIPT italic_i italic_k end_POSTSUBSCRIPT, representing the current at both the origin and end of the line. Regarding PowerFlowNet as the model outputs a different vector, we use the equations to convert the output into Iisubscript𝐼𝑖I_{i}italic_I start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT and Iiksubscript𝐼𝑖𝑘I_{ik}italic_I start_POSTSUBSCRIPT italic_i italic_k end_POSTSUBSCRIPT to obtain comparable result.

3.5 Implementation Details

We explore 3 configurations of the PowerFlowNet, defined as PowerFlowNetL𝑃𝑜𝑤𝑒𝑟𝐹𝑙𝑜𝑤𝑁𝑒subscript𝑡𝐿PowerFlowNet_{L}italic_P italic_o italic_w italic_e italic_r italic_F italic_l italic_o italic_w italic_N italic_e italic_t start_POSTSUBSCRIPT italic_L end_POSTSUBSCRIPT (large), PowerFlowNetM𝑃𝑜𝑤𝑒𝑟𝐹𝑙𝑜𝑤𝑁𝑒subscript𝑡𝑀PowerFlowNet_{M}italic_P italic_o italic_w italic_e italic_r italic_F italic_l italic_o italic_w italic_N italic_e italic_t start_POSTSUBSCRIPT italic_M end_POSTSUBSCRIPT (medium), and PowerFlowNetS𝑃𝑜𝑤𝑒𝑟𝐹𝑙𝑜𝑤𝑁𝑒subscript𝑡𝑆PowerFlowNet_{S}italic_P italic_o italic_w italic_e italic_r italic_F italic_l italic_o italic_w italic_N italic_e italic_t start_POSTSUBSCRIPT italic_S end_POSTSUBSCRIPT (small). These reflect the number of hidden topology-adaptive convolutions utilized, as specified in the original paper. In a similar manner, we implemented LeapNetM𝐿𝑒𝑎𝑝𝑁𝑒subscript𝑡𝑀LeapNet_{M}italic_L italic_e italic_a italic_p italic_N italic_e italic_t start_POSTSUBSCRIPT italic_M end_POSTSUBSCRIPT, LeapNetS𝐿𝑒𝑎𝑝𝑁𝑒subscript𝑡𝑆LeapNet_{S}italic_L italic_e italic_a italic_p italic_N italic_e italic_t start_POSTSUBSCRIPT italic_S end_POSTSUBSCRIPT, ResNetM𝑅𝑒𝑠𝑁𝑒subscript𝑡𝑀ResNet_{M}italic_R italic_e italic_s italic_N italic_e italic_t start_POSTSUBSCRIPT italic_M end_POSTSUBSCRIPT, and ResNetS𝑅𝑒𝑠𝑁𝑒subscript𝑡𝑆ResNet_{S}italic_R italic_e italic_s italic_N italic_e italic_t start_POSTSUBSCRIPT italic_S end_POSTSUBSCRIPT which vary in the number of hidden layers used, according to the values of (Donon et al., 2020b).
For the dataset generation we used Grid2op (Donnot, 2020) and Pandapower (Thurner et al., 2018), which are two popular Python frameworks for AI-based Power Engineering. The models were trained for 25 epochs using the Adam optimizer (Kingma & Ba, 2014). The learning rate was fixed at 0.0010.0010.0010.001, with a linear scheduler of a step size equal to 5 and a batch size equal to 128. The training dataset comprised 10,000 different N𝑁Nitalic_N grid instances, while both the evaluation dataset for the N𝑁Nitalic_N case and the evaluation dataset for the N1𝑁1N-1italic_N - 1 case consisted of 2,000 instances each.

4 Results

In this section, we present the experimental results. Initially, we demonstrate that pretrained models lack robustness in the N1𝑁1N-1italic_N - 1 scenario and we conduct a short analysis of this issue using graph theory. Finally, as a partial solution to this problem, we report on the outcomes of an empirical study by mixing N1𝑁1N-1italic_N - 1 cases into the training set.

4.1 N1𝑁1N-1italic_N - 1 case

While the results on the N𝑁Nitalic_N cases are promising for each approach on the two datasets, and could even be deemed reliable enough given the speedup compared to Newton Raphson, their performance deteriorates in the modified topology scenario. We observe a significant increase in the error when evaluating the models under the N1𝑁1N-1italic_N - 1 scenario (Table 1). In particular, the best MSE reported for the N𝑁Nitalic_N case is 0.0510.0510.0510.051, resp. 0.1130.1130.1130.113, whereas for the N1𝑁1N-1italic_N - 1 case it is 1.4671.4671.4671.467, resp. 4.1844.1844.1844.184 in the IEEE 14 dataset, resp. in the IEEE 118 dataset. The increase ranges between 10-100x in most cases and highlights the extent to which the models are impacted by simple grid’s topology modification, especially in the case of larger grids such as IEEE 118, which remains small in comparison to actual grids.

This indicates that the current models lack robustness when subjected to the critical assessments required for real-time operating grids.

Models Datasets N N-1
PowerFlowNetL𝑃𝑜𝑤𝑒𝑟𝐹𝑙𝑜𝑤𝑁𝑒subscript𝑡𝐿PowerFlowNet_{L}italic_P italic_o italic_w italic_e italic_r italic_F italic_l italic_o italic_w italic_N italic_e italic_t start_POSTSUBSCRIPT italic_L end_POSTSUBSCRIPT IEEE 14 0.051 1.467
IEEE 118 0.3630.3630.3630.363 8.2938.2938.2938.293
PowerFlowNetM𝑃𝑜𝑤𝑒𝑟𝐹𝑙𝑜𝑤𝑁𝑒subscript𝑡𝑀PowerFlowNet_{M}italic_P italic_o italic_w italic_e italic_r italic_F italic_l italic_o italic_w italic_N italic_e italic_t start_POSTSUBSCRIPT italic_M end_POSTSUBSCRIPT IEEE 14 0.0760.0760.0760.076 1.5821.5821.5821.582
IEEE 118 0.1840.1840.1840.184 4.184
PowerFlowNetS𝑃𝑜𝑤𝑒𝑟𝐹𝑙𝑜𝑤𝑁𝑒subscript𝑡𝑆PowerFlowNet_{S}italic_P italic_o italic_w italic_e italic_r italic_F italic_l italic_o italic_w italic_N italic_e italic_t start_POSTSUBSCRIPT italic_S end_POSTSUBSCRIPT IEEE 14 0.0550.0550.0550.055 2.3582.3582.3582.358
IEEE 118 0.4150.4150.4150.415 7.2497.2497.2497.249
ResNetM𝑅𝑒𝑠𝑁𝑒subscript𝑡𝑀ResNet_{M}italic_R italic_e italic_s italic_N italic_e italic_t start_POSTSUBSCRIPT italic_M end_POSTSUBSCRIPT IEEE 14 0.0890.0890.0890.089 1.7891.7891.7891.789
IEEE 118 0.5940.5940.5940.594 4.5364.5364.5364.536
ResNetS𝑅𝑒𝑠𝑁𝑒subscript𝑡𝑆ResNet_{S}italic_R italic_e italic_s italic_N italic_e italic_t start_POSTSUBSCRIPT italic_S end_POSTSUBSCRIPT IEEE 14 0.0970.0970.0970.097 2.1212.1212.1212.121
IEEE 118 0.113 7.8977.8977.8977.897
Table 1: MSE for the power flow prediction without any topological change and for the N1𝑁1N-1italic_N - 1 case, across the two datasets. Bold indicates the smaller MSE reported for the IEEE 14 dataset, while gray indicates the smaller MSE reported for the IEEE 118 dataset.

4.2 Graph Analysis

Dataset 𝒟maxsubscript𝒟𝑚𝑎𝑥\mathcal{D}_{max}caligraphic_D start_POSTSUBSCRIPT italic_m italic_a italic_x end_POSTSUBSCRIPT MSE 𝒟mediansubscript𝒟𝑚𝑒𝑑𝑖𝑎𝑛\mathcal{D}_{median}caligraphic_D start_POSTSUBSCRIPT italic_m italic_e italic_d italic_i italic_a italic_n end_POSTSUBSCRIPT MSE
IEEE 14 5 1.297 3 1.325
4 1.632 2 1.244
IEEE 118 12 7.526 8 4.864
11 8.491 7 6.503
Table 2: Comparison of the MSE metric based on the node with the highest degree 𝒟maxsubscript𝒟𝑚𝑎𝑥\mathcal{D}_{max}caligraphic_D start_POSTSUBSCRIPT italic_m italic_a italic_x end_POSTSUBSCRIPT and on the node with the median degree 𝒟mediansubscript𝒟𝑚𝑒𝑑𝑖𝑎𝑛\mathcal{D}_{median}caligraphic_D start_POSTSUBSCRIPT italic_m italic_e italic_d italic_i italic_a italic_n end_POSTSUBSCRIPT for the IEEE 14 and IEEE 118 datasets. Bold indicates the smaller MSE reported.

To further investigate the issue, we conducted an additional analysis to determine if the model’s performance in the N1𝑁1N-1italic_N - 1 scenario is influenced by the specific line removed from the grid topology.
We, therefore, focused on nodes with higher connectivity to assess their impact on model predictions (Figure LABEL:fig:3). Specifically, we identified the node with the highest degree x𝒟maxsubscript𝑥subscript𝒟𝑚𝑎𝑥x_{\mathcal{D}_{max}}italic_x start_POSTSUBSCRIPT caligraphic_D start_POSTSUBSCRIPT italic_m italic_a italic_x end_POSTSUBSCRIPT end_POSTSUBSCRIPT in the original topology (N𝑁Nitalic_N case). Since the grid agent removes lines randomly, the degree of x𝒟maxsubscript𝑥subscript𝒟𝑚𝑎𝑥x_{\mathcal{D}_{max}}italic_x start_POSTSUBSCRIPT caligraphic_D start_POSTSUBSCRIPT italic_m italic_a italic_x end_POSTSUBSCRIPT end_POSTSUBSCRIPT varies across instances. We clustered test set instances based on the degree of the node x𝒟maxsubscript𝑥subscript𝒟𝑚𝑎𝑥x_{\mathcal{D}_{max}}italic_x start_POSTSUBSCRIPT caligraphic_D start_POSTSUBSCRIPT italic_m italic_a italic_x end_POSTSUBSCRIPT end_POSTSUBSCRIPT and evaluated the model on these subsets. Additionally, we included the node with the median degree x𝒟mediansubscript𝑥subscript𝒟𝑚𝑒𝑑𝑖𝑎𝑛x_{\mathcal{D}_{median}}italic_x start_POSTSUBSCRIPT caligraphic_D start_POSTSUBSCRIPT italic_m italic_e italic_d italic_i italic_a italic_n end_POSTSUBSCRIPT end_POSTSUBSCRIPT for a more comprehensive analysis. For this experiment, we utilized PowerFlowNetL𝑃𝑜𝑤𝑒𝑟𝐹𝑙𝑜𝑤𝑁𝑒subscript𝑡𝐿PowerFlowNet_{L}italic_P italic_o italic_w italic_e italic_r italic_F italic_l italic_o italic_w italic_N italic_e italic_t start_POSTSUBSCRIPT italic_L end_POSTSUBSCRIPT, which demonstrated the lowest MSE error in both the N𝑁Nitalic_N and N1𝑁1N-1italic_N - 1 power flow scenarios for the IEEE 14 dataset.

In Table 2, for each dataset, the first row represents the original values of 𝒟max𝒟𝑚𝑎𝑥\mathcal{D}{max}caligraphic_D italic_m italic_a italic_x and 𝒟median𝒟𝑚𝑒𝑑𝑖𝑎𝑛\mathcal{D}{median}caligraphic_D italic_m italic_e italic_d italic_i italic_a italic_n, while the second row shows the degrees of these nodes when a connected line is removed. We observe that when a line connected to nodes with higher degrees is removed, it has a greater impact on the prediction process, as it produces a bigger error in the model. The intuition behind this finding is that nodes with higher degrees exhibit greater connectivity within the graph, thereby exerting a more significant impact on the grid’s physical behavior.

Models p MSE
PowerFlowNetL𝑃𝑜𝑤𝑒𝑟𝐹𝑙𝑜𝑤𝑁𝑒subscript𝑡𝐿PowerFlowNet_{L}italic_P italic_o italic_w italic_e italic_r italic_F italic_l italic_o italic_w italic_N italic_e italic_t start_POSTSUBSCRIPT italic_L end_POSTSUBSCRIPT 0.010.010.010.01 0.141
0.10.10.10.1 0.0780.0780.0780.078
PowerFlowNetM𝑃𝑜𝑤𝑒𝑟𝐹𝑙𝑜𝑤𝑁𝑒subscript𝑡𝑀PowerFlowNet_{M}italic_P italic_o italic_w italic_e italic_r italic_F italic_l italic_o italic_w italic_N italic_e italic_t start_POSTSUBSCRIPT italic_M end_POSTSUBSCRIPT 0.010.010.010.01 0.3580.3580.3580.358
0.10.10.10.1 0.0910.0910.0910.091
PowerFlowNetS𝑃𝑜𝑤𝑒𝑟𝐹𝑙𝑜𝑤𝑁𝑒subscript𝑡𝑆PowerFlowNet_{S}italic_P italic_o italic_w italic_e italic_r italic_F italic_l italic_o italic_w italic_N italic_e italic_t start_POSTSUBSCRIPT italic_S end_POSTSUBSCRIPT 0.010.010.010.01 0.1950.1950.1950.195
0.10.10.10.1 0.0960.0960.0960.096
ResNetM𝑅𝑒𝑠𝑁𝑒subscript𝑡𝑀ResNet_{M}italic_R italic_e italic_s italic_N italic_e italic_t start_POSTSUBSCRIPT italic_M end_POSTSUBSCRIPT 0.010.010.010.01 0.2960.2960.2960.296
0.10.10.10.1 0.1040.1040.1040.104
ResNetS𝑅𝑒𝑠𝑁𝑒subscript𝑡𝑆ResNet_{S}italic_R italic_e italic_s italic_N italic_e italic_t start_POSTSUBSCRIPT italic_S end_POSTSUBSCRIPT 0.010.010.010.01 0.3480.3480.3480.348
0.10.10.10.1 0.1220.1220.1220.122
LeapNetM𝐿𝑒𝑎𝑝𝑁𝑒subscript𝑡𝑀LeapNet_{M}italic_L italic_e italic_a italic_p italic_N italic_e italic_t start_POSTSUBSCRIPT italic_M end_POSTSUBSCRIPT 0.010.010.010.01 0.1750.1750.1750.175
0.10.10.10.1 0.067
LeapNetS𝐿𝑒𝑎𝑝𝑁𝑒subscript𝑡𝑆LeapNet_{S}italic_L italic_e italic_a italic_p italic_N italic_e italic_t start_POSTSUBSCRIPT italic_S end_POSTSUBSCRIPT 0.010.010.010.01 0.1370.1370.1370.137
0.10.10.10.1 0.0820.0820.0820.082
Table 3: MSE for the mixed N1𝑁1N-1italic_N - 1 and N-2 power flow prediction across the two datasets. Bold indicates the smaller MSE reported for the p=0.01𝑝0.01p=0.01italic_p = 0.01, while gray indicates the smaller MSE reported for p=0.1𝑝0.1p=0.1italic_p = 0.1.

4.3 Mix Training

The ResNet, LeapNet, and PowerFlowNet models were trained using instances of both N𝑁Nitalic_N and N1𝑁1N-1italic_N - 1 cases from the IEEE 14 dataset to evaluate their performance on unseen N1𝑁1N-1italic_N - 1 cases. The probability p𝑝pitalic_p of generating an N1𝑁1N-1italic_N - 1 instance was set to either 0.010.010.010.01 or 0.10.10.10.1 for each dataset. As shown in Table 3, the robustness of each model notably improves, particularly when p=0.1𝑝0.1p=0.1italic_p = 0.1. This finding is particularly significant for larger grids, where the number of N1𝑁1N-1italic_N - 1 configurations increases exponentially. It demonstrates that grid robustness is enhanced even with a relatively small number of N1𝑁1N-1italic_N - 1 instances during the training process.

5 Conclusion

In this paper, we analyzed the robustness of AI-based models for power grid operations under the N1𝑁1N-1italic_N - 1 security criterion. Our study identified significant deficiencies in model robustness under real-time conditions and emphasized the need for improvements. A graph theory-based analysis highlighted the critical impact of node connectivity on model predictions. We deployed a mixed training technique with both N𝑁Nitalic_N and N1𝑁1N-1italic_N - 1 instances, which significantly enhanced model adaptability and reliability. Future research could focus on develo** a sampling method for N1𝑁1N-1italic_N - 1 instances to construct a training dataset, taking into account graph connectivity. This approach is motivated by the observation that the connectivity degree of each node significantly impacts the prediction accuracy of the models. In conclusion, our findings stress the importance of practical scenarios in develo** AI methodologies for critical infrastructure, advocating for future research on more complex topological changes and related topics, such as Voltage Control (Sun et al., 2019).

References

  • Aslam et al. (2021) Aslam, S., Herodotou, H., Mohsin, S. M., Javaid, N., Ashraf, N., and Aslam, S. A survey on deep learning methods for power load and renewable energy forecasting in smart microgrids. Renewable and Sustainable Energy Reviews, 144:110992, 2021.
  • Bolz et al. (2019) Bolz, V., Rueß, J., and Zell, A. Power flow approximation based on graph convolutional networks. In 2019 18th ieee international conference on machine learning and applications (icmla), pp.  1679–1686. IEEE, 2019.
  • Capitanescu (2016) Capitanescu, F. Critical review of recent advances and further developments needed in ac optimal power flow. Electric Power Systems Research, 136:57–68, 2016.
  • Coffrin & Van Hentenryck (2014) Coffrin, C. and Van Hentenryck, P. A linear-programming approximation of ac power flows. INFORMS Journal on Computing, 26(4):718–734, 2014.
  • Donnot (2020) Donnot, B. Grid2op- A testbed platform to model sequential decision making in power systems. . https://GitHub.com/rte-france/grid2op, 2020.
  • Donnot et al. (2017) Donnot, B., Guyon, I., Schoenauer, M., Panciatici, P., and Marot, A. Introducing machine learning for power system operation support. arXiv preprint arXiv:1709.09527, 2017.
  • Donnot et al. (2018) Donnot, B., Guyon, I., Schoenauer, M., Marot, A., and Panciatici, P. Fast power system security analysis with guided dropout. arXiv preprint arXiv:1801.09870, 2018.
  • Donon et al. (2020a) Donon, B., Clément, R., Donnot, B., Marot, A., Guyon, I., and Schoenauer, M. Neural networks for power flow: Graph neural solver. Electric Power Systems Research, 189:106547, 2020a.
  • Donon et al. (2020b) Donon, B., Donnot, B., Guyon, I., Liu, Z., Marot, A., Panciatici, P., and Schoenauer, M. Leap nets for system identification and application to power systems. Neurocomputing, 416:316–327, 2020b.
  • D’orto et al. (2021) D’orto, M., Sjöblom, S., Chien, L. S., Axner, L., and Gong, J. Comparing different approaches for solving large scale power-flow problems with the newton-raphson method. IEEE Access, 9:56604–56615, 2021.
  • Ghamizi et al. (2024) Ghamizi, S., Cao, J., Ma, A., and Rodriguez, P. Powerflowmultinet: Multigraph neural networks for unbalanced three-phase distribution systems. arXiv preprint arXiv:2403.00892, 2024.
  • He et al. (2016) He, K., Zhang, X., Ren, S., and Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp.  770–778, 2016.
  • Hu et al. (2020) Hu, X., Hu, H., Verma, S., and Zhang, Z.-L. Physics-guided deep neural networks for power flow analysis. IEEE Transactions on Power Systems, 36(3):2082–2092, 2020.
  • Karniadakis et al. (2021) Karniadakis, G. E., Kevrekidis, I. G., Lu, L., Perdikaris, P., Wang, S., and Yang, L. Physics-informed machine learning. Nature Reviews Physics, 3(6):422–440, 2021.
  • Kingma & Ba (2014) Kingma, D. P. and Ba, J. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
  • Kulworawanichpong (2010) Kulworawanichpong, T. Simplified newton–raphson power-flow solution method. International journal of electrical power & energy systems, 32(6):551–558, 2010.
  • Leyli Abadi et al. (2022) Leyli Abadi, M., Marot, A., Picault, J., Danan, D., Yagoubi, M., Donnot, B., Attoui, S., Dimitrov, P., Farjallah, A., and Etienam, C. Lips-learning industrial physical simulation benchmark suite. Advances in Neural Information Processing Systems, 35:28095–28109, 2022.
  • Lin et al. (2023) Lin, N., Orfanoudakis, S., Cardenas, N. O., Giraldo, J. S., and Vergara, P. P. Powerflownet: Leveraging message passing gnns for improved power flow approximation. arXiv preprint arXiv:2311.03415, 2023.
  • Marot et al. (2020) Marot, A., Rozier, A., Dussartre, M., Crochepierre, L., and Donnot, B. Towards an ai assistant for power grid operators. arXiv preprint arXiv:2012.02026, 2020.
  • Pagnier & Chertkov (2021) Pagnier, L. and Chertkov, M. Physics-informed graphical neural network for parameter & state estimations in power systems. arXiv preprint arXiv:2102.06349, 2021.
  • Sereeter et al. (2019) Sereeter, B., Vuik, C., and Witteveen, C. On a comparison of newton–raphson solvers for power flow problems. Journal of Computational and Applied Mathematics, 360:157–169, 2019.
  • Srivastava et al. (2014) Srivastava, N., Hinton, G., Krizhevsky, A., Sutskever, I., and Salakhutdinov, R. Dropout: a simple way to prevent neural networks from overfitting. The journal of machine learning research, 15(1):1929–1958, 2014.
  • Sun et al. (2019) Sun, H., Guo, Q., Qi, J., Ajjarapu, V., Bravo, R., Chow, J., Li, Z., Moghe, R., Nasr-Azadani, E., Tamrakar, U., et al. Review of challenges and research opportunities for voltage control in smart grids. IEEE Transactions on Power Systems, 34(4):2790–2801, 2019.
  • Thurner et al. (2018) Thurner, L., Scheidler, A., Schäfer, F., Menke, J.-H., Dollichon, J., Meier, F., Meinecke, S., and Braun, M. pandapower—an open-source python tool for convenient modeling, analysis, and optimization of electric power systems. IEEE Transactions on Power Systems, 33(6):6510–6521, 2018.