CIM-Topology-Processor
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.
benchmarks/RESULTS.md compares it with networkx, scipy, rustworkx and
igraph on networks up to 128k buses.
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 sibling checkouts
uv sync --extra gridappsd # plus the GridAPPS-D service
.venv/bin/python -m pytest test
[tool.uv.sources] in pyproject.toml points cim-graph, cim-profiles and cimtables at
../CIM-Graph, ../CIM-Profiles and ../CIM-Tables.
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/cim17rebuilds the areas and checks them against it.new_topo_message.json: the shape of the topology message.node_breaker_substation.cimtbl: a smallcim18v17node-breaker substation for the bus and island tests.
The CIM18 (cim18v17) fixtures are the .cimtbl files in CIMTBL-Models.
examples/9500node_example.ipynb is the CIM17-era DSO development
notebook for cim17/distribution/dso_topology.py. Like that module, it is hardcoded to IEEE 9500
names and to local paths.
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.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cim_topology-0.1.1.tar.gz | 8.9 MB | With provenance | Details for cim_topology-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cim_topology-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for cim_topology-0.1.1-py3-none-any.whl |
Total release size: 9.0 MB
Release files / cim_topology-0.1.1.tar.gz
| Download URL | cim_topology-0.1.1.tar.gz |
|---|---|
| Size | 8.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ff604236d91359a0040864204177620c554daf938b87a379537e2743ca368e1d
|
|
BLAKE2b-256 checksum How to use checksums |
00069d7b16beeea6416064aef6336cb03959ad947f8b617612fe07c991ec967f
|
| 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 20, 2026.
Transparency logRelease files / cim_topology-0.1.1-py3-none-any.whl
| Download URL | cim_topology-0.1.1-py3-none-any.whl |
|---|---|
| Size | 55.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
955401c1ecb24f6b5ee7f9e4597016e5b1450ebbcc4eff247319ffc78500b94a
|
|
BLAKE2b-256 checksum How to use checksums |
985a7c1b96284b178b5c603fd10dede7255676a3ffb8a56c3b3b9faa4eab52c1
|
| 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 20, 2026.
Transparency logSecurity for cim-topology 0.1.1
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.
Attestation for cim_topology-0.1.1.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 20, 2026.
Transparency logA 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.