From 29dc7d64acc63757ee1ed433781112934a462801 Mon Sep 17 00:00:00 2001 From: ekatef Date: Sun, 9 Jul 2023 20:49:43 +0300 Subject: [PATCH] Simplify definition of dc_as_links flag --- scripts/simplify_network.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/simplify_network.py b/scripts/simplify_network.py index 520f9c50d..d7470e2b4 100644 --- a/scripts/simplify_network.py +++ b/scripts/simplify_network.py @@ -294,8 +294,7 @@ def simplify_links(n, costs, config, output, aggregation_strategies=dict()): pass return n, n.buses.index.to_series() - dc_as_links = not n.links.loc[n.links.carrier == "DC"].empty - dc_as_lines = not n.lines.loc[n.lines.carrier == "DC"].empty + dc_as_links = not (n.lines.carrier == "DC").any() # Determine connected link components, ignore all links but DC adjacency_matrix = n.adjacency_matrix( @@ -400,7 +399,7 @@ def split_links(nodes): lengths * n.links.loc[all_links, "underwater_fraction"] ).sum() / lengths.sum() # HVDC part is represented as "Line" component - elif dc_as_lines: + else: p_max_pu = config["lines"].get("p_max_pu", 1.0) lengths = n.lines.loc[all_dc_lines, "length"] length = lengths.sum() / len(lengths) if len(lengths) > 0 else 0