From 97364922b474a4ea615d30558c5954be5a8085f2 Mon Sep 17 00:00:00 2001 From: MichaMans Date: Thu, 15 Sep 2016 14:25:03 +0200 Subject: [PATCH 1/7] #296 changed the OutputData path interactions to save all output in the users home folder under TEASEROutput --- teaser/__init__.py | 2 +- teaser/data/output/text_output.py | 9 +++++---- teaser/logic/utilities.py | 19 +++++++++++-------- teaser/project.py | 7 ++++--- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/teaser/__init__.py b/teaser/__init__.py index 95151dc37..13cf88a93 100644 --- a/teaser/__init__.py +++ b/teaser/__init__.py @@ -18,7 +18,7 @@ else: raise Exception('This software runs on python versions 2.7 or >=3.3 only!') -new_path = utilitis.get_full_path("OutputData") +new_path = os.path.join(os.path.expanduser('~'), ("TEASEROutput")) if not os.path.exists(new_path): os.makedirs(new_path) diff --git a/teaser/data/output/text_output.py b/teaser/data/output/text_output.py index 074a5f50e..4842cf126 100644 --- a/teaser/data/output/text_output.py +++ b/teaser/data/output/text_output.py @@ -7,6 +7,8 @@ """ import teaser.logic.utilities as utilitis from mako.template import Template +import os + def export_parameters_txt(prj, path): '''Exports parameters of all buildings in a readable text file @@ -19,19 +21,18 @@ def export_parameters_txt(prj, path): can be specified ''' if path is None: - path = "OutputData/"+prj.name + path = os.path.join(os.path.expanduser('~'), "TEASEROutput/", prj.name) else: path = path+"/"+prj.name for bldg in prj.buildings: bldg_path = path + "/" + bldg.name + "/" - utilitis.create_path(utilitis.get_full_path(bldg_path)) + utilitis.create_path(bldg_path) readable_template = Template( filename=utilitis.get_full_path( "data/output/texttemplate/ReadableBuilding")) - out_file = open(utilitis.get_full_path - (bldg_path+"ReadableOutput.txt"), 'w') + out_file = open((bldg_path + "ReadableOutput.txt"), 'w') out_file.write(readable_template.render_unicode (bldg=bldg, prj=prj)) out_file.close() diff --git a/teaser/logic/utilities.py b/teaser/logic/utilities.py index 58b4a7c31..5df332101 100644 --- a/teaser/logic/utilities.py +++ b/teaser/logic/utilities.py @@ -15,6 +15,7 @@ def celsius_to_kelvin(value): f_value = 0 return f_value+273.15 + def create_path(path): '''Create a folder. @@ -35,23 +36,25 @@ def create_path(path): os.makedirs(path) os.chdir(path) - return path + def get_default_path(): '''Function to construct default path to OutputData folder - This function constructs the default path to the OutputData folder ''' - directory = os.path.dirname(__file__) - src = "teaser" - last_index = directory.rfind(src) - default_path = os.path.join(directory[:last_index], "teaser", "OutputData") + home_path = os.path.expanduser('~') + + teaser_default_path = os.path.join(home_path, 'TEASEROutput') + # directory = os.path.dirname(__file__) + # src = "teaser" + # last_index = directory.rfind(src) + # teaser_default_path = os.path.join(directory[:last_index], "teaser", "OutputData") - return default_path + return teaser_default_path def get_full_path(rel_path): @@ -75,4 +78,4 @@ def get_full_path(rel_path): first_path = os.path.join(directory[:last_index], "teaser") full_path = os.path.join(first_path, rel_path) - return full_path \ No newline at end of file + return full_path diff --git a/teaser/project.py b/teaser/project.py index c46dea11f..1d2d0667c 100644 --- a/teaser/project.py +++ b/teaser/project.py @@ -6,6 +6,7 @@ import warnings +import os import teaser.logic.utilities as utilitis import teaser.data.input.teaserxml_input as txml_in import teaser.data.output.teaserxml_output as txml_out @@ -832,7 +833,7 @@ def save_project(self, file_name=None, path=None): name = file_name if path is None: - new_path = utilitis.get_full_path("OutputData") + "/" + name + new_path = os.path.join(utilitis.get_default_path(), name) else: new_path = path + "/" + name utilitis.create_path(utilitis.get_full_path(path)) @@ -877,7 +878,7 @@ def save_citygml(self, file_name=None, path=None): name = file_name if path is None: - new_path = utilitis.get_full_path("OutputData") + "/" + name + new_path = os.path.join(utilitis.get_default_path(), name) else: new_path = path + "/" + name utilitis.create_path(utilitis.get_full_path(path)) @@ -999,7 +1000,7 @@ def export_parameters_txt(self, path=None): ''' if path is None: - path = "OutputData/"+self.name + path = os.path.join(utilitis.get_default_path(), self.name) else: path = path+"/"+self.name From a255e73fb21c5705738073a213386bed68f043b7 Mon Sep 17 00:00:00 2001 From: MichaMans Date: Thu, 15 Sep 2016 14:28:30 +0200 Subject: [PATCH 2/7] #295 changed the typo in the documentation example --- doc/teaser.Examples.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/teaser.Examples.rst b/doc/teaser.Examples.rst index ea528574f..a979f1124 100644 --- a/doc/teaser.Examples.rst +++ b/doc/teaser.Examples.rst @@ -14,7 +14,7 @@ that building and to export that building to internal XML and a Modelica record First thing we need to do is to import our Project API module:: - from teaser.project import project + from teaser.project import Project We instantiate the Project class. The parameter load_data = True indicates that we load the XML data bases into our Project. This can take a few sec.:: From ed75fb281e9983888e6825bcb6e3b64664d9ce9e Mon Sep 17 00:00:00 2001 From: MichaMans Date: Thu, 15 Sep 2016 14:53:15 +0200 Subject: [PATCH 3/7] #294 changed the three element calculation in the thermal zone --- teaser/logic/buildingobjects/thermalzone.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/teaser/logic/buildingobjects/thermalzone.py b/teaser/logic/buildingobjects/thermalzone.py index db602c347..46a350167 100644 --- a/teaser/logic/buildingobjects/thermalzone.py +++ b/teaser/logic/buildingobjects/thermalzone.py @@ -491,7 +491,7 @@ def calc_three_element(self, if self.r_conv_inner_rt != 0: self.r_conv_inner_ow = 1/((1/self.r_conv_inner_ow)+( 1/self.r_conv_inner_rt)) - if self.r_rad_inner_gf != 0: + if self.r_rad_inner_rt != 0: self.r_rad_inner_ow = 1/((1/self.r_rad_inner_ow)+( 1/self.r_rad_inner_rt)) From ac01294ca75c2a24dd331c33c04885631de93c98 Mon Sep 17 00:00:00 2001 From: MichaMans Date: Thu, 15 Sep 2016 15:01:06 +0200 Subject: [PATCH 4/7] #290 the function retrofit all buildings now passes its function parameters to the buildings within the project --- teaser/project.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/teaser/project.py b/teaser/project.py index c46dea11f..2a9ac79c0 100644 --- a/teaser/project.py +++ b/teaser/project.py @@ -182,8 +182,7 @@ def retrofit_all_buildings(self, ''' for bldg in self.buildings: - bldg.year_of_retrofit = year_of_retrofit - bldg.retrofit_building() + bldg.retrofit_building(year_of_retrofit, window_type, material) def type_bldg_office(self, name, @@ -252,9 +251,9 @@ def type_bldg_office(self, type_bldg.generate_archetype() type_bldg.calc_building_parameter( - number_of_elements=self._number_of_elements_calc, - merge_windows=self._merge_windows_calc, - used_library=self._used_library_calc) + number_of_elements=self._number_of_elements_calc, + merge_windows=self._merge_windows_calc, + used_library=self._used_library_calc) return type_bldg def type_bldg_institute(self, From cec13573f0d08c5738ef033146a35e5c6a83363d Mon Sep 17 00:00:00 2001 From: MichaMans Date: Thu, 15 Sep 2016 15:25:22 +0200 Subject: [PATCH 5/7] #272 changed the inline loop iteration object from i to x in the annex export, added a annex export to the unittest, changed the error raise and exception in the project --- teaser/logic/simulation/annex.py | 10 +++++----- teaser/project.py | 22 ++++++++++++++-------- tests/test_data.py | 19 +++++++++++++++++++ 3 files changed, 38 insertions(+), 13 deletions(-) diff --git a/teaser/logic/simulation/annex.py b/teaser/logic/simulation/annex.py index cc3afbd65..8715528bd 100644 --- a/teaser/logic/simulation/annex.py +++ b/teaser/logic/simulation/annex.py @@ -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: @@ -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: @@ -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]) @@ -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] diff --git a/teaser/project.py b/teaser/project.py index c46dea11f..42d5d5320 100644 --- a/teaser/project.py +++ b/teaser/project.py @@ -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. @@ -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, diff --git a/tests/test_data.py b/tests/test_data.py index c27ac5228..84945b52d 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -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''' From 14de37af982396433c5f9b175696ab6e28e5771b Mon Sep 17 00:00:00 2001 From: PRemmen Date: Wed, 21 Sep 2016 17:20:39 +0200 Subject: [PATCH 6/7] add version to pyxb install requirements --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index f00d9c3cd..2f44d9143 100644 --- a/setup.py +++ b/setup.py @@ -58,5 +58,5 @@ 'teaser.examples.examplefiles': ['*.teaserXML'], 'teaser.examples.examplefiles.MelatenXML': ['*.xml']}, classifiers = ['License :: OSI Approved :: MIT License'], - setup_requires = ['mako', 'pyxb', 'pytest'], - install_requires = ['mako', 'pyxb', 'pytest']) + setup_requires = ['mako', 'pyxb==1.2.4', 'pytest'], + install_requires = ['mako', 'pyxb==1.2.4', 'pytest']) From a61793f3f197ce360f8d86cc4c94a7057105db1e Mon Sep 17 00:00:00 2001 From: PRemmen Date: Wed, 21 Sep 2016 17:21:51 +0200 Subject: [PATCH 7/7] upgrade version numbers --- README.md | 2 +- doc/conf.py | 2 +- doc/index.rst | 2 +- setup.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7a1fc9856..2a0c9e84f 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ IEA-EBC [Annex60](https://github.com/iea-annex60/modelica-annex60). ### Version -The current version is 0.3.8, which is a pre-release. +The current version is 0.3.9, which is a pre-release. ### How to cite TEASER diff --git a/doc/conf.py b/doc/conf.py index de880c195..c4acf761b 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -60,7 +60,7 @@ # The short X.Y version. version = '0.3.' # The full version, including alpha/beta/rc tags. -release = '0.3.8' +release = '0.3.9' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/doc/index.rst b/doc/index.rst index ff3b6c0a2..12a86afe9 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -60,7 +60,7 @@ IEA-EBC `Annex60 `_. Version ================== -The current version is 0.3.8, which is a pre-release. +The current version is 0.3.9, which is a pre-release. How to cite TEASER ================== diff --git a/setup.py b/setup.py index 2f44d9143..ff83e9e1e 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup setup(name='teaser', - version='0.3.8', + version='0.3.9', description='Tool for Energy Analysis and Simulation for Efficient Retrofit ', url='https://github.com/RWTH-EBC/TEASER', author='RWTH Aachen University, E.ON Energy Research Center, Institute of Energy Efficient Buildings and Indoor Climate',