Technical Documentation
RMS Simulation
Performance Benchmark
PowerFactory 15.2
DIgSILENT GmbH
Heinrich-Hertz-Str. 9
72810 - Gomaringen
Germany
http://www.digsilent.de
info@digsilent.de
r1596
Copyright 2014, DIgSILENT GmbH. Copyright of this document belongs to DIgSILENT GmbH.
No part of this document may be reproduced, copied, or transmitted in any form, by any means
electronic or mechanical, without the prior written permission of DIgSILENT GmbH.
Contents
1 Introduction 4
2 Simulation Improvements 4
3 Benchmark Tests 10
4 Data Modelling 17
5 Conclusion 24
1 Introduction
PowerFactory 15.2 completes the successful series of PowerFactory version 15 releases. The
latest release comes with a broad range of new functions, new electrical models and extensions
to the existing modelling suite. Special attention has been paid to improved calculation and
simulation performance.
This document is written in the form of a tutorial to show results of several RMS simulation
benchmark tests run on different projects which will not be made available to the user community
due to confidentiality reasons. This document is intended as a hands-on cookbook that shows
by examples what are the likely causes of slow simulations and what are the remedies which
are offered to the user in PowerFactory 15.2, together with an assessment of the performance
improvement with respect to PowerFactory 15.1.
2 Simulation Improvements
A large number of linear equation systems must be solved during a simulation. PowerFactory
15.2 implements an enhanced high performance algorithm for this task, resulting in a significant
speed-up for the overall calculation.
DSL has been enhanced via the introduction of the following one-shot functions: selfix, limfix
and outfix. These functions are analogous to the existing functions select, limits and output,
with the notable difference that they are evaluated only at initialisation, which provides significant
speed-up depending on their frequency of use. The introduction of the new functions exploits the
fact that a great proportion of the above-mentioned, existing functions were called on constant
parameters in dynamic models, e.g. to select a switch or to warn about a parameter lying outside
its allowable range, and thus need not be evaluated at each step. Also, any operation included
in an inc statement should use selfix rather than select regardless of the type of arguments
used, because inc statements are evaluated only at initialisation.
Figures 2.1 and 2.2 show an example of first order function coded with legacy DSL functions
and with new, one-shot DSL functions: in this case, the time constant T is a fixed parameter
which can thus be safely evaluated only at initialisation.
The newly-developed C Interface lets the user program virtually any model using the C lan-
guage.The advantage with respect to the existing DSL models or MATLAB interface models is
that the model is then compiled and may run as fast as a standard PowerFactory element. A
detailed description of the C Interface is available in the User Manual.
The standard models provided by PowerFactory have been enhanced with the use of new, one-
shot DSL functions and are delivered in a compiled form to achieve greater speed-up.
The speed-up provided by the C Interface extends beyond models coded directly in the C lan-
guage, and models within the standard library. In addition, the user can create or modify an ex-
isting DSL model, run the automatic DSL-to-C Interface Converter and simulate the customised
model as fast as a standard PowerFactory element.
A detailed description of the procedure to compile user-defined models is available in the User
Manual.
Further performance improvements are made possible via the use of the following algorithm
options:
PowerFactory 15.2 offers detailed monitoring of the transitions being scheduled and applied
within DSL models and informs the user about potential inconsistencies occurring during the
simulation.
systematic error messages are due to inconsistent operations. These errors should be
solved as soon as they appear not only because they may indicate a modelling mistake,
but also because they may harm simulation performance. For instance, x. = 1/0 would
result in a very large derivative leading to large errors, small steps (in case of variable step
size strategy) and numerical problems.
occasional error messages may be due to continuous/discrete modelling inconsistencies.
This happens because any numerical solution cannot in the general case exactly identify
and apply transitions at precise instants, but rather at approximate times. It is thus possi-
ble, for instance, that sqrt(limstate(x, 0, M ax)) issues a warning for a negative argument
because the limstate can be transitorily returning an unfeasible value outside its bounds.
While these errors may be ignored, it is recommended to use safer formulations such as
sqrt(max(limstate(x, 0., M ax), 0.)).
PowerFactory 15.2 enhances the users possibilities to monitor the simulation process through
the introduction of several additional variables which are accessible within the result file of the
simulation. Variables are members of the result file object.
These quantities are intended per simulation step. Several errors, counters and step sizes are
available. The following terms are used:
Equation errors:
b : errbs Error for bus equations
Error at the last iteration
b : errf i Error for network model equations
Error at the last iteration
b : erremt Error for dynamic model equations (EMT)
Error at the last iteration
b : errgrd Error for dynamic model equations (GRD)
Error at the last iteration
Integration errors:
b : ierremt Integration error for dynamic model equations (EMT)
A high value indicates that the step size may be too high
b : ierrgrd Integration error for dynamic model equations (GRD)
A high value indicates that the step size may be too high
Step sizes:
b : dtemt Integration step size for dynamic model equations (EMT)
Integration step size for instantaneous values simulation
b : dtgrd Integration step size for dynamic model equations (GRD)
Integration step size for RMS values simulation
b : dtint Interruption step
A value equal to zero indicates that the step size has not been interrupted
3 Benchmark Tests
In this Section, several models of real-world systems are used to assess the performance
speed-up of the improvements detailed in Section 2.
For confidentiality reasons, the identity of the models is not revealed. The approximate figures
concerning system size and component characteristics are given only to provide a general idea
of the speed-up obtainable on similar systems.
These simulations are run on an off-the-shelf desktop PC, using one core, having the following
characteristics:
Processor: Intel Xeon CPU E3-1240 V2 @ 3.4 GHz
RAM: 12 GB
Operative System: 64-bit Windows 7
System 1 is a very large model based on a real system with more than:
Importing and running the simulation in PowerFactory 15.1 is the first step of this investigation.
The simulation runs without warnings or errors with tCP U = 192 s, which is considered the
reference time for the following sections.
The simulation in PowerFactory 15.2 runs with tCP U = 38 s. Improved linear system solver (see
Section 2.1), default algorithmic options Fast convergence check and Fast computation of
outputs (see Section 2.6) and models from the Compiled improved standard library (see
Section 2.4) are to be credited for this more than five-fold speed-up.
Running the simulation without Fast convergence check and Fast computation of outputs
(see Section 2.6) and models from the Compiled improved standard library (see Section 2.4)
takes a simulation time of tCP U = 128 s, with a 1.5 speed-up to be attributed to the improved
linear system solver (see Section 2.1).
The default option Fast convergence check (see Section 2.6) gives a performance improve-
ment leading to a simulation lasting tCP U = 123 s with a speed-up of 1.55.
Another default option, Fast computation of outputs (see Section 2.6) allows to run the simu-
lation in tCP U = 79 s with a 2.45 speed-up.
An algorithmic option which may improve the simulation speed in the general case is Fast inde-
pendent solution of network and dynamic models (see Section 2.6). In this case however,
a speed-up cannot be expected because the whole system (i.e. the network and the dynamic
models) is completely solved once per time step in almost every step.
Finally, models from the Compiled improved standard library (see Section 2.4) bring down
the simulation time to tCP U = 38 s with more than five times speed-up.
Running the simulation with step size equal to 0.025 s gives the results summarised in table 3.2.
The overall simulation time in this case passes from tCP U = 96 s in PowerFactory 15.1 to
tCP U = 22 s in PowerFactory 15.2, with an overall speed-up of 4.35.
The simulated disturbance is a triphase short circuit on a 275 kV line at t = 1 s cleared by line
tripping at t = 1.1 s, resulting in a stable simulation between t = 0 s and t = 10 s. The variable
step size is shown in Fig. 3.1: details on the optimisation process that led to this step size are
given in Section 4.2. The reported CPU times tCP U refer to this simulation horizon.
The data model and the solver parameters had some issues whose investigation is reported
in Section 4.2. Before these issues were solved, the simulation time was tCP U = 63 s. With
the improvements detailed in Section 4.2, PowerFactory 15.1 runs in tCP U = 22 s, which is
considered the reference time for the following measurements.
The simulation in PowerFactory 15.2 runs with tCP U = 18 s. The improved linear system solver
(see Section 2.1) is to be credited for this 1.2 speed-up.
The default options Fast convergence check and Fast computation of outputs (see Sec-
tion 2.6) give a straight performance improvement when applied in fixed step size simulation.
However, since they systematically worsen the error estimation, an adaptation of the prediction
error bounds is required in order to provide a speed-up in variable step size simulation (other-
wise they may result in a performance degradation due the increased estimation of the error and
the consequent decrease of the average step size). In this respect, the prediction error bounds
are increased by 50%.
Another algorithmic option which may improve the simulation speed is Fast independent solu-
tion of network and dynamic models (see Section 2.6). To see whether a speed-up can be
expected, the result file variable itreq is plotted in Fig. 3.2: this quantity represents the number
of times the whole system (i.e. the network and the dynamic models) have to be completely
solved in order to achieve convergence in a given step.
By default, Fast independent solution of network and dynamic models is switched off to
guarantee the same accuracy as older PowerFactory versions whichever the step size used.
Indeed, if large steps are used, with respect to the dynamics involved, the response obtained
with the independent solution may differ from the default solution or even lead to divergence.
However, in this case, the Fast independent solution of network and dynamic models may
be safely used without loss of accuracy and gives a two-fold speed-up which corresponds to a
simulation time tCP U = 11 s.
Since this system is a real industrial case with customised models, no model from the Com-
piled improved standard library is used (see Section 2.4). However, the user may still improve
his(her) simulation, first by rewriting his(her) DSL models with the use of One-shot DSL func-
tions (see Section 2.2) and then by converting them with the Automatic DSL-to-C Interface
converter (see Section 2.5) and running them with the C Interface for dynamic models (see
Section 2.3).
One-shot DSL functions bring the simulation time down to tCP U = 10 s while the fastest
simulation is obtained with the C Interface for dynamic models and it lasts tCP U = 9 s with a
2.45 speed-up.
Importing and running the simulation in PowerFactory 15.1 is the first step of this investigation.
The simulation runs without warnings or errors with tCP U = 14 s, which is considered the
reference time for the following sections.
The simulation in PowerFactory 15.2 runs with tCP U = 13 s. The improved linear system solver
(see Section 2.1) is to be credited for this 1.1 speed-up.
The default option Fast computation of outputs (see Section 2.6) gives a performance im-
provement leading to a simulation lasting tCP U = 12 s with a speed-up of 1.15.
Another default option, Fast convergence check (see Section 2.6) allows to run the simulation
in tCP U = 9 s with a default speed-up of 1.55.
Another algorithmic option which may improve the simulation speed is Fast independent solu-
tion of network and dynamic models (see Section 2.6). To see whether a speed-up can be
expected, the result file variable itreq is plotted in Fig. 3.3: this quantity represents the number
of times the whole system (i.e. the network and the dynamic models) have to be completely
solved in order to achieve convergence in a given step.
In this case, the Fast independent solution of network and dynamic models may be safely
used without loss of accuracy and gives a 3.5 speed-up which corresponds to a simulation time
tCP U = 4 s.
Since this system is a real industrial case with customised models, no model from the Com-
piled improved standard library is used (see Section 2.4). However, the user may still improve
his(her) simulation, first by rewriting his(her) DSL models with the use of One-shot DSL func-
tions (see Section 2.2) and then by converting them with the Automatic DSL-to-C Interface
converter (see Section 2.5) and running them with the C Interface for dynamic models (see
Section 2.3).
One-shot DSL functions and the usage of automatically converted models with the C Interface
for dynamic models bring the simulation time down to tCP U = 3 s with a 4.65 speed-up.
Importing and running the simulation in PowerFactory 15.1 is the first step of this investigation.
The simulation runs without warnings or errors with tCP U = 137 s, which is considered the
reference time for the following sections.
The simulation in PowerFactory 15.2 runs with tCP U = 76 s. Improved linear system solver (see
Section 2.1) and default algorithmic options Fast convergence check and Fast computation
of outputs (see Section 2.6) are to be credited for this 1.8 speed-up.
Running the simulation without Fast convergence check and Fast computation of outputs
(see Section 2.6) takes a simulation time of tCP U = 103 s, with a 1.35 speed-up to be attributed
to the improved linear system solver (see Section 2.1).
The default option Fast convergence check (see Section 2.6) gives a performance improve-
ment leading to a simulation lasting tCP U = 98 s with a speed-up of 1.4.
The other default option, Fast computation of outputs (see Section 2.6) allows to run the
simulation in the default time of tCP U = 76 s, which corresponds to a 1.8 speed-up.
An algorithmic option which may improve the simulation speed in the general case is Fast inde-
pendent solution of network and dynamic models (see Section 2.6). In this case however,
a speed-up cannot be expected because the whole system (i.e. the network and the dynamic
models) is completely solved once per time step in almost every step.
Since this system is a real industrial case with customised models, no model from the Com-
piled improved standard library is used (see Section 2.4). However, the user may still improve
his(her) simulation, first by rewriting his(her) DSL models with the use of One-shot DSL func-
tions (see Section 2.2) and then by converting them with the Automatic DSL-to-C Interface
converter (see Section 2.5) and running them with the C Interface for dynamic models (see
Section 2.3).
One-shot DSL functions bring the simulation time down to tCP U = 73 s while the fastest
simulation is obtained with the C Interface for dynamic models and it lasts tCP U = 52 s with a
2.65 speed-up.
4 Data Modelling
Section 3 showed the speed-up of the improvements detailed in Section 2. Some of them are
available out-of-the-box in PowerFactory 15.2 while some others require some action from the
user. Some of these improvements may speed-up the simulation considerably.
Our experience shows, however, that equally significant speed-ups may come from the solution
of data model issues or from the proper tuning of simulation parameters. Such issues may go
unnoticed for long time because they possibly do not influence the simulated response but only
the simulation performance.
PowerFactory 15.2, as detailed in Section 2, also increases the user possibilities to analyse the
simulation, detect such issues and hopefully solve them.
This section explores several aspects of the development of simulation models and shows their
application on a practical example of improvement of simulation speed through solution of data
model and solver parameters issues.
The development of a model for simulation is a complex task. The following best practices aim
at developing more meaningful models. Our experience shows that consistent models are often
simulated faster than inconsistent ones.
A model is a means to an end: no matter how detailed it is, the model is always an imperfect
representation of the underlying system. The scope of the simulation should guide the mod-
eler in choosing the appropriate level of detail. For instance, if the time horizon of interest of
a transient simulation is the first few seconds after a disturbance, load tap changer and boiler
dynamics need not to be represented. Also, the implementation of the model should be as sim-
ple as possible, avoiding unnecessary functions, and potentially using one-shot DSL functions
whenever possible (see Section 2.2).
Dynamic simulations in PowerFactory always suppose a steady-state initialisation, i.e. all the
derivatives of the state variables are supposed to be negligible. It is useful to verify that there
are indeed no dynamics by running a simulation without imposing any event and observing
that the response of the variables of interest is constant over a period of time. In case of DSL
models, it could also be useful to run the simulation with the option Display internal DSL events
in output window (see Fig. 4.1): ideally, no event should be scheduled or applied.
At initialisation, and during the simulation (in case of DSL models with the appropriate DSL
warning option selected, as indicated in Fig. 4.1), some warnings may be printed.
Solving the problems that lead to the warnings is beneficial to the user for at least two reasons:
first, the user makes sure that all the operations inside his/her models are consistent (thus ruling
out that the inconsistency comes from inaccurate modelling or errors), and second the user will
exactly get from the simulation what he/she expects from it. As an example, a division by zero
may be interpreted differently by the DSL code (in DSL, for instance, a division by zero is a large
number), by the C code (infinity) and by the user him(her)self.
It is recommended to check any warning and potentially correct them with the objective of a
warning-free simulation.
After obtaining a warning-free steady-state simulation, the next step is to impose a simple event,
for which a qualitative expected response is known. At this stage, it is recommended to tem-
porarily switch to the most accurate simulation settings. With respect to the default settings,
these are the usage of A-stable algorithm for all models (solves all the equations together,
eliminating interface errors), the disabling of the fast algorithmic options (see Section 2.6) and
the setting of the Resolution factor to 0 (see Fig. 4.2 and Fig. 4.3).
Figure 4.2: Running a simulation with the most accurate algorithmic options
Figure 4.3: Running a simulation with the most accurate event options
If the simulation runs with warnings or the simulated response is not as expected, possible
solutions are: to use a smaller integration step, or to examine again the model for modelling
inconsistencies.
The step size is the solution parameter which possibly has the largest impact on the simulation
performance. An appropriate tuning is thus needed to avoid unnecessarily slow simulations.
As a rule of thumb, in order to obtain accurate results in PowerFactory , the integration step
size should not be larger than the smallest equivalent time constant of the dynamics present
in the system. Starting with fixed step size simulations, the step size h should be increased
(or decreased) until the simulation responses show no substantial differences for h/2, h and
2h in a typical simulation. The largest h that satisfies this requirement is probably an optimal
integration step size.
Once the simulation responds as expected, the user may consider to disable the A-stable
algorithm for all models in order to solve network and dynamic models separately. For specific
models with strong interaction with the network, the option of solving some specific models only
together with the network is offered by enabling the A-stable flag of each single element.
In the general case, the simulation without A-stable models should be faster, but the simulated
response should not vary significantly.
The default options Fast convergence check and Fast computation of outputs (see Sec-
tion 2.6) may be enabled, provided that the simulated response is not changed significantly.
This may happen in case of too-large step sizes or numerical problems.
The default option Apply DSL events directly (see Section 2.6) may also be enabled, provided
that no outer-loop iteration problem occur as a consequence. In this case, the model should be
revised in order to separate events which cannot be resolved within the given step, or the step
size should be reduced.
The simulation process can then be monitored for a typical simulation. The following iteration
counters are of particular interest: b : itreq, Number of whole system iterations and b : itevt,
Number of event loops. For more details please refer to Section 2.8.
It is important that these counters are, respectively, 1 and 0 from initialisation to the first event
imposed. This corresponds to a steady-state initialisation.
During the course of the simulation, higher values are acceptable. However, as the system
settles to a new steady-state (if any), these counters should tend to their initial values of 1 and
0.
If the value of b : itreq is significantly higher, this may indicate that some A-stable flags are not
set properly or that the step size is too large leading to high interface errors. The preferred option
in this case is to identify the responsible models and solve the interface problem. Alternatively,
the option Fast independent solution of network and dynamic models (see Section 2.6)
may be enabled, in order to enforce that the network is solved independently of and before the
dynamic models. The user should anyway check the simulated response and be advised that
this approach may lead to divergence or numerically unstable simulations, especially with large
step sizes.
Monitoring anomalies in other simulation process variables may be useful as well. For the
description and usage of the other variables, please refer to Section 2.8.
PowerFactory offers the possibility of using an automatic step size adaptation algorithm. To
evaluate whether this may bring a performance boost, the following errors may be monitored: b :
ierremt, Integration error for dynamic model equations (EMT) and b : ierrgrd, Integration
error for dynamic model equations (GRD) (see Section 2.8).
The step size adaptation algorithm increases the step size as soon as these estimated errors
are below the specified minimum for a number of delay steps, and decreases the step size on
the step immediately following an estimated error higher than the maximum. These parameters
can be set as indicated in Fig. 4.4.
The automatic step size adaptation may be useful whenever a fixed step size simulation shows
generally declining error estimations tending to negligible values. The choice of the upper and
lower bounds should be made accordingly to the error estimations. The choice of delay, max-
imum increase and increase/decrease factors should be made taking into account that neither
too frequent nor too large step size variations are beneficial to the integration algorithm.
Despite the newly developed C Interface for dynamic models (see Section 2.3), it is likely that
a vast majority of users will continue to use DSL for developing user-defined models, thanks to
its flexibility and ease of usage. Towards the end of the developing process, it is however rec-
ommended to use the Automatic DSL-to-C Interface converter (see Section 2.5) and compile
any developed user-defined DSL model to guarantee that the simulation runs as fast as pos-
sible. Negligible differences between the response computed with DSL and with C Interface
models are to be expected.
One of the examples used for benchmark tests in Section 3, System 2, is revisited hereafter in
order to demonstrate the impact of appropriate data modelling to simulation performance.
The description of System 2 is available in Section 3.2. Importing and running the simulation in
PowerFactory 15.1 is the first step of this investigation. The simulation runs without warnings or
errors with tCP U = 63 s, which is considered the reference time for the following section.
Since this is a variable step simulation, it is of interest to look at the step size used. The result file
variable dtgrd is shown in Fig. 4.6. The step size h, which should vary between h = 0.002 s and
h = 0.2 s, is in fact very close to the lower limit for the most of the simulation. To explain this
behaviour, the result file variable ierrgrd is plotted in Fig. 4.7.
The blue line in Fig. 4.7 is the upper limit for the prediction error estimation, which corresponds
to the default value 0.01. The error is very much above the maximum for the first few seconds
of the simulation, which explains why the step size is so small.
Finding the state variable(s) which is(are) responsible for such large error estimation is a cum-
bersome task in PowerFactory 15.1. The investigation proceeds in the next section with Power-
Factory 15.2, which gives the user more tools to investigate such simulation issues.
The simulation in PowerFactory 15.2 runs with tCP U = 46 s. The improved linear system solver
(see Section 2.1) is to be credited for this 1.35 speed-up. More specifically, the simulation is
run without Fast convergence check and Fast computation of outputs (see Section 2.6) to
better assess the speed-up of the improved linear system solver.
Since speeding up power system simulation is a complex subject, which can be hardly achieved
by one-fits-all approaches, the biggest gain may come from the attentive analysis of the ex-
perienced user. The first difference that the user may remark between the simulation run of
PowerFactory 15.2 with respect PowerFactory 15.1 is that several warnings of the type shown
in Fig. 4.5 are printed out at initialisation (see Section 2.7). In this example, a division by zero is
interpreted by DSL as a division by a large number.
Figure 4.7: Prediction error estimation in the initial PowerFactory 15.1 simulation
Figure 4.8: Step size in the corrected model PowerFactory 15.2 simulation
Once the model definitions have been modified to avoid inconsistent operations at initialisa-
tion, the user has the option to run the simulation with DSL consistency checks, by setting the
appropriate DSL warning option as shown in Fig. 4.1.
The simulation without inconsistencies now runs in tCP U = 22 s with a speed-up of 2.85. The
explanation for such surprising speed-up is that some of the state variables derivatives were
the result of a division by zero (probably because of a modelling error that went unnoticed).
This is interpreted by DSL as a very large derivative, resulting in a very large estimation of the
prediction error which was preventing the step size from increasing. Indeed, the integration step
looks different now, as plotted in Fig. 4.8.
Observing the step size in Fig. 4.8 shows many variations which are in general not beneficial to
the simulation speed. The maximum prediction error is thus set to 0.02 leading to tCP U = 18 s
and a less variable and somewhat larger step size, as plotted in Fig. 3.1.
The simulation with improved step size strategy in PowerFactory 15.2 now runs with a speed-
up of 3.5 compared to the initial PowerFactory 15.1. The above speed-ups are summarised in
table 4.1. Exporting the corrected model to PowerFactory 15.1 leads to tCP U = 22 s, which was
considered the reference time in the previous Section 3.2.
To ease the comparison, the final timing of tCP U = 9 s reported in Section 3.2, correspond-
ing to the use of all PowerFactory 15.2 enhanced algorithmic options detailed in Section 2.6
(Fast computation of outputs, Fast convergence check and Fast independent solution of
network and dynamic models), Fast DSL functions (see Section 2.2) and C Interface for
dynamic models (see Section 2.3) is here shown again in table 4.1, this time with respect to
the initial simulation time of tCP U = 63 s.
The final seven-fold speed-up is thus obtained not only by use of the new PowerFactory 15.2
options and improved linear solver, but also by solving data model and step size strategy issues
thanks to the enhanced DSL and simulation debugging possibilities.
5 Conclusion
PowerFactory 15.2 provides considerable performance improvement for RMS simulation. This
paper describes various enhancements which significantly increase the simulation speed, de-
pending on the specific dynamic model. In summary, these are:
The possibility to compile user-defined models using the new automatic DSL-to-C con-
verter, which allows the user to run a customised DSL model as fast as a standard Pow-
erFactory element (see Section 2.5);
Advanced algorithmic options which offer additional speed-ups (see Section 2.6);
Enhanced DSL debugging possibilities that may warn the user about potential issues that
can severely affect the simulation speed (see Section 2.7);
Enhanced simulation debug information that may give insight on computational effort and
provide directions towards additional speed-ups (see Section 2.8).
This paper also shows the above improvements in action on several benchmark tests, leading to
up to seven-fold speed-ups of an optimised simulation in PowerFactory 15.2 with respect to an
initial simulation in PowerFactory 15.1 (System 2, see Section 4.2), and up to five-fold speed-
ups of an optimal default simulation in PowerFactory 15.2 with respect to an optimal default
simulation in PowerFactory 15.1 (System 1, see Section 3.1).