Skip to content

Commit

Permalink
Merge pull request #311 from RWTH-EBC/release_v039
Browse files Browse the repository at this point in the history
Release v039
  • Loading branch information
MichaMans authored Sep 21, 2016
2 parents ab0ce80 + 68a08df commit 73f4729
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 42 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,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
==================
Expand Down
2 changes: 1 addition & 1 deletion doc/teaser.Examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.::
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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',
Expand Down Expand Up @@ -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'])
2 changes: 1 addition & 1 deletion teaser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
9 changes: 5 additions & 4 deletions teaser/data/output/text_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
2 changes: 1 addition & 1 deletion teaser/logic/buildingobjects/thermalzone.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
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]
19 changes: 11 additions & 8 deletions teaser/logic/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def celsius_to_kelvin(value):
f_value = 0
return f_value+273.15


def create_path(path):
'''Create a folder.
Expand All @@ -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):
Expand All @@ -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
return full_path
38 changes: 22 additions & 16 deletions teaser/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -115,7 +116,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 +135,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 Expand Up @@ -182,8 +189,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,
Expand Down Expand Up @@ -252,9 +258,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,
Expand Down Expand Up @@ -832,7 +838,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))
Expand Down Expand Up @@ -877,7 +883,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))
Expand Down Expand Up @@ -999,7 +1005,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

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 73f4729

Please sign in to comment.