fix naming bugs
This commit is contained in:
parent
b0150bd65d
commit
4a6dd2fe33
@ -417,20 +417,13 @@ sector:
|
|||||||
isentropic_compressor_efficiency: 0.8
|
isentropic_compressor_efficiency: 0.8
|
||||||
heat_loss: 0.0
|
heat_loss: 0.0
|
||||||
heat_pump_sources:
|
heat_pump_sources:
|
||||||
central:
|
urban central:
|
||||||
- air
|
- air
|
||||||
decentral:
|
urban decentral:
|
||||||
|
- air
|
||||||
|
rural:
|
||||||
- air
|
- air
|
||||||
- ground
|
- ground
|
||||||
heat_systems:
|
|
||||||
rural:
|
|
||||||
- residential rural
|
|
||||||
- services rural
|
|
||||||
urban decentral:
|
|
||||||
- residential urban decentral
|
|
||||||
- services urban decentral
|
|
||||||
urban central:
|
|
||||||
- urban central
|
|
||||||
cluster_heat_buses: true
|
cluster_heat_buses: true
|
||||||
heat_demand_cutout: default
|
heat_demand_cutout: default
|
||||||
bev_dsm_restriction_value: 0.75
|
bev_dsm_restriction_value: 0.75
|
||||||
|
@ -12,18 +12,18 @@ from DecentralHeatingCopApproximator import DecentralHeatingCopApproximator
|
|||||||
|
|
||||||
|
|
||||||
def get_cop(
|
def get_cop(
|
||||||
heat_system_type: str,
|
heat_system_category: str,
|
||||||
heat_source: str,
|
heat_source: str,
|
||||||
source_inlet_temperature_celsius: xr.DataArray,
|
source_inlet_temperature_celsius: xr.DataArray,
|
||||||
) -> xr.DataArray:
|
) -> xr.DataArray:
|
||||||
if heat_system_type == "decentral":
|
if heat_system_category in ["urban decentral", "rural"]:
|
||||||
return DecentralHeatingCopApproximator(
|
return DecentralHeatingCopApproximator(
|
||||||
forward_temperature_celsius=snakemake.params.heat_pump_sink_T_decentral_heating,
|
forward_temperature_celsius=snakemake.params.heat_pump_sink_T_decentral_heating,
|
||||||
source_inlet_temperature_celsius=source_inlet_temperature_celsius,
|
source_inlet_temperature_celsius=source_inlet_temperature_celsius,
|
||||||
source_type=heat_source,
|
source_type=heat_source,
|
||||||
).approximate_cop()
|
).approximate_cop()
|
||||||
|
|
||||||
elif heat_system_type == "central":
|
elif heat_system_category == "urban central":
|
||||||
return CentralHeatingCopApproximator(
|
return CentralHeatingCopApproximator(
|
||||||
forward_temperature_celsius=snakemake.params.forward_temperature_central_heating,
|
forward_temperature_celsius=snakemake.params.forward_temperature_central_heating,
|
||||||
return_temperature_celsius=snakemake.params.return_temperature_central_heating,
|
return_temperature_celsius=snakemake.params.return_temperature_central_heating,
|
||||||
@ -33,7 +33,7 @@ def get_cop(
|
|||||||
).approximate_cop()
|
).approximate_cop()
|
||||||
else:
|
else:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"Invalid heat system type '{heat_system_type}'. Must be one of ['decentral', 'central']"
|
f"Invalid heat system type '{heat_system_category}'. Must be one of ['urban decentral', 'urban central', 'rural]"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -50,14 +50,14 @@ if __name__ == "__main__":
|
|||||||
set_scenario_config(snakemake)
|
set_scenario_config(snakemake)
|
||||||
|
|
||||||
cop_all_system_types = []
|
cop_all_system_types = []
|
||||||
for heat_system_type, heat_sources in snakemake.params.heat_pump_sources.items():
|
for heat_system_category, heat_sources in snakemake.params.heat_pump_sources.items():
|
||||||
cop_this_system_type = []
|
cop_this_system_type = []
|
||||||
for heat_source in heat_sources:
|
for heat_source in heat_sources:
|
||||||
source_inlet_temperature_celsius = xr.open_dataarray(
|
source_inlet_temperature_celsius = xr.open_dataarray(
|
||||||
snakemake.input[f"temp_{heat_source.replace('ground', 'soil')}_total"]
|
snakemake.input[f"temp_{heat_source.replace('ground', 'soil')}_total"]
|
||||||
)
|
)
|
||||||
cop_da = get_cop(
|
cop_da = get_cop(
|
||||||
heat_system_type=heat_system_type,
|
heat_system_category=heat_system_category,
|
||||||
heat_source=heat_source,
|
heat_source=heat_source,
|
||||||
source_inlet_temperature_celsius=source_inlet_temperature_celsius,
|
source_inlet_temperature_celsius=source_inlet_temperature_celsius,
|
||||||
)
|
)
|
||||||
|
@ -1840,9 +1840,9 @@ def add_heat(n, costs):
|
|||||||
|
|
||||||
n.madd(
|
n.madd(
|
||||||
"Bus",
|
"Bus",
|
||||||
nodes + f" {heat_system} heat",
|
nodes + f" {heat_system.value} heat",
|
||||||
location=nodes,
|
location=nodes,
|
||||||
carrier=f"{heat_system} heat",
|
carrier=f"{heat_system.value} heat",
|
||||||
unit="MWh_th",
|
unit="MWh_th",
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1891,10 +1891,10 @@ def add_heat(n, costs):
|
|||||||
)
|
)
|
||||||
|
|
||||||
## Add heat pumps
|
## Add heat pumps
|
||||||
for heat_source in snakemake.params.heat_pump_sources[heat_system.system_type]:
|
for heat_source in snakemake.params.heat_pump_sources[heat_system.system_category]:
|
||||||
costs_name = heat_system.heat_pump_costs_name(heat_source)
|
costs_name = heat_system.heat_pump_costs_name(heat_source)
|
||||||
efficiency = (
|
efficiency = (
|
||||||
cop.sel(heat_system=heat_system.system_type, heat_source=heat_source, name=nodes)
|
cop.sel(heat_system=heat_system.system_category, heat_source=heat_source, name=nodes)
|
||||||
.to_pandas()
|
.to_pandas()
|
||||||
.reindex(index=n.snapshots)
|
.reindex(index=n.snapshots)
|
||||||
if options["time_dep_hp_cop"]
|
if options["time_dep_hp_cop"]
|
||||||
@ -2013,7 +2013,7 @@ def add_heat(n, costs):
|
|||||||
lifetime=costs.at[heat_system.system_type + " solar thermal", "lifetime"],
|
lifetime=costs.at[heat_system.system_type + " solar thermal", "lifetime"],
|
||||||
)
|
)
|
||||||
|
|
||||||
if options["chp"] and heat_system == "urban central":
|
if options["chp"] and heat_system == HeatSystem.URBAN_CENTRAL:
|
||||||
# add gas CHP; biomass CHP is added in biomass section
|
# add gas CHP; biomass CHP is added in biomass section
|
||||||
n.madd(
|
n.madd(
|
||||||
"Link",
|
"Link",
|
||||||
@ -2070,7 +2070,7 @@ def add_heat(n, costs):
|
|||||||
lifetime=costs.at["central gas CHP", "lifetime"],
|
lifetime=costs.at["central gas CHP", "lifetime"],
|
||||||
)
|
)
|
||||||
|
|
||||||
if options["chp"] and options["micro_chp"] and heat_system != "urban central":
|
if options["chp"] and options["micro_chp"] and heat_system.value != "urban central":
|
||||||
n.madd(
|
n.madd(
|
||||||
"Link",
|
"Link",
|
||||||
nodes + f" {heat_system} micro gas CHP",
|
nodes + f" {heat_system} micro gas CHP",
|
||||||
@ -2079,7 +2079,7 @@ def add_heat(n, costs):
|
|||||||
bus1=nodes,
|
bus1=nodes,
|
||||||
bus2=nodes + f" {heat_system} heat",
|
bus2=nodes + f" {heat_system} heat",
|
||||||
bus3="co2 atmosphere",
|
bus3="co2 atmosphere",
|
||||||
carrier=heat_system + " micro gas CHP",
|
carrier=heat_system.value + " micro gas CHP",
|
||||||
efficiency=costs.at["micro CHP", "efficiency"],
|
efficiency=costs.at["micro CHP", "efficiency"],
|
||||||
efficiency2=costs.at["micro CHP", "efficiency-heat"],
|
efficiency2=costs.at["micro CHP", "efficiency-heat"],
|
||||||
efficiency3=costs.at["gas", "CO2 intensity"],
|
efficiency3=costs.at["gas", "CO2 intensity"],
|
||||||
@ -2106,36 +2106,35 @@ def add_heat(n, costs):
|
|||||||
|
|
||||||
# share of space heat demand 'w_space' of total heat demand
|
# share of space heat demand 'w_space' of total heat demand
|
||||||
w_space = {}
|
w_space = {}
|
||||||
for sector in HeatSector:
|
for sector in sectors:
|
||||||
w_space[sector.value] = heat_demand[sector.value + " space"] / (
|
w_space[sector] = heat_demand[sector + " space"] / (
|
||||||
heat_demand[sector.value + " space"] + heat_demand[sector.value + " water"]
|
heat_demand[sector + " space"] + heat_demand[sector + " water"]
|
||||||
)
|
)
|
||||||
w_space["tot"] = (
|
w_space["tot"] = (
|
||||||
heat_demand["services space"] + heat_demand["residential space"]
|
heat_demand["services space"] + heat_demand["residential space"]
|
||||||
) / heat_demand.T.groupby(level=[1]).sum().T
|
) / heat_demand.T.groupby(level=[1]).sum().T
|
||||||
|
|
||||||
for heat_system in n.loads[
|
for name in n.loads[
|
||||||
n.loads.carrier.isin([x.value + " heat" for x in HeatSystem])
|
n.loads.carrier.isin([x + " heat" for x in heat_systems])
|
||||||
].index:
|
].index:
|
||||||
node = n.buses.loc[heat_system, "location"]
|
node = n.buses.loc[name, "location"]
|
||||||
ct = pop_layout.loc[node, "ct"]
|
ct = pop_layout.loc[node, "ct"]
|
||||||
|
|
||||||
# weighting 'f' depending on the size of the population at the node
|
# weighting 'f' depending on the size of the population at the node
|
||||||
if "urban central" in heat_system:
|
if "urban central" in name:
|
||||||
f = dist_fraction[node]
|
f = dist_fraction[node]
|
||||||
elif "urban decentral" in heat_system:
|
elif "urban decentral" in name:
|
||||||
f = urban_fraction[node] - dist_fraction[node]
|
f = urban_fraction[node] - dist_fraction[node]
|
||||||
else:
|
else:
|
||||||
f = 1 - urban_fraction[node]
|
f = 1 - urban_fraction[node]
|
||||||
if f == 0:
|
if f == 0:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# get sector name ("residential"/"services"/or both "tot" for urban central)
|
# get sector name ("residential"/"services"/or both "tot" for urban central)
|
||||||
if "urban central" in heat_system:
|
if "urban central" in name:
|
||||||
sec = "tot"
|
sec = "tot"
|
||||||
if "residential" in heat_system:
|
if "residential" in name:
|
||||||
sec = "residential"
|
sec = "residential"
|
||||||
if "services" in heat_system:
|
if "services" in name:
|
||||||
sec = "services"
|
sec = "services"
|
||||||
|
|
||||||
# get floor aread at node and region (urban/rural) in m^2
|
# get floor aread at node and region (urban/rural) in m^2
|
||||||
@ -2143,7 +2142,7 @@ def add_heat(n, costs):
|
|||||||
pop_layout.loc[node].fraction * floor_area.loc[ct, "value"] * 10**6
|
pop_layout.loc[node].fraction * floor_area.loc[ct, "value"] * 10**6
|
||||||
).loc[sec] * f
|
).loc[sec] * f
|
||||||
# total heat demand at node [MWh]
|
# total heat demand at node [MWh]
|
||||||
demand = n.loads_t.p_set[heat_system]
|
demand = n.loads_t.p_set[name]
|
||||||
|
|
||||||
# space heat demand at node [MWh]
|
# space heat demand at node [MWh]
|
||||||
space_heat_demand = demand * w_space[sec][node]
|
space_heat_demand = demand * w_space[sec][node]
|
||||||
@ -2184,12 +2183,12 @@ def add_heat(n, costs):
|
|||||||
|
|
||||||
# add for each retrofitting strength a generator with heat generation profile following the profile of the heat demand
|
# add for each retrofitting strength a generator with heat generation profile following the profile of the heat demand
|
||||||
for strength in strengths:
|
for strength in strengths:
|
||||||
node_name = " ".join(heat_system.split(" ")[2::])
|
node_name = " ".join(name.split(" ")[2::])
|
||||||
n.madd(
|
n.madd(
|
||||||
"Generator",
|
"Generator",
|
||||||
[node],
|
[node],
|
||||||
suffix=" retrofitting " + strength + " " + node_name,
|
suffix=" retrofitting " + strength + " " + node_name,
|
||||||
bus=heat_system,
|
bus=name,
|
||||||
carrier="retrofitting",
|
carrier="retrofitting",
|
||||||
p_nom_extendable=True,
|
p_nom_extendable=True,
|
||||||
p_nom_max=dE_diff[strength]
|
p_nom_max=dE_diff[strength]
|
||||||
|
Loading…
Reference in New Issue
Block a user