Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from teaser.logic.buildingobjects.buildingphysics.ceiling import Ceiling
from teaser.logic.buildingobjects.buildingphysics.floor import Floor
from teaser.logic.buildingobjects.buildingphysics.groundfloor \
import GroundFloor
from teaser.logic.buildingobjects.buildingphysics.innerwall import InnerWall
from teaser.logic.buildingobjects.buildingphysics.outerwall import OuterWall
from teaser.logic.buildingobjects.buildingphysics.rooftop import Rooftop
from teaser.logic.buildingobjects.buildingphysics.window import Window
excel_file = 'N:\Forschung\EBC0301_PtJ_Living_Roadmap_mfu\Students\jsc-tbe\MASEA_Typebuildings.xlsx'
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()
----------
element : BuildingElement()
Instance of BuildingElement or inherited Element of TEASER
data_class : DataClass()
DataClass containing the bindings for TypeBuildingElement and
Material (typically this is the data class stored in prj.data,
but the user can individually change that.
"""
check_str = "{}_{}_{}".format(
type(element).__name__, element.building_age_group, element.construction_type
)
del data_class.element_bind[check_str]
with open(utilities.get_full_path(data_class.path_tb), "w") as file:
file.write(
json.dumps(data_class.element_bind, indent=4, separators=(",", ": "))
)
@author: TEASER 4 Development Team
This Scripts loads an project from TEASER 3 and executes the calculation
'''
from teaser.project import Project
import teaser.logic.utilities as utilitis
'''
load project of VDI 6007 room from TEASER file
'''
prj = Project(False)
prj.load_project(utilitis.get_full_path(
"examples/examplefiles/new.teaserXML"))
'''
execute VDI calculation for single zone
'''
if __name__ == "__main__":
prj.buildings[0].calc_building_parameter('ebc')
'''
parameters inner wall
'''
print("Parameters for inner wall")
print("r1_iw:", prj.buildings[0].thermal_zones[0].r1_iw,"K/W ---", "TEASER 3: 4.62113316216e-06 K/W")
print("c1_iw: ", prj.buildings[0].thermal_zones[0].c1_iw,"kJ/K ---", "TEASER 3: 1209810287.22 kJ/K")
print("area_iw: ", prj.buildings[0].thermal_zones[0].area_iw,"qm ---", "TEASER 3: 9866.66666667 qm")
print("alpha_conv_iw: ", prj.buildings[0].thermal_zones[0].alpha_conv_inner_iw,
warnings.warn(warning_text)
add_to_json = False
return
if add_to_json is True:
data_class.element_bind[check_str] = collections.OrderedDict()
_set_basic_data_json(
element=element, wall_out=data_class.element_bind[check_str]
)
_set_layer_data_json(
element=element, wall_out=data_class.element_bind[check_str]
)
with open(utilities.get_full_path(data_class.path_tb), "w") as file:
file.write(
json.dumps(data_class.element_bind, indent=4, separators=(",", ": "))
)
if __name__ == '__main__':
this_path = os.path.dirname(__file__)
input_path = os.path.join(
this_path,
'examplefiles',
'MelatenXML')
info_list = read_XMLs(input_path)
prj = create_reference_project(info_list)
prj.name = "Melaten_Ref"
prj.used_library_calc = 'AixLib'
prj.number_of_elements_calc = 2
prj.weather_file_path = utilities.get_full_path(
os.path.join(
"data",
"input",
"inputdata",
"weatherdata",
"DEU_BW_Mannheim_107290_TRY2010_12_Jahr_BBSR.mos"))
prj.calc_all_buildings()
prj.export_aixlib(
internal_id=None,
path=None)
prj.name = "Melaten_Retrofit"
prj.retrofit_all_buildings(year_of_retrofit=2015)
def __init__(self):
"""Constructor of DataClass
"""
self.element_bind = None
self.path_tb = utils.get_full_path(
"data/input/inputdata/TypeBuildingElements_old.xml")
self.material_bind = None
self.path_mat = utils.get_full_path(
"data/input/inputdata/MaterialTemplates_old.xml")
self.conditions_bind = None
self.path_uc = utils.get_full_path(
"data/input/inputdata/UseConditions.xml")
self.load_tb_binding()
self.load_uc_binding()
self.load_mat_binding()
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()
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(
os.path.join(
'data',
'output',
'texttemplate',
'ReadableBuilding_ThreeElement')),
lookup=lookup)
model_template_4 = Template(
filename=utilities.get_full_path(
name of the new file
path : string
if the Files should not be stored in OutputData, an alternative
can be specified
"""
if file_name is None:
name = self.name
else:
name = file_name
if path is None:
new_path = os.path.join(utilities.get_default_path(), name)
else:
new_path = os.path.join(path, name)
utilities.create_path(utilities.get_full_path(path))
citygml_out.save_gml(self, new_path)
check.heat_capac == material.heat_capac:
warnings.warn(warning_text)
add_to_xml = False
break
if add_to_xml is True:
mat_pyxb = mat_bind.MaterialType()
mat_pyxb.name = material.name
mat_pyxb.density = material.density
mat_pyxb.thermal_conduc = material.thermal_conduc
mat_pyxb.heat_capac = material.heat_capac
mat_pyxb.material_id = material.material_id
mat_binding.Material.append(mat_pyxb)
out_file = open(utilities.get_full_path(data_class.path_mat), "w")
out_file.write(mat_binding.toDOM().toprettyxml())