Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_load_save_project(self):
"""test of load_project and save_project"""
prj.load_project(utilities.get_full_path(("examples/examplefiles"
"/new.teaserXML")))
therm_zone = prj.buildings[-1].thermal_zones[0]
assert therm_zone.outer_walls[0].area == 40.0
tz_area = sum([tz.area for tz in prj.buildings[
-1].thermal_zones])
assert prj.buildings[-1].net_leased_area == tz_area
prj.save_project(file_name="unitTest", path=None)
prj.save_project(file_name=None, path=utilities.get_default_path())
prj.set_default()
private function, do not call
Parameters
----------
path : string
path of where the package.mo should be placed
name : string
name of the Modelica package
within : string
path of Modelica package containing this package
"""
package_template = Template(filename=utilities.get_full_path(
"data/output/modelicatemplate/package"))
out_file = open(
utilities.get_full_path(os.path.join(path, "package.mo")), 'w')
out_file.write(package_template.render_unicode(
name=name,
within=within,
uses=uses))
out_file.close()
def export_parameters_txt(prj, path):
"""Exports parameters of all buildings in a readable text file
Parameters
----------
path : string
if the Files should not be stored in OutputData, an alternative
can be specified
"""
lookup = TemplateLookup(directories=[utilities.get_full_path(
os.path.join('data', 'output', 'modelicatemplate'))])
model_template_1 = Template(
filename=utilities.get_full_path(
os.path.join(
'data',
'output',
'texttemplate',
'ReadableBuilding_OneElement')),
lookup=lookup)
model_template_2 = Template(
filename=utilities.get_full_path(
os.path.join(
'data',
'output',
'texttemplate',
'ReadableBuilding_TwoElement')),
lookup=lookup)
model_template_3 = Template(
filename=utilities.get_full_path(
import pickle
load_pickle = os.path.join(
utilities.get_default_path(),
'teaser_pickle.p')
pickle_prj = pickle.load(open(load_pickle, "rb"))
print(pickle_prj)
# 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)
#file = "D:/jsc-tbe/TEASER/teaser/data/input/inputdata
# /TypeBuildingElements_old.xml"
file = utils.get_full_path(
"data/input/inputdata/MaterialTemplates_old.xml")
elem_xml = et.parse(file)
elem_tree = elem_xml.getroot()
# load new MaterialTemplates
dataclass_new = DataClass()
# load old MaterialTemplates
dataclass_old = DataClass()
dataclass_old.path_mat = utils.get_full_path(
"data/input/inputdata/MaterialTemplates_old.xml")
dataclass_old.path_tb = utils.get_full_path(
"data/input/inputdata/TypeBuildingElements_old.xml")
dataclass_old.load_tb_binding()
dataclass_old.load_mat_binding()
# read TypeBuildingElements XML and list all elements
# load element
element_binding_old = dataclass_old.element_bind
element_binding_new = dataclass_new.element_bind
ow_list = element_binding_old.OuterWall
iw_list = element_binding_old.InnerWall
ce_list = element_binding_old.Ceiling
f_list = element_binding_old.Floor
ft_list = element_binding_old.Rooftop
gf_list = element_binding_old.GroundFloor
w_list = element_binding_old.Window
from teaser.data.dataclass import DataClass
import teaser.data.input.buildingelement_input as be_input
from teaser.logic.buildingobjects.buildingphysics.outerwall import OuterWall
from teaser.logic.buildingobjects.buildingphysics.door import Door
from teaser.logic.buildingobjects.buildingphysics.window import Window
from teaser.logic.buildingobjects.buildingphysics.rooftop import Rooftop
from teaser.logic.buildingobjects.buildingphysics.groundfloor import GroundFloor
from teaser.logic.buildingobjects.buildingphysics.innerwall import InnerWall
from teaser.logic.buildingobjects.buildingphysics.ceiling import Ceiling
from teaser.logic.buildingobjects.buildingphysics.floor import Floor
import teaser.logic.utilities as utils
import os
data_class_old = DataClass()
data_class_old.path_tb = utils.get_full_path(
"data/input/inputdata/TypeElements_TABULA_DE.xml")
data_class_old.load_tb_binding()
data_class_old.path_mat = utils.get_full_path(
"data/input/inputdata/MaterialTemplates.xml")
data_class_old.load_tb_binding()
data_class_old.load_mat_binding()
# os.remove(utils.get_full_path(
# "data/input/inputdata/TypeElements_TABULA_DE.json"))
data_class_new = DataClass(used_statistic='tabula_de')
for out_wall in data_class_old.element_bind.OuterWall:
wall = OuterWall()
be_input.load_type_element(
element=wall,
df = pd.read_excel(io=excel_file, skiprows=1)
df = df.set_index('Material TEASER Typebuildings')
#file = "D:/jsc-tbe/TEASER/teaser/data/input/inputdata
# /TypeBuildingElements_old.xml"
file = utils.get_full_path(
"data/input/inputdata/MaterialTemplates_old.xml")
elem_xml = et.parse(file)
elem_tree = elem_xml.getroot()
# load new MaterialTemplates
dataclass_new = DataClass()
# load old MaterialTemplates
dataclass_old = DataClass()
dataclass_old.path_mat = utils.get_full_path(
"data/input/inputdata/MaterialTemplates_old.xml")
dataclass_old.path_tb = utils.get_full_path(
"data/input/inputdata/TypeBuildingElements_old.xml")
dataclass_old.load_tb_binding()
dataclass_old.load_mat_binding()
# read TypeBuildingElements XML and list all elements
# load element
element_binding_old = dataclass_old.element_bind
element_binding_new = dataclass_new.element_bind
ow_list = element_binding_old.OuterWall
iw_list = element_binding_old.InnerWall
ce_list = element_binding_old.Ceiling
f_list = element_binding_old.Floor
ft_list = element_binding_old.Rooftop
def main(number_of_elements=2):
prj = from_scratch(number_of_elements=number_of_elements, save=False)
# prj = load_file()
prj.used_library_calc = 'IBPSA'
prj.number_of_elements_calc = number_of_elements
prj.merge_windows_calc = False
prj.weather_file_path = utilities.get_full_path(
os.path.join(
"data",
"input",
"inputdata",
"weatherdata",
"ASHRAE140.mos"))
prj.buildings[0].calc_building_parameter(
number_of_elements=number_of_elements,
merge_windows=False,
used_library='IBPSA')
prj.export_ibpsa()