Physics-Guided Graph Neural Networks for Real-time AC/DC Power Flow
  Analysis
The increasing scale of alternating current and direct current (AC/DC) hybrid
systems necessitates a faster power flow analysis tool than ever. This letter
thus proposes a specific physics-guided graph neural network (PG-GNN). The
tailored graph modelling of AC and DC grids is firstly advanced to enhance the
topology adaptability of the PG-GNN. To eschew unreliable experience emulation
from data, AC/DC physics are embedded in the PG-GNN using duality. Augmented
Lagrangian method-based learning scheme is then presented to help the PG-GNN
better learn nonconvex patterns in an unsupervised label-free manner.
Multi-PG-GNN is finally conducted to master varied DC control modes. Case study
shows that, relative to the other 7 data-driven rivals, only the proposed
method matches the performance of the model-based benchmark, also beats it in
computational efficiency beyond 10 times.
Mei Yang, Gao Qiu, Yong Wu, Junyong Liu, Nina Dai, Yue Shui, Kai Liu, Lijie Ding
# Physics-Guided Graph Neural Networks for Real-time AC/DC Power Flow Analysis

###### Abstract

The increasing scale of alternating current and direct current (AC/DC) hybrid systems necessitates a faster power flow analysis tool than ever. This letter thus proposes a specific physics-guided graph neural network (PG-GNN). The tailored graph modelling of AC and DC grids is firstly advanced to enhance the topology adaptability of the PG-GNN. To secure unreliable experience emulation from data, AC/DC physics are embedded in the PG-GNN using duality. Augmented Lagrangian method-based learning scheme is then presented to help the PG-GNN better learn nonconvex patterns in an unsupervised label-free manner. Multi-PG-GNN is finally conducted to master varied DC control modes. Case study shows that, relative to the other 7 data-driven rivals, only the proposed method matches the performance of the model-based benchmark, also beats it in computational efficiency beyond 10 times.

AC/DC hybrid systems, power flow analysis, physics-guided graph neural networks, Lagrangian method

## I Introduction

Higher power transmission efficiency of AC/DC hybrid systems has widely benefited renewable energy consumption [1]. Faster AC/DC power flow analysis is thus necessary more than ever, due to significant uncertainties from renewable energy, massive scale of interconnected grids, and nonlinearity of DC lines and converters [2]. This is the key for real-time dispatch and control in AC/DC hybrid systems.

Rich model-based methods are available for AC/DC power flow, spanning from the basic unified methods [3] and sequential methods [4], to the their enhanced parallel versions [2, 5]. However, issues, such as slow convergence rate and diverse control modes, can still beget heavy computing burden of power flow analysis in large-scale AC/DC hybrid systems. Emerging data-driven methods provide faster solutions [6, 7, 8], but their generalizability can be limited by the absence of physics embedding and topology patterns.

Graph neural network (GNN) may be the prospective fix for above concerns, only when it is carefully trained to follow physics. Two alternatives exist towards this end, one is to emulate systematic process of power flow solvers, such as Newton-Raphson (NR) solver [9], Hades2 solver [10], etc. However, this method may be slow-paced when DC control mode switches, since the solving workflow must be revisited to hit new control mode. Treating power flow equations directly as loss function is the other candidate [11]. This idea is better, since a one-time feedforward computation is all we need to catch a power flow solution, provided that GNN has been well-trained. The remaining issue is how to embed all AC/DC physical principles into loss function. Penalizing them is pragmatic but imprudent, as it is formidable to handpick penalty weights from scratch. Besides, DC control mode switching has not been studied by the above methods.

To fill the above gaps, an augmented Lagrangian method (ALM)-based physics-guided GNN (PG-GNN) is proposed. On the tailored graph modelling of AC and DC grids, AC/DC operational physics are analytically embedded into GNN learning process. Then, the learning task is recast as a parameterized duality problem of AC/DC power flow model. To yield tolerable performance of the PG-GNN against nonconvex physics, the ALM-based gradient decent algorithm is proposed to cope with the above problem. At last, a multi-PG-GNN decision framework is presented, with a view to enable DC control mode switching.

## II Power Flow Model for AC/DC Hybrid Systems

