Merge branch 'idf_lights' into systems_catalog

This commit is contained in:
Oriol Gavalda 2023-05-19 11:21:12 -04:00
commit 3680e0356f
3 changed files with 512 additions and 492 deletions

File diff suppressed because it is too large Load Diff

View File

@ -150,7 +150,6 @@ class Idf:
Solar_Absorptance=layer.material.solar_absorptance, Solar_Absorptance=layer.material.solar_absorptance,
Visible_Absorptance=layer.material.visible_absorptance Visible_Absorptance=layer.material.visible_absorptance
) )
@staticmethod @staticmethod
def _create_infiltration_schedules(thermal_zone): def _create_infiltration_schedules(thermal_zone):
_infiltration_schedules = [] _infiltration_schedules = []
@ -177,6 +176,21 @@ class Idf:
_infiltration_schedules.append(_schedule) _infiltration_schedules.append(_schedule)
return _infiltration_schedules 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 @staticmethod
def _create_yearly_values_schedules(schedule_type, values): def _create_yearly_values_schedules(schedule_type, values):
_schedule = Schedule() _schedule = Schedule()
@ -279,7 +293,8 @@ class Idf:
def _add_construction(self, thermal_boundary): def _add_construction(self, thermal_boundary):
for construction in self._idf.idfobjects[self._CONSTRUCTION]: for construction in self._idf.idfobjects[self._CONSTRUCTION]:
if thermal_boundary.parent_surface.vegetation is not None: 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 return
else: else:
if construction.Name == thermal_boundary.construction_name: if construction.Name == thermal_boundary.construction_name:
@ -335,8 +350,10 @@ class Idf:
return thermostat return thermostat
return self._idf.newidfobject(self._THERMOSTAT, return self._idf.newidfobject(self._THERMOSTAT,
Name=thermostat_name, Name=thermostat_name,
Heating_Setpoint_Schedule_Name=f'Heating thermostat schedules {thermal_zone.usage_name}', Heating_Setpoint_Schedule_Name=
Cooling_Setpoint_Schedule_Name=f'Cooling thermostat schedules {thermal_zone.usage_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): def _add_heating_system(self, thermal_zone, zone_name):
for air_system in self._idf.idfobjects[self._IDEAL_LOAD_AIR_SYSTEM]: 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): def _add_ventilation(self, thermal_zone, zone_name):
# for zone in self._idf.idfobjects["ZONE"]: for zone in self._idf.idfobjects["ZONE"]:
# if zone.Name == f'{zone_name}_infiltration': if zone.Name == f'{zone_name}_ventilation':
# return return
schedule = f'Ventilation schedules {thermal_zone.usage_name}' schedule = f'Ventilation schedules {thermal_zone.usage_name}'
# if schedule not in self._idf.idfobjects[self._HOURLY_SCHEDULE]: if schedule not in self._idf.idfobjects[self._HOURLY_SCHEDULE]:
# return return
# todo: revise ventilation with Pilar # todo: revise ventilation with Pilar
self._idf.newidfobject(self._VENTILATION, self._idf.newidfobject(self._VENTILATION,
Name=f'{zone_name}_ventilation', Name=f'{zone_name}_ventilation',
Zone_or_ZoneList_Name=zone_name, Zone_or_ZoneList_Name=zone_name,
Schedule_Name=schedule, Schedule_Name=schedule,
Design_Flow_Rate_Calculation_Method='Flow/Zone', Design_Flow_Rate_Calculation_Method='AirChanges/Hour',
Flow_Rate_per_Zone_Floor_Area=thermal_zone.infiltration_rate_system_off Flow_Rate_per_Zone_Floor_Area=thermal_zone.mechanical_air_change
) )
def _add_dhw(self, thermal_zone, zone_name): 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: if building.name in self._target_buildings or building.name in self._adjacent_buildings:
_new_schedules = self._create_infiltration_schedules(thermal_zone) _new_schedules = self._create_infiltration_schedules(thermal_zone)
self._add_schedules(usage, 'Infiltration', _new_schedules) 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, 'Occupancy', thermal_zone.occupancy.occupancy_schedules)
self._add_schedules(usage, 'HVAC AVAIL', thermal_zone.thermal_control.hvac_availability_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) self._add_schedules(usage, 'Heating thermostat', thermal_zone.thermal_control.heating_set_point_schedules)
@ -654,7 +673,7 @@ class Idf:
outside_boundary_condition = 'Ground' outside_boundary_condition = 'Ground'
sun_exposure = 'NoSun' sun_exposure = 'NoSun'
wind_exposure = 'NoWind' 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 = 'Surface'
outside_boundary_condition_object = boundary.parent_surface.name outside_boundary_condition_object = boundary.parent_surface.name
sun_exposure = 'NoSun' sun_exposure = 'NoSun'

View File

@ -158,6 +158,7 @@ OCCUPANCY = 'Occupancy'
APPLIANCES = 'Appliances' APPLIANCES = 'Appliances'
HVAC_AVAILABILITY = 'HVAC Avail' HVAC_AVAILABILITY = 'HVAC Avail'
INFILTRATION = 'Infiltration' INFILTRATION = 'Infiltration'
VENTILATION = 'Ventilation'
COOLING_SET_POINT = 'ClgSetPt' COOLING_SET_POINT = 'ClgSetPt'
HEATING_SET_POINT = 'HtgSetPt' HEATING_SET_POINT = 'HtgSetPt'
EQUIPMENT = 'Equipment' EQUIPMENT = 'Equipment'