This release is a pre-release and may not be stable for production use.
cimhub_matpower
Bidirectional converter between MATPOWER (.m case files) and CIM (IEC 61970) using the cim17v40 profile.
Usage
MATPOWER to CIM (Import)
import os
os.environ['CIMG_CIM_PROFILE'] = 'cim17v40'
from cimhub_matpower.importer.matpower_to_cim import matpower_to_cim
network = matpower_to_cim("case9.m")
CIM to MATPOWER (Export)
from cimhub_matpower.exporter.cim_to_matpower import cim_to_matpower
cim_to_matpower(network, "output.m")
Equipment Coverage
| MATPOWER Field | CIM Class(es) |
|---|---|
bus |
TopologicalNode, ConnectivityNode, BaseVoltage |
gen |
SynchronousMachine, GeneratingUnit |
branch |
ACLineSegment, PowerTransformer |
gencost |
GrossToNetActivePowerCurve |
areas |
ControlArea |
Unit Conventions
MATPOWER uses per-unit impedances on the system MVA base. The converter handles the z_base = base_kv² / base_mva conversion automatically — do not manually multiply by baseMVA.
Generator sign convention: MATPOWER Pg is positive for generation (power out). CIM Terminal.p is positive for power flowing into equipment — the converter negates when crossing the boundary.
Running Tests
uv run pytest cimhub_matpower/tests/ -v
Status
- Importer: functional for buses, generators, branches, gencost, areas.
- Exporter: implemented; full roundtrip tests in progress.
- Known gap: reactive power limits (
Qmin/Qmax) and transformer tap ratios need validation.
Metadata
Release files for cimhub-matpower 2.0.0a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cimhub_matpower-2.0.0a1.tar.gz | 45.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cimhub_matpower-2.0.0a1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 89.2 kB
Release files / cimhub_matpower-2.0.0a1.tar.gz
| Download URL | cimhub_matpower-2.0.0a1.tar.gz |
|---|---|
| Size | 45.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6a0a0939753d08d0d805c0facd8dd3c99d3d67226cc4c78684713428ab37b15a
|
|
BLAKE2b-256 checksum How to use checksums |
fda0f355be5feb3d655c24e83d0dc7a761de793d47b69c451c89a4fd63f3099f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.
Transparency logRelease files / cimhub_matpower-2.0.0a1-py3-none-any.whl
| Download URL | cimhub_matpower-2.0.0a1-py3-none-any.whl |
|---|---|
| Size | 43.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f999e149f9cd157b7006c310569b637e37ca5c7afd62eb3443caf594a685085f
|
|
BLAKE2b-256 checksum How to use checksums |
2950d7c98702de308ab1c584e5fc21688a4596884337835822a705082dbcb376
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.
Transparency log