In this letter, we apply the quasi-steady state model of AC/DC hybrid system. Let \(\mathcal{N}_{PV}\), \(\mathcal{N}_{ac}\), \(\mathcal{N}_{dc}\), and \(\mathcal{N}_{pcc}\) stands for PV bus set, AC bus set, DC bus set, and the set of point of common coupling, respectively. \(\mathcal{N}_{pcc}\) implies the bus connected by both DC links and AC branches. Following the definitions, the AC/DC power flow is modelled as follows (\(\forall i\in\mathcal{N}_{ac},j\in\mathcal{N}_{ac}\cup\mathcal{N}_{pcc},k\in \mathcal{N}_{dc},p\in\mathcal{N}_{PV},c\in\mathcal{N}_{pcc}\)):

\[P_{i}^{inj}-\sum_{j\in i}P_{ij}(V_{i},V_{j},\delta_{ij})=0 \tag{1a}\] \[Q_{i}^{inj}-\sum_{j\in i}Q_{ij}(V_{i},V_{j},\delta_{ij})=0\] (1b) \[P_{c}^{inj}-\sum_{j\in c}P_{cj}(V_{c},V_{j},\delta_{ij})\pm V_{d,k}^{re/iv}I_{d,k}=0\] (2a) \[Q_{c}^{inj}\sum_{j\in c}Q_{cj}(V_{c},V_{j},\delta_{ij})V_{d,k}^{re/iv}I_{d,k}\tan\varphi_{k}^{re/iv}=0\] (2b) \[V_{p}=V_{p}^{ref}\] (3) \[V_{d,k}^{re}=3\sqrt{2}K_{ck}^{re}V_{c}\cos\alpha_{k}/\pi-3X_{ck}^{re}I_{d,k}/\pi \tag{4a}\]
\[V_{d,k}^{iv}=3\sqrt{2}K_{ck}^{iv}V_{c}\cos\gamma_{k}/\pi-3X_{ck}^{iv}I_{d,k}/\pi \tag{4b}\]

\[R_{dc}I_{d,k}=V_{d,k}^{re}-V_{d,k}^{iv} \tag{5}\] \[\cos\varphi_{k}^{re/iv}=V_{d,k}^{re/iv}/(3\sqrt{2}K_{ck}^{re/iv}V_{c }/\pi) \tag{6}\]

Control model 1: \(I_{d,k}^{re}\!-\!I_{d,k}^{re,ref}\!=\!0,V_{d,k}^{iv}\!-\!V_{d,k}^{iv,ref}=0\) (7a) Control model 2: \(\alpha_{k}-\alpha_{k}^{min}=0,I_{d,k}^{iv}-I_{d,k}^{iv,ref}=0\) (7b)

where \(K_{ck}^{re}\) and \(K_{ck}^{iv}\) stand for the ratio of the converter transformer at the rectifier-side and inverter-side \(k\). Note that, superscript \(re/iv\) stand for rectifier or inverter, respectively. \(X_{ck}^{re}\) and \(X_{ck}^{iv}\) represent the reactance of the converter connected at the inverter and rectifier DC bus \(k\). \(\alpha_{k}\) is firing angle of the \(k\)th rectifier, and \(\gamma_{k}\) is extinction angle of the \(k\)th inverter. \(V_{d,k}^{ref/iv}\) represent the rectifier/inverter voltage of \(k\)th DC line. \(R_{dc}\) and \(I_{d,k}\) represent resistance and current of the \(k\)th DC line, respectively. \(V\) indicates the nodal voltage amplitude, \(j\in i\) implies that the \(j\)th bus is adjacent to the \(i\)th bus through branch \(ij\). \(P_{ij}(V_{i},V_{j},\delta_{ij})\) and \(Q_{ij}(V_{i},V_{j},\delta_{ij})\) are function to calculate active and reactive transmission power of line \(ij\), respectively. \(\delta_{ij}\) is voltage phase angle difference between bus \(i\) and bus \(j\). The sign of the third term on the right hand side of (2) is negative if it specify the rectifier side, and is positive otherwise. (7) are governing equations of the DC system. Here we only provide two common control modes. The subscript \(ref\) indicates the control reference.

## III The Proposed Methodology

### _Graph modeling for AC/DC power flow analysis_

