Python Based Scenario Design and Parallel Simulation Method For Transient Rotor Angle Stability Assessment in PowerFactory
Python Based Scenario Design and Parallel Simulation Method For Transient Rotor Angle Stability Assessment in PowerFactory
Python Based Scenario Design and Parallel Simulation Method For Transient Rotor Angle Stability Assessment in PowerFactory
Abstract—Transient rotor angle stability after a fault event is tial execution of simulation tasks. The parallelization of tasks
a computationally intensive process and performing it for large is a customary solution to a specific problem however some
number of scenarios requires parallelization. To facilitate it, this of the commercial software like PowerFactory and PSS/E
paper presents a tool that combines scenario modeling, task list
creation and dispatcher of parallel processes as a single platform have provided an application programming interface (API)
in Python. PowerFactory allows only one instance from a user in Python to facilitate this process. It has opened a range
account in a Windows machine that can modify its database. The of possible applications that can automate the tasks related
proposed approach overcomes this limitation and enable multiple to networks preparation and simulation. However, for the
instances from a single machine. It is tested on a single infinite software that have a single database for each user on windows
machine equivalent (SIME) method for calculation of critical
clearance time (CCT) while assessing the rotor angle stability. machines, it limits using the parallel instances of a software
This approach leads to the reduction of computational time as a from a single user account. This paper proposes a workaround
factor of number of parallel instances and significantly improves to this limitation by utilizing a software utility that can access
handling of tasks and aggregation of results. The methodology multiple user accounts at the same time thus allowing to run
is generic and can be adopted to any software that provides a software instances in parallel. This greatly improves the han-
Python interface.
dling of operations from a single machine that can define the
Index Terms—Python, Parallel processing, Stability analysis, simulation scenarios as tasks. The proposed simulation method
Critical clearance time is based on object oriented approach for scenario design and
validation, task list creation and dynamic task assignment
I. I NTRODUCTION and is termed as python based scenario design and parallel
Power systems globally in the last decade are experiencing simulation (PySDPS) tool. It is entirely based in Python pro-
an increasing trend of renewable energy integration from gramming language and its generic nature enables adaptation
sources such as solar and wind predominantly connected to to any simulation program. For instance, it can be applied to
the distribution networks. This has driven a large number of open-source software like PandaPower [4], PowerGAMA [5]
national and international projects aiming at a wide spectrum and Python for Power System Analysis (PyPSA) [6] working
of challenges. These studies for example involve analysis of in conjunction with PowerFactory. PySDPS as a platform can
distribution network hosting capacity [1], performing security be extended to suit the particular application requirement other
assessment of the power system dynamic stability [2] or than the mentioned cases.
studying the impacts of introducing controllers in the medium
or low voltage distribution networks [3]. Such studies often II. P OWER FACTORY PARALLELIZATION
perform scenario based analysis. Scenarios can be for instance PowerFactory relies on a database architecture with a single
the configurations of various controller parameters, their varia- database maintained for each Windows user account. It is
tions, control actions, future scenario events or contingencies. therefore not possible to create multiple instances of Power-
Subsequently, data analytic is performed to quantify the results Factory for a single Windows user, as per time of publication.
based on the key performance indicators. The simulation The developed method has come up with a work around for
design for scenario based study usually involves a number this problem, thus enabling creation of multiple instances of
of repetitive processes that can be generalized and automated. PowerFactory on Windows.
This paper presents a generic approach that aims to facilitate PStools is a suite of tools provided by Microsoft to facili-
such scenario based studies. tate the network administrators with remote management. An
Generally, the scenario based analysis whether performed interesting program within the toolbox is named PsExec.exe.
using an open-source or commercial software requires sequen- This command line tool allows a network administrator to run
Authorized licensed use limited to: UNIVERSITAS GADJAH MADA. Downloaded on August 14,2024 at 00:31:35 UTC from IEEE Xplore. Restrictions apply.
programs on a remote computer using a specific Windows performed on the generated result files. Now we discuss, each
login ID. PySDPS uses this capability to create multiple part of the tool in detail.
PowerFactory instances using multiple Windows user login
credentials. A. Scenario Design
A client-server architecture is used to dispatch tasks where
the server relies on the multiprocess python package. The In the simulation setup the first step is to prepare the
client process that is a PowerFactory instance is initiated and networks according to the user specifications. An outline of the
the task is dispatched. The task list is updated dynamically as scenario design algorithm is given in Alg. 1, where the concept
the task is completed by the PowerFactory instance, following of variation based approach is presented. In the scope of
which new instance of PowerFactory is created and the next PowerFactory, each variation can introduce controllers in the
task from the process queue is dispatched. network, create new loads, measurement devices and modify
existing settings. The expansion stages are time triggered
III. D ESIGN OF P Y SDPS TOOL and they get activated based on the current simulation time
An outline of the simulation work-flow is shown in Fig. 1. if the corresponding variation is active. The variations and
The first part is setting specifications for the scenario design. expansion stages together can be used to configure the network
The scenario details can be specific as per requirements, for in PowerFactory.
instance, settings for short circuit analysis, setup and activation
of a network variation, operational strategy, simulation settings Algorithm 1: Network preparation.
or settings for the controllers. Input : Network data including controller parameter
settings, variations and expansion stages,
composite frames, common models and path
to profiles.
Output: PowerFactory network configured.
1 ∀ ci ∈ C del (ci ) ; // Delete previous changes
2 (V, EV ) ← ; // variations and expansions stages
3 // Set the study case time and date
4 for vi in V do
5 for ej in EV do
6 Activate vi and ej ;
7 // Initalize composite and common models
k
8 Mcomp ← Mcomp ; // composite frame
l
9 Mcom ← Mcom ; // common model
Authorized licensed use limited to: UNIVERSITAS GADJAH MADA. Downloaded on August 14,2024 at 00:31:35 UTC from IEEE Xplore. Restrictions apply.
Algorithm 3: Task dispatcher. other events that can cause imbalance between supply and
Input : Number of workers (W ), Task list (J) demand. The fault should be cleared with-in the maximum ad-
Output: Task completion missible clearing time called critical clearance time (CCT) to
ensure transient stability [12]. The transition undergone by the
1 Initialize worker processes; system is studied under fault and post-fault operational state
2 for wa in W do of the network. There are generally two methods for studying
3 waT .start() // Start worker process the transient stability assessment, time domain simulation
4 Initialize multiprocess task queue (Q); and direct stability methods. Among time domain simulation
5 for jb in J do method, a popular approach is the derivation of single machine
6 Q ← jb // Put tasks in the queue equivalent (SIME) of the whole system [13]. This method has
been widely used in planning studies. Direct stability methods
7 Add empty tasks as process kill switch to queue; pave way towards real time assessment of transient stability
8 for waT in W T do and they are extensively researched in the literature [14]. These
9 Q ← None methods are based on derivation of energy-type Lyapunov
10 Initialize result queue (R); functions that require certain assumptions to be made. An
alternate approach avoiding such assumption is based on the
11 for qc in Q do // For each next task in queue perturbation vectors and has been discussed in [15].
12 for waT ∈ W T do // Check available worker In this paper, as an application of the proposed PySDPS
13 if waT = available then tool, we study the transient stability assessment as a planning
14 waT = qc ; problem and apply the well known time domain SIME based
15 if waT = None then equal area criteria (EAC) method. The network is evaluated
16 Terminate process wa ; for a set of contingencies that are introducing fault on the
17 else transmission lines. In the post fault state, the rotor angles of
18 Initialize the worker command line all generators must regain synchronism in order to ensure
script and execute process; the transient frequency stability. The assessment of CCT
19 Put results in results queue (R); is performed using SIME method that combines the time
domain stability analysis with EAC approach. This particular
application is described in [16], where the DIgSILENT pro-
IV. A PPLICATION OF P Y SDPS TOOL gramming language (DPL) was used to assess the stability of
the post fault scenario. This paper models DPL based method
A. Need for Scenario Based Analysis for Rotor Angle Stability
completely in Python to facilitate its future extensions.
The replacement of traditional combustion based generation
with renewable energy sources, have led to bulk power transfer C. Single Infinite Machine Equivalent
over long distances, slow transmission expansion and increas-
ing technical issue of declining inertia in the transmission The single infinite machine equivalent (SIME) is a hybrid
systems [8]. Due to these circumstances, the transmission lines method that combines the time domain electromagnetic tran-
are operated closer to their technical limits [9]. Therefore, sient simulation with EAC method to determine if the fault
the impact of outage of an element in the grid (line, bus, clearance time leads to a stable or unstable state of the grid.
load, generator, transformer etc.) generally referred as the For this, the time domain simulation of the network in post
contingency is thus amplified and can cause cascade events in fault state is performed and the rotor angle dynamics for the
the grid [10]. The increasing vulnerability scenarios in the grid multiple generators is measured. Based on the rotor angles,
include reduction in stability margins related to rotor angle the generators are divided among the critical and non-critical
stability, high rate of change of frequency events due to inertia machines as shown in Fig. 2. These systems are combined
decline and poorly damped oscillations and others impacts together in a single one machine infinite bus (OMIB) system.
outlined in [11]. These scenarios requires for instance varying The stability of the OMIB is assessed in terms of transient
the location of converter interfaced generation (CIG), changing stability margins based on the accelerating and decelerating
the level of power in-feed from renewable energy resources, energy as part of EAC method.
protection system configuration and different fault location and
types. Therefore, it is often the case that vulnerability scenarios D. Equal Area Criterion
of future require the study of large number of scenarios. The EAC of the multi-machine system is governed by the
sign of the stability margin given as,
B. Transient Rotor Angle Stability Assessment
η = Adec − Aacc (1)
The transient rotor angle stability is the ability of a power
system to retain synchronism after subjected to a large contin- here, Adec and Aacc represents decelerating and accelerating
gency. A contingency may represent a short-circuit at certain areas, respectively. The system is stable if η is positive,
line, failure of a generation unit, disconnection of load and unstable if it is negative and critically stable if it is zero.
Authorized licensed use limited to: UNIVERSITAS GADJAH MADA. Downloaded on August 14,2024 at 00:31:35 UTC from IEEE Xplore. Restrictions apply.
may represent the network modification, inclusion of new
generation or for varying load/generation scenarios. In the
considered case, the inertia in the network is reduced from
its base case to its 50% and correspondingly, the CCT values
are calculated by introducing faults in the lines. This analysis
on the first hand demonstrates that in order to perform this
study, there is a need to analyze large number of scenarios
and effectively demonstrates the effectiveness of the proposed
approach.
V. U SE -C ASE
The CCT assessment using the proposed simulation ap-
proach is carried out on IEEE 39 bus, 10 machine system [17].
The single line diagram of the test system is shown in Fig. 4.
The SIME based method is used for the calculation of CCT
following the contingency of a single line. Thus the number
of scenarios is equal to the number of lines in the network.
Fig. 2. Classification of multiple machines into critical and non-critical The inertia of the generators is sequentially decreased from
machines and OMIB system.
its base value and the analysis is repeated. As the network
consists of 34 lines, the inertia reduction from 100% of the
The recovery of stable OMIB trajectory occurs at the base value to its 50% is performed in 10 steps leading to 204
recovery angle δr < δu and at time tr as shown in Fig. 2. If scenarios. The base value of inertia corresponds to the system
the OMIB trajectory grows beyond the unstable angle limit δu values as reported in the literature [17]. For each scenario the
then η becomes negative and the system satisfies the instability fault clearance time is increased from 40 to 300 milliseconds
criteria. (ms) in steps of 20 ms. If the system gets unstable for a fault
on a certain line and its clearance time, the last recorded fault
clearance time is termed as CCT for the given contingency.
~
SG G_8_B37
G_10_B30
Bus 37 Load 26
Line 26 - 29
Load 29
Trf 25 - 37
~ Line 26 - 28 Line 28 - 29
SG
Bus 25 Bus 26 Bus 28 Bus 29
Bus 30
Line 26 - 27
Trf 29 - 38
Line 02 - 25
Bus 24 SG
Bus 18 Bus 17 Load 27 ~
G_9_B38
Line 03 - 18
Line 16 - 24
Line 02 - 03
Line 16 - 17
Bus 01 Load 24
G_6_B35
Load 18
~
Bus 03 SG
Bus 16
Bus 35
Line 01 - 39
Line 15 - 16
Line 16 - 21
Line 03 - 04
Interconnection to
Trf 22 - 35
Rest of U.S.A. / Canada Load 03
Load 04 Line 21 - 22
Load 16
~ Line 04 - 14 Bus 15
Line 23 - 24
G_1_B39 SG
Line 14 - 15
Bus 21 Bus 22
Bus 04
Line 16 - 19
Line 04 - 05
Bus 39 Load 15
Bus 14
Load 21
Line 22 - 23
Bus 05 Load 12
Load 39
Line 05 - 06
Load 23
Line 13 - 14
Bus 12
Line 05 - 08
Bus 06
Line 06 - 07
Bus 19 Bus 23
Trf 13 - 12
Trf 11 - 12
Line 06 - 11
Line 09 - 39
Load 20
Trf 19 - 20
Trf 23 - 36
Bus 07
Trf 06 - 31
Bus 13
Trf 19 - 33
Line 07 - 08
Trf 20 - 34
Load 07
Bus 08 SG
~
Line 08 - 09
Bus 31 G_7_B36
Bus 10 Bus 34 Bus 33
Trf 10 - 32
SG G_3_B32
~
Fig. 5 and 6 shows the EAC based results for the stable
and unstable case. The faults are introduced at line 06-11 and
02-25 at 0.1 seconds. They are cleared at 0.22 seconds by
disconnection of the line. We can observe that in case of 06-
Fig. 3. EAC is explained for stable case with recovery time related to recovery
angle. 11 leads to the stable scenario and 02-25, it leads to unstable
condition.
The time evolution of normalized rotor angles for both cases
E. Parametric Study is shown in Fig. 7 and 8. We can observe that for the stable
For a given system, there can be large number contingencies case, the critical machines rotor angles converge towards the
for which the CCT needs to be calculated. These scenarios non-critical machines in the long run. The unstable case can
Authorized licensed use limited to: UNIVERSITAS GADJAH MADA. Downloaded on August 14,2024 at 00:31:35 UTC from IEEE Xplore. Restrictions apply.
Dynamics of rotor angles when short-circuit fault is introduced on
Pm and Pe of the system when short-circuit fault is introduced on line line 06-11 at 0.1 second and cleared at 0.22 second (Stable case)
06-11 at 0.1 second and cleared at 0.22 second (Stable case). Gen1
Gen2
0.42 Pm
−0.35 Gen3
Pa
0.40 Gen4
Gen5 Critical machine
0.38 Gen6
Power (p.u.)
−0.40
Gen7
0.36 Gen8
δp.u. (rad)
Gen9
0.34
−0.45 Gen10
0.32
0.30
−0.50 Non-critical machines
0.28
0.0 0.1 0.2 0.3 0.4 0.5 0.6
Time (s)
−0.55
Fig. 5. The trajectory of the electrical and mechanical power of OMIB system 0.0 0.1 0.2 0.3 0.4 0.5 0.6
is stable according to EAC. Time (s)
Fig. 7. Dynamics of normalized rotor angles for the stable case shows
Pm and Pe of the system when short-circuit fault is introduced on line the convergence of the critical machine rotor angle towards the non-critical
02-25 at 0.1 second and cleared at 0.22 second (Un-stable case). machines in the network.
1.1
Pm Dynamics of rotor angles when short-circuit fault is introduced on
1.0 Pa line 02-25 at 0.1 second and cleared at 0.22 second (Un-stable case)
0.9 Gen1
0.50
Power (p.u.)
Gen2
0.8 Gen3
0.25 Gen4 Critical machines
0.7 Gen5
Gen6
0.6 0.00 Gen7
0.5 Gen8
δp.u. (rad)
−0.25 Gen9
0.4 Gen10
Fig. 6. The trajectory of the electrical and mechanical power of OMIB system
is un-stable according to EAC −1.00
−1.25
0.0 0.2 0.4 0.6 0.8
be seen distinctly showing the divergence of rotor angle of Time (s)
critical machines. As the inertia is decreased in the grid, the Fig. 8. For the unstable case the rotor angles of critical machines diverges
CCT shrinks and it is shown in Fig. 9. It can be observed from the rest and system looses stability.
that, as we move from 100% inertia towards 50% level, higher
number of contingencies require CCT to be less than 100 ms.
The sequential execution of the tasks leads to the total time number of parallel instances selected in the software tool. Due
of 18,414 seconds. While using the PySDPS and having 8 to highly modular and adaptable structure, it can be well suited
parallel instances using PowerFactory in engine mode, reduces for performing large number of studies. The only limitation to
this time to 2,807 seconds. This amounts to 84% reduction in the proposed approach are the number of available licenses of
the processing time. PowerFactory and computational capability of hardware.
VI. C ONCLUSION
Planning and operation tasks in power systems often require
scenario analysis. When the process under study is of transient
rotor angle stability assessment, this may lead to large com-
putational time to simulate all scenarios. Thus methods that
can perform parallel simulations can facilitate this process.
Running multiple instances of PowerFactory is a challenging
task at the time of publishing the paper and often requires
manual work of handling data and scenario set. The proposed
simulation approach solves this problem by a modular and
flexible approach of software instance handling that enables
running multiple instances in parallel using a single user
account on windows machine. The computational time of any
scenario simulated in PowerFactory can be decreased by the Fig. 9. Average CCT as function of inertia in the system.
Authorized licensed use limited to: UNIVERSITAS GADJAH MADA. Downloaded on August 14,2024 at 00:31:35 UTC from IEEE Xplore. Restrictions apply.
R EFERENCES
[1] Varela, J., Hatziargyriou, N., Puglisi, L. J., Rossi, M., Abart, A., and
Bletterie, B., “The igreengrid project: Increasing hosting capacity in
distribution grids,” IEEE Power and Energy Magazine, vol. 15, no. 3,
pp. 30–40, May 2017.
[2] Khan, S., Bletterie, B., Anta, A., and Gawlik, W., “On small signal
frequency stability under virtual inertia and the role of plls,” Energies,
vol. 11, no. 9, p. 2372, 2018.
[3] Evangelopoulos, V. A., Georgilakis, P. S., and Hatziargyriou, N. D.,
“Optimal operation of smart distribution networks: A review of models,
methods and future research,” Electric Power Systems Research, vol.
140, pp. 95–106, 2016.
[4] Thurner, L., Scheidler, A., Schafer, 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, 2018.
[5] Svendsen, H. G. and Spro, O. C., “Powergama: A new simplified
modelling approach for analyses of large interconnected power systems,
applied to a 2030 western mediterranean case study,” Journal of Renew-
able and Sustainable Energy, vol. 8, no. 5, p. 055501, 2016.
[6] Brown, T., Hörsch, J., and Schlachtberger, D., “PyPSA: Python for
Power System Analysis,” Journal of Open Research Software, vol. 6,
no. 4, 2018.
[7] DIgSILENT PowerFactory Version 2018 User Manual, DIgSILENT
GmbH, Heinrich-Hertz-Strae 9, 72810 Gomaringen, Germany, May
2018.
[8] Andersson, G., Donalek, P., Farmer, R., Hatziargyriou, N., Kamwa, I.,
Kundur, P., Martins, N., Paserba, J., Pourbeik, P., Sanchez-Gasca, J.
et al., “Causes of the 2003 major grid blackouts in north america
and europe, and recommended means to improve system dynamic
performance,” IEEE transactions on Power Systems, vol. 20, no. 4, pp.
1922–1928, 2005.
[9] Tan, J., Crossley, P., McLaren, P., Gale, P., Hall, I., and Farrell, J.,
“Application of a wide area backup protection expert system to prevent
cascading outages,” IEEE Transactions on Power Delivery, vol. 17,
no. 2, pp. 375–380, 2002.
[10] Dobson, I., Chen, J., Thorp, J., Carreras, B. A., and Newman, D. E.,
“Examining criticality of blackouts in power system models with cas-
cading events,” in System Sciences, 2002. HICSS. Proceedings of the
35th Annual Hawaii International Conference on. IEEE, 2002, pp.
10–pp.
[11] Denis, G., Prevost, T., Debry, M.-S., Xavier, F., Guillaud, X., and
Menze, A., “The migrate project: the challenges of operating a trans-
mission grid with only inverter-based generation. a grid-forming control
improvement with transient current-limiting control,” IET Renewable
Power Generation, vol. 12, no. 5, pp. 523–529, 2017.
[12] Machowski, J., Bialek, J., and Bumby, J., Power system dynamics:
stability and control. John Wiley & Sons, 2011.
[13] Zhang, Y., Wehenkel, L., Rousseaux, P., and Pavella, M., “Sime: A
hybrid approach to fast transient stability assessment and contingency
selection,” International Journal of Electrical Power & Energy Systems,
vol. 19, no. 3, pp. 195–208, 1997.
[14] Chiang, H.-D., Direct methods for stability analysis of electric power
systems: theoretical foundation, BCU methodologies, and applications.
John Wiley & Sons, 2011.
[15] Bosetti, H. and Khan, S., “Transient stability in oscillating multi-
machine systems using lyapunov vectors,” IEEE Transactions on Power
Systems, vol. 33, no. 2, pp. 2078–2086, 2018.
[16] Cepeda, J., Salazar, P., Echeverrı́a, D., and Arcos, H., Implementation
of the Single Machine Equivalent (SIME) Method for Transient Stabil-
ity Assessment in DIgSILENT PowerFactory. Springer International
Publishing, 2018, pp. 319–353.
[17] Athay, T., Podmore, R., and Virmani, S., “A practical method for
the direct analysis of transient stability,” IEEE Transactions on Power
Apparatus and Systems, no. 2, pp. 573–584, 1979.
Authorized licensed use limited to: UNIVERSITAS GADJAH MADA. Downloaded on August 14,2024 at 00:31:35 UTC from IEEE Xplore. Restrictions apply.