Skip to content

Commit

Permalink
Merge pull request #303 from RWTH-EBC/issue272_BugExportAnnex
Browse files Browse the repository at this point in the history
#272 changed the inline loop iteration object from i to x in the anne…
  • Loading branch information
PRemmen authored Sep 21, 2016
2 parents 8413de1 + cec1357 commit f97b60b
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 13 deletions.
10 changes: 5 additions & 5 deletions teaser/logic/simulation/annex.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ def compare_orientation(bldg, number_of_elements=3):
if number_of_elements != 4:
zone.weightfactor_ow.append(
sum([wall.wf_out for wall in walls]))
[zone.outer_walls_areas.append(i.area) for i in walls]
[zone.outer_walls_areas.append(x.area) for x in walls]
zone.tilt_wall.append(i[1])
zone.orientation_wall.append(i[0])
elif i[1] >= 90:
zone.weightfactor_ow.append(
sum([wall.wf_out for wall in walls]))
[zone.outer_walls_areas.append(i.area) for i in walls]
[zone.outer_walls_areas.append(x.area) for x in walls]
zone.tilt_wall.append(i[1])
zone.orientation_wall.append(i[0])
else:
Expand All @@ -115,7 +115,7 @@ def compare_orientation(bldg, number_of_elements=3):
sum([win.area for win in wins]))
zone.g_sunblind_list.append(
sum([win.shading_g_total for win in wins]))
[zone.window_areas.append(i.area) for i in wins]
[zone.window_areas.append(x.area) for x in wins]
zone.tilt_win.append(i[1])
zone.orientation_win.append(i[0])
elif i[1] >= 90:
Expand All @@ -125,7 +125,7 @@ def compare_orientation(bldg, number_of_elements=3):
sum([win.area for win in wins]))
zone.g_sunblind_list.append(
sum([win.shading_g_total for win in wins]))
[zone.window_areas.append(i.area) for i in wins]
[zone.window_areas.append(x.area) for x in wins]
zone.tilt_win.append(i[1])
zone.orientation_win.append(i[0])

Expand All @@ -134,4 +134,4 @@ def compare_orientation(bldg, number_of_elements=3):
if rts:
zone.orientation_rt.append(i[0])
zone.tilt_rt.append(i[1])
[zone.weightfactor_rt.append(i.wf_out) for i in rts]
[zone.weightfactor_rt.append(x.wf_out) for x in rts]
22 changes: 14 additions & 8 deletions teaser/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def instantiate_data_class(self, type_element_file=None):
'''
return DataClass(type_element_file)

def calc_all_buildings(self):
def calc_all_buildings(self, raise_errors=False):
'''Calculates values for all project buildings
You need to set the following parameters in the Project class.
Expand All @@ -134,17 +134,23 @@ def calc_all_buildings(self):
used library (AixLib and Annex60 are supported)
'''


for bldg in reversed(self.buildings):
try:
if raise_errors is True:
for bldg in reversed(self.buildings):
bldg.calc_building_parameter(
number_of_elements=self._number_of_elements_calc,
merge_windows=self._merge_windows_calc,
used_library=self._used_library_calc)
except:
print(bldg.name)
self.buildings.remove(bldg)
else:
for bldg in reversed(self.buildings):
try:
bldg.calc_building_parameter(
number_of_elements=self._number_of_elements_calc,
merge_windows=self._merge_windows_calc,
used_library=self._used_library_calc)
except:
print("Following building can't be calculated:", bldg.name)
print("raise_errors=True to get python errors")
self.buildings.remove(bldg)

def retrofit_all_buildings(self,
year_of_retrofit,
Expand Down
19 changes: 19 additions & 0 deletions tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,25 @@ def test_export_aixlib(self):
prj.calc_all_buildings()
prj.export_aixlib(building_model='MultizoneEquipped')

def test_export_annex(self):
'''test of export_annex, no calculation verification'''

prj.number_of_elements_calc = 2
prj.merge_windows_calc = True
prj.used_library_calc = 'Annex60'
prj.calc_all_buildings()
prj.export_annex()
prj.number_of_elements_calc = 3
prj.merge_windows_calc = False
prj.used_library_calc = 'Annex60'
prj.calc_all_buildings()
prj.export_annex()
prj.number_of_elements_calc = 4
prj.merge_windows_calc = False
prj.used_library_calc = 'Annex60'
prj.calc_all_buildings()
prj.export_annex()

def test_export_parameters_txt(self):
'''test of the export of the readable parameter output'''

Expand Down

0 comments on commit f97b60b

Please sign in to comment.