Ring-Bus Substation¶
The ring-bus configuration arranges the bus sections in a closed loop, with a breaker between each pair of neighbouring sections. Each branch connects to one section. Any one breaker can be opened for maintenance without an outage, because every section is still fed from the other way round the ring. A ring needs at least three sections.

CIM representation¶
Each bus section is a node with a BusbarSection. A ring breaker bay joins each section to the next, and
the last bay closes the ring back onto section 1. Each branch connects to its section through one
Disconnector.
| Object | mRIDs |
|---|---|
| Section s | node vl_115_bus_s, BusbarSection vl_115_bus_s_bbs |
| Ring bay s | breaker bay vl_115_ring_s, from vl_115_bus_s to the next section's node |
| Branch on section s | Disconnector vl_115_s_d, from vl_115_bus_s to the branch node |
A breaker bay p is the chain p_d1 - p_j1 - p_brk - p_j2 - p_d2: a Breaker between two
Disconnectors, with a junction node on either side of the breaker. See
Substation builder for the naming rules and the call order shared by every
layout.
The diagram comes from an earlier release of CIM-Builder, and its labels are not the mRIDs written now.
The table gives the current mRIDs, all prefixed with the VoltageLevel mRID vl_115.
import logging
import os
os.environ["CIMG_CIM_PROFILE"] = "cim18v17"
os.environ["CIMG_USE_UNITS"] = "TRUE"
os.environ["CIMG_SYSTEM_MVA_BASE"] = "100"
# The IEEE 13 files carry CIMHub extensions that cim18v17 does not have: hide the parser warnings
logging.getLogger("cimgraph").setLevel(logging.ERROR)
import cimgraph.utils as utils
import cimprofiles.cim18.cim18v17 as cim
from cimgraph.databases import XMLFile
from cimgraph.models import FeederModel
from cimtables.units import Qty
from cimbuilder.object_builder import BaseVoltageBuilder, FeederBuilder
from cimbuilder.substation_builder import RingBusSubstationBuilder
Load the IEEE 13 and IEEE 13 Assets feeders¶
Both feeder files load into one graph. The substation is built into the same graph, so that its switches connect to the feeders' existing head nodes.
IEEE13 = "49AD8E07-3BF9-A4E2-CB8F-C3722F837B62"
IEEE13_ASSETS = "5B816B93-7A5F-B64C-8460-47C17D6E4B0F"
FEEDER_FILES = ["../../tests/test_models/IEEE13.xml", "../../tests/test_models/IEEE13_Assets.xml"]
network = FeederModel(
container=cim.Feeder(mRID=IEEE13), connection=XMLFile(filename=FEEDER_FILES), distributed=False
)
container = network.container
Two small helpers: sourcebus finds a feeder's head node, the ConnectivityNode named sourcebus inside
that feeder, and show prints each switch with the nodes on its two terminals.
def sourcebus(network, feeder_mRID):
"""mRID of the feeder head node, the ConnectivityNode named sourcebus in the feeder"""
for node in network.graph[cim.ConnectivityNode].values():
node_container = node.ConnectivityNodeContainer
if node.name == "sourcebus" and node_container is not None and node_container.mRID == feeder_mRID:
return node.mRID
raise ValueError(f"no sourcebus in feeder {feeder_mRID}")
def show(switches):
"""one line per switch: class, mRID, the nodes on its two terminals and normalOpen"""
for switch in switches:
node1, node2 = [terminal.ConnectivityNode for terminal in switch.Terminals]
print(
f"{type(switch).__name__:13} {switch.mRID:24} "
f"{node1.name or node1.mRID} - {node2.name or node2.mRID} normalOpen={switch.normalOpen}"
)
print("IEEE 13 sourcebus: ", sourcebus(network, IEEE13))
print("IEEE 13 Assets sourcebus:", sourcebus(network, IEEE13_ASSETS))
IEEE 13 sourcebus: A8A25B50-3AE3-4A31-A18B-B3FA13397ED3 IEEE 13 Assets sourcebus: E14BD0DF-466D-487B-8786-0D46515D1F9B
Create the Substation and its 115 kV VoltageLevel¶
References between objects are mRID strings, as in every other builder. The BaseVoltage is created first
so the VoltageLevel can refer to it.
BaseVoltageBuilder(network, container).create(
mRID="bv_115kV", name="115 kV", nominalVoltage=Qty(115, "kV")
)
builder = RingBusSubstationBuilder(network, container)
substation = builder.create(mRID="sub_ring_bus", name="sub_ring_bus")
substation, voltage_level = builder.add_voltage_level(
substation, mRID="vl_115", name="115 kV", BaseVoltage="bv_115kV"
)
Add the buses¶
sections sets the number of ring sections (default 4, at least 3). The ring bays are returned as ring.
voltage_level, busbars, ring = builder.add_buses(voltage_level, sections=4)
print([busbar.mRID for busbar in busbars])
show(ring)
['vl_115_bus_1_bbs', 'vl_115_bus_2_bbs', 'vl_115_bus_3_bbs', 'vl_115_bus_4_bbs'] Disconnector vl_115_ring_1_d1 vl_115_bus_1 - vl_115_ring_1_j1 normalOpen=False Breaker vl_115_ring_1_brk vl_115_ring_1_j1 - vl_115_ring_1_j2 normalOpen=False Disconnector vl_115_ring_1_d2 vl_115_ring_1_j2 - vl_115_bus_2 normalOpen=False Disconnector vl_115_ring_2_d1 vl_115_bus_2 - vl_115_ring_2_j1 normalOpen=False Breaker vl_115_ring_2_brk vl_115_ring_2_j1 - vl_115_ring_2_j2 normalOpen=False Disconnector vl_115_ring_2_d2 vl_115_ring_2_j2 - vl_115_bus_3 normalOpen=False Disconnector vl_115_ring_3_d1 vl_115_bus_3 - vl_115_ring_3_j1 normalOpen=False Breaker vl_115_ring_3_brk vl_115_ring_3_j1 - vl_115_ring_3_j2 normalOpen=False Disconnector vl_115_ring_3_d2 vl_115_ring_3_j2 - vl_115_bus_4 normalOpen=False Disconnector vl_115_ring_4_d1 vl_115_bus_4 - vl_115_ring_4_j1 normalOpen=False Breaker vl_115_ring_4_brk vl_115_ring_4_j1 - vl_115_ring_4_j2 normalOpen=False Disconnector vl_115_ring_4_d2 vl_115_ring_4_j2 - vl_115_bus_1 normalOpen=False
Add the branches¶
section picks the ring section, and names the branch disconnector. Each section takes one branch.
voltage_level, switches = builder.add_branch(voltage_level, section=1, node="line_1")
show(switches)
voltage_level, switches = builder.add_branch(voltage_level, section=3, node=sourcebus(network, IEEE13))
show(switches)
voltage_level, switches = builder.add_branch(voltage_level, section=4, node=sourcebus(network, IEEE13_ASSETS))
show(switches)
Disconnector vl_115_1_d vl_115_bus_1 - line_1 normalOpen=False Disconnector vl_115_3_d vl_115_bus_3 - sourcebus normalOpen=False Disconnector vl_115_4_d vl_115_bus_4 - sourcebus normalOpen=False
Link the feeders to the substation¶
The switches connect the feeders electrically. The feeder containers link to the substation through
Feeder.NormalEnergizingSubstation:
feeder_builder = FeederBuilder(network, container)
for feeder_mRID in (IEEE13, IEEE13_ASSETS):
feeder = network.find_by_mRID(feeder_mRID)
feeder_builder.add_connectivity(feeder, NormalEnergizingSubstation=substation.mRID)
print([feeder.name for feeder in substation.NormalEnergizedFeeder])
['ieee13nodeckt', 'ieee13nodecktassets']
Save the substation and feeders to CIM XML¶
os.makedirs("output", exist_ok=True)
utils.write_xml(network, "output/ring_bus.xml")
Read the XML file back¶
Reload the file into a new model and check that the substation, its feeders and its switching equipment all came back, along with the feeders' load.
roundtrip = FeederModel(
container=cim.Feeder(mRID=IEEE13),
connection=XMLFile(filename="output/ring_bus.xml"),
distributed=False,
)
substation = roundtrip.find_by_mRID("sub_ring_bus")
voltage_level = roundtrip.find_by_mRID("vl_115")
print("feeders:", [feeder.name for feeder in substation.NormalEnergizedFeeder])
for cim_class in (cim.BusbarSection, cim.Breaker, cim.Disconnector):
count = sum(isinstance(equipment, cim_class) for equipment in voltage_level.Equipments)
print(f"{cim_class.__name__}: {count}")
feeders: ['ieee13nodeckt', 'ieee13nodecktassets'] BusbarSection: 4 Breaker: 4 Disconnector: 11
# CIM XML values are in SI base units (W); CIMUnit converts them for display
total_load = sum(float(load.p) for load in roundtrip.graph[cim.EnergyConsumer].values())
print(f"total load served by the substation: {cim.ActivePower(total_load).to('kW'):.1f} kW")
total load served by the substation: 6937.0 kW
<style>
['pre { line-height: 125%; }\ntd.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }\nspan.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }\ntd.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }\nspan.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }\n.highlight-ipynb .hll { background-color: var(--jp-cell-editor-active-background) }\n.highlight-ipynb { background: var(--jp-cell-editor-background); color: var(--jp-mirror-editor-variable-color) }\n.highlight-ipynb .c { color: var(--jp-mirror-editor-comment-color); font-style: italic } /* Comment */\n.highlight-ipynb .err { color: var(--jp-mirror-editor-error-color) } /* Error */\n.highlight-ipynb .k { color: var(--jp-mirror-editor-keyword-color); font-weight: bold } /* Keyword */\n.highlight-ipynb .o { color: var(--jp-mirror-editor-operator-color); font-weight: bold } /* Operator */\n.highlight-ipynb .p { color: var(--jp-mirror-editor-punctuation-color) } /* Punctuation */\n.highlight-ipynb .ch { color: var(--jp-mirror-editor-comment-color); font-style: italic } /* Comment.Hashbang */\n.highlight-ipynb .cm { color: var(--jp-mirror-editor-comment-color); font-style: italic } /* Comment.Multiline */\n.highlight-ipynb .cp { color: var(--jp-mirror-editor-comment-color); font-style: italic } /* Comment.Preproc */\n.highlight-ipynb .cpf { color: var(--jp-mirror-editor-comment-color); font-style: italic } /* Comment.PreprocFile */\n.highlight-ipynb .c1 { color: var(--jp-mirror-editor-comment-color); font-style: italic } /* Comment.Single */\n.highlight-ipynb .cs { color: var(--jp-mirror-editor-comment-color); font-style: italic } /* Comment.Special */\n.highlight-ipynb .kc { color: var(--jp-mirror-editor-keyword-color); font-weight: bold } /* Keyword.Constant */\n.highlight-ipynb .kd { color: var(--jp-mirror-editor-keyword-color); font-weight: bold } /* Keyword.Declaration */\n.highlight-ipynb .kn { color: var(--jp-mirror-editor-keyword-color); font-weight: bold } /* Keyword.Namespace */\n.highlight-ipynb .kp { color: var(--jp-mirror-editor-keyword-color); font-weight: bold } /* Keyword.Pseudo */\n.highlight-ipynb .kr { color: var(--jp-mirror-editor-keyword-color); font-weight: bold } /* Keyword.Reserved */\n.highlight-ipynb .kt { color: var(--jp-mirror-editor-keyword-color); font-weight: bold } /* Keyword.Type */\n.highlight-ipynb .m { color: var(--jp-mirror-editor-number-color) } /* Literal.Number */\n.highlight-ipynb .s { color: var(--jp-mirror-editor-string-color) } /* Literal.String */\n.highlight-ipynb .ow { color: var(--jp-mirror-editor-operator-color); font-weight: bold } /* Operator.Word */\n.highlight-ipynb .pm { color: var(--jp-mirror-editor-punctuation-color) } /* Punctuation.Marker */\n.highlight-ipynb .w { color: var(--jp-mirror-editor-variable-color) } /* Text.Whitespace */\n.highlight-ipynb .mb { color: var(--jp-mirror-editor-number-color) } /* Literal.Number.Bin */\n.highlight-ipynb .mf { color: var(--jp-mirror-editor-number-color) } /* Literal.Number.Float */\n.highlight-ipynb .mh { color: var(--jp-mirror-editor-number-color) } /* Literal.Number.Hex */\n.highlight-ipynb .mi { color: var(--jp-mirror-editor-number-color) } /* Literal.Number.Integer */\n.highlight-ipynb .mo { color: var(--jp-mirror-editor-number-color) } /* Literal.Number.Oct */\n.highlight-ipynb .sa { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Affix */\n.highlight-ipynb .sb { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Backtick */\n.highlight-ipynb .sc { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Char */\n.highlight-ipynb .dl { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Delimiter */\n.highlight-ipynb .sd { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Doc */\n.highlight-ipynb .s2 { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Double */\n.highlight-ipynb .se { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Escape */\n.highlight-ipynb .sh { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Heredoc */\n.highlight-ipynb .si { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Interpol */\n.highlight-ipynb .sx { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Other */\n.highlight-ipynb .sr { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Regex */\n.highlight-ipynb .s1 { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Single */\n.highlight-ipynb .ss { color: var(--jp-mirror-editor-string-color) } /* Literal.String.Symbol */\n.highlight-ipynb .il { color: var(--jp-mirror-editor-number-color) } /* Literal.Number.Integer.Long */']
</style>