Example #1
0
    def __init__(
        self,
        bldg_type: BuildingTypeProtocol,
        base_data: BaseDataForVentilationProtocol,
        vent_rate_variability: bool,
        get_area_pp_for_room_method: Callable[[str], float],
    ):
        """
        :param bldg_type: Building type to generate the profile for, e.g. object of SIA2024BuildingType
        :param base_data: nominal values data store, e.g. SIA2024DataAccessor
        :param vent_rate_variability: True if variability should be added to the ventilation rate
        :param get_area_pp_for_room_method: method to get the area_per_person for a room
        """
        self.get_area_pp_for_room_method = get_area_pp_for_room_method
        self.base_data = base_data
        self.bldg_type = bldg_type

        self.vent_rate_variable_per_room_lookup_table = None
        if vent_rate_variability:
            self.__vent_rate_variable_per_room_lookup_table = ValuePerKeyCache(
                self.bldg_type.get_room_types(),
                self.__get_vent_rate_variable_for_room)
            self.__get_vent_rate_for_room_method = self.__vent_rate_variable_per_room_lookup_table.lookup_value
        else:
            self.__get_vent_rate_for_room_method = self.__calc_vent_rate_nom_for_room
    def __init__(
        self,
        bldg_type: BuildingTypeProtocol,
        base_data_accessor: BaseDataForDHWProtocol,
        dhw_variability: bool,
        get_year_profile_occupancy_hourly_per_room_method: Callable[
            [str], List[float]],
        nighttime_pattern_yearly_profile: List[bool],
    ):
        """
        :param bldg_type: type of building for which to generate profile, e.g. object of SIA2024BuildingType
        :param base_data_accessor: base data, e.g. SIA2024DataAccessor
        :param dhw_variability: True if variability should be added to dhw power/m2 value
        :param get_year_profile_occupancy_hourly_per_room_method: reference to method returning occupancy year profile defining hourly fraction [0...1] of full occupancy
        :param nighttime_pattern_yearly_profile: nighttime profile, to determine hours in which dhw should be turned off in case room is specified as such in excel input sheet
        """
        self.base_data = base_data_accessor
        self.bldg_type = bldg_type
        self._get_year_profile_occupancy_hourly_per_room_method = get_year_profile_occupancy_hourly_per_room_method
        self._nighttime_pattern_yearly_profile = nighttime_pattern_yearly_profile

        self.__dhw_var_per_room_cache = None
        if dhw_variability:
            self.__dhw_var_per_room_cache = ValuePerKeyCache(
                self.bldg_type.get_room_types(),
                self.__get_dhw_demand_variable_for_room)
            self.__get_dhw_power_per_area_for_room_method = self.__dhw_var_per_room_cache.lookup_value
        else:
            self.__get_dhw_power_per_area_for_room_method = self.base_data.get_dhw_demand_std
 def activate_appliance_level_variability(self):
     """
     Activate variability for the appliance level value.
     For profile variability see activate_profile_variability()
     Appliance level per room type contained in current buidling type is calculated and cached for later use.
     :return: nothing
     """
     self.__app_level_var_per_room_cache = ValuePerKeyCache(
         self.bldg_type.get_room_types(),
         self.__gen_app_level_variable_for_room)
     self.__get_appliance_level_for_room_method = self.__app_level_var_per_room_cache.lookup_value
    def activate_lighting_setpoint_variability(self, variability_prc: float):
        """
        :param variability_prc: defines the percentage of the standard value to use for randomization,
                                e.g. if nominal setpoint is 50lux and variability_prc is 0.1 resulting variabilit range is 45...55 lux
        """
        assert variability_prc <= 1, "variability_prc must be percentage in range 0...1"

        def wrap_get_lighting_setpoint_var(room_type):
            return self.__get_lighting_setpoint_var_for_room(
                room_type, variability_prc)

        self.light_sp_var_per_room_cache = ValuePerKeyCache(
            self.bldg_type.get_room_types(), wrap_get_lighting_setpoint_var)
        self.__get_lighting_setpoint_for_room_method = self.light_sp_var_per_room_cache.lookup_value
