diff --git a/src/gsy_e/models/strategy/energy_parameters/heatpump/cop_models/cop_models.py b/src/gsy_e/models/strategy/energy_parameters/heatpump/cop_models/cop_models.py index 0b5f8f3c2..8f518cb9a 100644 --- a/src/gsy_e/models/strategy/energy_parameters/heatpump/cop_models/cop_models.py +++ b/src/gsy_e/models/strategy/energy_parameters/heatpump/cop_models/cop_models.py @@ -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) diff --git a/src/gsy_e/models/strategy/energy_parameters/heatpump/heat_pump.py b/src/gsy_e/models/strategy/energy_parameters/heatpump/heat_pump.py index 860dfb913..a7f0fdc93 100644 --- a/src/gsy_e/models/strategy/energy_parameters/heatpump/heat_pump.py +++ b/src/gsy_e/models/strategy/energy_parameters/heatpump/heat_pump.py @@ -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) @@ -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) diff --git a/src/gsy_e/models/strategy/state/heatpump_tank_states/pcm_tank_state.py b/src/gsy_e/models/strategy/state/heatpump_tank_states/pcm_tank_state.py index 874972e56..82f8071f1 100644 --- a/src/gsy_e/models/strategy/state/heatpump_tank_states/pcm_tank_state.py +++ b/src/gsy_e/models/strategy/state/heatpump_tank_states/pcm_tank_state.py @@ -141,6 +141,7 @@ 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 " @@ -148,6 +149,7 @@ def _limit_condenser_temp(self, condenser_temp_C: float) -> float: 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): diff --git a/tests/strategies/state/heatpump_tank_states/test_pcm_tank_state.py b/tests/strategies/state/heatpump_tank_states/test_pcm_tank_state.py index 721ec2da6..8ddc3036a 100644 --- a/tests/strategies/state/heatpump_tank_states/test_pcm_tank_state.py +++ b/tests/strategies/state/heatpump_tank_states/test_pcm_tank_state.py @@ -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