A power system can be represented as directed graph \(\mathcal{G}=(\mathcal{V},\mathcal{E},\mathbf{A})\), where \(\mathcal{V}\), \(\mathcal{E}\) and \(\mathbf{A}\) are settled upon the set of buses, that of branches, and adjacency matrix, respectively. GNN naturally involves these properties for well topology-adaptability. For an AC/DC hybrid system, GNN is not easy to create since features necessary to characterize AC grids, DC grids and their bridges do not always match each other. Thus, this letter proposes an alternative to unify these features. As shown in Fig. 1, by introducing converters into nodes, and DC transformers and lines into edges, a DC grid can be unified in a common graph of AC grid. In this sense, for an AC/DC system with \(N\) buses, \(b\) branches and \(a\) DC lines, its corresponding GNN owns \(N+2a\) nodes and \(b+3a\) edges:

\[\boldsymbol{H}(\cdot)^{(0)}=\boldsymbol{x}\triangleq\left[\boldsymbol{x}^{ \mathcal{V}},\boldsymbol{Z}^{\mathcal{V}\leftarrow\mathcal{E}}\boldsymbol{x}^ {\mathcal{E}}\right] \tag{8}\]

where \(\boldsymbol{x}^{\mathcal{V}}\!\!=\!\![\boldsymbol{x}_{1}^{\mathcal{V}},\ldots, \boldsymbol{x}_{N\!=\!2a}^{\mathcal{V}}]^{T}\!\in\!\mathbb{R}^{(N+2a)\!\times\!2}\) and particularly, \(\boldsymbol{x}_{1}^{\mathcal{V}}\!\!=\!\![P^{g}\!-\!P_{1}^{L},V_{1}]^{T}\!,i \!\in\!\mathcal{N}_{PV}\); For rectifiers, \(\boldsymbol{x}_{1}^{\mathcal{V}}\!\!=\!\![\boldsymbol{\alpha}^{min},X_{ck}^{re }I_{d,k}^{re,ref}]\) (mode 1) or \(\boldsymbol{x}_{k}^{\mathcal{V}}\!\!=\!\![\boldsymbol{\alpha}^{min},X_{ck}^{re }I_{d,k}^{re,ref}]\) (mode 2). For inverters, \(\boldsymbol{x}_{k}^{\mathcal{V}}\!\!=\!\![\boldsymbol{\gamma}^{min},V_{d,k}^{ vir},f]\) (mode 1) or \(\boldsymbol{x}_{k}^{\mathcal{V}}\!\!=\!\![\boldsymbol{\gamma}^{min},X_{ck}^{iv}I_{d,k}^{ re,ref}]\) (mode 1) or \(\boldsymbol{x}_{k}^{\mathcal{V}}\!\!=\!\![\boldsymbol{\gamma}^{min},X_{ck}^{iv}I_{d,k}^{ re,ref}]\) (mode 2), \(k\!\!\in\!\!\mathcal{N}_{dc}\); \(\boldsymbol{x}_{k}^{\mathcal{V}}\!\!=\!\![P^{g}\!-\!P_{i}^{L},Q_{i}^{g}\!\!-\!Q _{i}^{L}]^{T}\!,i\!\in\!\mathcal{N}_{PQ}\!\!\cup\!\mathcal{N}_{pcc}; \boldsymbol{x}_{i}^{\mathcal{V}}\!\!=\!\![P^{g}\!-\!P_{i}^{L},V_{i}]^{T}\!,i\! \in\!\mathcal{N}_{V\delta}\), \(\mathcal{N}_{V\delta}\) denote the set of swing bus. The edge features of the input are structured by the branches, which are denoted by \(\boldsymbol{x}^{\mathcal{E}}\!\in\!\mathbb{R}^{(b+3a)\times 2}\). Specifically, for AC branches, \(\boldsymbol{x}^{\mathcal{E}}\!\!=\!\![G_{\mathcal{E}},B_{\mathcal{E}}]\), where \(G_{\mathcal{E}}\) and \(B_{\mathcal{E}}\) are admittance parameters of line \(\mathcal{E}\). For rectifiers and inverters, \(\boldsymbol{x}^{\mathcal{E}}\!\!=\!\![K_{ck}^{re,min},K_{ck}^{re,max}]\). For DC branches, \(\boldsymbol{x}^{\mathcal{E}}\!\!=\!\![R_{dc},I_{d,k}^{re,ref}]\) (mode 1) or \(\boldsymbol{x}^{\mathcal{E}}\!\!=\![R_{dc},I_{d,k}^{iv,ref}]\) (mode 2). \(\boldsymbol{Z}^{\mathcal{V}\leftarrow\mathcal{E}}\!\!\in\!\mathbb{R}^{(M+2a) \times(b+3a)}\) is a trainable transformation matrix that embeds edge features into nodes.