Example #5
0
    def activate_infiltrat_rate_variability(self, variability_perc: float):
        """
        :param variability_perc: defines the percentage of the standard value to use for randomization, e.g. if infiltration rate standard is 0.3 m3/h/m2 and
                                 variability_prc is 0.2 the variability range is 0.24...0.36m3/h/m2
        :return: nothing
        """
        assert variability_perc <= 1, f"please provide variability_perc as percentage in range 0..1, {variability_perc} was given"

        def wrap_get_inf_rate(room_type):
            return self.__get_infiltration_rate_variable_for_room(
                room_type, variability_perc)

        self.__inf_rate_variable_per_room_cache = ValuePerKeyCache(
            self.bldg_type.get_room_types(), wrap_get_inf_rate)
        self.__get_infiltration_rate_for_room_method = self.__inf_rate_variable_per_room_cache.lookup_value
 def __init__(self, bldg_type: BuildingTypeProtocol, base_data_accessor,
              area_pp_variability: bool):
     """
     :param bldg_type: building type for which to calculate the area per person, e.g. SIA2024_2015_BuildingType
     :param base_data_accessor: object providing access to base data, e.g. SIA2024DataAccessor
     :param area_pp_variability:
     """
     self._logger = logging.getLogger(__name__)
     self.base_data = base_data_accessor
     self.bldg_type = bldg_type
     self.area_pp_per_room_variable_cache = None
     self.area_pp_for_room_method = self.base_data.get_area_per_person_std
     if area_pp_variability:
         self.area_pp_per_room_variable_cache = ValuePerKeyCache(
             self.bldg_type.get_room_types(),
             self.__calc_area_pp_var_for_room)
         self.area_pp_for_room_method = self.area_pp_per_room_variable_cache.lookup_value
    def activate_profile_variability(self, vertical_variability: float,
                                     do_horizontal_variability: bool):
        """
        Activates vertical and horizontal variability (shuffling within time-blocks) on hourly profile values.
        The time-blocks for horizontal shuffling are defined per room-type in the base_data.

        :param vertical_variability: sigma for vertical variability, set to 0 to deactivate
        :param do_horizontal_variability: whether horizontal variability should be applied or not.
        :return: nothing, profiles per room are generated and cached
        """
        assert vertical_variability <= 1 and vertical_variability >= 0

        def wrap_gen_occ_prof_variable(room_type):
            return self.__generate_occupancy_profile_variable_for_room(
                room_type, vertical_variability, do_horizontal_variability)

        self.__occupancy_profiles_variable_cache = ValuePerKeyCache(
            self.bldg_type.get_room_types(), wrap_gen_occ_prof_variable)
        self.get_occupancy_profile_for_room_method = self.__occupancy_profiles_variable_cache.lookup_value
    def activate_profile_variability(self, vertical_variability: float,
                                     do_horizontal_variability: bool):
        """
        Activate profile variability.
        To activate variability for the activity level value itself, see activate_appliance_level_variability.
        Timeblocks of day within which to shuffle profile values when horizontal variability is requested are looked up in the base_data data store.
        Profiles are generated per room_type contained in current building type and cached for later use.

        :param vertical_variability: sigma for randomization of each profile value; set to 0 to deactivate vertical variability
        :param do_horizontal_variability: pass True if you want horizontal variability/shuffling within timeblocks of a day
        :return: nothing
        """
        def wrap_get_profile_for_room(room_type):
            return self.__gen_app_prof_for_room_variable(
                room_type, vertical_variability, do_horizontal_variability)

        self.__app_prof_var_per_room_cache = ValuePerKeyCache(
            self.bldg_type.get_room_types(), wrap_get_profile_for_room)
        self.__get_appliance_profile_for_room_method = self.__app_prof_var_per_room_cache.lookup_value
    def __init__(
        self,
        bldg_type: BuildingTypeProtocol,
        base_data_accessor: BaseDataForDHWBasedOnLitersPerDayProtocol,
        dhw_variability: bool,
        nominal_hotwater_temperature: pint.Quantity,
        coldwater_tmeperature: pint.Quantity,
        get_year_profile_occupancy_hourly_per_room_method: Callable[
            [str], List[float]],
        nighttime_pattern_yearly_profile: List[bool],
        get_year_profile_variation_monthly_for_room_method: Callable[
            [str], Iterable[float]],
        ureg: pint.UnitRegistry,
    ):
        """
        :param bldg_type: type of building for which to generate profile, e.g. object of SIA2024BuildingType
        :param base_data_accessor: base data, e.g. SIA2024DataAccessor
        :param dhw_variability: True if variability should be added to dhw l/day/person value
        :param nominal_hotwater_temperature: required temperature for the domestic hotwater in degree Celsius
        :param coldwater_tmeperature: inlet temperature of the water for preparing domestic hot water
        :param get_year_profile_occupancy_hourly_per_room_method: reference to method returning occupancy year profile defining hourly fraction [0...1] of full occupancy
        :param nighttime_pattern_yearly_profile: nighttime profile, to determine hours in which dhw should be turned off in case room is specified as such in excel input sheet
        :param get_year_profile_variation_monthly_for_room_method: reference to method returning monthly variation profile, defining full or partial occupancy as used in the occupancy profile; needed to scale DHW demand value correctly;
        """
        self._logger = logging.getLogger(__name__)
        self._base_data = base_data_accessor
        self._bldg_type = bldg_type
        self._ureg = ureg

        self._delta_temperature = nominal_hotwater_temperature - coldwater_tmeperature
        self._get_year_profile_occupancy_hourly_per_room_method = get_year_profile_occupancy_hourly_per_room_method
        self._nighttime_pattern_yearly_profile = nighttime_pattern_yearly_profile
        self._get_year_profile_variation_monthly_for_room_method = get_year_profile_variation_monthly_for_room_method

        self.__dhw_var_liter_per_day_per_room_cache = None
        if dhw_variability:
            self.__dhw_var_liter_per_day_per_room_cache = ValuePerKeyCache(
                self._bldg_type.get_room_types(),
                self.__get_dhw_liter_per_day_demand_variable_for_room)
            self._get_dhw_demand_liter_per_day_per_person_for_room_method = self.__dhw_var_liter_per_day_per_room_cache.lookup_value
        else:
            self._get_dhw_demand_liter_per_day_per_person_for_room_method = self._base_data.get_dhw_demand_liter_per_day_pp_std
