Skip to content

Commit

Permalink
Merge pull request #1076 from koen-vg/transmission-limit-fix
Browse files Browse the repository at this point in the history
Fix disabling transmission limit for volume limit type
  • Loading branch information
fneum committed May 21, 2024
2 parents 0370dee + b6fa004 commit 1fff76b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions scripts/add_brownfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,22 +132,20 @@ def disable_grid_expansion_if_limit_hit(n):
minimum and extendable is turned off; the corresponding global
constraint is then dropped.
"""
cols = {"cost": "capital_cost", "volume": "length"}
for limit_type in ["cost", "volume"]:
glcs = n.global_constraints.query(
f"type == 'transmission_expansion_{limit_type}_limit'"
)
types = {"expansion_cost": "capital_cost", "volume_expansion": "length"}
for limit_type in types:
glcs = n.global_constraints.query(f"type == 'transmission_{limit_type}_limit'")

for name, glc in glcs.iterrows():
total_expansion = (
(
n.lines.query("s_nom_extendable")
.eval(f"s_nom_min * {cols[limit_type]}")
.eval(f"s_nom_min * {types[limit_type]}")
.sum()
)
+ (
n.links.query("carrier == 'DC' and p_nom_extendable")
.eval(f"p_nom_min * {cols[limit_type]}")
.eval(f"p_nom_min * {types[limit_type]}")
.sum()
)
).sum()
Expand Down

0 comments on commit 1fff76b

Please sign in to comment.