cgmes2pgm_converter
provides a library to convert Common Grid Model Exchange Standard (CGMES) datasets to PowerGridModel format.
It was designed to apply the PGM State Estimation on a CGMES dataset.
The CGMES dataset is fetched from a SPARQL endpoint and converted to a PGM dataset.
This converter works with CGMES 3.0 / CIM 100 datasets, as well as CGMES 2.4 / CIM 16 datasets.
Methods to substitute additional measurements are included as well to improve state estimation (e.g. passive nodes). cgmes2pgm_suite provides additional tools for working with CGMES and PGM.
The package can be installed from PyPI using pip:
pip install cgmes2pgm_converter
The CGMES-Model needs to be imported as a dataset into a triplestore providing a SPARQL endpoint (e.g. Apache Jena Fuseki).
Currently, the CGMES model needs to be stored in the default graph of the dataset. This approach may be updated in future versions.
from cgmes2pgm_converter import CgmesToPgmConverter, CgmesDataset
dataset = CgmesDataset(
base_url="http://localhost:3030/dataset_name",
cim_namespace="http://iec.ch/TC57/2013/CIM-schema-cim16#", # for CGMES 2.4
# "http://iec.ch/TC57/CIM100#", # for CGMES 3.0
)
converter = CgmesToPgmConverter(datasource=dataset)
input_data, extra_info = converter.convert()
See cgmes2pgm_suite for an complete example of how to use the converter.
The following list of CGMES classes is supported by the converter:
- All Branches (ACLineSegment, EquivalentBranch)
- Links (Switch, Breaker, Disconnector)
- Transformers (2-Winding, 3-Winding)
- RatioTapchanger
- PhaseTapChangerTabular
- PhaseTapChangerLinear, -Symmetrical, -Asymmetrical
- Measurements (P, Q, U, I*)
- Generators & Loads
- SynchronousMachine, AsynchronousMachine
- ExternalNEtworkInjection
- EnergyConsumer
- StaticVarCompensator
- Shunts (Linear-, NonlinearShuntCompensator)
- DC Components
- CsConverter, VsConverter
- Replaced by loads since PGM does not support DC Components
* Used to create Q-measurements
This project is licensed under the Apache License 2.0.
This project includes third-party dependencies, which are licensed under their own respective licenses.
- cgmes2pgm_converter (Apache License 2.0)
- bidict (Mozilla Public License 2.0)
- numpy (BSD License)
- pandas (BSD License)
- power-grid-model (Mozilla Public License 2.0)
- power-grid-model-io (Mozilla Public License 2.0)
- SPARQLWrapper (W3C License)
- XlsxWriter (BSD License)
- PyYAML (MIT License)
- StrEnum (MIT License)
- SciPy (BSD License)
For local development, the package can be installed from source:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install -e .
pre-commit install
For organizations requiring commercial support, professional maintenance, integration services, or custom extensions for this project, these services are available from SOPTIM AG.
Please feel free to contact us via powergridmodel@soptim.de.
We welcome contributions to improve this project. Please see our Contributing Guide for details on how to submit pull requests, report issues, and suggest improvements.
This project adheres to a code of conduct adapted from the Apache Foundation's Code of Conduct. We expect all contributors and users to follow these guidelines to ensure a welcoming and inclusive community.