From c9d30c6ca4095649fbcfeac43203842e94df2e5b Mon Sep 17 00:00:00 2001 From: Soroush Date: Fri, 13 Nov 2020 01:37:53 -0500 Subject: [PATCH] Adding occupancy, lighting, and infiltration --- helpers/idf_helper.py | 85 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/helpers/idf_helper.py b/helpers/idf_helper.py index bbcffd62..9572e510 100644 --- a/helpers/idf_helper.py +++ b/helpers/idf_helper.py @@ -31,6 +31,35 @@ class IdfHelper: self._idf = IDF(self._idf_file_path, self._epw_file_path) self._idf.epw = self._epw_file_path + def add_schedule(self,occupancy): + schedule_occupancy =self._idf.newidfobject("SCHEDULE:DAY:HOURLY".upper()) + schedule_occupancy.Name='occupant schedule' + schedule_occupancy.Hour_1=occupancy.occupant_schedule[0] + schedule_occupancy.Hour_2=occupancy.occupant_schedule[1] + schedule_occupancy.Hour_3=occupancy.occupant_schedule[2] + schedule_occupancy.Hour_4=occupancy.occupant_schedule[3] + schedule_occupancy.Hour_5=occupancy.occupant_schedule[4] + schedule_occupancy.Hour_6=occupancy.occupant_schedule[5] + schedule_occupancy.Hour_7=occupancy.occupant_schedule[6] + schedule_occupancy.Hour_8=occupancy.occupant_schedule[7] + schedule_occupancy.Hour_9=occupancy.occupant_schedule[8] + schedule_occupancy.Hour_10=occupancy.occupant_schedule[9] + schedule_occupancy.Hour_11=occupancy.occupant_schedule[10] + schedule_occupancy.Hour_12=occupancy.occupant_schedule[11] + schedule_occupancy.Hour_13=occupancy.occupant_schedule[12] + schedule_occupancy.Hour_14=occupancy.occupant_schedule[13] + schedule_occupancy.Hour_15=occupancy.occupant_schedule[14] + schedule_occupancy.Hour_16=occupancy.occupant_schedule[15] + schedule_occupancy.Hour_17=occupancy.occupant_schedule[16] + schedule_occupancy.Hour_18=occupancy.occupant_schedule[17] + schedule_occupancy.Hour_19=occupancy.occupant_schedule[18] + schedule_occupancy.Hour_20=occupancy.occupant_schedule[19] + schedule_occupancy.Hour_21=occupancy.occupant_schedule[20] + schedule_occupancy.Hour_22=occupancy.occupant_schedule[21] + schedule_occupancy.Hour_23=occupancy.occupant_schedule[22] + schedule_occupancy.Hour_24=occupancy.occupant_schedule[23] + + def add_material(self, layer): materials = self._idf.newidfobject("MATERIAL".upper()) materials.Name = layer.material.name @@ -111,6 +140,62 @@ class IdfHelper: self.add_heating_system(building) self._idf.intersect_match() + def add_lighting (self): + for zone in self._idf.idfobjects["ZONE"]: + self._idf.newidfobject("LIGHTS", + Name = zone.Name+"_"+"lighting", + Zone_or_ZoneList_Name = zone.Name, + Schedule_Name = "Lighting_Weekday", + Design_Level_Calculation_Method = 'Watts/Area', + Watts_per_Zone_Floor_Area = 15, + Return_Air_Fraction = 0, + Fraction_Radiant = 0.7, + Fraction_Visible = 0.2, + Fraction_Replaceable = 1, + # Lights.End-Use_Subcategory='LightsWired', + Return_Air_Fraction_Calculated_from_Plenum_Temperature = 'No' + ) + + def add_occupancy(self,occupancy): + for zone in self._idf.idfobjects["ZONE"]: + self._idf.newidfobject("PEOPLE", + Name = zone.Name+"_"+"occupancy", + Zone_or_ZoneList_Name = zone.Name, + Number_of_People_Schedule_Name = 'occupant schedule', + Number_of_People_Calculation_Method = "People", + Number_of_People = occupancy.number_of_occupants, + # Zone_Floor_Area_per_Person=31.41, + # People_per_Zone_Floor_Area=17*0.05, + # Zone_Floor_Area_per_Person=1.65880764E+01, + Fraction_Radiant = 0.3, + Activity_Level_Schedule_Name = "People_Weekday_ActivityLevel" + ) + + def add_equipment(self): + for zone in self._idf.idfobjects["ZONE"]: + self._idf.newidfobject("ELECTRICEQUIPMENT", + Name = zone.Name+"_"+'electricload', + Zone_or_ZoneList_Name = zone.Name, + Schedule_Name = 'ElectricalEquipment', + Design_Level_Calculation_Method = 'EquipmentLevel', + Design_Level = 566000 + ) + + def add_infiltration(self): + for zone in self._idf.idfobjects["ZONE"]: + self._idf.newidfobject("ZONEINFILTRATION:DESIGNFLOWRATE", + Name=zone.Name+"_"+"infiltration", + Zone_or_ZoneList_Name=zone.Name, + Schedule_Name='Infiltration_schedule', + Design_Flow_Rate_Calculation_Method='AirChanges/Hour', + Air_Changes_per_Hour=0.35, + Constant_Term_Coefficient=0.606, + Temperature_Term_Coefficient=3.6359996E-02, + Velocity_Term_Coefficient=0.1177165, + Velocity_Squared_Term_Coefficient=0.0000000E+00 + ) + + def run(self, output_directory, window_ratio=0.35, display_render=False, output_prefix=None, keep_file=None): self._idf.set_default_constructions() self._idf.set_wwr(window_ratio, construction="Project External Window")