ieeh-tu-dresden / powerfactory-tools

A toolbox for Python based control of DIgSILENT PowerFactory
BSD 3-Clause "New" or "Revised" License
21 stars 6 forks source link

IEEH PowerFactory Tools

License

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:

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.

PowerFactory Interface

The toolbox builds up on the PowerFactoryInterface, that provides comfort functions to:

General Remarks

Please find below some important general remarks and assumptions to consider for the application.

General Unit Conversion

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:

Exporter

The PowerFactoryExporter connects to PowerFactory via PowerFactoryInterface.

Tutorials

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 Code Ocean Capsule how to import a PSDM grid representation in Matlab for grid calculation purposes.

Installation

Install via pip:

pip install ieeh-powerfactory-tools

Compatibility

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!

Development

Install uv

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:

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), DIgSILENT PowerFactory 2022 SP2 (version < 3.0) and DIgSILENT PowerFactory 2024 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.

DOI