diff --git a/hub/exports/building_energy/idf.py b/hub/exports/building_energy/idf.py index 27f678fd..058a4e8d 100644 --- a/hub/exports/building_energy/idf.py +++ b/hub/exports/building_energy/idf.py @@ -150,7 +150,6 @@ class Idf: Solar_Absorptance=layer.material.solar_absorptance, Visible_Absorptance=layer.material.visible_absorptance ) - @staticmethod def _create_infiltration_schedules(thermal_zone): _infiltration_schedules = [] @@ -177,6 +176,21 @@ class Idf: _infiltration_schedules.append(_schedule) return _infiltration_schedules + @staticmethod + def _create_ventilation_schedules(thermal_zone): + _ventilation_schedules = [] + if thermal_zone.thermal_control is None: + return [] + for hvac_availability_schedule in thermal_zone.thermal_control.hvac_availability_schedules: + _schedule = Schedule() + _schedule.type = cte.VENTILATION + _schedule.data_type = cte.FRACTION + _schedule.time_step = cte.HOUR + _schedule.time_range = cte.DAY + _schedule.day_types = copy.deepcopy(hvac_availability_schedule.day_types) + _ventilation_schedules = thermal_zone.thermal_control.hvac_availability_schedules + return _ventilation_schedules + @staticmethod def _create_yearly_values_schedules(schedule_type, values): _schedule = Schedule() @@ -279,7 +293,8 @@ class Idf: def _add_construction(self, thermal_boundary): for construction in self._idf.idfobjects[self._CONSTRUCTION]: if thermal_boundary.parent_surface.vegetation is not None: - if construction.Name == f'{thermal_boundary.construction_name}_{thermal_boundary.parent_surface.vegetation.name}': + if construction.Name == f'{thermal_boundary.construction_name}_' \ + f'{thermal_boundary.parent_surface.vegetation.name}': return else: if construction.Name == thermal_boundary.construction_name: @@ -335,8 +350,10 @@ class Idf: return thermostat return self._idf.newidfobject(self._THERMOSTAT, Name=thermostat_name, - Heating_Setpoint_Schedule_Name=f'Heating thermostat schedules {thermal_zone.usage_name}', - Cooling_Setpoint_Schedule_Name=f'Cooling thermostat schedules {thermal_zone.usage_name}') + Heating_Setpoint_Schedule_Name= + f'Heating thermostat schedules {thermal_zone.usage_name}', + Cooling_Setpoint_Schedule_Name= + f'Cooling thermostat schedules {thermal_zone.usage_name}') def _add_heating_system(self, thermal_zone, zone_name): for air_system in self._idf.idfobjects[self._IDEAL_LOAD_AIR_SYSTEM]: @@ -422,19 +439,19 @@ class Idf: ) def _add_ventilation(self, thermal_zone, zone_name): - # for zone in self._idf.idfobjects["ZONE"]: - # if zone.Name == f'{zone_name}_infiltration': - # return + for zone in self._idf.idfobjects["ZONE"]: + if zone.Name == f'{zone_name}_ventilation': + return schedule = f'Ventilation schedules {thermal_zone.usage_name}' - # if schedule not in self._idf.idfobjects[self._HOURLY_SCHEDULE]: - # return + if schedule not in self._idf.idfobjects[self._HOURLY_SCHEDULE]: + return # todo: revise ventilation with Pilar self._idf.newidfobject(self._VENTILATION, Name=f'{zone_name}_ventilation', Zone_or_ZoneList_Name=zone_name, Schedule_Name=schedule, - Design_Flow_Rate_Calculation_Method='Flow/Zone', - Flow_Rate_per_Zone_Floor_Area=thermal_zone.infiltration_rate_system_off + Design_Flow_Rate_Calculation_Method='AirChanges/Hour', + Flow_Rate_per_Zone_Floor_Area=thermal_zone.mechanical_air_change ) def _add_dhw(self, thermal_zone, zone_name): @@ -493,6 +510,8 @@ class Idf: if building.name in self._target_buildings or building.name in self._adjacent_buildings: _new_schedules = self._create_infiltration_schedules(thermal_zone) self._add_schedules(usage, 'Infiltration', _new_schedules) + _new_schedules2 = self._create_ventilation_schedules(thermal_zone) + self._add_schedules(usage, 'Ventilation', _new_schedules2) self._add_schedules(usage, 'Occupancy', thermal_zone.occupancy.occupancy_schedules) self._add_schedules(usage, 'HVAC AVAIL', thermal_zone.thermal_control.hvac_availability_schedules) self._add_schedules(usage, 'Heating thermostat', thermal_zone.thermal_control.heating_set_point_schedules) @@ -654,7 +673,7 @@ class Idf: outside_boundary_condition = 'Ground' sun_exposure = 'NoSun' wind_exposure = 'NoWind' - if boundary.parent_surface.percentage_shared is not None and boundary.parent_surface.percentage_shared >= 0.5: + if boundary.parent_surface.percentage_shared is not None and boundary.parent_surface.percentage_shared > 0.5: outside_boundary_condition = 'Surface' outside_boundary_condition_object = boundary.parent_surface.name sun_exposure = 'NoSun' diff --git a/hub/helpers/constants.py b/hub/helpers/constants.py index 90690979..c4a933aa 100644 --- a/hub/helpers/constants.py +++ b/hub/helpers/constants.py @@ -158,6 +158,7 @@ OCCUPANCY = 'Occupancy' APPLIANCES = 'Appliances' HVAC_AVAILABILITY = 'HVAC Avail' INFILTRATION = 'Infiltration' +VENTILATION = 'Ventilation' COOLING_SET_POINT = 'ClgSetPt' HEATING_SET_POINT = 'HtgSetPt' EQUIPMENT = 'Equipment'