2024-07-24 15:04:58 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2024-07-25 13:10:45 +00:00
|
|
|
# SPDX-FileCopyrightText: : 2020-2024 The PyPSA-Eur Authors
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
|
2024-07-24 13:03:44 +00:00
|
|
|
|
|
|
|
from typing import Union
|
|
|
|
|
2024-07-24 15:04:58 +00:00
|
|
|
import numpy as np
|
|
|
|
import xarray as xr
|
2024-07-24 13:03:44 +00:00
|
|
|
from BaseCopApproximator import BaseCopApproximator
|
|
|
|
|
2024-07-24 15:04:58 +00:00
|
|
|
|
2024-07-24 13:03:44 +00:00
|
|
|
class DecentralHeatingCopApproximator(BaseCopApproximator):
|
|
|
|
"""
|
2024-07-24 15:04:58 +00:00
|
|
|
Approximate the coefficient of performance (COP) for a heat pump in a
|
|
|
|
decentral heating system (individual/household heating).
|
|
|
|
|
2024-07-24 13:03:44 +00:00
|
|
|
Uses a quadratic regression on the temperature difference between the source and sink based on empirical data proposed by Staffell et al. 2012 .
|
|
|
|
|
|
|
|
References
|
|
|
|
----------
|
|
|
|
[1] Staffell et al., Energy & Environmental Science 11 (2012): A review of domestic heat pumps, https://doi.org/10.1039/C2EE22653G.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
forward_temperature_celsius: Union[xr.DataArray, np.array],
|
|
|
|
source_inlet_temperature_celsius: Union[xr.DataArray, np.array],
|
2024-07-24 15:04:58 +00:00
|
|
|
source_type: str,
|
2024-07-24 13:03:44 +00:00
|
|
|
):
|
|
|
|
"""
|
|
|
|
Initialize the COPProfileBuilder object.
|
|
|
|
|
|
|
|
Parameters:
|
|
|
|
----------
|
|
|
|
forward_temperature_celsius : Union[xr.DataArray, np.array]
|
|
|
|
The forward temperature in Celsius.
|
|
|
|
return_temperature_celsius : Union[xr.DataArray, np.array]
|
|
|
|
The return temperature in Celsius.
|
|
|
|
source: str
|
2024-07-29 16:29:27 +00:00
|
|
|
The source of the heat pump. Must be either 'air' or 'ground'
|
2024-07-24 13:03:44 +00:00
|
|
|
"""
|
2024-07-24 15:04:58 +00:00
|
|
|
|
2024-07-24 13:03:44 +00:00
|
|
|
self.delta_t = forward_temperature_celsius - source_inlet_temperature_celsius
|
2024-07-29 16:29:27 +00:00
|
|
|
if source_type not in ["air", "ground"]:
|
|
|
|
raise ValueError("'source' must be one of ['air', 'ground']")
|
2024-07-24 13:03:44 +00:00
|
|
|
else:
|
|
|
|
self.source_type = source_type
|
2024-07-24 15:04:58 +00:00
|
|
|
|
2024-07-24 13:03:44 +00:00
|
|
|
def approximate_cop(self) -> Union[xr.DataArray, np.array]:
|
|
|
|
"""
|
2024-07-24 15:04:58 +00:00
|
|
|
Compute output of quadratic regression for air-/ground-source heat
|
|
|
|
pumps.
|
|
|
|
|
|
|
|
Calls the appropriate method depending on `source`.
|
|
|
|
"""
|
2024-07-24 13:03:44 +00:00
|
|
|
if self.source_type == "air":
|
|
|
|
return self._approximate_cop_air_source()
|
2024-07-29 16:29:27 +00:00
|
|
|
elif self.source_type == "ground":
|
2024-07-24 13:03:44 +00:00
|
|
|
return self._approximate_cop_ground_source()
|
|
|
|
|
|
|
|
def _approximate_cop_air_source(self) -> Union[xr.DataArray, np.array]:
|
|
|
|
"""
|
|
|
|
Evaluate quadratic regression for an air-sourced heat pump.
|
2024-07-24 15:04:58 +00:00
|
|
|
|
2024-07-24 13:03:44 +00:00
|
|
|
COP = 6.81 - 0.121 * delta_T + 0.000630 * delta_T^2
|
2024-07-24 15:04:58 +00:00
|
|
|
|
2024-07-24 13:03:44 +00:00
|
|
|
Returns
|
|
|
|
-------
|
|
|
|
Union[xr.DataArray, np.array]
|
2024-07-24 15:04:58 +00:00
|
|
|
The calculated COP values.
|
|
|
|
"""
|
2024-07-24 13:03:44 +00:00
|
|
|
return 6.81 - 0.121 * self.delta_t + 0.000630 * self.delta_t**2
|
2024-07-24 15:04:58 +00:00
|
|
|
|
2024-07-24 13:03:44 +00:00
|
|
|
def _approximate_cop_ground_source(self) -> Union[xr.DataArray, np.array]:
|
|
|
|
"""
|
|
|
|
Evaluate quadratic regression for a ground-sourced heat pump.
|
2024-07-24 15:04:58 +00:00
|
|
|
|
2024-07-24 13:03:44 +00:00
|
|
|
COP = 8.77 - 0.150 * delta_T + 0.000734 * delta_T^2
|
2024-07-24 15:04:58 +00:00
|
|
|
|
2024-07-24 13:03:44 +00:00
|
|
|
Returns
|
|
|
|
-------
|
|
|
|
Union[xr.DataArray, np.array]
|
2024-07-24 15:04:58 +00:00
|
|
|
The calculated COP values.
|
|
|
|
"""
|
2024-07-24 13:03:44 +00:00
|
|
|
return 8.77 - 0.150 * self.delta_t + 0.000734 * self.delta_t**2
|