Skip to content

Commit

Permalink
Merge pull request #428 from RWTH-EBC/issue373_unittests
Browse files Browse the repository at this point in the history
Issue373 unittests
  • Loading branch information
PRemmen authored Apr 3, 2017
2 parents 0daf987 + 1458461 commit 0a8e063
Show file tree
Hide file tree
Showing 15 changed files with 2,971 additions and 254 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#####################
.cache/
__pycache__/
.coverage

#pip install #
#####################
Expand All @@ -48,4 +49,4 @@ dist
#ignore docs#
#####################

doc/_build
doc/_build
2 changes: 1 addition & 1 deletion teaser/data/dataclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def load_mat_binding(self):
"""
try:
__xml_file_mat = open(self.path_mat, 'r+')
version_parse = et.parse(self.path_tb)
version_parse = et.parse(self.path_mat)
except:
__xml_file_mat = open(self.path_mat, 'w')
version_parse = False
Expand Down
24 changes: 16 additions & 8 deletions teaser/data/input/teaserxml_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,14 @@ def _load_building(prj, pyxb_bld, type, project_bind):
pyxb_ahu.by_pass_dehumidification
bldg.central_ahu.efficiency_recovery = pyxb_ahu.efficiency_recovery

if float(project_bind.version) >= 0.5:
bldg.central_ahu.efficiency_recovery_false = \
pyxb_ahu.efficiency_recovery_false
else:
try:
if float(project_bind.version) >= 0.5:
bldg.central_ahu.efficiency_recovery_false = \
pyxb_ahu.efficiency_recovery_false
else:
bldg.central_ahu.efficiency_recovery_false = \
pyxb_ahu.efficiency_revocery_false
except AttributeError:
bldg.central_ahu.efficiency_recovery_false = \
pyxb_ahu.efficiency_revocery_false

Expand Down Expand Up @@ -191,10 +195,14 @@ def _load_building(prj, pyxb_bld, type, project_bind):
zone.use_conditions.daily_operation_heating = \
pyxb_use.UsageOperationTime.daily_operation_heating

if float(project_bind.version) >= 0.4:
zone.use_conditions.maintained_illuminance = \
pyxb_use.Lighting.maintained_illuminance
else:
try:
if float(project_bind.version) >= 0.4:
zone.use_conditions.maintained_illuminance = \
pyxb_use.Lighting.maintained_illuminance
else:
zone.use_conditions.maintained_illuminance = \
pyxb_use.Lighting.maintained_illuminace
except AttributeError:
zone.use_conditions.maintained_illuminance = \
pyxb_use.Lighting.maintained_illuminace

Expand Down
25 changes: 24 additions & 1 deletion teaser/examples/e5_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def example_save():
# To load data from *.teaserXML we can use a simple API function. So
# first we need to instantiate our API (similar to example
# e1_generate_archetype). The XML file is called
# `ArchetypeExample.teaserXML` and saved in the default path.
# `ArchetypeExample.teaserXML` and saved in the default path. You need to
# run e4 first before you can load this example file.

from teaser.project import Project

Expand All @@ -31,6 +32,11 @@ def example_save():

prj.load_project(
path=load_xml)
prj = Project()
prj.load_project(utilities.get_full_path(
"examples/examplefiles/new.teaserXML"))
prj.save_project(file_name="new", path=None)


# To reload data from a pickle file, we do not need to instantiate an
# API, as pickle will automatically instantiate all classes as they have
Expand All @@ -44,6 +50,23 @@ def example_save():

pickle_prj = pickle.load(open(load_pickle, "rb"))

# The last option to import data into TEASER is using a CityGML file. The
# import of CityGML underlies some limitations e.g. concerning data
# given in the file and the way the buildings are modeled.

prj_gml = Project()

load_gml = utilities.get_full_path(os.path.join(
'examples',
'examplefiles',
'CityGMLSample.gml'))

prj_gml.load_citygml(path=load_gml)

# After you imported your teaser project one or another way into you
# python environment you can access variables and functions.


if __name__ == '__main__':
example_save()

Expand Down
Loading

0 comments on commit 0a8e063

Please sign in to comment.