update base year COPs

This commit is contained in:
AmosSchledorn 2024-07-25 14:33:14 +02:00
parent 368971f2a6
commit b80bb7bb7a

View File

@ -419,11 +419,11 @@ def add_heating_capacities_installed_before_baseyear(
n, n,
baseyear, baseyear,
grouping_years, grouping_years,
ashp_cop, cop: dict,
gshp_cop, time_dep_hp_cop: bool,
time_dep_hp_cop,
costs, costs,
default_lifetime, default_lifetime,
existing_heating: pd.DataFrame
): ):
""" """
Parameters Parameters
@ -435,13 +435,13 @@ def add_heating_capacities_installed_before_baseyear(
currently assumed heating capacities split between residential and currently assumed heating capacities split between residential and
services proportional to heating load in both 50% capacities services proportional to heating load in both 50% capacities
in rural buses 50% in urban buses in rural buses 50% in urban buses
cop: dict
Dictionary with time-dependent coefficients of perforamnce (COPs) for air and ground heat pumps as values and keys "air decentral", "ground decentral", "air central", "ground central"
time_dep_hp_cop: bool
If True, time-dependent (dynamic) COPs are used for heat pumps
""" """
logger.debug(f"Adding heating capacities installed before {baseyear}") logger.debug(f"Adding heating capacities installed before {baseyear}")
existing_heating = pd.read_csv(
snakemake.input.existing_heating_distribution, header=[0, 1], index_col=0
)
for name in existing_heating.columns.get_level_values(0).unique(): for name in existing_heating.columns.get_level_values(0).unique():
name_type = "central" if name == "urban central" else "decentral" name_type = "central" if name == "urban central" else "decentral"
@ -457,12 +457,11 @@ def add_heating_capacities_installed_before_baseyear(
# Add heat pumps # Add heat pumps
costs_name = f"decentral {heat_pump_type}-sourced heat pump" costs_name = f"decentral {heat_pump_type}-sourced heat pump"
cop = {"air": ashp_cop, "ground": gshp_cop} efficiency = (
cop[f"{heat_pump_type} {name_type}"][nodes]
if time_dep_hp_cop: if options["time_dep_hp_cop"]
efficiency = cop[heat_pump_type][nodes] else costs.at[costs_name, "efficiency"]
else: )
efficiency = costs.at[costs_name, "efficiency"]
too_large_grouping_years = [gy for gy in grouping_years if gy >= int(baseyear)] too_large_grouping_years = [gy for gy in grouping_years if gy >= int(baseyear)]
if too_large_grouping_years: if too_large_grouping_years:
@ -639,29 +638,43 @@ if __name__ == "__main__":
) )
if options["heating"]: if options["heating"]:
time_dep_hp_cop = options["time_dep_hp_cop"]
ashp_cop = (
xr.open_dataarray(snakemake.input.cop_air_total)
.to_pandas()
.reindex(index=n.snapshots)
)
gshp_cop = (
xr.open_dataarray(snakemake.input.cop_soil_total)
.to_pandas()
.reindex(index=n.snapshots)
)
default_lifetime = snakemake.params.existing_capacities[
"default_heating_lifetime"
]
add_heating_capacities_installed_before_baseyear( add_heating_capacities_installed_before_baseyear(
n, n=n,
baseyear, baseyear=baseyear,
grouping_years_heat, grouping_years=grouping_years_heat,
ashp_cop, cop={
gshp_cop, "air decentral": xr.open_dataarray(
time_dep_hp_cop, snakemake.input.cop_air_decentral_heating
costs, )
default_lifetime, .to_pandas()
.reindex(index=n.snapshots),
"ground decentral": xr.open_dataarray(
snakemake.input.cop_soil_decentral_heating
)
.to_pandas()
.reindex(index=n.snapshots),
"air central": xr.open_dataarray(
snakemake.input.cop_air_central_heating
)
.to_pandas()
.reindex(index=n.snapshots),
"ground central": xr.open_dataarray(
snakemake.input.cop_soil_central_heating
)
.to_pandas()
.reindex(index=n.snapshots),
},
time_dep_hp_cop=options["time_dep_hp_cop"],
costs=costs,
default_lifetime=snakemake.params.existing_capacities[
"default_heating_lifetime"
],
existing_heating=pd.read_csv(
snakemake.input.existing_heating_distribution,
header=[0, 1],
index_col=0,
),
) )
if options.get("cluster_heat_buses", False): if options.get("cluster_heat_buses", False):