Merge changes for conflict solving and remove debug messages

This commit is contained in:
Guille 2020-11-12 13:57:15 -05:00
parent d91a726ba4
commit ce2c873aa0

View File

@ -63,40 +63,39 @@ class IdfHelper:
Solar_Absorptance=layer.material.solar_absorptance,
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_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.Roughness = cte.roughness
materials.Thickness = layer.thickness
materials.Conductivity = layer.material.conductivity
materials.Density = layer.material.density
@ -105,21 +104,6 @@ class IdfHelper:
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]:
if construction.Name == thermal_boundary.construction_name:
@ -130,25 +114,16 @@ class IdfHelper:
if len(layers) == 2:
self._idf.newidfobject(self._CONSTRUCTION, Name=thermal_boundary.construction_name,
Outside_Layer=layers[0].material.name, Layer_2=layers[1].material.name)
debug = f'{self._CONSTRUCTION}, Name={thermal_boundary.construction_name}, Outside_Layer={layers[0].material.name}' \
f', Layer_2={layers[1].material.name}'
elif len(thermal_boundary.layers) == 3:
self._idf.newidfobject(self._CONSTRUCTION, Name=thermal_boundary.construction_name,
Outside_Layer=layers[0].material.name, Layer_2=layers[1].material.name,
Layer_3=layers[2].material.name)
debug = f'{self._CONSTRUCTION}, Name={thermal_boundary.construction_name}, ' \
f'Outside_Layer={layers[0].material.name}, Layer_2={layers[1].material.name}, ' \
f'Layer_3={layers[2].material.name}'
elif len(thermal_boundary.layers) == 4:
self._idf.newidfobject(self._CONSTRUCTION, Name=thermal_boundary.construction_name,
Outside_Layer=layers[0].material.name, Layer_2=layers[1].material.name,
Layer_3=layers[2].material.name, Layer_4=layers[3].material.name)
debug = f'{self._CONSTRUCTION}, Name={thermal_boundary.construction_name}, ' \
f'Outside_Layer={layers[0].material.name}, Layer_2={layers[1].material.name}, ' \
f'Layer_3={layers[2].material.name}, Layer_4={layers[3].material.name}'
else:
raise Exception("This libs version cannot handle more than 4 layers")
print(debug)
def _add_heating_system(self, building):
for usage_zone in building.usage_zones:
@ -205,61 +180,60 @@ class IdfHelper:
self._add_heating_system(building)
self._idf.intersect_match()
def add_lighting (self):
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'
)
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):
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"
)
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
)
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
)
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()