A toolbox for Python based control of DIgSILENT PowerFactory.
This application is intended to use for an external usage ('engine mode') of the power flow calculation program DIgSILENT PowerFactory. Therefore, the Python-PowerFactory-API, provided by the company, is utilized.
The following functionalities are provided:
Important: As the set of different elements, data types and attributes can differ between the various main versions (e.g. 2022
, 2024
) of PowerFactory, all functionalities are set up individual for main versions.
The toolbox builds up on the PowerFactoryInterface, that provides comfort functions to:
Please find below some important general remarks and assumptions to consider for the application.
A connection to PowerFactory is established via PowerFactoryInterface. After this initialization, a temporary unit conversion to default values is automatically performed to have a project setting independent behavior. The units are reset when the interface is closed. During an active connection, the following units apply:
The PowerFactoryExporter connects to PowerFactory via PowerFactoryInterface.
The grid export follows the rules of usage recommended by PSDM:
Rated Power
is always defined positive (absolute value).By default, all assests of all active grids within the selected study case are to be exported, see example readme.
do_not_export
in the first line of the description field.The following type of elements are supported:
ElmLne
- a symmetrical overhead line / cableElmTerm
- a network terminal / busElmCoup
- a bus-bus switch (e.g. a circuit breaker in a detailed switching gear)ElmTr2
- a symmetrical 2-winding transformersElmTr3
- a symmetrical 3-winding transformers (in future releases)ElmLod
- a general load (asym. / sym.)ElmLodmv
- a medium voltage loadElmLodlv
- a low voltage loadElmLodlvp
- a partial low voltage loadElmPvsys
- a PV system (generator)ElmGenstat
- a static generatorElmXnet
- an external grid representationRelFuse
- a fuse (bus-bus or bus-load)Remarks on export of loads
:
ElmLod
) is of type const. impedance
.ElmLodmv
) is of type const. power
.ElmLodlv
, ElmLodlvp
) is of type const. current
.NaN
. Consider to exclude them for export.Remarks on export of transformer
:
Remarks on export of fuses
:
Remarks on export of the SteadyStateCase
:
CosPhiConst
, except in the case where active and reactive power are explicitly specified in the load flow mask in PowerFactory, then it's QConst
.Please consider the README in the example section. Here, Jupyter notebooks are provided to get in touch with the usage of this toolbox:
In addition, please see this interactive example how to import a PSDM grid representation in Matlab
for grid calculation purposes.
Install via pip:
pip install ieeh-powerfactory-tools
Tools Version | PSDM Version | PowerFactory Version | Recommended Python Version |
---|---|---|---|
<= 1.3.1 | 1.1.0 | 2022 | 3.10 |
1.4.x | 1.1.0 | 2022 | 3.10 |
1.5.1 | 1.3.0 | 2022 | 3.10 |
2.1.0 | 2.2.0 | 2022 | 3.10 |
3.0.0 | 2.3.1 | 2022, 2024 | 3.10, 3.12 |
Remark: As each PowerFactory version may extend features or change the way a model or command is used, powerfactory-tools comes with PowerFactory version-specific code, see src/versions.
The correct Python version: Be aware, that the Python version of your code environment must match the selected Python version of the PowerFactory API!
Clone powerfactory-tools
git@github.com:ieeh-tu-dresden/powerfactory-tools.git
cd powerfactory-tools
Install powerfactory-tools
as a production tool
uv sync --no-dev
Install powerfactory-tools
in development mode
uv sync
Optional: As pyproject.toml allows different python versions -> specify the Python version (e.g. 3.12) to be used for your local virtual environment .venv
uv sync --python 3.12
For development in Visual Studio Code, all configurations are already provided:
Please note that this work is part of research activities and is still under active development.
This code was tested with DIgSILENT PowerFactory 2021 SP5
(version < 1.4), DIgSILENT PowerFactory 2022 SP2
(version < 3.0) and DIgSILENT PowerFactory 2024 SP2
.
Please provide a link to this repository:
https://github.com/ieeh-tu-dresden/powerfactory-tools
Please cite as:
Institute of Electrical Power Systems and High Voltage Engineering - TU Dresden, PowerFactory Tools - A toolbox for Python based control of DIgSILENT PowerFactory, Zenodo, 2022. https://doi.org/10.5281/zenodo.7074968.