[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
b720bd9eca
commit
8d6feb6a66
@ -160,4 +160,4 @@ enhanced_geothermal,,,
|
|||||||
#NAME?,--,int,The maximum hours the reservoir can be charged under flexible operation
|
#NAME?,--,int,The maximum hours the reservoir can be charged under flexible operation
|
||||||
#NAME?,--,float,The maximum boost in power output under flexible operation
|
#NAME?,--,float,The maximum boost in power output under flexible operation
|
||||||
#NAME?,--,"{true, false}",Add option for variable capacity factor (see Ricks et al. 2024)
|
#NAME?,--,"{true, false}",Add option for variable capacity factor (see Ricks et al. 2024)
|
||||||
#NAME?,--,float,Share of sourced heat that is replenished by the earth's core (see details in `build_egs_potentials.py <https://github.com/PyPSA/pypsa-eur-sec/blob/master/scripts/build_egs_potentials.py>`_)
|
#NAME?,--,float,Share of sourced heat that is replenished by the earth's core (see details in `build_egs_potentials.py <https://github.com/PyPSA/pypsa-eur-sec/blob/master/scripts/build_egs_potentials.py>`_)
|
||||||
|
|
@ -1,32 +1,39 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from typing import Union
|
from typing import Union
|
||||||
import xarray as xr
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import xarray as xr
|
||||||
|
|
||||||
|
|
||||||
class BaseCopApproximator(ABC):
|
class BaseCopApproximator(ABC):
|
||||||
"""
|
"""
|
||||||
Abstract class for approximating the coefficient of performance (COP) of a heat pump."""
|
Abstract class for approximating the coefficient of performance (COP) of a
|
||||||
def __init__(
|
heat pump.
|
||||||
self,
|
"""
|
||||||
forward_temperature_celsius: Union[xr.DataArray, np.array],
|
|
||||||
source_inlet_temperature_celsius: Union[xr.DataArray, np.array],
|
def __init__(
|
||||||
):
|
self,
|
||||||
"""
|
forward_temperature_celsius: Union[xr.DataArray, np.array],
|
||||||
Initialize CopApproximator.
|
source_inlet_temperature_celsius: Union[xr.DataArray, np.array],
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
Initialize CopApproximator.
|
||||||
|
|
||||||
|
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.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
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.
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def approximate_cop(self) -> Union[xr.DataArray, np.array]:
|
def approximate_cop(self) -> Union[xr.DataArray, np.array]:
|
||||||
"""Approximate heat pump coefficient of performance (COP).
|
"""
|
||||||
|
Approximate heat pump coefficient of performance (COP).
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
-------
|
-------
|
||||||
@ -34,28 +41,39 @@ class BaseCopApproximator(ABC):
|
|||||||
The calculated COP values.
|
The calculated COP values.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def celsius_to_kelvin(t_celsius: Union[float, xr.DataArray, np.array]) -> Union[float, xr.DataArray, np.array]:
|
def celsius_to_kelvin(
|
||||||
|
t_celsius: Union[float, xr.DataArray, np.array]
|
||||||
|
) -> Union[float, xr.DataArray, np.array]:
|
||||||
if (np.asarray(t_celsius) > 200).any():
|
if (np.asarray(t_celsius) > 200).any():
|
||||||
raise ValueError("t_celsius > 200. Are you sure you are using the right units?")
|
raise ValueError(
|
||||||
|
"t_celsius > 200. Are you sure you are using the right units?"
|
||||||
|
)
|
||||||
return t_celsius + 273.15
|
return t_celsius + 273.15
|
||||||
|
|
||||||
|
def logarithmic_mean(
|
||||||
def logarithmic_mean(t_hot: Union[float, xr.DataArray, np.ndarray], t_cold: Union[float, xr.DataArray, np.ndarray]) -> Union[float, xr.DataArray, np.ndarray]:
|
t_hot: Union[float, xr.DataArray, np.ndarray],
|
||||||
|
t_cold: Union[float, xr.DataArray, np.ndarray],
|
||||||
|
) -> Union[float, xr.DataArray, np.ndarray]:
|
||||||
if (np.asarray(t_hot <= t_cold)).any():
|
if (np.asarray(t_hot <= t_cold)).any():
|
||||||
raise ValueError("t_hot must be greater than t_cold")
|
raise ValueError("t_hot must be greater than t_cold")
|
||||||
return (t_hot - t_cold) / np.log(t_hot / t_cold)
|
return (t_hot - t_cold) / np.log(t_hot / t_cold)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def celsius_to_kelvin(t_celsius: Union[float, xr.DataArray, np.array]) -> Union[float, xr.DataArray, np.array]:
|
def celsius_to_kelvin(
|
||||||
|
t_celsius: Union[float, xr.DataArray, np.array]
|
||||||
|
) -> Union[float, xr.DataArray, np.array]:
|
||||||
if (np.asarray(t_celsius) > 200).any():
|
if (np.asarray(t_celsius) > 200).any():
|
||||||
raise ValueError("t_celsius > 200. Are you sure you are using the right units?")
|
raise ValueError(
|
||||||
|
"t_celsius > 200. Are you sure you are using the right units?"
|
||||||
|
)
|
||||||
return t_celsius + 273.15
|
return t_celsius + 273.15
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def logarithmic_mean(t_hot: Union[float, xr.DataArray, np.ndarray], t_cold: Union[float, xr.DataArray, np.ndarray]) -> Union[float, xr.DataArray, np.ndarray]:
|
def logarithmic_mean(
|
||||||
|
t_hot: Union[float, xr.DataArray, np.ndarray],
|
||||||
|
t_cold: Union[float, xr.DataArray, np.ndarray],
|
||||||
|
) -> Union[float, xr.DataArray, np.ndarray]:
|
||||||
if (np.asarray(t_hot <= t_cold)).any():
|
if (np.asarray(t_hot <= t_cold)).any():
|
||||||
raise ValueError("t_hot must be greater than t_cold")
|
raise ValueError("t_hot must be greater than t_cold")
|
||||||
return (t_hot - t_cold) / np.log(t_hot / t_cold)
|
return (t_hot - t_cold) / np.log(t_hot / t_cold)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,16 +1,21 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
import xarray as xr
|
|
||||||
import numpy as np
|
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
import xarray as xr
|
||||||
from BaseCopApproximator import BaseCopApproximator
|
from BaseCopApproximator import BaseCopApproximator
|
||||||
|
|
||||||
|
|
||||||
class CentralHeatingCopApproximator(BaseCopApproximator):
|
class CentralHeatingCopApproximator(BaseCopApproximator):
|
||||||
"""
|
"""
|
||||||
Approximate the coefficient of performance (COP) for a heat pump in a central heating system (district heating).
|
Approximate the coefficient of performance (COP) for a heat pump in a
|
||||||
|
central heating system (district heating).
|
||||||
Uses an approximation method proposed by Jensen et al. (2018) and default parameters from Pieper et al. (2020).
|
|
||||||
The method is based on a thermodynamic heat pump model with some hard-to-know parameters being approximated.
|
Uses an approximation method proposed by Jensen et al. (2018) and
|
||||||
|
default parameters from Pieper et al. (2020). The method is based on
|
||||||
|
a thermodynamic heat pump model with some hard-to-know parameters
|
||||||
|
being approximated.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
@ -42,11 +47,19 @@ class CentralHeatingCopApproximator(BaseCopApproximator):
|
|||||||
heat_loss : float, optional
|
heat_loss : float, optional
|
||||||
The heat loss, by default 0.0.
|
The heat loss, by default 0.0.
|
||||||
"""
|
"""
|
||||||
self.t_source_in_kelvin = BaseCopApproximator.celsius_to_kelvin(source_inlet_temperature_celsius)
|
self.t_source_in_kelvin = BaseCopApproximator.celsius_to_kelvin(
|
||||||
self.t_sink_out_kelvin = BaseCopApproximator.celsius_to_kelvin(forward_temperature_celsius)
|
source_inlet_temperature_celsius
|
||||||
|
)
|
||||||
|
self.t_sink_out_kelvin = BaseCopApproximator.celsius_to_kelvin(
|
||||||
|
forward_temperature_celsius
|
||||||
|
)
|
||||||
|
|
||||||
self.t_sink_in_kelvin = BaseCopApproximator.celsius_to_kelvin(return_temperature_celsius)
|
self.t_sink_in_kelvin = BaseCopApproximator.celsius_to_kelvin(
|
||||||
self.t_source_out = BaseCopApproximator.celsius_to_kelvin(source_outlet_temperature_celsius)
|
return_temperature_celsius
|
||||||
|
)
|
||||||
|
self.t_source_out = BaseCopApproximator.celsius_to_kelvin(
|
||||||
|
source_outlet_temperature_celsius
|
||||||
|
)
|
||||||
|
|
||||||
self.isentropic_efficiency_compressor_kelvin = isentropic_compressor_efficiency
|
self.isentropic_efficiency_compressor_kelvin = isentropic_compressor_efficiency
|
||||||
self.heat_loss = heat_loss
|
self.heat_loss = heat_loss
|
||||||
@ -87,14 +100,17 @@ class CentralHeatingCopApproximator(BaseCopApproximator):
|
|||||||
@property
|
@property
|
||||||
def t_sink_mean_kelvin(self) -> Union[xr.DataArray, np.array]:
|
def t_sink_mean_kelvin(self) -> Union[xr.DataArray, np.array]:
|
||||||
"""
|
"""
|
||||||
Calculate the logarithmic mean temperature difference between the cold and hot sinks.
|
Calculate the logarithmic mean temperature difference between the cold
|
||||||
|
and hot sinks.
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
Union[xr.DataArray, np.array]
|
Union[xr.DataArray, np.array]
|
||||||
The mean temperature difference.
|
The mean temperature difference.
|
||||||
"""
|
"""
|
||||||
return BaseCopApproximator.logarithmic_mean(t_cold=self.t_sink_in_kelvin, t_hot=self.t_sink_out_kelvin)
|
return BaseCopApproximator.logarithmic_mean(
|
||||||
|
t_cold=self.t_sink_in_kelvin, t_hot=self.t_sink_out_kelvin
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def t_source_mean_kelvin(self) -> Union[xr.DataArray, np.array]:
|
def t_source_mean_kelvin(self) -> Union[xr.DataArray, np.array]:
|
||||||
@ -106,12 +122,15 @@ class CentralHeatingCopApproximator(BaseCopApproximator):
|
|||||||
Union[xr.DataArray, np.array]
|
Union[xr.DataArray, np.array]
|
||||||
The mean temperature of the heat source.
|
The mean temperature of the heat source.
|
||||||
"""
|
"""
|
||||||
return BaseCopApproximator.logarithmic_mean(t_hot=self.t_source_in_kelvin, t_cold=self.t_source_out)
|
return BaseCopApproximator.logarithmic_mean(
|
||||||
|
t_hot=self.t_source_in_kelvin, t_cold=self.t_source_out
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def delta_t_lift(self) -> Union[xr.DataArray, np.array]:
|
def delta_t_lift(self) -> Union[xr.DataArray, np.array]:
|
||||||
"""
|
"""
|
||||||
Calculate the temperature lift as the difference between the logarithmic sink and source temperatures.
|
Calculate the temperature lift as the difference between the
|
||||||
|
logarithmic sink and source temperatures.
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
@ -132,14 +151,14 @@ class CentralHeatingCopApproximator(BaseCopApproximator):
|
|||||||
-------
|
-------
|
||||||
np.array
|
np.array
|
||||||
The ideal Lorenz COP.
|
The ideal Lorenz COP.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self.t_sink_mean_kelvin / self.delta_t_lift
|
return self.t_sink_mean_kelvin / self.delta_t_lift
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def delta_t_refrigerant_source(self) -> Union[xr.DataArray, np.array]:
|
def delta_t_refrigerant_source(self) -> Union[xr.DataArray, np.array]:
|
||||||
"""
|
"""
|
||||||
Calculate the temperature difference between the refrigerant source inlet and outlet.
|
Calculate the temperature difference between the refrigerant source
|
||||||
|
inlet and outlet.
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
@ -153,7 +172,8 @@ class CentralHeatingCopApproximator(BaseCopApproximator):
|
|||||||
@property
|
@property
|
||||||
def delta_t_refrigerant_sink(self) -> Union[xr.DataArray, np.array]:
|
def delta_t_refrigerant_sink(self) -> Union[xr.DataArray, np.array]:
|
||||||
"""
|
"""
|
||||||
Temperature difference between the refrigerant and the sink based on approximation.
|
Temperature difference between the refrigerant and the sink based on
|
||||||
|
approximation.
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
@ -165,7 +185,8 @@ class CentralHeatingCopApproximator(BaseCopApproximator):
|
|||||||
@property
|
@property
|
||||||
def ratio_evaporation_compression_work(self) -> Union[xr.DataArray, np.array]:
|
def ratio_evaporation_compression_work(self) -> Union[xr.DataArray, np.array]:
|
||||||
"""
|
"""
|
||||||
Calculate the ratio of evaporation to compression work based on approximation.
|
Calculate the ratio of evaporation to compression work based on
|
||||||
|
approximation.
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
@ -173,7 +194,7 @@ class CentralHeatingCopApproximator(BaseCopApproximator):
|
|||||||
The calculated ratio of evaporation to compression work.
|
The calculated ratio of evaporation to compression work.
|
||||||
"""
|
"""
|
||||||
return self._ratio_evaporation_compression_work_approximation()
|
return self._ratio_evaporation_compression_work_approximation()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def delta_t_sink(self) -> Union[xr.DataArray, np.array]:
|
def delta_t_sink(self) -> Union[xr.DataArray, np.array]:
|
||||||
"""
|
"""
|
||||||
@ -190,7 +211,8 @@ class CentralHeatingCopApproximator(BaseCopApproximator):
|
|||||||
self, delta_t_source: Union[xr.DataArray, np.array]
|
self, delta_t_source: Union[xr.DataArray, np.array]
|
||||||
) -> Union[xr.DataArray, np.array]:
|
) -> Union[xr.DataArray, np.array]:
|
||||||
"""
|
"""
|
||||||
Approximates the temperature difference between the refrigerant and the source.
|
Approximates the temperature difference between the refrigerant and the
|
||||||
|
source.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
@ -212,7 +234,8 @@ class CentralHeatingCopApproximator(BaseCopApproximator):
|
|||||||
c: float = {"ammonia": 0.016, "isobutane": 2.4},
|
c: float = {"ammonia": 0.016, "isobutane": 2.4},
|
||||||
) -> Union[xr.DataArray, np.array]:
|
) -> Union[xr.DataArray, np.array]:
|
||||||
"""
|
"""
|
||||||
Approximates the temperature difference between the refrigerant and heat sink.
|
Approximates the temperature difference between the refrigerant and
|
||||||
|
heat sink.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
----------
|
----------
|
||||||
@ -236,7 +259,6 @@ class CentralHeatingCopApproximator(BaseCopApproximator):
|
|||||||
|
|
||||||
The approximate temperature difference at the refrigerant sink is calculated using the following formula:
|
The approximate temperature difference at the refrigerant sink is calculated using the following formula:
|
||||||
a * (t_sink_out - t_source_out + 2 * delta_t_pinch) + b * delta_t_sink + c
|
a * (t_sink_out - t_source_out + 2 * delta_t_pinch) + b * delta_t_sink + c
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if refrigerant not in a.keys():
|
if refrigerant not in a.keys():
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
@ -292,4 +314,3 @@ class CentralHeatingCopApproximator(BaseCopApproximator):
|
|||||||
+ b[refrigerant] * self.delta_t_sink
|
+ b[refrigerant] * self.delta_t_sink
|
||||||
+ c[refrigerant]
|
+ c[refrigerant]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,16 +1,18 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
import xarray as xr
|
|
||||||
import numpy as np
|
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
import xarray as xr
|
||||||
from BaseCopApproximator import BaseCopApproximator
|
from BaseCopApproximator import BaseCopApproximator
|
||||||
|
|
||||||
|
|
||||||
class DecentralHeatingCopApproximator(BaseCopApproximator):
|
class DecentralHeatingCopApproximator(BaseCopApproximator):
|
||||||
"""
|
"""
|
||||||
Approximate the coefficient of performance (COP) for a heat pump in a decentral heating system (individual/household heating).
|
Approximate the coefficient of performance (COP) for a heat pump in a
|
||||||
|
decentral heating system (individual/household heating).
|
||||||
|
|
||||||
Uses a quadratic regression on the temperature difference between the source and sink based on empirical data proposed by Staffell et al. 2012 .
|
Uses a quadratic regression on the temperature difference between the source and sink based on empirical data proposed by Staffell et al. 2012 .
|
||||||
|
|
||||||
References
|
References
|
||||||
@ -22,7 +24,7 @@ class DecentralHeatingCopApproximator(BaseCopApproximator):
|
|||||||
self,
|
self,
|
||||||
forward_temperature_celsius: Union[xr.DataArray, np.array],
|
forward_temperature_celsius: Union[xr.DataArray, np.array],
|
||||||
source_inlet_temperature_celsius: Union[xr.DataArray, np.array],
|
source_inlet_temperature_celsius: Union[xr.DataArray, np.array],
|
||||||
source_type: str
|
source_type: str,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Initialize the COPProfileBuilder object.
|
Initialize the COPProfileBuilder object.
|
||||||
@ -36,18 +38,20 @@ class DecentralHeatingCopApproximator(BaseCopApproximator):
|
|||||||
source: str
|
source: str
|
||||||
The source of the heat pump. Must be either 'air' or 'soil'
|
The source of the heat pump. Must be either 'air' or 'soil'
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.delta_t = forward_temperature_celsius - source_inlet_temperature_celsius
|
self.delta_t = forward_temperature_celsius - source_inlet_temperature_celsius
|
||||||
if source_type not in ["air", "soil"]:
|
if source_type not in ["air", "soil"]:
|
||||||
raise ValueError("'source' must be one of ['air', 'soil']")
|
raise ValueError("'source' must be one of ['air', 'soil']")
|
||||||
else:
|
else:
|
||||||
self.source_type = source_type
|
self.source_type = source_type
|
||||||
|
|
||||||
def approximate_cop(self) -> Union[xr.DataArray, np.array]:
|
def approximate_cop(self) -> Union[xr.DataArray, np.array]:
|
||||||
"""
|
"""
|
||||||
Compute output of quadratic regression for air-/ground-source heat pumps.
|
Compute output of quadratic regression for air-/ground-source heat
|
||||||
|
pumps.
|
||||||
Calls the appropriate method depending on `source`."""
|
|
||||||
|
Calls the appropriate method depending on `source`.
|
||||||
|
"""
|
||||||
if self.source_type == "air":
|
if self.source_type == "air":
|
||||||
return self._approximate_cop_air_source()
|
return self._approximate_cop_air_source()
|
||||||
elif self.source_type == "soil":
|
elif self.source_type == "soil":
|
||||||
@ -56,24 +60,25 @@ class DecentralHeatingCopApproximator(BaseCopApproximator):
|
|||||||
def _approximate_cop_air_source(self) -> Union[xr.DataArray, np.array]:
|
def _approximate_cop_air_source(self) -> Union[xr.DataArray, np.array]:
|
||||||
"""
|
"""
|
||||||
Evaluate quadratic regression for an air-sourced heat pump.
|
Evaluate quadratic regression for an air-sourced heat pump.
|
||||||
|
|
||||||
COP = 6.81 - 0.121 * delta_T + 0.000630 * delta_T^2
|
COP = 6.81 - 0.121 * delta_T + 0.000630 * delta_T^2
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
Union[xr.DataArray, np.array]
|
Union[xr.DataArray, np.array]
|
||||||
The calculated COP values."""
|
The calculated COP values.
|
||||||
|
"""
|
||||||
return 6.81 - 0.121 * self.delta_t + 0.000630 * self.delta_t**2
|
return 6.81 - 0.121 * self.delta_t + 0.000630 * self.delta_t**2
|
||||||
|
|
||||||
def _approximate_cop_ground_source(self) -> Union[xr.DataArray, np.array]:
|
def _approximate_cop_ground_source(self) -> Union[xr.DataArray, np.array]:
|
||||||
"""
|
"""
|
||||||
Evaluate quadratic regression for a ground-sourced heat pump.
|
Evaluate quadratic regression for a ground-sourced heat pump.
|
||||||
|
|
||||||
COP = 8.77 - 0.150 * delta_T + 0.000734 * delta_T^2
|
COP = 8.77 - 0.150 * delta_T + 0.000734 * delta_T^2
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
Union[xr.DataArray, np.array]
|
Union[xr.DataArray, np.array]
|
||||||
The calculated COP values."""
|
The calculated COP values.
|
||||||
|
"""
|
||||||
return 8.77 - 0.150 * self.delta_t + 0.000734 * self.delta_t**2
|
return 8.77 - 0.150 * self.delta_t + 0.000734 * self.delta_t**2
|
||||||
|
|
@ -1,10 +1,11 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
import xarray as xr
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import xarray as xr
|
||||||
|
from _helpers import set_scenario_config
|
||||||
from CentralHeatingCopApproximator import CentralHeatingCopApproximator
|
from CentralHeatingCopApproximator import CentralHeatingCopApproximator
|
||||||
from DecentralHeatingCopApproximator import DecentralHeatingCopApproximator
|
from DecentralHeatingCopApproximator import DecentralHeatingCopApproximator
|
||||||
from _helpers import set_scenario_config
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if "snakemake" not in globals():
|
if "snakemake" not in globals():
|
||||||
@ -19,24 +20,29 @@ if __name__ == "__main__":
|
|||||||
set_scenario_config(snakemake)
|
set_scenario_config(snakemake)
|
||||||
|
|
||||||
for source_type in ["air", "soil"]:
|
for source_type in ["air", "soil"]:
|
||||||
# source inlet temperature (air/soil) is based on weather data
|
# source inlet temperature (air/soil) is based on weather data
|
||||||
source_inlet_temperature_celsius = xr.open_dataarray(snakemake.input[f"temp_{source_type}_total"])
|
source_inlet_temperature_celsius = xr.open_dataarray(
|
||||||
|
snakemake.input[f"temp_{source_type}_total"]
|
||||||
|
)
|
||||||
|
|
||||||
# Approximate COP for decentral (individual) heating
|
# Approximate COP for decentral (individual) heating
|
||||||
cop_individual_heating = DecentralHeatingCopApproximator(
|
cop_individual_heating = 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=source_type
|
source_type=source_type,
|
||||||
).approximate_cop()
|
).approximate_cop()
|
||||||
cop_individual_heating.to_netcdf(snakemake.output[f"cop_{source_type}_decentral_heating"])
|
cop_individual_heating.to_netcdf(
|
||||||
|
snakemake.output[f"cop_{source_type}_decentral_heating"]
|
||||||
|
)
|
||||||
|
|
||||||
# Approximate COP for central (district) heating
|
# Approximate COP for central (district) heating
|
||||||
cop_central_heating = CentralHeatingCopApproximator(
|
cop_central_heating = 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,
|
||||||
source_inlet_temperature_celsius=source_inlet_temperature_celsius,
|
source_inlet_temperature_celsius=source_inlet_temperature_celsius,
|
||||||
source_outlet_temperature_celsius=source_inlet_temperature_celsius - snakemake.params.heat_source_cooling_central_heating,
|
source_outlet_temperature_celsius=source_inlet_temperature_celsius
|
||||||
|
- snakemake.params.heat_source_cooling_central_heating,
|
||||||
).approximate_cop()
|
).approximate_cop()
|
||||||
cop_central_heating.to_netcdf(snakemake.output[f"cop_{source_type}_central_heating"])
|
cop_central_heating.to_netcdf(
|
||||||
|
snakemake.output[f"cop_{source_type}_central_heating"]
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user