Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import teaser.logic.utilities as utils
- import os
- """This module contains an example that shows to create a building not using
- the archetype approach but adding all information separately. In this example
- we import all needed modules and classes where we need it in the code. For you
- application we suggest to use PEP008 and import them at the beginning of the
- script.
- """
- def example_create_building():
- """"This function demonstrates generating a building adding all
- information separately"""
- # First step: Import the TEASER API (called Project) into your Python module
- from teaser.project import Project
- # To use the API instantiate the Project class and rename the Project. The
- # parameter load_data=True indicates that we load data into our
- # Project (e.g. for Material properties and typical wall constructions.
- # This can take a few seconds, depending on the size of the used data base.
- prj = Project(load_data=True)
- prj.name = "BuildingExample"
- # Instantiate a Building class and set the Project API as a parent to
- # this building. This will automatically add this building and all its
- # future changes to the project. This is helpful as we can use the data
- # base and API functions (like explained in e2 - e5). We also set some
- # building parameters. Be careful: Dymola does not like whitespaces in
- # names and filenames, thus we will delete them anyway in TEASER.
- from teaser.logic.buildingobjects.building import Building
- bldg = Building(parent=prj)
- bldg.name = "SuperExampleBuilding"
- bldg.street_name = "AwesomeAvenue42"
- bldg.city = "46325FantasticTown"
- bldg.year_of_construction = 2015
- bldg.number_of_floors = 1
- bldg.height_of_floors = 3.5
- # Instantiate a ThermalZone class and set the Building as a parent of it.
- # Set some parameters of the thermal zone. Be careful: Dymola does not
- # like whitespaces in names and filenames, thus we will delete them
- # anyway in TEASER.
- from teaser.logic.buildingobjects.thermalzone import ThermalZone
- tz = ThermalZone(parent=bldg)
- tz.name = "LivingRoom"
- tz.area = 140.0
- tz.volume = tz.area * bldg.number_of_floors * bldg.height_of_floors
- tz.infiltration_rate = 0.5
- # # Instantiate BoundaryConditions and load conditions for `Living`.
- # from teaser.logic.buildingobjects.boundaryconditions.boundaryconditions \
- # import BoundaryConditions
- # tz.use_conditions = BoundaryConditions(parent=tz)
- # tz.use_conditions.load_use_conditions("Living", prj.data)
- # Define two building elements reflecting a pitched roof (south = 180° and
- # north = 0°). Setting the the ThermalZone as a parent will automatically
- # assign this element to the thermal zone. We also set names, tilt and
- # coefficients for heat transfer on the inner and outer side of the
- # roofs. If the building has a flat roof, please use -1 as
- # orientation. Please read the docs to get more information on these
- # parameters.
- from teaser.logic.buildingobjects.buildingphysics.rooftop import Rooftop
- roof_south = Rooftop(parent=tz)
- roof_south.name = "Roof_South_DK_TEST"
- roof_south.building_age_group = [2005, 2015]
- roof_south.construction_type = "tabula_standard_2_SFH"
- roof_south.area = 75.0
- roof_south.orientation = 180.0
- roof_south.tilt = 55.0
- roof_south.inner_convection = 1.7
- roof_south.outer_convection = 20.0
- roof_south.inner_radiation = 5.0
- roof_south.outer_radiation = 5.0
- # To define the wall constructions we need to instantiate Layer and
- # Material objects and set attributes. id indicates the order of wall
- # construction from inside to outside (so 0 is on the inner surface). You
- # need to set this value!
- from teaser.logic.buildingobjects.buildingphysics.layer import Layer
- from teaser.data.dataclass import DataClass
- empty_data = DataClass()
- empty_data.element_bind = None
- empty_data.path_tb = utils.get_full_path(
- os.path.join(
- 'data',
- 'input',
- 'inputdata',
- 'TypeElements_TABULA_DK.xml'))
- empty_data.load_tb_binding()
- # First layer south
- layer_s1 = Layer(parent=roof_south, id=0)
- layer_s1.thickness = 0.3
- from teaser.logic.buildingobjects.buildingphysics.material import Material
- material_s1 = Material(layer_s1)
- material_s1.load_material_template("Insulation_DK_1", data_class=empty_data)
- # material_s1.save_type_element()
- # material_s1.save_material_template(empty_data)
- # Second layer south
- layer_s2 = Layer(parent=roof_south, id=1)
- layer_s2.thickness = 0.15
- material_s2 = Material(layer_s2)
- material_s2.load_material_template("Tile", data_class=empty_data)
- roof_south.save_type_element(empty_data)
- if __name__ == '__main__':
- example_create_building()
- print("Example 6: That's it :)")
Add Comment
Please, Sign In to add comment