forked from s_ranjbar/city_retrofit
Merge remote-tracking branch 'origin/master'
# Conflicts: # helpers/idf_helper.py
This commit is contained in:
commit
d91a726ba4
|
@ -64,6 +64,61 @@ class IdfHelper:
|
|||
Visible_Absorptance=layer.material.visible_absorptance
|
||||
)
|
||||
print(f"Add material {layer.material.name}")
|
||||
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
|
||||
materials.Roughness = helpers.roughness
|
||||
materials.Thickness = layer.thickness
|
||||
materials.Conductivity = layer.material.conductivity
|
||||
materials.Density = layer.material.density
|
||||
materials.Specific_Heat = layer.material.specific_heat
|
||||
materials.Thermal_Absorptance = layer.material.thermal_absorptance
|
||||
materials.Solar_Absorptance = layer.material.solar_absorptance
|
||||
materials.Visible_Absorptance = layer.material.visible_absorptance
|
||||
|
||||
def add_construction(self, thermal_boundary):
|
||||
for boundary in thermal_boundary:
|
||||
for layer in boundary:
|
||||
if len(layer) == 2:
|
||||
self._idf.newidfobject("CONSTRUCTION", Name=boundary.construction_name,
|
||||
Outside_Layer=layer[0].material.name, Layer_2=layer[1].material.name)
|
||||
elif len(layer) == 3:
|
||||
self._idf.newidfobject("CONSTRUCTION", Name=boundary.construction_name,
|
||||
Outside_Layer=layer[0].material.name, Layer_2=layer[1].material.name, Layer_3=layer[2].material.name)
|
||||
elif len(layer) == 4:
|
||||
self._idf.newidfobject("CONSTRUCTION", Name=boundary.construction_name,
|
||||
Outside_Layer=layer[0].material.name, Layer_2=layer[1].material.name, Layer_3=layer[2].material.name, Layer_4=layer[3].material.name)
|
||||
else:
|
||||
print("Could not find the true construction")
|
||||
|
||||
def _add_construction(self, thermal_boundary):
|
||||
for construction in self._idf.idfobjects[self._CONSTRUCTION]:
|
||||
|
@ -150,6 +205,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")
|
||||
|
@ -162,7 +273,6 @@ class IdfHelper:
|
|||
idf_path = None
|
||||
if keep_file is not None:
|
||||
idf_path = (keep_file / 'in.idf').resolve()
|
||||
print(str(idf_path))
|
||||
self._idf.saveas(str(idf_path))
|
||||
if idf_path is None:
|
||||
idf_path = (Path(__file__).parent / 'in.idf').resolve()
|
||||
|
|
Loading…
Reference in New Issue
Block a user