Correct missing information

This commit is contained in:
Guille Gutierrez 2023-03-27 11:39:45 -04:00
parent 9ed8fc61e2
commit 27005e20c9

View File

@ -11,6 +11,7 @@ from pathlib import Path
from geomeppy import IDF
import hub.helpers.constants as cte
from hub.city_model_structure.attributes.schedule import Schedule
from hub.city_model_structure.building_demand.thermal_zone import ThermalZone
class Idf:
@ -20,6 +21,7 @@ class Idf:
_BUILDING = 'BUILDING'
_ZONE = 'ZONE'
_LIGHTS = 'LIGHTS'
_APPLIANCES = 'OTHEREQUIPMENT'
_PEOPLE = 'PEOPLE'
_THERMOSTAT = 'HVACTEMPLATE:THERMOSTAT'
_IDEAL_LOAD_AIR_SYSTEM = 'HVACTEMPLATE:ZONE:IDEALLOADSAIRSYSTEM'
@ -320,6 +322,7 @@ class Idf:
def _add_occupancy(self, thermal_zone, zone_name):
number_of_people = thermal_zone.occupancy.occupancy_density * thermal_zone.total_floor_area
print(thermal_zone.occupancy.occupancy_density)
fraction_radiant = 0
total_sensible = thermal_zone.occupancy.sensible_radiative_internal_gain + \
thermal_zone.occupancy.sensible_convective_internal_gain
@ -336,6 +339,54 @@ class Idf:
Activity_Level_Schedule_Name=f'Activity Level schedules {thermal_zone.usage_name}'
)
def _add_lighting(self, thermal_zone: ThermalZone, zone_name: str):
fraction_radiant = thermal_zone.lighting.radiative_fraction
# todo: fraction visible should come from catalog
fraction_visible = 0.3
method = 'Watts/Area'
factor_size = thermal_zone.total_floor_area / thermal_zone.footprint_area
watts_per_zone_floor_area = thermal_zone.lighting.density*factor_size
# todo: fraction replaceable should come from catalog
fraction_replaceable = 1
subcategory = f'ELECTRIC EQUIPMENT#{zone_name}#GeneralLights'
self._idf.newidfobject(self._LIGHTS,
Name=f'{zone_name}_lights',
Zone_or_ZoneList_Name=zone_name,
Schedule_Name=f'Lighting schedules {thermal_zone.usage_name}',
Design_Level_Calculation_Method=method,
Watts_per_Zone_Floor_Area=watts_per_zone_floor_area,
Fraction_Radiant=fraction_radiant,
Fraction_Visible=fraction_visible,
Fraction_Replaceable=fraction_replaceable,
EndUse_Subcategory=subcategory
)
def _add_appliances(self, thermal_zone, zone_name):
fuel_type = 'Electricity'
fraction_radiant = thermal_zone.appliances.radiative_fraction
fraction_convective = thermal_zone.appliances.convective_fraction
fraction_latent = 0
method = 'Watts/Area'
factor_size = thermal_zone.total_floor_area / thermal_zone.footprint_area
watts_per_zone_floor_area = thermal_zone.appliances.density*factor_size
print(thermal_zone.appliances.density)
print(watts_per_zone_floor_area)
subcategory = f'ELECTRIC EQUIPMENT#{zone_name}#InteriorEquipment'
# _object = self._idf.newidfobject(self._APPLIANCES)
# print(vars(_object))
self._idf.newidfobject(self._APPLIANCES,
Fuel_Type=fuel_type,
Name=f'{zone_name}_appliances',
Zone_or_ZoneList_Name=zone_name,
Schedule_Name=f'Appliance schedules {thermal_zone.usage_name}',
Design_Level_Calculation_Method=method,
Power_per_Zone_Floor_Area=watts_per_zone_floor_area,
Fraction_Latent=fraction_latent,
Fraction_Radiant=fraction_radiant,
EndUse_Subcategory=subcategory
)
def _add_infiltration(self, thermal_zone, zone_name):
for zone in self._idf.idfobjects["ZONE"]:
if zone.Name == f'{zone_name}_infiltration':
@ -392,12 +443,18 @@ class Idf:
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, 'Cooling thermostat', thermal_zone.thermal_control.cooling_set_point_schedules)
self._add_schedules(usage, 'Lighting', thermal_zone.lighting.schedules)
self._add_schedules(usage, 'Appliances', thermal_zone.appliances.schedules)
self._add_people_activity_level_schedules(thermal_zone)
self._add_zone(thermal_zone, building.name)
self._add_heating_system(thermal_zone, building.name)
self._add_infiltration(thermal_zone, building.name)
self._add_occupancy(thermal_zone, building.name)
self._add_lighting(thermal_zone, building.name)
self._add_appliances(thermal_zone, building.name)
if self._export_type == "Surfaces":
if building.name in self._target_buildings or building.name in self._adjacent_buildings:
self._add_surfaces(building, building.name)
@ -406,7 +463,7 @@ class Idf:
else:
self._add_block(building)
# todo: this should change to specific variables per zone to process only the ones in the buildings_to_calculate
for building in self._target_buildings:
for _ in self._target_buildings:
continue
self._idf.newidfobject(