Skip to content

Commit 9e80f10

Browse files
committed
feat: add check if buses from map are in network
1 parent e12751b commit 9e80f10

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

scripts/cba/simplify_sb_network.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,13 @@ def move_bus_carrier_and_cleanup(
9595
None
9696
Network is modified in place.
9797
"""
98+
# create busmap
9899
if busmap is None:
99100
busmap = n.buses.loc[n.buses.carrier == from_carrier, "location"]
101+
# check if buses exist in network
102+
if not busmap.isin(n.buses.index).all():
103+
missing = busmap[~busmap.isin(n.buses.index)]
104+
raise ValueError(f"Locations not found in n.buses.index: {missing.tolist()}")
100105

101106
# remove load shedding generators on low voltage buses to avoid having two
102107
# load shedding generators at market node

0 commit comments

Comments
 (0)