fix bug in simplyfy network (#1222)

This commit is contained in:
Philipp Glaum 2024-08-16 13:16:52 +02:00 committed by GitHub
parent 55cca6a0f9
commit 8480d62d33
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -301,7 +301,7 @@ def simplify_links(
# Only span graph over the DC link components
G = n.graph(branch_components=["Link"])
def split_links(nodes, added_supernodes=None):
def split_links(nodes, added_supernodes):
nodes = frozenset(nodes)
seen = set()
@ -363,7 +363,9 @@ def simplify_links(
added_supernodes.append(node_corsica)
for lbl in labels.value_counts().loc[lambda s: s > 2].index:
for b, buses, links in split_links(labels.index[labels == lbl]):
for b, buses, links in split_links(
labels.index[labels == lbl], added_supernodes
):
if len(buses) <= 2:
continue