pypsa-eur/scripts/build_cop_profiles/DecentralHeatingCopApproximator.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

110 lines
3.8 KiB
Python
Raw Normal View History

# -*- 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
import numpy as np
import xarray as xr
2024-07-24 13:03:44 +00:00
from BaseCopApproximator import BaseCopApproximator
2024-07-24 13:03:44 +00:00
class DecentralHeatingCopApproximator(BaseCopApproximator):
"""
Approximate the coefficient of performance (COP) for a heat pump in a
decentral heating system (individual/household heating).
2024-07-31 15:01:27 +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.
Attributes
----------
forward_temperature_celsius : Union[xr.DataArray, np.array]
The forward temperature in Celsius.
source_inlet_temperature_celsius : Union[xr.DataArray, np.array]
The source inlet temperature in Celsius.
source_type : str
The source of the heat pump. Must be either 'air' or 'ground'.
Methods
-------
__init__(forward_temperature_celsius, source_inlet_temperature_celsius, source_type)
Initialize the DecentralHeatingCopApproximator object.
approximate_cop()
Compute the COP values using quadratic regression for air-/ground-source heat pumps.
_approximate_cop_air_source()
Evaluate quadratic regression for an air-sourced heat pump.
_approximate_cop_ground_source()
Evaluate quadratic regression for a ground-sourced heat pump.
2024-07-24 13:03:44 +00:00
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],
source_type: str,
2024-07-24 13:03:44 +00:00
):
"""
2024-07-31 15:01:27 +00:00
Initialize the DecentralHeatingCopApproximator object.
2024-07-24 13:03:44 +00:00
2024-07-31 15:01:27 +00:00
Parameters
2024-07-24 13:03:44 +00:00
----------
forward_temperature_celsius : Union[xr.DataArray, np.array]
The forward temperature in Celsius.
2024-07-31 15:01:27 +00:00
source_inlet_temperature_celsius : Union[xr.DataArray, np.array]
The source inlet temperature in Celsius.
source_type : str
The source of the heat pump. Must be either 'air' or 'ground'.
2024-07-24 13:03:44 +00:00
"""
2024-07-24 13:03:44 +00:00
self.delta_t = forward_temperature_celsius - source_inlet_temperature_celsius
if source_type not in ["air", "ground"]:
2024-07-31 15:01:27 +00:00
raise ValueError("'source_type' must be one of ['air', 'ground']")
2024-07-24 13:03:44 +00:00
else:
self.source_type = source_type
2024-07-24 13:03:44 +00:00
def approximate_cop(self) -> Union[xr.DataArray, np.array]:
"""
2024-07-31 15:01:27 +00:00
Compute the COP values using quadratic regression for air-/ground-source heat pumps.
2024-07-31 15:01:27 +00:00
Returns
-------
Union[xr.DataArray, np.array]
The calculated COP values.
"""
2024-07-24 13:03:44 +00:00
if self.source_type == "air":
return self._approximate_cop_air_source()
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 13:03:44 +00:00
COP = 6.81 - 0.121 * delta_T + 0.000630 * delta_T^2
2024-07-24 13:03:44 +00:00
Returns
-------
Union[xr.DataArray, np.array]
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 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 13:03:44 +00:00
COP = 8.77 - 0.150 * delta_T + 0.000734 * delta_T^2
2024-07-24 13:03:44 +00:00
Returns
-------
Union[xr.DataArray, np.array]
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