Skip to content

Export: CIM → DSS

The exporter writes an OpenDSS model from a cimgraph FeederModel to a directory of .dss files.

Basic Usage

from cimhub_opendss.exporter.cim_to_dss import cim_to_dss

cim_to_dss(feeder, "/path/to/output/")

The output directory will contain:

  • Master.dss — top-level redirect file that loads all components
  • Lines.dss, Loads.dss, Transformers.dss, etc. — one file per element type

What Gets Exported

CIM Class DSS Type Module
ACLineSegment Line exporter/lines/ac_line_segment.py
PerLengthSequenceImpedance LineCode exporter/lines/per_length_impedance.py
EnergyConsumer Load exporter/loads/energy_consumer.py
PowerTransformer Transformer exporter/transformers/power_transformer.py
TransformerTank Transformer exporter/transformers/transformer_tank.py
LinearShuntCompensator Capacitor exporter/shunts/capacitor.py
RegulatingControl CapControl exporter/shunts/capcontrol.py
RatioTapChanger RegControl exporter/regulators/regcontrol.py
PhotoVoltaicUnit PVSystem exporter/pvsystems/pvsystem.py
BatteryUnit Storage exporter/storage/storage.py
SynchronousMachine Generator exporter/generators/generator.py
EnergySource Vsource exporter/vsources/energy_source.py
Switch subclasses Switch / Breaker / Fuse / Recloser exporter/switches/
WireInfo WireData exporter/conductors/wiredata.py

Registry Pattern

Each converter function is registered via @dss_exporter_registry.register(CIMClass). The orchestrator cim_to_dss iterates all registered converters and writes each element type to its own file.

from cimhub_opendss.exporter.dss_registry import dss_exporter_registry

# List all registered CIM classes
print(list(dss_exporter_registry._registry.keys()))