handle gas pipeline retrofitting with lossy links

This commit is contained in:
Fabian Neumann 2024-01-03 12:57:22 +01:00
parent 72e6c208ef
commit 80f9259bac

View File

@ -774,9 +774,13 @@ def add_pipe_retrofit_constraint(n):
"""
Add constraint for retrofitting existing CH4 pipelines to H2 pipelines.
"""
gas_pipes_i = n.links.query("carrier == 'gas pipeline' and p_nom_extendable").index
if "reversed" not in n.links.columns:
n.links["reversed"] = False
gas_pipes_i = n.links.query(
"carrier == 'gas pipeline' and p_nom_extendable and ~reversed"
).index
h2_retrofitted_i = n.links.query(
"carrier == 'H2 pipeline retrofitted' and p_nom_extendable"
"carrier == 'H2 pipeline retrofitted' and p_nom_extendable and ~reversed"
).index
if h2_retrofitted_i.empty or gas_pipes_i.empty: