Skip to main content
Pre-release

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

CIM-Topology-Processor

GitHub Tag GitHub Release Date GitHub Actions Workflow Status Libraries.io dependency status for GitHub repo

PyPI - Version PyPI - Downloads PyPI - Format

GitHub Issues or Pull Requests GitHub Issues or Pull Requests GitHub commit activity

GitHub Downloads (all assets, all releases) GitHub License

The topology processor shared by the CIM tool chain (CIMHub, CIM-Repair, GridAPPS-D). Everything that involves spanning trees or topology processing lives here behind one API: sorting and orienting a network, islands, voltage zones and base voltages, connectivity gaps, and the distributed areas of a feeder.

The core is a pure-Python LinkNet structure, from the two papers in references/:

  • R. Podmore, LINKNET: a structure for computer representation and solution of electric power networks, 1971.
  • A. Anderson and R. Podmore, IEEE Access, 2022: LinkNet over CIM ConnectivityNodes and Terminals.

Status

The repo is being rewritten for the CIM17 -> CIM18 change in distribution topology.

Package Status
cimtopology.core Model-agnostic LinkNet core and shared API. Tested.
cimtopology.cim18 cim18v17 models: feeder, switch and secondary ConnectedAreas; TopologicalNodes, bus numbers and TopologicalIslands for feeders and node-breaker substations. Tested.
cimtopology.cim17 Frozen pre-CIM18 code (cimhub_2023 / cim17v40), kept as the behavioral reference.

Installation

Requires Python 3.10+ and uv.

uv sync                       # cim-graph, cim-profiles and cimtables from PyPI
uv sync --extra gridappsd      # plus the GridAPPS-D service
.venv/bin/python -m pytest test

Usage

The core: no CIM model needed

A format converter (a cimhub_{tool} package for DSS, CYME SXST, ...) describes its network and asks for the topology. This runs before any CIM model exists, so every bus can get the right BaseVoltage, and the gaps can go to CIM-Repair.

from cimtopology.core import (Branch, Coil, Connection, Network, Source, System, Topology, Transformer,
                              walk, write_sorted_csv)

network = Network(
    sources=(Source('src', 12.47, System.THREE_PHASE),),
    branches=(Branch('l1', 'a', 'src'), Branch('sw1', 'a', 'b', switch=True, open=True)),
    transformers=(Transformer('xf1', (Coil('a', 12.47, Connection.POLYPHASE, frozenset({1, 2, 3})),
                                      Coil('lv', 0.48, Connection.POLYPHASE, frozenset({1, 2, 3})))),),
)
topology = Topology(network)
topology.islands()          # bus -> root bus, through closed equipment
topology.voltage_zones()    # bus -> root bus, without crossing a transformer
topology.gaps()             # isolated nodes, isolated sources, unenergized islands
write_sorted_csv(topology.sort(), 'sorted.csv')   # each branch once, oriented from the source
walk(network)['lv']         # BusSystem(0.48, THREE_PHASE); its .base_voltage is 'bv_480v'

CIM18 (cim18v17) models

import cimtables
from cimtopology.cim18 import build_connected_areas, build_topology, number_buses

feeder = cimtables.load_model('IEEE13_CDPSM.cimtbl')
feeder_area = build_connected_areas(feeder)   # ConnectedArea tree: feeder > switch > secondary
build_topology(feeder)                        # TopologicalNodes, then TopologicalIslands
number_buses(substation_model)                # busNumber / busName for busbar buses

Each builder works in place and can be rerun after switching. CLAUDE.md lists what changed from the CIM17 code.

GridAPPS-D background service (CIM17)

topology_background_service.py runs the CIM17 distributed-area code against Blazegraph. Register it with topology_background_service.config, then start it:

python topology_background_service.py

It listens on goss.gridappsd.request.data.cimtopology. GET_DISTRIBUTED_AREAS returns the hierarchical topology message for a Feeder, FeederArea or DistributionArea mRID. GET_BASE_TOPOLOGY and GET_SNAPSHOT_TOPOLOGY are not supported.

from gridappsd import GridAPPSD

gapps = GridAPPSD()
message = {"requestType": "GET_DISTRIBUTED_AREAS",
           "mRID": "49AD8E07-3BF9-A4E2-CB8F-C3722F837B62",  # IEEE 13-node feeder
           "resultFormat": "JSON"}
response = gapps.get_response("goss.gridappsd.request.data.cimtopology", message, timeout=30)

The service sets CIMG_CIM_PROFILE=cimhub_2023, CIMG_URL=http://localhost:8889/bigdata/namespace/kb/sparql and CIMG_NAMESPACE=http://iec.ch/TC57/CIM100#, and authenticates with GRIDAPPSD_USER / GRIDAPPSD_PASSWORD.

Test Models

test/test_models/ holds plain files (no Git LFS):

  • ieee13_distributed.xml: IEEE 13-node feeder (cimhub_2023) with the GridAPPS-D reference areas. test/cim17 rebuilds the areas and checks them against it.
  • new_topo_message.json: the shape of the topology message.
  • node_breaker_substation.cimtbl: a small cim18v17 node-breaker substation for the bus and island tests.
  • IEEE13_CDPSM/ and IEEE13_tiered/: copies of the cim18v17 IEEE13 feeder and its tier-2 switch areas from CIMTBL-Models.

The tests need nothing outside the repo.

License

See LICENSE.

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-topology 0.1.2a5

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-topology 0.1.2a5
File Size Uploaded Provenance Actions
cim_topology-0.1.2a5.tar.gz 8.9 MB With provenance Details for cim_topology-0.1.2a5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cim-topology 0.1.2a5
File Interpreter ABI Platform Actions
cim_topology-0.1.2a5-py3-none-any.whl Python 3 none any Details for cim_topology-0.1.2a5-py3-none-any.whl

Total release size: 9.0 MB

Release files / cim_topology-0.1.2a5.tar.gz

Download URL cim_topology-0.1.2a5.tar.gz
Size 8.9 MB
Tags Source
SHA-256 checksum
How to use checksums
8b97d7f24e0e3b430ec803282e3a8a10e15e2987a4f90bebd6f3aa26b48b8d5f
BLAKE2b-256 checksum
How to use checksums
b2bccbe5ec3d25f9ed05a9a000ca6883062d95e8bfb5657c1ea83c09956c3bef
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_topology-0.1.2a5-py3-none-any.whl

Download URL cim_topology-0.1.2a5-py3-none-any.whl
Size 60.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e01609794886235990a391ded77a1f10d326a8d4883dbed62952df218b8000ed
BLAKE2b-256 checksum
How to use checksums
372f16e107fdd81351319b903dcc55252a862ffaa2f12187783e0450ab52f44b
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-topology 0.1.2a5

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_topology-0.1.2a5.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