Tests to incorporate HVAC systems to EP workflow

This commit is contained in:
Oriol Gavalda 2023-11-16 15:52:00 -05:00
parent a3c5219ccd
commit cfd2586f80

View File

@ -55,6 +55,7 @@ class Idf:
_LOCATION = 'SITE:LOCATION' _LOCATION = 'SITE:LOCATION'
_SIMPLE = 'Simple' _SIMPLE = 'Simple'
_EQUIPMENT_CONNECTIONS = 'ZONEHVAC:EQUIPMENTCONNECTIONS' _EQUIPMENT_CONNECTIONS = 'ZONEHVAC:EQUIPMENTCONNECTIONS'
_NODE_LIST = 'NODELIST'
idf_surfaces = { idf_surfaces = {
cte.WALL: 'wall', cte.WALL: 'wall',
@ -118,7 +119,8 @@ class Idf:
if levels_of_detail.construction is None: if levels_of_detail.construction is None:
raise AttributeError('Level of detail of construction not assigned') raise AttributeError('Level of detail of construction not assigned')
if levels_of_detail.construction < 2: if levels_of_detail.construction < 2:
raise AttributeError(f'Level of detail of construction = {levels_of_detail.construction}. Required minimum level 2') raise AttributeError(
f'Level of detail of construction = {levels_of_detail.construction}. Required minimum level 2')
if levels_of_detail.usage is None: if levels_of_detail.usage is None:
raise AttributeError('Level of detail of usage not assigned') raise AttributeError('Level of detail of usage not assigned')
if levels_of_detail.usage < 2: if levels_of_detail.usage < 2:
@ -349,7 +351,7 @@ class Idf:
def _add_window_construction_and_material(self, thermal_opening): def _add_window_construction_and_material(self, thermal_opening):
for window_material in self._idf.idfobjects[self._WINDOW_MATERIAL_SIMPLE]: for window_material in self._idf.idfobjects[self._WINDOW_MATERIAL_SIMPLE]:
if window_material['UFactor'] == thermal_opening.overall_u_value and \ if window_material['UFactor'] == thermal_opening.overall_u_value and \
window_material['Solar_Heat_Gain_Coefficient'] == thermal_opening.g_value: window_material['Solar_Heat_Gain_Coefficient'] == thermal_opening.g_value:
return return
order = str(len(self._idf.idfobjects[self._WINDOW_MATERIAL_SIMPLE]) + 1) order = str(len(self._idf.idfobjects[self._WINDOW_MATERIAL_SIMPLE]) + 1)
@ -368,6 +370,7 @@ class Idf:
return return
self._idf.newidfobject(self._ZONE, Name=name, Volume=thermal_zone.volume) self._idf.newidfobject(self._ZONE, Name=name, Volume=thermal_zone.volume)
self._add_heating_system(thermal_zone, name) self._add_heating_system(thermal_zone, name)
#self._add_nodelist_system(thermal_zone, name)
def _add_thermostat(self, thermal_zone): def _add_thermostat(self, thermal_zone):
thermostat_name = f'Thermostat {thermal_zone.usage_name}' thermostat_name = f'Thermostat {thermal_zone.usage_name}'
@ -382,23 +385,31 @@ class Idf:
) )
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._EQUIPMENT_CONNECTIONS]:
if air_system.Zone_Name == zone_name: if air_system.Zone_Name == zone_name:
return return
thermostat = self._add_thermostat(thermal_zone) thermostat = self._add_thermostat(thermal_zone)
self._idf.newidfobject(self._EQUIPMENT_CONNECTIONS, self._idf.newidfobject(self._EQUIPMENT_CONNECTIONS,
Zone_Name=zone_name, Zone_Name=zone_name,
Zone_Conditioning_Equipment_List_Name=f'{thermal_zone.usage_name} Equipment List', Zone_Conditioning_Equipment_List_Name=f'{zone_name} Equipment List',
Zone_Air_Inlet_Node_or_NodeList_Name=f'{thermal_zone.usage_name} Inlet Node List', Zone_Air_Inlet_Node_or_NodeList_Name=f'{zone_name} Inlet Node List',
Zone_Air_Node_Name=f'Node 1', Zone_Air_Node_Name=f'Node 1',
Zone_Return_Air_Node_or_NodeList_Name=f'{thermal_zone.usage_name} Return Node List') Zone_Return_Air_Node_or_NodeList_Name=f'{zone_name} Return Node List')
def _add_nodelist_system(self, thermal_zone, zone_name):
self._idf.newidfobject(self._NODE_LIST,
Name=f'{zone_name} Inlet Node List',
Node_Name='Node 2')
self._idf.newidfobject(self._NODE_LIST,
Name=f'{zone_name} Return Node List',
Node_Name='Node 3')
def _add_occupancy(self, thermal_zone, zone_name): def _add_occupancy(self, thermal_zone, zone_name):
number_of_people = thermal_zone.occupancy.occupancy_density * thermal_zone.total_floor_area number_of_people = thermal_zone.occupancy.occupancy_density * thermal_zone.total_floor_area
fraction_radiant = 0 fraction_radiant = 0
total_sensible = ( total_sensible = (
thermal_zone.occupancy.sensible_radiative_internal_gain + thermal_zone.occupancy.sensible_convective_internal_gain thermal_zone.occupancy.sensible_radiative_internal_gain + thermal_zone.occupancy.sensible_convective_internal_gain
) )
if total_sensible != 0: if total_sensible != 0:
fraction_radiant = thermal_zone.occupancy.sensible_radiative_internal_gain / total_sensible fraction_radiant = thermal_zone.occupancy.sensible_radiative_internal_gain / total_sensible
@ -554,6 +565,7 @@ class Idf:
self._add_schedules(usage, 'Activity Level', _new_schedules) self._add_schedules(usage, 'Activity Level', _new_schedules)
self._add_zone(thermal_zone, building.name) self._add_zone(thermal_zone, building.name)
self._add_heating_system(thermal_zone, building.name) self._add_heating_system(thermal_zone, building.name)
#self._add_nodelist_system(thermal_zone, building.name)
self._add_infiltration(thermal_zone, building.name) self._add_infiltration(thermal_zone, building.name)
self._add_ventilation(thermal_zone, building.name) self._add_ventilation(thermal_zone, building.name)
self._add_occupancy(thermal_zone, building.name) self._add_occupancy(thermal_zone, building.name)