We then consider ChebNet to enhance GNN, as ChebNet can aggregate high-order neighbor information and result in better performance [12]. Prior to the depiction of ChebNet, we firstly calculate the graph Laplacian matrix \(\boldsymbol{L}\) by subtracting \(\boldsymbol{A}\) from degree matrix \(\boldsymbol{D}\), i.e., \(\boldsymbol{L}=\boldsymbol{D}\!-\!\boldsymbol{A}\). Then, the feedforward of the ChebNet is given by (9):

\[\boldsymbol{H}(\cdot)^{(l+1)}=\sigma\left(\sum_{j=0}^{F} \boldsymbol{T}_{j}(\hat{L})\boldsymbol{H}(\cdot)^{(l)}\boldsymbol{\theta}_{j} \right),\boldsymbol{H}(\cdot)^{(0)}\!=\!\boldsymbol{x}\] (9a) \[\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \!\!\!\!\!\!\!\!\!\!\!\!\!
outperforms other competitive GNNs. Specifically, ALM rises the following learning scheme (\(i\in\{PQU,DC\}\)).

\[\mathcal{L}_{\rho}^{\mathbf{\theta}}\left(\mathbf{\lambda},\phi^{\mathbf{\theta }}(\mathbf{x})\right) = f_{DC}^{Ang}\left(\phi^{\mathbf{\theta}}(\mathbf{x})\right)+\sum_{i}\lambda_ {i}f_{i}\left(\phi^{\mathbf{\theta}}(\mathbf{x})\right) \tag{12}\] \[+ \frac{\rho}{2}\sum_{i}\left\|f_{i}\left(\phi^{\mathbf{\theta}}(\mathbf{x} )\right)\right\|_{2}^{2}\] \[\mathbf{\theta}^{k+1}:=\arg\min\mathbf{\theta}\mathcal{L}_{\rho}^{\mathbf{ \theta}}\left(\mathbf{\lambda}^{k},\phi^{\mathbf{\theta}^{k}}(\mathbf{x})\right)\] (13a) \[\lambda_{i}^{k+1}:=\lambda_{i}^{k}+\rho\left|f_{i}\left(\phi^{\bm {\theta}^{k+1}}(\mathbf{x})\right)\right| \tag{13b}\]

where \(\rho>0\). (13a) updates \(\mathbf{\theta}\) by minimizing (12). By fixing \(\mathbf{\theta}\), (13b) then updates dual variables, which will be forwarded to perform (13a) over again. (13) continues until the setting steps are hit or (12) remains stable. Notably, (13a) can be realized via gradient descent:

\[\mathbf{\theta}\leftarrow\mathbf{\theta}+\frac{\partial\mathcal{L}^{\mathbf{\theta}}(\mathbf{ \lambda},\phi^{\mathbf{\theta}}(\mathbf{x}))}{\partial\mathbf{\theta}}=\mathbf{\theta}+\frac{ \partial\mathcal{L}^{\mathbf{\theta}}(\mathbf{\lambda},\phi^{\mathbf{\theta}}(\mathbf{x}))}{ \partial\phi^{\mathbf{\theta}}(\mathbf{x})}\frac{\partial\phi^{\mathbf{\theta}}(\mathbf{x})}{ \partial\mathbf{\theta}} \tag{14}\]
## V Conclusion

A physics-guided graph neural networks (PG-GNN) is proposed for AC/DC power flow solution. A build-in graph model of AC and DC components is firstly designed. It then provides parameterized Lagrangian duality of AC/DC power flow problem to embed physics in PG-GNN. An augmented Lagrangian method (ALM)-based training strategy is proposed to enable PG-GNN to better fulfill nonconvex patterns. Decision framework is finally built upon multi-PG-GNN such that DC control mode switching can be manipulated. Case study on the IEEE 30-bus system justifies that the proposed method hits the best trade-off between decision efficiency and accuracy compared to classical model-based and 7 advanced data-driven methods. This work proved the necessity of physics embedding for reliable AC/DC power flow solution, and showed the flexibility of multiple PG-GNNs regarding model switching.