Example #10
0
    def __init__(self, bldg_type: BuildingTypeProtocol,
                 base_data: BaseDataForThermostatDemandProtocol,
                 setpoint_variability):
        """
        :param bldg_type: building type object for which to generate profile, e.g. object of SIA2024BuildingType
        :param base_data: base data, e.g. SIA2024DataAccessor
        :param setpoint_variability:
        """
        self.base_data = base_data
        self.bldg_type = bldg_type

        if setpoint_variability is not None:

            def wrap_get_setpoints(room_type):
                return self.__generate_setpoint_heating_cooling_variable(
                    room_type, setpoint_variability)

            self.__thermostat_setpoint_var_cache = ValuePerKeyCache(
                self.bldg_type.get_room_types(), wrap_get_setpoints)
            self.__get_thermostat_setpoints_method = self.__thermostat_setpoint_var_cache.lookup_value
        else:
            self.__get_thermostat_setpoints_method = self.__lookup_setpoint_heating_cooling_nominal
    def __init__(
        self,
        bldg_type: BuildingTypeProtocol,
        base_data: BaseDataForVariationMonthlyProtocol,
        vertical_variability: float,
    ):
        """
        :param bldg_type: building type for which to get monthly variation, e.g. object of SIA2024BuildingType
        :param base_data: base data, e.g. SIA2024ParametersFactory
        :param vertical_variability: value > 0 (and <1) for variability of monthly values, if 0 nominal values without variability are used
        """
        self.base_data = base_data

        if vertical_variability > 0:

            def wrap_get_monthly_var_prof(room_type):
                return self.__generate_monthly_variation_variable(
                    room_type, vertical_variability)

            self.monthly_variation_variable_per_room_cache = ValuePerKeyCache(
                bldg_type.get_room_types(), wrap_get_monthly_var_prof)
            self.__get_monthly_variation_per_room_method = self.monthly_variation_variable_per_room_cache.lookup_value
        else:
            self.__get_monthly_variation_per_room_method = self.base_data.get_monthly_variation
 def activate_lighting_density_variability(self):
     self.light_dens_var_per_room_cache = ValuePerKeyCache(
         self.bldg_type.get_room_types(),
         self.__get_lighting_density_var_for_room)
     self.__get_lighting_density_for_room_method = self.light_dens_var_per_room_cache.lookup_value