Topology-Aware Neural Networks for Fast Contingency Analysis of Power
  Systems
Training Neural Networks able to capture the topology changes of the power
grid is one of the significant challenges towards the adoption of machine
learning techniques for N-k security computations and a wide range of other
operations that involve grid reconfiguration. As the number of N-k scenarios
increases exponentially with increasing system size this renders such problems
extremely time-consuming to solve with traditional solvers. In this paper, we
combine Physics-Informed Neural Networks with both a Guided-Dropout (GD) Neural
Network (which associates dedicated neurons with specific line
connections/disconnections) and an edge-varrying Graph Neural Neural Network
(GNN) architecture to learn the setpoints for a grid that considers all
probable single-line reconfigurations (all critical N-1 scenarios) and
subsequently apply the trained models to N-k scenarios.We demonstrate how
incorporating the underlying physical equations for the network equations
within the training procedure of the GD and the GNN architectures, performs
with N-1, N-2, and N-3 case studies. Using the AC Power Flow as a guiding
application, we test our methods on the 14-bus, 30-bus, 57-bus, and 118-bus
systems. We find that these topology-aware NNs not only achieve the task of
contingency screening with satisfactory accuracy but do this at up to 1000
times faster than the Newton Raphson power flow solver. Moreover, our results
provide a comparison of the GD and GNN models in terms of accuracy and
computational speed and provide recommendations on their adoption for
contingency analysis of power systems.
Agnes M. Nakiganda, Catherine Cheylan, Spyros Chatzivasileiadis
# Topology-Aware Neural Networks for Fast Contingency Analysis of Power Systems

###### Abstract

Training Neural Networks able to capture the topology changes of the power grid is one of the significant challenges towards the adoption of machine learning techniques for N-\(k\) security computations and a wide range of other operations that involve grid reconfiguration. As the number of N-\(k\) scenarios increases exponentially with increasing system size this renders such problems extremely time-consuming to solve with traditional solvers. In this paper, we combine Physics-Informed Neural Networks with both a Guided-Dropout (GD) (which associates dedicated neurons with specific line connections/disconnections) and an edge-carrying Graph Neural Neural Network (GNN) architecture to learn the setpoints for a grid that considers all probable single-line reconfigurations (all critical N\(-1\) scenarios) and subsequently apply the trained models to N-\(k\) scenarios.We demonstrate how incorporating the underlying physical equations for the network equations within the training procedure of the GD and the GNN architectures, performs with N\(-1\), N\(-2\), and N\(-3\) case studies. Using the AC Power Flow as a guiding application, we test our methods on the 14-bus, 30-bus, 57-bus, and 118-bus systems. We find that these topology-aware NNs not only achieve the task of contingency screening with satisfactory accuracy but do this at 100 to 1000 times faster than the Newton Raphson power flow solver. Moreover, our results provide a comparison of the GD and GNN models in terms of accuracy and computational speed and provide recommendations on their adoption for contingency analysis of power systems.

 AC Power Flow, Graph Neural Network, Guided Dropout, Network Topology, Physics Informed Neural Network

## I Introduction

The power grid is rapidly transforming and incorporating numerous devices that operate in work together to maintain a balance of supply and demand. Now more than ever, it is vital that system operators can ascertain that potentially critical contingency scenarios are promptly screened, analyzed and mitigation measures devised. Power systems today are designed with inherent N\(-1\) operational reliability, however, as networks grow larger and incorporate more devices, the N-\(k\) system security must be adequately handled such that a reliable and resilient grid can be maintained. The power grid is a separate in synchronism to maintain a balance of supply and demand. Now more than ever, it is vital that system operators can ascertain that potential critical contingency scenarios are promptly screened, analyzed and mitigation measures devised. Power systems today are designed with inherent N\(-1\) operational reliability, however, as networks grow larger and incorporate more devices, the N-\(k\) system security must be adequately managed such that a reliable and resilient grid can be maintained [1]. Moreover, if not sufficiently handled such multiple contingencies can result in voltage collapse and cascading failures [2, 3]. Traditionally, numerical methods such as Newton Raphson have served as a means to solve the power flow problem for critical contingency screening analysis, however, the necessary computing time for handling the combinatorial explosion of N-k scenarios becomes prohibitive with such techniques.

Machine Learning (ML) models including Decision Trees, Support Vector Machines, Random Forests, and Neural Networks to mention but a few have been shown to handle complex power systems problems tractably and efficiently [4, 5, 6]. These methods eliminate the computationally intensive iterative procedures of traditional power flow solvers and scale well with increasing grid sizes. However, the downside to many ML algorithms is that they are often unable to consider grid topologies beyond the one topology on which they have been trained i.e., they do not incorporate variables that relate to connection/disconnection of power lines or reconfiguration of buses. Moreover, training a single model for each potential N-\(1\) topology would also be unrealistic and impractical. This affects their ability to generalize to varying grid configurations, which is an inherent aspect of the contingency assessment problem in power systems and is, therefore, hindering their adoption in real systems.

In order to leverage the enormous computational efficiency of ML methods for application to the N-\(k\) power flow problem, various ML-based architectures have been proposed. In [7], an one-hot encoding that adds extra binary variables to represent the connection/disconnection of components was presented. However, results therein show this method may not scale well to larger systems with hundreds of components. In [7] and [8], the authors introduce the so-called "Guided Dropout" method to address the topology change problem. "Guided Dropout", _sparsifies_ the neural network model by introducing