Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ def calc_cop(

if electrical_demand_kW:
# estimate the heat demand by using the median COP of the model fitting data
# this is only for heaving an initial value for the model call
heat_demand_kW = electrical_demand_kW * self._model["COP_med"]

heat_demand_kW = self._limit_heat_demand_kW(heat_demand_kW)
Expand Down
26 changes: 10 additions & 16 deletions src/gsy_e/models/strategy/energy_parameters/heatpump/heat_pump.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,12 @@ def update_cop_after_dis_charging(
bought_energy_kWh: float,
):
"""Update the COP of the heat pump in its state class."""
if bought_energy_kWh < FLOATING_POINT_TOLERANCE:
cop = self._hp_state.get_cop(last_time_slot)
else:
cop = self._calc_cop(
heat_energy_kJ=None,
source_temp_C=source_temp_C,
time_slot=last_time_slot,
electrical_energy_kWh=bought_energy_kWh,
)
cop = self._calc_cop(
heat_energy_kJ=None,
source_temp_C=source_temp_C,
time_slot=last_time_slot,
electrical_energy_kWh=bought_energy_kWh,
)

# Set the calculated COP on both the last and the current time slot to use in calculations
self._hp_state.set_cop(last_time_slot, cop)
Expand Down Expand Up @@ -686,13 +683,10 @@ def _update_cop_after_dis_charging(
bought_energy_kWh: float,
):
"""Update the COP of the heat pump in its state class."""
if bought_energy_kWh < FLOATING_POINT_TOLERANCE:
cop = self._state.get_cop(last_time_slot)
else:
cop = self._calc_cop(
time_slot=last_time_slot,
electrical_energy_kWh=bought_energy_kWh,
)
cop = self._calc_cop(
time_slot=last_time_slot,
electrical_energy_kWh=bought_energy_kWh,
)

# Set the calculated COP on both the last and the current time slot to use in calculations
self.state.set_cop(last_time_slot, cop)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,15 @@ def _limit_condenser_temp(self, condenser_temp_C: float) -> float:
self._params.min_temp_htf_C,
round(condenser_temp_C, 2),
)
return self._params.min_temp_htf_C
if (condenser_temp_C - self._params.max_temp_htf_C) > FLOATING_POINT_TOLERANCE:
log.warning(
"The PCM storage tank reached it's maximum (%s), charging "
"condensor temperature of %s is limited to the maximum",
self._params.max_temp_htf_C,
round(condenser_temp_C, 2),
)
return self._params.max_temp_htf_C
return condenser_temp_C

def increase_tank_temp_from_heat_energy(self, heat_energy_kWh: float, time_slot: DateTime):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_increase_tank_temp_from_heat_energy_correctly_updates_storage_temp_and_
assert pcm_tank._htf_temps_C[NEXT_MARKET_SLOT] == [40] * 5
assert pcm_tank._pcm_temps_C[NEXT_MARKET_SLOT] == [39] * 5
assert pcm_tank._soc.get(NEXT_MARKET_SLOT) == 0.6
assert pcm_tank._condenser_temp_C.get(NEXT_MARKET_SLOT) == 45
assert pcm_tank._condenser_temp_C.get(NEXT_MARKET_SLOT) == 42

def test_decrease_tank_temp_from_heat_energy_correctly_updates_storage_temp_and_soc(
self, pcm_tank
Expand Down
Loading