# CGMES2PGM-Converter
`cgmes2pgm_converter` provides a library to convert Common Grid Model Exchange Standard (CGMES) datasets to [PowerGridModel](https://github.com/PowerGridModel/power-grid-model) 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](https://github.com/SOPTIM/cgmes2pgm_suite) provides additional tools for working with CGMES and PGM.
## Getting Started
The package can be installed from PyPI using pip:
```bash
pip install cgmes2pgm_converter
```
### Set up the CGMES-Model
The CGMES-Model needs to be imported as a dataset into a triplestore providing a SPARQL endpoint (e.g. [Apache Jena Fuseki](https://jena.apache.org/)).
Currently, the CGMES model needs to be stored in the default graph of the dataset. This approach may be updated in future versions.
### Conversion
```python
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](https://github.com/SOPTIM/cgmes2pgm_suite) for an complete example of how to use the converter.
## Supported CGMES Classes
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
## License
This project is licensed under the [Apache License 2.0](LICENSE.txt).
## Dependencies
This project includes third-party dependencies, which are licensed under their own respective licenses.
- [cgmes2pgm_converter](https://pypi.org/project/cgmes2pgm_converter/) (Apache License 2.0)
- [bidict](https://pypi.org/project/bidict/) (Mozilla Public License 2.0)
- [numpy](https://pypi.org/project/numpy/) (BSD License)
- [pandas](https://pypi.org/project/pandas/) (BSD License)
- [power-grid-model](https://pypi.org/project/power-grid-model/) (Mozilla Public License 2.0)
- [power-grid-model-io](https://pypi.org/project/power-grid-model-io/) (Mozilla Public License 2.0)
- [SPARQLWrapper](https://pypi.org/project/SPARQLWrapper/) (W3C License)
- [XlsxWriter](https://pypi.org/project/XlsxWriter/) (BSD License)
- [PyYAML](https://pypi.org/project/PyYAML/) (MIT License)
- [StrEnum](https://pypi.org/project/StrEnum/) (MIT License)
- [SciPy](https://pypi.org/project/scipy/) (BSD License)
## Development
For local development, the package can be installed from source:
```bash
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install -e .
pre-commit install
```
## Commercial Support and Services
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](mailto:powergridmodel@soptim.de).
## Contributing
We welcome contributions to improve this project.
Please see our [Contributing Guide](CONTRIBUTING.md) for details on how to submit pull requests, report issues, and suggest improvements.
## Code of Conduct
This project adheres to a code of conduct adapted from the [Apache Foundation's Code of Conduct](https://www.apache.org/foundation/policies/conduct).
We expect all contributors and users to follow these guidelines to ensure a welcoming and inclusive community.
Raw data
{
"_id": null,
"home_page": null,
"name": "cgmes2pgm-converter",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12.3",
"maintainer_email": null,
"keywords": "cgmes, pgm, State Estimation, Power Grid Model",
"author": null,
"author_email": "\"Lars Friedrich, Eduard Fried, Udo Schmitz\" <powergridmodel@soptim.de>",
"download_url": "https://files.pythonhosted.org/packages/5b/63/2007dbb0bc0702b3520eaf5e918e5be2d8630c6f95ca2a74608bd611e8c4/cgmes2pgm_converter-0.2.1.tar.gz",
"platform": null,
"description": "# CGMES2PGM-Converter\n\n`cgmes2pgm_converter` provides a library to convert Common Grid Model Exchange Standard (CGMES) datasets to [PowerGridModel](https://github.com/PowerGridModel/power-grid-model) format.\nIt was designed to apply the PGM State Estimation on a CGMES dataset.\nThe CGMES dataset is fetched from a SPARQL endpoint and converted to a PGM dataset.\nThis converter works with CGMES 3.0 / CIM 100 datasets, as well as CGMES 2.4 / CIM 16 datasets.\n\nMethods to substitute additional measurements are included as well to improve state estimation (e.g. passive nodes).\n[cgmes2pgm_suite](https://github.com/SOPTIM/cgmes2pgm_suite) provides additional tools for working with CGMES and PGM.\n\n## Getting Started\n\nThe package can be installed from PyPI using pip:\n\n```bash\npip install cgmes2pgm_converter\n```\n\n### Set up the CGMES-Model\n\nThe CGMES-Model needs to be imported as a dataset into a triplestore providing a SPARQL endpoint (e.g. [Apache Jena Fuseki](https://jena.apache.org/)).\n\nCurrently, the CGMES model needs to be stored in the default graph of the dataset. This approach may be updated in future versions.\n\n### Conversion\n\n```python\nfrom cgmes2pgm_converter import CgmesToPgmConverter, CgmesDataset\n\ndataset = CgmesDataset(\n base_url=\"http://localhost:3030/dataset_name\",\n cim_namespace=\"http://iec.ch/TC57/2013/CIM-schema-cim16#\", # for CGMES 2.4\n # \"http://iec.ch/TC57/CIM100#\", # for CGMES 3.0\n)\n\nconverter = CgmesToPgmConverter(datasource=dataset)\ninput_data, extra_info = converter.convert()\n```\n\nSee [cgmes2pgm_suite](https://github.com/SOPTIM/cgmes2pgm_suite) for an complete example of how to use the converter.\n\n## Supported CGMES Classes\n\nThe following list of CGMES classes is supported by the converter:\n\n- All Branches (ACLineSegment, EquivalentBranch)\n- Links (Switch, Breaker, Disconnector)\n- Transformers (2-Winding, 3-Winding)\n - RatioTapchanger\n - PhaseTapChangerTabular\n - PhaseTapChangerLinear, -Symmetrical, -Asymmetrical\n- Measurements (P, Q, U, I\\*)\n- Generators & Loads\n - SynchronousMachine, AsynchronousMachine\n - ExternalNEtworkInjection\n - EnergyConsumer\n - StaticVarCompensator\n- Shunts (Linear-, NonlinearShuntCompensator)\n- DC Components\n - CsConverter, VsConverter\n - Replaced by loads since PGM does not support DC Components\n\n\\* Used to create Q-measurements\n\n## License\n\nThis project is licensed under the [Apache License 2.0](LICENSE.txt).\n\n## Dependencies\n\nThis project includes third-party dependencies, which are licensed under their own respective licenses.\n\n- [cgmes2pgm_converter](https://pypi.org/project/cgmes2pgm_converter/) (Apache License 2.0)\n- [bidict](https://pypi.org/project/bidict/) (Mozilla Public License 2.0)\n- [numpy](https://pypi.org/project/numpy/) (BSD License)\n- [pandas](https://pypi.org/project/pandas/) (BSD License)\n- [power-grid-model](https://pypi.org/project/power-grid-model/) (Mozilla Public License 2.0)\n- [power-grid-model-io](https://pypi.org/project/power-grid-model-io/) (Mozilla Public License 2.0)\n- [SPARQLWrapper](https://pypi.org/project/SPARQLWrapper/) (W3C License)\n- [XlsxWriter](https://pypi.org/project/XlsxWriter/) (BSD License)\n- [PyYAML](https://pypi.org/project/PyYAML/) (MIT License)\n- [StrEnum](https://pypi.org/project/StrEnum/) (MIT License)\n- [SciPy](https://pypi.org/project/scipy/) (BSD License)\n\n## Development\n\nFor local development, the package can be installed from source:\n\n```bash\npython3 -m venv .venv\nsource .venv/bin/activate\npip install -r requirements.txt\npip install -e .\npre-commit install\n```\n\n## Commercial Support and Services\n\nFor organizations requiring commercial support, professional maintenance, integration services,\nor custom extensions for this project, these services are available from **SOPTIM AG**.\n\nPlease feel free to contact us via [powergridmodel@soptim.de](mailto:powergridmodel@soptim.de).\n\n## Contributing\n\nWe welcome contributions to improve this project.\nPlease see our [Contributing Guide](CONTRIBUTING.md) for details on how to submit pull requests, report issues, and suggest improvements.\n\n## Code of Conduct\n\nThis project adheres to a code of conduct adapted from the [Apache Foundation's Code of Conduct](https://www.apache.org/foundation/policies/conduct).\nWe expect all contributors and users to follow these guidelines to ensure a welcoming and inclusive community.\n",
"bugtrack_url": null,
"license": null,
"summary": "Library to convert Common Grid Model Exchange Standard (CGMES) datasets to PowerGridModel (PGM) format",
"version": "0.2.1",
"project_urls": {
"Homepage": "https://github.com/SOPTIM/cgmes2pgm_converter",
"Issues": "https://github.com/SOPTIM/cgmes2pgm_converter/issues",
"Repository": "https://github.com/SOPTIM/cgmes2pgm_converter"
},
"split_keywords": [
"cgmes",
" pgm",
" state estimation",
" power grid model"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "bdab6e2e23534e30d7632ea642234386b1c80e90f395f44ee8228819f5f8853a",
"md5": "020d7b103c79d18ac35fee397ef59546",
"sha256": "51526d25837a094cc6a5353984a90a6f0518e81b344511b292dfa0b47e38968d"
},
"downloads": -1,
"filename": "cgmes2pgm_converter-0.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "020d7b103c79d18ac35fee397ef59546",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12.3",
"size": 102377,
"upload_time": "2025-07-31T09:36:50",
"upload_time_iso_8601": "2025-07-31T09:36:50.910378Z",
"url": "https://files.pythonhosted.org/packages/bd/ab/6e2e23534e30d7632ea642234386b1c80e90f395f44ee8228819f5f8853a/cgmes2pgm_converter-0.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "5b632007dbb0bc0702b3520eaf5e918e5be2d8630c6f95ca2a74608bd611e8c4",
"md5": "c03c31aaa6eb30ca07d3ed3a257d8be1",
"sha256": "9c075bbfac729a5722833e01db1aacaeaa7f612f3d58174733255b3faa4f3cb8"
},
"downloads": -1,
"filename": "cgmes2pgm_converter-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "c03c31aaa6eb30ca07d3ed3a257d8be1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12.3",
"size": 55593,
"upload_time": "2025-07-31T09:36:52",
"upload_time_iso_8601": "2025-07-31T09:36:52.519559Z",
"url": "https://files.pythonhosted.org/packages/5b/63/2007dbb0bc0702b3520eaf5e918e5be2d8630c6f95ca2a74608bd611e8c4/cgmes2pgm_converter-0.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-31 09:36:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "SOPTIM",
"github_project": "cgmes2pgm_converter",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "bidict",
"specs": [
[
"~=",
"0.23.1"
]
]
},
{
"name": "numpy",
"specs": [
[
"~=",
"2.2.0"
]
]
},
{
"name": "pandas",
"specs": [
[
"~=",
"2.2.0"
]
]
},
{
"name": "power-grid-model",
"specs": [
[
"~=",
"1.11.37"
]
]
},
{
"name": "power-grid-model-io",
"specs": [
[
"~=",
"1.3.7"
]
]
},
{
"name": "SPARQLWrapper",
"specs": [
[
"~=",
"2.0.0"
]
]
},
{
"name": "XlsxWriter",
"specs": [
[
"~=",
"3.2.0"
]
]
},
{
"name": "PyYAML",
"specs": [
[
"~=",
"6.0.1"
]
]
},
{
"name": "StrEnum",
"specs": [
[
"~=",
"0.4.15"
]
]
}
],
"lcname": "cgmes2pgm-converter"
}