Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix H2 and battery issues in prepare_sector_network #1145

Merged
1 change: 1 addition & 0 deletions doc/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ E.g. if a new rule becomes available describe how to use it `make test` and in o

* The computation of `hydro_profile.nc` in `build_renewable_profiles.py` is not differentiated whether alternative clustering is applied or not; the indexing of the different power plants in `add_electricity.py` is performed according to the bus either in case alternative clustering is applied or not and a `hydro_inflow_factor` is computed prior to the computation of `inflow_t` to split the inflow according to the capacity of each different unit of each power plant (if more units are present). `PR #1119 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1119>`_

* Fix bugs in `prepare_sector_network.py` related to links with H2 buses and bug of re-addition of H2 and battery carriers in present `PR #1145 <https://github.com/pypsa-meets-earth/pypsa-earth/pull/1145>`_

PyPSA-Earth 0.4.1
=================
Expand Down
51 changes: 27 additions & 24 deletions scripts/prepare_sector_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ def H2_liquid_fossil_conversions(n, costs):
def add_hydrogen(n, costs):
"function to add hydrogen as an energy carrier with its conversion technologies from and to AC"

n.add("Carrier", "H2")
if not "H2" in n.carriers.index:
n.add("Carrier", "H2")

n.madd(
"Bus",
Expand Down Expand Up @@ -1088,7 +1089,9 @@ def add_aviation(n, cost):

def add_storage(n, costs):
"function to add the different types of storage systems"
n.add("Carrier", "battery")

if not "battery" in n.carriers.index:
n.add("Carrier", "battery")

n.madd(
"Bus",
Expand Down Expand Up @@ -1177,19 +1180,19 @@ def h2_hc_conversions(n, costs):
if snakemake.config["sector"]["hydrogen"]["hydrogen_colors"]:
n.madd(
"Bus",
nodes + " blue H2",
location=nodes,
spatial.nodes + " blue H2",
location=spatial.nodes,
carrier="blue H2",
x=n.buses.loc[list(nodes)].x.values,
y=n.buses.loc[list(nodes)].y.values,
x=n.buses.loc[list(spatial.nodes)].x.values,
y=n.buses.loc[list(spatial.nodes)].y.values,
)

n.madd(
"Link",
spatial.nodes,
suffix=" SMR CC",
bus0=spatial.gas.nodes,
bus1=nodes + " blue H2",
bus1=spatial.nodes + " blue H2",
bus2="co2 atmosphere",
bus3=spatial.co2.nodes,
p_nom_extendable=True,
Expand All @@ -1204,9 +1207,9 @@ def h2_hc_conversions(n, costs):

n.madd(
"Link",
nodes + " blue H2",
bus0=nodes + " blue H2",
bus1=nodes + " H2",
spatial.nodes + " blue H2",
bus0=spatial.nodes + " blue H2",
bus1=spatial.nodes + " H2",
carrier="blue H2",
capital_cost=0,
p_nom_extendable=True,
Expand All @@ -1219,7 +1222,7 @@ def h2_hc_conversions(n, costs):
spatial.nodes,
suffix=" SMR CC",
bus0=spatial.gas.nodes,
bus1=nodes + " H2",
bus1=spatial.nodes + " H2",
bus2="co2 atmosphere",
bus3=spatial.co2.nodes,
p_nom_extendable=True,
Expand All @@ -1236,18 +1239,18 @@ def h2_hc_conversions(n, costs):
if snakemake.config["sector"]["hydrogen"]["hydrogen_colors"]:
n.madd(
"Bus",
nodes + " grey H2",
location=nodes,
spatial.nodes + " grey H2",
location=spatial.nodes,
carrier="grey H2",
x=n.buses.loc[list(nodes)].x.values,
y=n.buses.loc[list(nodes)].y.values,
x=n.buses.loc[list(spatial.nodes)].x.values,
y=n.buses.loc[list(spatial.nodes)].y.values,
)

n.madd(
"Link",
nodes + " SMR",
spatial.nodes + " SMR",
bus0=spatial.gas.nodes,
bus1=nodes + " grey H2",
bus1=spatial.nodes + " grey H2",
bus2="co2 atmosphere",
p_nom_extendable=True,
carrier="SMR",
Expand All @@ -1259,9 +1262,9 @@ def h2_hc_conversions(n, costs):

n.madd(
"Link",
nodes + " grey H2",
bus0=nodes + " grey H2",
bus1=nodes + " H2",
spatial.nodes + " grey H2",
bus0=spatial.nodes + " grey H2",
bus1=spatial.nodes + " H2",
carrier="grey H2",
capital_cost=0,
p_nom_extendable=True,
Expand All @@ -1271,9 +1274,9 @@ def h2_hc_conversions(n, costs):
else:
n.madd(
"Link",
nodes + " SMR",
spatial.nodes + " SMR",
bus0=spatial.gas.nodes,
bus1=nodes + " H2",
bus1=spatial.nodes + " H2",
bus2="co2 atmosphere",
p_nom_extendable=True,
carrier="SMR",
Expand Down Expand Up @@ -1341,7 +1344,7 @@ def add_shipping(n, costs):
if options["shipping_hydrogen_liquefaction"]:
n.madd(
"Bus",
nodes,
spatial.nodes,
suffix=" H2 liquid",
carrier="H2 liquid",
location=spatial.nodes,
Expand Down Expand Up @@ -1370,7 +1373,7 @@ def add_shipping(n, costs):
):
n.madd(
"Load",
nodes,
spatial.nodes,
suffix=" H2 for shipping",
bus=shipping_bus,
carrier="H2 for shipping",
Expand Down
Loading