Capturing Power System Dynamics by Physics-Informed Neural Networks and Optimization
Capturing Power System Dynamics by Physics-Informed Neural Networks and Optimization
Abstract— This paper proposes a tractable framework to The high computational cost and the absence of informative
determine key characteristics of non-linear dynamic systems by margins towards the critical values are the main drawbacks.
converting physics-informed neural networks to a mixed integer The former aspect can be partly addressed by the use of
linear program. Our focus is on power system applications.
Traditional methods in power systems require the use of a reduced-order modelling techniques [2]–[4] but these do
large number of simulations and other heuristics to determine not remove the second drawback. Direct methods using
parameters such as the critical clearing time, i.e., the maximum Lyapunov functions offer an alternative [5]–[7], however,
allowable time within which a disturbance must be cleared the results often lead to overly conservative conclusions and,
before the system moves to instability. The work proposed in except for [7], rely on system linearizations. A third route
this paper uses physics-informed neural networks to capture the
power system dynamic behavior and, through an exact trans- involves machine learning algorithms [8]–[12] which can
formation, converts them to a tractable optimization problem provide results at a fraction of the computational time. So
which can be used to determine critical system indices. By far, their black-box nature and lack of interpretability of their
converting neural networks to mixed integer linear programs, assessments have been posing major barriers for adoption
our framework also allows to adjust the conservativeness of in a safety-critical environment. We aimed to remove these
the neural network output with respect to the existing stability
boundaries. We demonstrate the performance of our methods barriers with our recent work on neural network verification
on the non-linear dynamics of converter-based generation in for power systems [13] and worst-case guarantees for neural
response to voltage disturbances. network behaviour [14]. Still, however, methods based on
machine learning algorithms require the assessment of a large
I. I NTRODUCTION number of scenarios to obtain insights about critical system
Modern power systems undergo a transition where large responses and estimate indices such as the critical clearing
and centrally located synchronous generators are replaced time or distance to instability.
by smaller and more distributed converter-based generation The main goal of this paper is to propose a method to
units. These changes substantially impact the dynamic be- determine critical indices for power systems (such as the
haviour of the power system and increase the number of critical clearing time) avoiding the need to perform thousands
phenomena that have to be taken into account for stability of simulations. To do that, we formulate an optimization
analyses [1]. The particular case we investigate concerns problem that encodes in its constraints all the information
‘grid-following’ converters, where the converter is controlled of the underlying dynamical system. Instead of using linear
based on the measurement of the voltage of the external approximations as in the direct methods [5], [6], we use
grid. The control action (i.e., setting an internal reference Physics Informed Neural Networks (PINNs), which have
value) adapts to different control objectives and limitations, shown good potential to capture power system dynamics
depending on the observed external voltage. A substantial governed by differential equations [15]. Inspired by our
voltage disturbance leads to a complex system response previous work [13], [14], we perform an exact transformation
which affects the power output of the converter. If the that converts the PINNs to a mixed integer linear program.
disturbance becomes too large, the control scheme leads to a This yields a tractable optimization program that accurately
loss of the delivered power which cannot be recovered in the captures in its constraints the power system dynamics, ini-
short-term. To avoid such undesirable system responses it is tially encoded in the PINN. Note that the reformulation of
crucial to understand for which disturbance characteristics neural networks to an optimization program provides for
and control parameters such a substantial power loss occurs. a very flexible framework with a wide range of possible
Such an analysis of hybrid dynamical systems is noto- applications. Besides neural network verification [13], [14],
riously difficult but unavoidable, as it is crucial to obtain [16], the same transformation has been recently used for the
insights on critical system responses. In power systems, design of a neural network controller that ensures asymptotic
these analyses often rely on a large number of time-domain stability [17].
simulations to exhibit the hybrid characteristic of the system. The main contributions of this paper are: i) a rigorous
framework that uses physics informed neural networks to
G. S. Misyris, J. Stiasny and S. Chatzivasileiadis are with the Technical capture the dynamics of power systems in a tractable opti-
University of Denmark, Department of Electrical Engineering, Kgs. Lyngby, mization program, ii) the ability to determine critical indices
Denmark (emails: {gmisy,jbest,spchatz}@elektro.dtu.dk).
This work is supported by Innovation Fund Denmark through the multiDC of hybrid dynamic systems avoiding the need for exhaustive
project (grant no. 6154-00020B). time-domain simulations, and iii) introducing the use of
The mapping φ usually renders the optimization problem [t, C]> = z0 (12)
intractable, in particular if differential states and discrete ẑk+1 = Wk+1 zk + bk+1 ∀k = 0, 1, ..., K − 1 (13)
events are involved. This is the case for hybrid dynamic zk = max(ẑk , 0) ∀k = 1, ..., K (14)
systems as described by > > >
[x̂ , ŷ ] = WK+1 zK + bK+1 . (15)
d
x = f (x, y, u, w; p) (9) We choose the Rectified Linear Unit (ReLU) in (14) as the
dt
activation function because its piece-wise linearity enables
0 = g(x, y, u, w; p) (10)
us to reformulate the max-operator (see Section II-B). Ac-
where y, u, w can show discrete switching behaviour. The tivation functions that are not piece-wise linear, such as the
following methodology will describe how we can transform hyperbolic tangent, would not allow this step in the presented
the potentially intractable mapping φ into a tractable approx- form. Wi and bi represent the weight matrices and bias
imation of it. This involves the approximation of the mapping vectors in each hidden layer and they are the adjustable
by a PINN as described in Section II-A and, subsequently, parameters during the training. In order to determine Wi
its reformulation into a mixed-integer linear program in and bi we minimize the mismatch between the approximated
Section II-B. states x̂(t; C), ŷ(t; C) and a dataset that contains simulated
4419
Authorized licensed use limited to: University of Michigan Library. Downloaded on November 24,2024 at 19:50:39 UTC from IEEE Xplore. Restrictions apply.
values x(t; C), y(t; C) which form the ground truth. The we convert this general non-linear program into a mixed-
mean-squared error across N data points from the dataset integer linear program (MILP) which in turns allows us to
yield a loss term for each of the m differential and n benefit from the specialized MILP solvers. The reformulation
algebraic states hinges around the use of a binary variable bk for each ReLU,
N i.e., for the Nk neurons in each layer of the PINN, and works
1 X i as follows. If bk = 0, (22c) and (22d) demand zk = 0, and
Lix = (x − x̂ij )2 ∀i = 1, ..., m (16)
N j=1 j if bk = 1, (22a) and (22b) yield zk = ẑk . ẑkmin and ẑkmax
N are required to bound the problem, however, they need to
1 X i be chosen large enough to not be binding. Tightening these
Liy = (y − ŷji )2 ∀i = 1, ..., n. (17)
N j=1 j bounds, by means of interval arithmetic [16] and a bound
tightening algorithm [14], can reduce the computation time
On top of these loss terms based on a dataset we add the
significantly.
physical knowledge of the system in form of a regularisation
- this addition differentiates a PINN from a plain NN III. C ASE STUDY
and allows for a more data efficient process. We use the This section introduces the essential aspects of the con-
regularisation to evaluate whether the state approximations verter dynamics which we seek to analyse; an extensive
satisfy the governing differential and algebraic equations. description can be found in [4], [20]. Furthermore, we
The associated loss terms Lif , Lig take the form describe the training of the PINNs as well as the formulation
Nc of the optimization problems through which we analyze the
1 X d
Lif = (f (x̂j , ŷj , uj , wj ; p)i − x̂ij )2 ∀i = 1, ..., m system characteristics in response to a voltage disturbance.
Nc j=1 dt Our objective is to determine: i) the maximum allowable
(18) disturbance duration ∆T , given the voltage disturbance mag-
Nc nitude ∆V , without entering an undesired control scheme,
1 X
Lig = (g(x̂j , ŷj , uj , wj ; p)i )2 ∀i = 1, ..., n. and ii) the amount of active power that is delivered shortly
Nc j=1 after the disturbance is cleared.
(19)
A. Current control in grid-following converters
Note that to evaluate these loss terms we do not require
The following model stems from the model-reduction
to know x and y, hence, we can evaluate Lif and Lig
approach laid out in [20], however, here we shall only focus
at Nc collocation points across the input domain without
on the control of the converter current for brevity. The
the need for additional simulations. We only require the
d i differential states of the currents id , iq lag their respective
approximations x̂, ŷ and the term dt x̂j can be computed
reference values iref ref
d , iq .
by applying automatic differentiation [19] on the differential
states x̂ with respect to the input variable t. Lastly, the values did 1 ref
= (i − id ), (23)
of uj , wj , p in the function evaluations f and g are either dt Tp d
given as fixed parameters or can be inferred from the input diq 1 ref
characteristics C. The weighted sum1 of the losses then forms = (i − iq ). (24)
dt Tq q
the objective function for the training procedure
These reference values are defined by the desired active
min λix Lix + λiy Liy + λif Lif + λig Lig (20) and reactive power output Pext , Qext under normal operating
Wi ,bi
conditions
s.t. (12) − (15). (21)
ref Pext
id = f, (25)
B. Mixed-Integer Linear reformulation V
meas
The above described PINN is effectively a combination Qext
iref
q = − + iQ f, (26)
of linear transformations and non-linear activation functions, Vmeas
here ReLUs (14). By using the exact reformulation (22a)- and they are adjusted by a current injection iQ for voltage
(22e) of the ReLUs [16] support
(
0, Vmeas > VQ
zk ≤ ẑk − ẑkmin (1 − bk ) (22a) iQ =
− (KRCI (VQ − Vmeas ) + IQ0 ) , Vmeas ≤ VQ
zk ≥ ẑk (22b)
(27)
zk = max(ẑk , 0) ⇒ zk ≤ ẑkmax bk (22c) and the factor f to represent the Low Voltage Ride-Through
zk ≥ 0
(22d) (LVRT) capabilities in case of abnormal conditions
bk ∈ {0, 1}Nk
(22e)
1,
Vmeas ≥ Vint
Vmeas −Vmin
f = c Vint −Vmin , Vmin ≤ Vmeas < Vint , (28)
1 For the values of the weighing parameters λi , λi , λi , λi please refer
x y g
f 0, Vmeas < Vmin .
to the published code on https://github.com/jbesty
4420
Authorized licensed use limited to: University of Michigan Library. Downloaded on November 24,2024 at 19:50:39 UTC from IEEE Xplore. Restrictions apply.
iQ f ∆V ∈{0.2, 0.267, 0.333, 0.4, 0.467, (37)
1
0.533, 0.6, 0.667, 0.733, 0.8} p.u. (38)
Inom c
fpost
with the initial condition being the equilibrium for the
converter set-point
0 Vmeas
KRCI Vmin Vint u = [Pext , Qext ] = [0.8, 0.2] p.u.. (39)
Vmeas
Additional 36 trajectories with varied values of ∆V are used
IQ0
as a validation dataset, their exact creation alongside further
t
training parameters can be found in the published code. The
VQ Vmeas parameters as well as the PINN dimensions are based on
heuristics, a hyper-parameter tuning could yield improved
Fig. 2. Adjustment of iQ and f based on the voltage level. iQ models the performance. In order to evaluate the governing equations at
voltage support characteristic and f the Low Voltage Ride-Through (LVRT)
characteristic. Adapted from [4].
the collocation points we require the values of the external
voltage w = [Vt ]. The time-series for Vt is constructed by
subtracting ∆V for a duration of ∆T from the set voltage
Figure 2 illustrates the control mechanism and shows how Vt = 1 p.u.. The system parameters p are not altered in this
the LVRT characteristic leads to a the reduction of f to fpost case study. All computations were performed on a regular
which is irreversible in the short term. A further complication machine (i5-7200U CPU @ 2.50GHz, 16GB RAM).
arises from the current limiters: C. Optimization problem formulation
(
max
Inom , Vmeas ≥ 0.9 p.u. We consider the problem of finding the maximum allow-
Id = q 2 2
(29) able disturbance duration while not entering the low-voltage
Inom − iq , Vmeas < 0.9 p.u.
(p ride through (LVRT) mode, i.e., Vmeas < Vint , since the
2
Inom − i2d , Vmeas ≥ 0.9 p.u. delivered power can return to the desired power set-point
max
Iq = (30) after the disturbance is cleared. Otherwise, the factor f leads
Inom , Vmeas < 0.9 p.u.
to lower reference currents iref ref
d , iq and hence to a reduced
These control actions all depend on the measured voltage delivered power in the short-term. The presented framework
Vmeas which constitutes another differential state, and which provides the flexibility to analyze this question from multiple
is linked to the external voltage through a low-pass filter in angles.
the transformed voltages vd , vq : First, we require that (41) is satisfied, i.e., the LVRT mode
dVmeas 1 q 2 is never entered. We add a parameter to control how close
= ( vd + vq2 − Vmeas ) (31) the approximation can be to the critical voltage Vint . By
dt Tm
adding this buffer, we account for the fact that the PINN
The delivered active and reactive power Ptotal , Qtotal then yields only an approximation of the system dynamics. This
depend on the external voltages and the converter currents effectively shrinks the feasible space, which can also be seen
Ptotal = vg,d id + vg,q iq , (32) as controlling the conservativeness of the resulting stability
assessment. The resulting optimization problem reads as
Qtotal = vg,q id − vg,d iq . (33)
max ∆T (40)
The Appendix contains the remaining system equations. t,x̂,ŷ,z,b
4421
Authorized licensed use limited to: University of Michigan Library. Downloaded on November 24,2024 at 19:50:39 UTC from IEEE Xplore. Restrictions apply.
t = 1s (48) 1
Vt [p.u.]
∆V = ∆V 0 (49) ∆T = 0.10 s, ∆V = 0.2 p.u.
0.5
(12), (13), (15) (50) ∆T = 0.15 s, ∆V = 0.5 p.u.
∆T = 0.25 s, ∆V = 0.73 p.u.
(22a) − (22e) (51) 0
The solution of the optimization problems is performed in
Matlab [22] using YALMIP [23] and a MILP solver provided 1
by Gurobi [24].
Vmeas [p.u.]
IV. R ESULTS 0.5
In this section we present the resulting approximations of
the PINN and the analysis of the dynamic system based on
the optimization problems in Section III-C. 0
A. PINN approximation
0.8
First, we consider the quality of the approximation of the
Ptotal [p.u.]
PINN. Figure 3 presents the voltage disturbance Vt and three 0.6
critical variables, Vmeas , Ptotal , Qtotal for three different dis- 0.4
turbance characteristics C. The blue and green predictions
stem from trajectories that are included in the training dataset 0.2
while the red curve is a previously unseen trajectory. All 0
three trajectories are captured well, in particular in the initial
phase until the disturbance is cleared, and for the later half
when the system is mostly settled again. The approximation 0.6
Qtotal [p.u.]
4422
Authorized licensed use limited to: University of Michigan Library. Downloaded on November 24,2024 at 19:50:39 UTC from IEEE Xplore. Restrictions apply.
0.25 [7] T. L. Vu and K. Turitsyn, “Lyapunov functions family approach to
transient stability assessment,” IEEE Transactions on Power Systems,
0.0 vol. 31, no. 2, pp. 1269–1277, 2016.
0.025 [8] L. A. Wehenkel, Automatic learning techniques in power systems.
0.05 Springer Science & Business Media, 2012.
0.2
[9] B. Donnot, I. Guyon, M. Schoenauer, P. Panciatici, and A. Marot,
∆T [s]
µ
0.25
Available: https://arxiv.org/abs/1711.07356
0.50 [17] B. Karg and S. Lucia, “Stability and feasibility of neural network-
0.55 based controllers via output range analysis,” in 2020 59th IEEE
0.15 0.60 Conference on Decision and Control (CDC), 2020, pp. 4947–4954.
0.75 [18] J. Stiasny, G. S. Misyris, and S. Chatzivasileiadis, “Physics-informed
0.90 neural networks for non-linear system identification applied to power
0.95 system dynamics,” in 2021 IEEE Powertech, 2021, https://arxiv.org/
0.98
abs/2004.04026.
0.1 [19] A. G. Baydin, B. A. Pearlmutter, A. A. Radul, and J. M. Siskind,
0.2 0.3 0.4 0.5 0.6 0.7 0.8 “Automatic differentiation in machine learning: a survey,” 2015.
∆V [p.u.] [Online]. Available: https://arxiv.org/pdf/1502.05767.pdf
[20] G. Chaspierre, G. Denis, P. Panciatici, and T. Van Cutsem, “An
active distribution network equivalent derived from large-disturbance
Fig. 5. Power delivery P̂total = µPext after 1 s. The dashed line simulations with uncertainty,” IEEE Transactions on Smart Grid,
corresponds to the LVRT boundary and is associated with µ = 0.6. vol. 11, no. 6, pp. 4749–4759, 2020.
[21] M. Abadi et al., “Tensorflow: Large-scale machine learning
on heterogeneous distributed systems,” 2016. [Online]. Available:
potential approximation error of the PINNs by introducing https://arxiv.org/pdf/1603.04467.pdf
[22] MATLAB version 9.7.0.1247435 (R2019b) Update 2, The Mathworks,
an -conservativeness factor, which can also be applied to Inc., Natick, Massachusetts, 2019.
account for a required stability margin. Future work will look [23] J. Löfberg, “Yalmip : A toolbox for modeling and optimization in
into neural network verification methods that can drive neural matlab,” in In Proceedings of the CACSD Conference, Taipei, Taiwan,
2004.
network training towards the minimum PINN approximation [24] Gurobi Optimization, “Gurobi optimizer reference manual,” 2021.
error. [Online]. Available: http://www.gurobi.com
R EFERENCES A PPENDIX
[1] H. N. V. Pico and B. B. Johnson, “Transient stability assessment of
multi-machine multi-converter power systems,” IEEE Transactions on
Power Systems, vol. 34, no. 5, pp. 3504–3514, 2019. vd = vx cos(θpll ) + vy sin(θpll ), (52)
[2] S. Mat Zali and J. V. Milanović, “Generic model of active distribution
network for large power system stability studies,” IEEE Transactions vq = −vx sin(θpll ) + vy cos(θpll ), (53)
on Power Systems, vol. 28, no. 3, pp. 3126–3133, 2013. dθpll
[3] G. Chaspierre, P. Panciatici, and T. Van Cutsem, “Modelling active dis- = (ωpll )ωref , (54)
tribution networks under uncertainty: Extracting parameter sets from dt
randomized dynamic responses,” in 2018 Power Systems Computation ωpll = Kpω vq + 1, (55)
Conference (PSCC), 2018, pp. 1–7.
[4] G. Chaspierre, M. Ghazavi, G. Denis, P. Panciatici, and T. Van Cutsem, PVSC = vd id + vq iq , (56)
“Dynamic equivalent of a real distribution grid hosting photovoltaic
and synchronous generators,” 2020.
QVSC = vq id − vd iq . (57)
[5] P. Kundur, N. J. Balu, and M. G. Lauby, Power system stability and vd = vg,d − ωpll Lc iq + Rc id , (58)
control. McGraw-hill New York, 1994, vol. 7.
[6] M. Pavella, D. Ernst, and D. Ruiz-Vega, Transient stability of power vq = vg,q + ωpll Lc id + Rc iq (59)
systems: a unified approach to assessment and control. Springer
Science & Business Media, 2012.
4423
Authorized licensed use limited to: University of Michigan Library. Downloaded on November 24,2024 at 19:50:39 UTC from IEEE Xplore. Restrictions apply.