Read a CIM model in the unit you want¶
cimhub-core is the shared layer under every CIMHub converter. Its export getters read
IEC CIM objects, in cim18v17, as plain floats and NamedTuples in the unit you name. It also holds the
.cimtbl import contract, the canonical table shapes and the test harness that the format spokes build on.
import cimtables
import cimprofiles.cim18.cim18v17 as cim
from cimhub_core.getters.load import get_phase_loads
network = cimtables.load_model('feeder.cimtbl') # a cim-graph FeederModel
load = next(obj for obj in network.graph[cim.EnergyConsumer].values() if obj.mRID == 'ld_n1')
print(get_phase_loads(load, 'kW', 'kVAr').total) # PhasePower(p=1155.0, q=660.0)
CIM stores SI, and each getter converts once, through cimtables.graph_write.get_qty, to the unit you pass. A value
CIM leaves unset comes back as None, and a model the getter cannot read safely raises with the object's class
and mRID.
-
User guide
Install it, load a small feeder and read its line, transformer, loads and terminals. Then units, per-unit bases, generator sign and time series.
-
Getter reference
Every getter by CIM concept: lines and wires, transformers, loads, sources and DER, topology and state, and the derived values under them.
-
Developer docs
The map of the code: how an importer reaches CIM through
.cimtbl, the rules every change keeps, how to write a getter and how the tests are laid out.
What is in core¶
| Part | What it is |
|---|---|
| Export getters | One function per CIM concept in cimhub_core.getters, returning floats and NamedTuples (reference). |
The .cimtbl contract |
How a native importer writes .cimtbl text that cimtables turns into CIM (developer). |
| Shapes | The canonical .cimtbl tables every importer emits, kept as examples in the package (developer). |
| Time points | The Parquet files that hold schedule points beside the CIM XML (guide). |
| Test harness | cimhub_core.cimtbl_testing: cim_scope, golden comparison and record-level diffs (developer). |
Core is one package of CIMHub. The converters themselves, and the landing page for all of them, are at CIMHub.