2023-03-06 08:27:45 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2024-02-19 15:21:48 +00:00
|
|
|
# SPDX-FileCopyrightText: : 2020-2024 The PyPSA-Eur Authors
|
2023-03-06 17:49:23 +00:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: MIT
|
2023-03-06 08:27:45 +00:00
|
|
|
"""
|
2023-03-09 11:45:43 +00:00
|
|
|
Build coefficient of performance (COP) time series for air- or ground-sourced
|
|
|
|
heat pumps.
|
|
|
|
|
2023-04-10 22:02:32 +00:00
|
|
|
The COP is a function of the temperature difference between source and
|
|
|
|
sink.
|
2023-03-09 11:45:43 +00:00
|
|
|
|
|
|
|
The quadratic regression used is based on Staffell et al. (2012)
|
|
|
|
https://doi.org/10.1039/C2EE22653G.
|
2023-03-06 08:27:45 +00:00
|
|
|
"""
|
2019-04-16 14:03:51 +00:00
|
|
|
|
|
|
|
import xarray as xr
|
2024-02-12 10:53:20 +00:00
|
|
|
from _helpers import set_scenario_config
|
2019-04-16 14:03:51 +00:00
|
|
|
|
|
|
|
|
2023-03-06 08:27:45 +00:00
|
|
|
def coefficient_of_performance(delta_T, source="air"):
|
|
|
|
if source == "air":
|
2021-07-01 18:09:04 +00:00
|
|
|
return 6.81 - 0.121 * delta_T + 0.000630 * delta_T**2
|
2023-03-06 08:27:45 +00:00
|
|
|
elif source == "soil":
|
2021-07-01 18:09:04 +00:00
|
|
|
return 8.77 - 0.150 * delta_T + 0.000734 * delta_T**2
|
|
|
|
else:
|
|
|
|
raise NotImplementedError("'source' must be one of ['air', 'soil']")
|
2019-04-16 14:03:51 +00:00
|
|
|
|
|
|
|
|
2023-03-06 08:27:45 +00:00
|
|
|
if __name__ == "__main__":
|
|
|
|
if "snakemake" not in globals():
|
2023-03-06 18:09:45 +00:00
|
|
|
from _helpers import mock_snakemake
|
2023-03-06 08:27:45 +00:00
|
|
|
|
2021-07-01 18:09:04 +00:00
|
|
|
snakemake = mock_snakemake(
|
2023-03-06 08:27:45 +00:00
|
|
|
"build_cop_profiles",
|
2023-04-29 16:49:49 +00:00
|
|
|
weather_year="",
|
2023-03-06 08:27:45 +00:00
|
|
|
simpl="",
|
2021-07-01 18:09:04 +00:00
|
|
|
clusters=48,
|
|
|
|
)
|
2019-04-16 14:03:51 +00:00
|
|
|
|
2024-02-12 10:53:20 +00:00
|
|
|
set_scenario_config(snakemake)
|
|
|
|
|
2021-07-01 18:09:04 +00:00
|
|
|
for area in ["total", "urban", "rural"]:
|
|
|
|
for source in ["air", "soil"]:
|
2023-03-06 08:27:45 +00:00
|
|
|
source_T = xr.open_dataarray(snakemake.input[f"temp_{source}_{area}"])
|
2019-04-16 14:03:51 +00:00
|
|
|
|
2023-06-15 16:52:25 +00:00
|
|
|
delta_T = snakemake.params.heat_pump_sink_T - source_T
|
2019-04-16 14:03:51 +00:00
|
|
|
|
2021-07-01 18:09:04 +00:00
|
|
|
cop = coefficient_of_performance(delta_T, source)
|
|
|
|
|
|
|
|
cop.to_netcdf(snakemake.output[f"cop_{source}_{area}"])
|