apply spatial management of gas nodes
This commit is contained in:
parent
5da6ac044b
commit
f4aa345c74
@ -43,9 +43,15 @@ def define_spatial(nodes):
|
|||||||
if options["gas_network"]:
|
if options["gas_network"]:
|
||||||
spatial.gas.nodes = nodes + " gas"
|
spatial.gas.nodes = nodes + " gas"
|
||||||
spatial.gas.locations = nodes
|
spatial.gas.locations = nodes
|
||||||
|
spatial.gas.biogas = nodes + " biogas"
|
||||||
|
spatial.gas.industry = nodes + " gas for industry"
|
||||||
|
spatial.gas.industry_cc = nodes + " gas for industry CC"
|
||||||
else:
|
else:
|
||||||
spatial.gas.nodes = ["EU gas"]
|
spatial.gas.nodes = ["EU gas"]
|
||||||
spatial.gas.locations = "EU"
|
spatial.gas.locations = "EU"
|
||||||
|
spatial.gas.biogas = ["EU biogas"]
|
||||||
|
spatial.gas.industry = ["gas for industry"]
|
||||||
|
spatial.gas.industry_cc = ["gas for industry CC"]
|
||||||
|
|
||||||
spatial.gas.df = pd.DataFrame(vars(spatial.gas), index=nodes)
|
spatial.gas.df = pd.DataFrame(vars(spatial.gas), index=nodes)
|
||||||
|
|
||||||
@ -1111,17 +1117,12 @@ def add_storage(n, costs):
|
|||||||
lifetime=costs.at['battery inverter', 'lifetime']
|
lifetime=costs.at['battery inverter', 'lifetime']
|
||||||
)
|
)
|
||||||
|
|
||||||
if options["gas_network"]:
|
|
||||||
gas_nodes = nodes + " gas"
|
|
||||||
else:
|
|
||||||
gas_nodes = pd.Index(["EU gas"])
|
|
||||||
|
|
||||||
if options['methanation']:
|
if options['methanation']:
|
||||||
|
|
||||||
n.madd("Link",
|
n.madd("Link",
|
||||||
nodes + " Sabatier",
|
nodes + " Sabatier",
|
||||||
bus0=nodes + " H2",
|
bus0=nodes + " H2",
|
||||||
bus1=gas_nodes.repeat((len(nodes)//len(gas_nodes))),
|
bus1=spatial.gas.nodes,
|
||||||
bus2="co2 stored",
|
bus2="co2 stored",
|
||||||
p_nom_extendable=True,
|
p_nom_extendable=True,
|
||||||
carrier="Sabatier",
|
carrier="Sabatier",
|
||||||
@ -1136,7 +1137,7 @@ def add_storage(n, costs):
|
|||||||
n.madd("Link",
|
n.madd("Link",
|
||||||
nodes + " helmeth",
|
nodes + " helmeth",
|
||||||
bus0=nodes,
|
bus0=nodes,
|
||||||
bus1=gas_nodes.repeat((len(nodes)//len(gas_nodes))),
|
bus1=spatial.gas.nodes,
|
||||||
bus2="co2 stored",
|
bus2="co2 stored",
|
||||||
carrier="helmeth",
|
carrier="helmeth",
|
||||||
p_nom_extendable=True,
|
p_nom_extendable=True,
|
||||||
@ -1151,7 +1152,7 @@ def add_storage(n, costs):
|
|||||||
|
|
||||||
n.madd("Link",
|
n.madd("Link",
|
||||||
nodes + " SMR CC",
|
nodes + " SMR CC",
|
||||||
bus0=gas_nodes.repeat((len(nodes)//len(gas_nodes))),
|
bus0=spatial.gas.nodes,
|
||||||
bus1=nodes + " H2",
|
bus1=nodes + " H2",
|
||||||
bus2="co2 atmosphere",
|
bus2="co2 atmosphere",
|
||||||
bus3="co2 stored",
|
bus3="co2 stored",
|
||||||
@ -1166,7 +1167,7 @@ def add_storage(n, costs):
|
|||||||
|
|
||||||
n.madd("Link",
|
n.madd("Link",
|
||||||
nodes + " SMR",
|
nodes + " SMR",
|
||||||
bus0=gas_nodes.repeat((len(nodes)//len(gas_nodes))),
|
bus0=spatial.gas.nodes,
|
||||||
bus1=nodes + " H2",
|
bus1=nodes + " H2",
|
||||||
bus2="co2 atmosphere",
|
bus2="co2 atmosphere",
|
||||||
p_nom_extendable=True,
|
p_nom_extendable=True,
|
||||||
@ -1302,8 +1303,6 @@ def add_land_transport(n, costs):
|
|||||||
|
|
||||||
|
|
||||||
def add_heat(n, costs):
|
def add_heat(n, costs):
|
||||||
# TODO options?
|
|
||||||
# TODO pop_layout?
|
|
||||||
|
|
||||||
print("adding heat")
|
print("adding heat")
|
||||||
|
|
||||||
@ -1311,11 +1310,6 @@ def add_heat(n, costs):
|
|||||||
|
|
||||||
nodes = create_nodes_for_heat_sector()
|
nodes = create_nodes_for_heat_sector()
|
||||||
|
|
||||||
if options["gas_network"]:
|
|
||||||
gas_nodes = pop_layout.index + " gas"
|
|
||||||
else:
|
|
||||||
gas_nodes = pd.Index(["EU gas"])
|
|
||||||
|
|
||||||
#NB: must add costs of central heating afterwards (EUR 400 / kWpeak, 50a, 1% FOM from Fraunhofer ISE)
|
#NB: must add costs of central heating afterwards (EUR 400 / kWpeak, 50a, 1% FOM from Fraunhofer ISE)
|
||||||
|
|
||||||
urban_fraction = options['central_fraction'] * pop_layout["urban"] / pop_layout[["urban", "rural"]].sum(axis=1)
|
urban_fraction = options['central_fraction'] * pop_layout["urban"] / pop_layout[["urban", "rural"]].sum(axis=1)
|
||||||
@ -1337,12 +1331,6 @@ def add_heat(n, costs):
|
|||||||
|
|
||||||
for name in heat_systems:
|
for name in heat_systems:
|
||||||
|
|
||||||
if options["gas_network"]:
|
|
||||||
gas_nodes_region = gas_nodes[[gas_node.replace(" gas","")
|
|
||||||
in nodes[name] for gas_node in gas_nodes]]
|
|
||||||
else:
|
|
||||||
gas_nodes_region = gas_nodes
|
|
||||||
|
|
||||||
name_type = "central" if name == "urban central" else "decentral"
|
name_type = "central" if name == "urban central" else "decentral"
|
||||||
|
|
||||||
n.add("Carrier", name + " heat")
|
n.add("Carrier", name + " heat")
|
||||||
@ -1464,7 +1452,7 @@ def add_heat(n, costs):
|
|||||||
n.madd("Link",
|
n.madd("Link",
|
||||||
nodes[name] + f" {name} gas boiler",
|
nodes[name] + f" {name} gas boiler",
|
||||||
p_nom_extendable=True,
|
p_nom_extendable=True,
|
||||||
bus0=gas_nodes_region.repeat((len(nodes[name])//len(gas_nodes_region))),
|
bus0=spatial.gas.df.loc[nodes[name], "nodes"].values,
|
||||||
bus1=nodes[name] + f" {name} heat",
|
bus1=nodes[name] + f" {name} heat",
|
||||||
bus2="co2 atmosphere",
|
bus2="co2 atmosphere",
|
||||||
carrier=name + " gas boiler",
|
carrier=name + " gas boiler",
|
||||||
@ -1494,7 +1482,7 @@ def add_heat(n, costs):
|
|||||||
# add gas CHP; biomass CHP is added in biomass section
|
# add gas CHP; biomass CHP is added in biomass section
|
||||||
n.madd("Link",
|
n.madd("Link",
|
||||||
nodes[name] + " urban central gas CHP",
|
nodes[name] + " urban central gas CHP",
|
||||||
bus0=gas_nodes_region,
|
bus0=spatial.gas.df.loc[nodes[name], "nodes"].values,
|
||||||
bus1=nodes[name],
|
bus1=nodes[name],
|
||||||
bus2=nodes[name] + " urban central heat",
|
bus2=nodes[name] + " urban central heat",
|
||||||
bus3="co2 atmosphere",
|
bus3="co2 atmosphere",
|
||||||
@ -1510,7 +1498,7 @@ def add_heat(n, costs):
|
|||||||
|
|
||||||
n.madd("Link",
|
n.madd("Link",
|
||||||
nodes[name] + " urban central gas CHP CC",
|
nodes[name] + " urban central gas CHP CC",
|
||||||
bus0=gas_nodes_region,
|
bus0=spatial.gas.df.loc[nodes[name], "nodes"].values,
|
||||||
bus1=nodes[name],
|
bus1=nodes[name],
|
||||||
bus2=nodes[name] + " urban central heat",
|
bus2=nodes[name] + " urban central heat",
|
||||||
bus3="co2 atmosphere",
|
bus3="co2 atmosphere",
|
||||||
@ -1531,7 +1519,7 @@ def add_heat(n, costs):
|
|||||||
n.madd("Link",
|
n.madd("Link",
|
||||||
nodes[name] + f" {name} micro gas CHP",
|
nodes[name] + f" {name} micro gas CHP",
|
||||||
p_nom_extendable=True,
|
p_nom_extendable=True,
|
||||||
bus0=gas_nodes_region,
|
bus0=spatial.gas.df.loc[nodes[name], "nodes"].values,
|
||||||
bus1=nodes[name],
|
bus1=nodes[name],
|
||||||
bus2=nodes[name] + f" {name} heat",
|
bus2=nodes[name] + f" {name} heat",
|
||||||
bus3="co2 atmosphere",
|
bus3="co2 atmosphere",
|
||||||
@ -1677,14 +1665,13 @@ def add_biomass(n, costs):
|
|||||||
|
|
||||||
# potential per node distributed within country by population
|
# potential per node distributed within country by population
|
||||||
biogas_pot = (biomass_potentials.loc[pop_layout.ct]
|
biogas_pot = (biomass_potentials.loc[pop_layout.ct]
|
||||||
.set_index(pop_layout.index)
|
.set_index(pop_layout.index)
|
||||||
.mul(pop_layout.fraction, axis="index")
|
.mul(pop_layout.fraction, axis="index")
|
||||||
.rename(index=lambda x: x + " biogas"))["biogas"]
|
.rename(index=lambda x: x + " biogas")
|
||||||
|
)["biogas"]
|
||||||
|
|
||||||
if options["gas_network"]:
|
# need to aggregate potentials if gas not nodally resolved
|
||||||
gas_nodes = nodes + " gas"
|
if not options["gas_network"]:
|
||||||
else:
|
|
||||||
gas_nodes = pd.Index(["EU gas"])
|
|
||||||
biogas_pot = biogas_pot.sum()
|
biogas_pot = biogas_pot.sum()
|
||||||
|
|
||||||
n.add("Carrier", "biogas")
|
n.add("Carrier", "biogas")
|
||||||
@ -1692,8 +1679,8 @@ def add_biomass(n, costs):
|
|||||||
n.add("Carrier", "solid biomass")
|
n.add("Carrier", "solid biomass")
|
||||||
|
|
||||||
n.madd("Bus",
|
n.madd("Bus",
|
||||||
gas_nodes.str.replace("gas", "biogas"),
|
spatial.gas.biogas,
|
||||||
location=gas_nodes.str.replace(" gas", ""),
|
location=spatial.gas.locations,
|
||||||
carrier="biogas"
|
carrier="biogas"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1704,8 +1691,8 @@ def add_biomass(n, costs):
|
|||||||
)
|
)
|
||||||
|
|
||||||
n.madd("Store",
|
n.madd("Store",
|
||||||
gas_nodes.str.replace("gas", "biogas"),
|
spatial.gas.biogas,
|
||||||
bus=gas_nodes.str.replace("gas", "biogas"),
|
bus=spatial.gas.biogas,
|
||||||
carrier="biogas",
|
carrier="biogas",
|
||||||
e_nom=biogas_pot,
|
e_nom=biogas_pot,
|
||||||
marginal_cost=costs.at['biogas', 'fuel'],
|
marginal_cost=costs.at['biogas', 'fuel'],
|
||||||
@ -1722,9 +1709,9 @@ def add_biomass(n, costs):
|
|||||||
)
|
)
|
||||||
|
|
||||||
n.madd("Link",
|
n.madd("Link",
|
||||||
gas_nodes.str.replace("gas", "") + "biogas to gas",
|
spatial.gas.locations + "biogas to gas",
|
||||||
bus0=gas_nodes.str.replace("gas", "biogas"),
|
bus0=spatial.gas.biogas,
|
||||||
bus1=gas_nodes,
|
bus1=spatial.gas.nodes,
|
||||||
bus2="co2 atmosphere",
|
bus2="co2 atmosphere",
|
||||||
carrier="biogas to gas",
|
carrier="biogas to gas",
|
||||||
capital_cost=costs.loc["biogas upgrading", "fixed"],
|
capital_cost=costs.loc["biogas upgrading", "fixed"],
|
||||||
@ -1783,19 +1770,14 @@ def add_industry(n, costs):
|
|||||||
# 1e6 to convert TWh to MWh
|
# 1e6 to convert TWh to MWh
|
||||||
industrial_demand = pd.read_csv(snakemake.input.industrial_demand, index_col=0) * 1e6
|
industrial_demand = pd.read_csv(snakemake.input.industrial_demand, index_col=0) * 1e6
|
||||||
|
|
||||||
methane_demand = ((industrial_demand.loc[nodes,"methane"]/8760)
|
methane_demand = industrial_demand.loc[nodes, "methane"].div(8760).rename(index=lambda x: x + " gas for industry")
|
||||||
.rename(index=lambda x: x + " gas for industry"))
|
|
||||||
|
|
||||||
if options["gas_network"]:
|
# need to aggregate methane demand if gas not nodally resolved
|
||||||
gas_nodes = nodes + " gas"
|
if not options["gas_network"]:
|
||||||
else:
|
|
||||||
gas_nodes = pd.Index(["EU gas"])
|
|
||||||
methane_demand = methane_demand.sum()
|
methane_demand = methane_demand.sum()
|
||||||
|
|
||||||
solid_biomass_by_country = industrial_demand["solid biomass"].groupby(pop_layout.ct).sum()
|
solid_biomass_by_country = industrial_demand["solid biomass"].groupby(pop_layout.ct).sum()
|
||||||
|
|
||||||
countries = solid_biomass_by_country.index
|
|
||||||
|
|
||||||
n.add("Bus",
|
n.add("Bus",
|
||||||
"solid biomass for industry",
|
"solid biomass for industry",
|
||||||
location="EU",
|
location="EU",
|
||||||
@ -1834,21 +1816,21 @@ def add_industry(n, costs):
|
|||||||
)
|
)
|
||||||
|
|
||||||
n.madd("Bus",
|
n.madd("Bus",
|
||||||
gas_nodes.str.replace("gas", "gas for industry"),
|
spatial.gas.industry,
|
||||||
location=gas_nodes.str.replace(" gas",""),
|
location=spatial.gas.locations,
|
||||||
carrier="gas for industry")
|
carrier="gas for industry")
|
||||||
|
|
||||||
n.madd("Load",
|
n.madd("Load",
|
||||||
gas_nodes.str.replace("gas", "gas for industry"),
|
spatial.gas.industry,
|
||||||
bus=gas_nodes.str.replace("gas", "gas for industry"),
|
bus=spatial.gas.industry,
|
||||||
carrier="gas for industry",
|
carrier="gas for industry",
|
||||||
p_set=methane_demand
|
p_set=methane_demand
|
||||||
)
|
)
|
||||||
|
|
||||||
n.madd("Link",
|
n.madd("Link",
|
||||||
gas_nodes.str.replace("gas", "gas for industry"),
|
spatial.gas.industry,
|
||||||
bus0=gas_nodes,
|
bus0=spatial.gas.nodes,
|
||||||
bus1=gas_nodes.str.replace("gas","gas for industry"),
|
bus1=spatial.gas.industry,
|
||||||
bus2="co2 atmosphere",
|
bus2="co2 atmosphere",
|
||||||
carrier="gas for industry",
|
carrier="gas for industry",
|
||||||
p_nom_extendable=True,
|
p_nom_extendable=True,
|
||||||
@ -1857,9 +1839,9 @@ def add_industry(n, costs):
|
|||||||
)
|
)
|
||||||
|
|
||||||
n.madd("Link",
|
n.madd("Link",
|
||||||
gas_nodes.str.replace("gas", "gas for industry CC"),
|
spatial.gas.industry_cc,
|
||||||
bus0=gas_nodes,
|
bus0=spatial.gas.nodes,
|
||||||
bus1=gas_nodes.str.replace("gas", "gas for industry"),
|
bus1=spatial.gas.industry,
|
||||||
bus2="co2 atmosphere",
|
bus2="co2 atmosphere",
|
||||||
bus3="co2 stored",
|
bus3="co2 stored",
|
||||||
carrier="gas for industry CC",
|
carrier="gas for industry CC",
|
||||||
|
Loading…
Reference in New Issue
Block a user