@@ -47,8 +47,12 @@ def __init__(self,
4747 self ._cop_dhw = None
4848 self ._results = None
4949 self ._results_fixed = (0 , 17 )
50- self .exclude_DHW_from_peak : bool = False # by default, the DHW increase the peak load. Set to false,
50+
51+ # False by default, the DHW increase the peak load. Set to false,
5152 # if you only want the heating load to determine the peak in extraction
53+ self .exclude_DHW_from_peak : bool = False
54+
55+ self ._limit_to_max_heat_pump_power : bool = False
5256
5357 # set variables
5458 self .cop = efficiency_heating
@@ -398,7 +402,7 @@ def _get_monthly_cop(self, peak: bool, power: np.ndarray = None) -> Union[float,
398402 elif peak :
399403 temperature = self .results .peak_extraction
400404 else :
401- temperature = self .results .monthly_extraction
405+ temperature = self .results .baseload_temperature
402406
403407 return self .cop .get_COP (temperature , power = np .nan_to_num (power ))
404408
@@ -424,7 +428,7 @@ def _get_monthly_cop_dhw(self, peak: bool, power: np.ndarray = None) -> Union[fl
424428 elif peak :
425429 temperature = self .results .peak_extraction
426430 else :
427- temperature = self .results .monthly_extraction
431+ temperature = self .results .baseload_temperature
428432
429433 return self .cop_dhw .get_COP (temperature , power = np .nan_to_num (power ))
430434
@@ -454,6 +458,63 @@ def _get_monthly_eer(self, peak: bool, power: np.ndarray = None) -> Union[float,
454458
455459 return self .eer .get_EER (temperature , power = np .nan_to_num (power ), month_indices = self .month_indices )
456460
461+ def _get_max_power_heating_monthly (self ) -> Union [float , np .ndarray ]:
462+ """
463+ This function returns the maximum power available in heating, taking into account the maximum power of the
464+ heat pump (when available). When the attribute '_limit_to_max_heat_pump_power' is False, the input array
465+ is simply returned.
466+
467+ Returns
468+ -------
469+ maximum heating power : float | np.ndarray
470+ Array with the maximum heating power
471+ """
472+ if isinstance (self .cop , SCOP ):
473+ return self .monthly_peak_heating_simulation_period
474+ if isinstance (self .results , tuple ):
475+ temperature = self .results [1 ]
476+ else :
477+ temperature = self .results .Tf
478+ return np .minimum (self .monthly_peak_heating_simulation_period , self .cop ._get_max_power (temperature ))
479+
480+ def _get_max_power_dhw_monthly (self ) -> Union [float , np .ndarray ]:
481+ """
482+ This function returns the maximum power available in dhw, taking into account the maximum power of the
483+ heat pump (when available). When the attribute '_limit_to_max_heat_pump_power' is False, the input array
484+ is simply returned.
485+
486+ Returns
487+ -------
488+ maximum dhw power : float | np.ndarray
489+ Array with the maximum dhw power
490+ """
491+ if isinstance (self .cop_dhw , SCOP ):
492+ return self .monthly_peak_dhw_simulation_period
493+ if isinstance (self .results , tuple ):
494+ temperature = self .results [1 ]
495+ else :
496+ temperature = self .results .Tf
497+ return np .minimum (self .monthly_peak_dhw_simulation_period , self .cop_dhw ._get_max_power (temperature ))
498+
499+ def _get_max_power_cooling_monthly (self ) -> Union [float , np .ndarray ]:
500+ """
501+ This function returns the maximum power available in cooling, taking into account the maximum power of the
502+ heat pump (when available). When the attribute '_limit_to_max_heat_pump_power' is False, the input array
503+ is simply returned.
504+
505+ Returns
506+ -------
507+ maximum cooling power : float | np.ndarray
508+ Array with the maximum cooling power
509+ """
510+ if isinstance (self .eer , SEER ):
511+ return self .monthly_peak_cooling_simulation_period
512+ if isinstance (self .results , tuple ):
513+ temperature = self .results [1 ]
514+ else :
515+ temperature = self .results .Tf
516+ return np .minimum (self .monthly_peak_cooling_simulation_period , self .eer ._get_max_power (temperature , month_indices = self .month_indices ))
517+
457518 @staticmethod
458519 def conversion_factor_secondary_to_primary_heating (cop_value : Union [int , float , np .ndarray ]) -> Union [
459520 float , np .ndarray ]:
@@ -560,6 +621,10 @@ def monthly_peak_injection_simulation_period(self) -> np.ndarray:
560621 Peak injection for the whole simulation period
561622 """
562623 part_load = self .monthly_peak_cooling_simulation_period
624+ if self ._limit_to_max_heat_pump_power :
625+ return np .multiply (
626+ self ._get_max_power_cooling_monthly (),
627+ self .conversion_factor_secondary_to_primary_cooling (self ._get_monthly_eer (True ,part_load )))
563628 return np .multiply (
564629 self .monthly_peak_cooling_simulation_period ,
565630 self .conversion_factor_secondary_to_primary_cooling (self ._get_monthly_eer (True , part_load )))
@@ -591,6 +656,10 @@ def _monthly_peak_extraction_heating_simulation_period(self) -> np.ndarray:
591656 Peak extraction for the whole simulation period
592657 """
593658 part_load = self .monthly_peak_heating_simulation_period
659+ if self ._limit_to_max_heat_pump_power :
660+ return np .multiply (
661+ self ._get_max_power_heating_monthly (),
662+ self .conversion_factor_secondary_to_primary_heating (self ._get_monthly_cop (True ,part_load )))
594663 return np .multiply (
595664 self .monthly_peak_heating_simulation_period ,
596665 self .conversion_factor_secondary_to_primary_heating (self ._get_monthly_cop (True , part_load )))
@@ -606,6 +675,10 @@ def _monthly_peak_extraction_dhw_simulation_period(self) -> np.ndarray:
606675 Peak extraction for the whole simulation period
607676 """
608677 part_load_dhw = self .monthly_peak_dhw_simulation_period
678+ if self ._limit_to_max_heat_pump_power :
679+ return np .multiply (
680+ self ._get_max_power_dhw_monthly (),
681+ self .conversion_factor_secondary_to_primary_heating (self ._get_monthly_cop_dhw (True ,part_load_dhw )))
609682 return np .multiply (
610683 self .monthly_peak_dhw_simulation_period ,
611684 self .conversion_factor_secondary_to_primary_heating (self ._get_monthly_cop_dhw (True , part_load_dhw )))
0 commit comments