Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

CIM-Builder

GitHub Tag GitHub Release Date Tests Release Libraries.io dependency status for GitHub repo

PyPI - Version PyPI - Python Version PyPI - Downloads PyPI - Format

GitHub Issues or Pull Requests GitHub Issues or Pull Requests GitHub commit activity GitHub License GitHub Downloads (all assets, all releases)

CIM-Builder is a Python library from Pacific Northwest National Laboratory, for building IEC CIM power system models from scratch. Other CIM tooling converts an existing source, such as an OpenDSS, PSS/E or GIS model; CIM-Builder writes the CIM objects directly, one call per piece of equipment or per substation. It can:

  1. create new objects with per-profile builders (add_connectivity, add_electrical, add_ssh, etc.)
  2. create new node-breaker substations from API calls,
  3. insert existing CIM distribution feeders into those substations,
  4. add new equipment and measurements to an existing model, and
  5. insert aggregate feeder data into an existing CIM transmission model.

Everything lands in a CIMantic Graphs model, ready to save as CIM RDF/XML or JSON-LD.

Documentation: https://pnnl-cim-tools.github.io/CIM-Builder/

Installation

CIM-Builder needs Python 3.10 or newer. It is installed as cim-builder and imported as cimbuilder:

pip install cim-builder

or, with uv, uv add cim-builder. It brings in its CIM dependencies, cim-tables, cim-graph and cim-profiles.

Example

A 115 kV ring bus substation with four sections and a branch on each:

from cimgraph.utils import write_xml
from cimtables.units import Qty

from cimbuilder.network import new_feeder_model
from cimbuilder.object_builder import BaseVoltageBuilder
from cimbuilder.substation_builder import RingBusSubstationBuilder

network = new_feeder_model(authority="https://example.com/models", model="demo", Feeder="fdr_demo")
BaseVoltageBuilder(network, network.container).create(mRID="bv_115kV", nominalVoltage=Qty(115, "kV"))

builder = RingBusSubstationBuilder(network, network.container)
substation = builder.create(mRID="sub_ring", name="Ring bus")
substation, voltage_level = builder.add_voltage_level(substation, mRID="vl_115", BaseVoltage="bv_115kV")
voltage_level, busbars, ring = builder.add_buses(voltage_level, sections=4)
for section in (1, 2, 3, 4):
    builder.add_branch(voltage_level, section=section, node=f"line_{section}")

write_xml(network, "ring_bus.xml")  # 4 busbars, 4 breakers, 12 disconnectors

The builder writes every ConnectivityNode, Terminal, BusbarSection, breaker and disconnector of the layout, with consistent mRIDs, in the right VoltageLevel with its BaseVoltage.

What is in the package

Substation builders: cimbuilder.substation_builder

One builder per node-breaker layout. Each has add_buses for the busbars and bus ties, and add_branch for the switches between a bus and a branch node:

Builder add_buses options add_branch connection point
SingleBusSubstationBuilder number
SectionalizedBusSubstationBuilder sections=2 section, number
MainAndTransferSubstationBuilder number
DoubleBusSingleBreakerSubstationBuilder number, bus=1
RingBusSubstationBuilder sections=4 section
BreakerAndHalfSubstationBuilder diameters=2 diameter, side

add_branch(..., node=...) creates the branch node if it does not exist yet. Given the head node of a distribution feeder already loaded into the same graph, it connects the substation to that feeder instead.

Object builders: cimbuilder.object_builder

One builder per CIM class: lines, switches, transformers, regulators and tap changers, loads and shunt capacitors, sources, generators and inverters, measurements and operational limits. Each builder creates the object, then fills it in one CIM profile part at a time:

line_builder = ACLineSegmentBuilder(network, container)
line = line_builder.create(mRID="line_1", name="line 1")
line_builder.add_connectivity(
    line, node1="bus_1", node2="bus_2", phases="ABC", length=Qty(1.2, "km"), BaseVoltage="bv_12_47kV"
)
line_builder.add_electrical(line, r=Qty(0.3, "ohm"), x=Qty(0.6, "ohm"))

Other objects are referred to by mRID, nodes are created as they are first used, and values can be given in any unit as a Qty.

Aggregate feeders: cimbuilder.feeder_builder

new_aggregate_feeder adds a whole distribution feeder to a transmission model as one head breaker, one aggregate load, aggregate behind-the-meter and front-of-the-meter PV and wind, and the feeder-head measurements an under-frequency load shedding study reads.

Development

git clone https://github.com/PNNL-CIM-Tools/CIM-Builder.git -b develop
cd CIM-Builder
uv sync
uv run pytest

See the developer docs for how the builders are put together and how to build the documentation, and Contributing before opening a pull request.

Attribution and Disclaimer

This software was created under a project sponsored by the U.S. Department of Energy’s Office of Electricity, an agency of the United States Government. Neither the United States Government nor the United States Department of Energy, nor Battelle, nor any of their employees, nor any jurisdiction or organization that has cooperated in the development of these materials, makes any warranty, express or implied, or assumes any legal liability or responsibility for the accuracy, completeness, or usefulness or any information, apparatus, product, software, or process disclosed, or represents that its use would not infringe privately owned rights.

Reference herein to any specific commercial product, process, or service by trade name, trademark, manufacturer, or otherwise does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United States Government or any agency thereof, or Battelle Memorial Institute. The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or any agency thereof.

PACIFIC NORTHWEST NATIONAL LABORATORY operated by BATTELLE for the UNITED STATES DEPARTMENT OF ENERGY under Contract DE-AC05-76RL01830

Metadata

Release files for cim-builder 0.2.0a1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cim-builder 0.2.0a1
File Size Uploaded Provenance Actions
cim_builder-0.2.0a1.tar.gz 3.6 MB With provenance Details for cim_builder-0.2.0a1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cim-builder 0.2.0a1
File Interpreter ABI Platform Actions
cim_builder-0.2.0a1-py3-none-any.whl Python 3 none any Details for cim_builder-0.2.0a1-py3-none-any.whl

Total release size: 3.7 MB

Release files / cim_builder-0.2.0a1.tar.gz

Download URL cim_builder-0.2.0a1.tar.gz
Size 3.6 MB
Tags Source
SHA-256 checksum
How to use checksums
6f5e17359eebafa8bd971f25d0c5efacd6902d7330d5d0f5a1b4c7e44a102540
BLAKE2b-256 checksum
How to use checksums
8d49ac09833ee9504a46a9106f66083bf4fa7aaf1fa0d748ad4b32392333bd17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 30, 2026.

Transparency log

Release files / cim_builder-0.2.0a1-py3-none-any.whl

Download URL cim_builder-0.2.0a1-py3-none-any.whl
Size 114.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e02d4ecce9e6c41d82a719fff7f272c89815acd5b759c77fbc3d632287a08787
BLAKE2b-256 checksum
How to use checksums
4138aea460b2ad54261f22320cbabd52093596cd328bb62b661b98c3459c4c62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 30, 2026.

Transparency log

Security for cim-builder 0.2.0a1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cim_builder-0.2.0a1.tar.gz

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 Nov 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page