A toolbox for Python based control of DIgSILENT PowerFactory
Project description
IEEH PowerFactory Tools
A toolbox for Python based control of DIgSILENT PowerFactory.
Field of Application
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:
- export of calculation relevant grid data from a PowerFactory project to the IEEH Power System Data Model
- basic control of PowerFactory
- [intended in future release] import from external grid data into the PowerFactory environment
Tutorials
Please consider the README in the example section. Here, Jupyter notebooks are provided to get in touch with the usage of this toolbox:
- for export: powerfactory_export.ipynb
- for control: powerfactory_control.ipynb
In addition, please see this interactive example how to import a PSDM grid representation in Matlab
for grid calculation purposes.
General Remarks on Export
Please find below some important general remarks and assumptions to consider for the application:
General
After successful connection to PowerFactory via PowerFactoryInterface, 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:
- power in MW
- voltage in kV
- current in kA
- length in km
Exporter
-
The grid export follows the rules of usage recommended by psdm:
- The passive sign convention is used for all types of loads (consumer as well as producer).
- The
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.
-
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
:- Be aware that the reference voltage of the load model must not match the nominal voltage of the terminal the load is connected to.
- By default, the power factor direction of the rated power is set to "not defined", see docs at LoadPower - as_rated_power().
-
Remarks on export of
transformer
:- The impedances of all winding objects are referred to the high voltage side of the transformer.
- The impedance of transformer earthing is an absolute natural value.
- The zero sequence impedances are exported without considering the vector group, resulting zero sequence must be calculated separately by the user afterwards.
- The zero sequence magnetising impedances are dependent on the wiring group, see docs at PowerFactoryExporter - create_transformer_2w().
-
Remarks on export of
fuses
:- Branch like fuses are exported as switching state.
- Element fuses does not apply a switching state by their own in PowerFactory but considered in export as applicable switching state.
-
Remarks on export of
SteadyStateCase
:- The operating points of the loads are specified by the controller and the associated load model in the topology for active or reactive power.
- By default a consumer load has a CosPhiConst type controller, except in the case where active and reactive power are explicitly specified in the load flow mask in PowerFactory.
- It is assumed, that a station controller (if relevant) is exclusively assigned to a single generator. The generator itself ought to be parameterized in the same way as the station controller to ensure that the exported q operating point is the same that set by the station controller.
Installation
Just install via pip:
pip install ieeh-powerfactory-tools
Compatibility
Tools Version | PSDM Version | PowerFactory Version | Python Version |
---|---|---|---|
<= 1.3.1 | 1.1.0 | 2022 | 3.9, 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 |
Starting with PowerFactory 2023
, a new model for LV and MV loads is available as well as e.g. the result structure of harmonic load flow has changed. Also Python 3.11
can be used. Related adjustments are on schedule for the next mayor release 3.x
Development
Install pdm
-
Windows
(Invoke-WebRequest -Uri https://raw.githubusercontent.com/pdm-project/pdm/main/install-pdm.py -UseBasicParsing).Content | python -
-
Linux/Mac:
curl -sSL https://raw.githubusercontent.com/pdm-project/pdm/main/install-pdm.py | python3 -
-
Or using pipx or pip:
pipx install pdm
pip install --user pdm
Clone powerfactory-tools
git@github.com:ieeh-tu-dresden/powerfactory-tools.git
cd powerfactory-tools
Install powerfactory-tools
-
as a production tool
pdm install --prod
-
in development mode
pdm install
For development in Visual Studio Code, all configurations are already provided:
Acknowledgement
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) and DIgSILENT PowerFactory 2022 SP2
.
Attribution
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ieeh_powerfactory_tools-2.1.0.tar.gz
.
File metadata
- Download URL: ieeh_powerfactory_tools-2.1.0.tar.gz
- Upload date:
- Size: 61.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.12.3 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 713df25013146dd197818efd15d251deb110874fe1c2d84b2c3860e28711198d |
|
MD5 | c4bf9716fbca689e16e3a981cba551d6 |
|
BLAKE2b-256 | 2d751e887168ef0d33be46eb9e8e885597edebeaebfc475e302780db6ddd0742 |
File details
Details for the file ieeh_powerfactory_tools-2.1.0-py3-none-any.whl
.
File metadata
- Download URL: ieeh_powerfactory_tools-2.1.0-py3-none-any.whl
- Upload date:
- Size: 61.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.12.3 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05a1ff95353c93af61b777e1276cf0737c29f6f2d3882003f9f6550b19388fcd |
|
MD5 | a2def5879900b1ecb5bff82eb3274d40 |
|
BLAKE2b-256 | cbbaf6df581a3c798e1857b0fa74c10d2bc8c294db48b49883733e3e5a92b829 |