Guest User

Untitled

a guest
Sep 19th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.82 KB | None | 0 0
  1. import teaser.logic.utilities as utils
  2. import os
  3. """This module contains an example that shows to create a building not using
  4. the archetype approach but adding all information separately. In this example
  5. we import all needed modules and classes where we need it in the code. For you
  6. application we suggest to use PEP008 and import them at the beginning of the
  7. script.
  8. """
  9.  
  10.  
  11. def example_create_building():
  12. """"This function demonstrates generating a building adding all
  13. information separately"""
  14.  
  15. # First step: Import the TEASER API (called Project) into your Python module
  16.  
  17. from teaser.project import Project
  18.  
  19. # To use the API instantiate the Project class and rename the Project. The
  20. # parameter load_data=True indicates that we load data into our
  21. # Project (e.g. for Material properties and typical wall constructions.
  22. # This can take a few seconds, depending on the size of the used data base.
  23.  
  24. prj = Project(load_data=True)
  25. prj.name = "BuildingExample"
  26.  
  27. # Instantiate a Building class and set the Project API as a parent to
  28. # this building. This will automatically add this building and all its
  29. # future changes to the project. This is helpful as we can use the data
  30. # base and API functions (like explained in e2 - e5). We also set some
  31. # building parameters. Be careful: Dymola does not like whitespaces in
  32. # names and filenames, thus we will delete them anyway in TEASER.
  33.  
  34. from teaser.logic.buildingobjects.building import Building
  35.  
  36. bldg = Building(parent=prj)
  37. bldg.name = "SuperExampleBuilding"
  38. bldg.street_name = "AwesomeAvenue42"
  39. bldg.city = "46325FantasticTown"
  40. bldg.year_of_construction = 2015
  41. bldg.number_of_floors = 1
  42. bldg.height_of_floors = 3.5
  43.  
  44. # Instantiate a ThermalZone class and set the Building as a parent of it.
  45. # Set some parameters of the thermal zone. Be careful: Dymola does not
  46. # like whitespaces in names and filenames, thus we will delete them
  47. # anyway in TEASER.
  48.  
  49. from teaser.logic.buildingobjects.thermalzone import ThermalZone
  50.  
  51. tz = ThermalZone(parent=bldg)
  52. tz.name = "LivingRoom"
  53. tz.area = 140.0
  54. tz.volume = tz.area * bldg.number_of_floors * bldg.height_of_floors
  55. tz.infiltration_rate = 0.5
  56.  
  57. # # Instantiate BoundaryConditions and load conditions for `Living`.
  58.  
  59. # from teaser.logic.buildingobjects.boundaryconditions.boundaryconditions \
  60. # import BoundaryConditions
  61.  
  62. # tz.use_conditions = BoundaryConditions(parent=tz)
  63. # tz.use_conditions.load_use_conditions("Living", prj.data)
  64.  
  65. # Define two building elements reflecting a pitched roof (south = 180° and
  66. # north = 0°). Setting the the ThermalZone as a parent will automatically
  67. # assign this element to the thermal zone. We also set names, tilt and
  68. # coefficients for heat transfer on the inner and outer side of the
  69. # roofs. If the building has a flat roof, please use -1 as
  70. # orientation. Please read the docs to get more information on these
  71. # parameters.
  72.  
  73. from teaser.logic.buildingobjects.buildingphysics.rooftop import Rooftop
  74.  
  75. roof_south = Rooftop(parent=tz)
  76. roof_south.name = "Roof_South_DK_TEST"
  77. roof_south.building_age_group = [2005, 2015]
  78. roof_south.construction_type = "tabula_standard_2_SFH"
  79. roof_south.area = 75.0
  80. roof_south.orientation = 180.0
  81. roof_south.tilt = 55.0
  82. roof_south.inner_convection = 1.7
  83. roof_south.outer_convection = 20.0
  84. roof_south.inner_radiation = 5.0
  85. roof_south.outer_radiation = 5.0
  86.  
  87. # To define the wall constructions we need to instantiate Layer and
  88. # Material objects and set attributes. id indicates the order of wall
  89. # construction from inside to outside (so 0 is on the inner surface). You
  90. # need to set this value!
  91.  
  92. from teaser.logic.buildingobjects.buildingphysics.layer import Layer
  93. from teaser.data.dataclass import DataClass
  94.  
  95. empty_data = DataClass()
  96. empty_data.element_bind = None
  97. empty_data.path_tb = utils.get_full_path(
  98. os.path.join(
  99. 'data',
  100. 'input',
  101. 'inputdata',
  102. 'TypeElements_TABULA_DK.xml'))
  103. empty_data.load_tb_binding()
  104. # First layer south
  105.  
  106. layer_s1 = Layer(parent=roof_south, id=0)
  107. layer_s1.thickness = 0.3
  108.  
  109. from teaser.logic.buildingobjects.buildingphysics.material import Material
  110.  
  111. material_s1 = Material(layer_s1)
  112. material_s1.load_material_template("Insulation_DK_1", data_class=empty_data)
  113.  
  114. # material_s1.save_type_element()
  115.  
  116. # material_s1.save_material_template(empty_data)
  117.  
  118. # Second layer south
  119.  
  120. layer_s2 = Layer(parent=roof_south, id=1)
  121. layer_s2.thickness = 0.15
  122.  
  123. material_s2 = Material(layer_s2)
  124. material_s2.load_material_template("Tile", data_class=empty_data)
  125.  
  126. roof_south.save_type_element(empty_data)
  127.  
  128.  
  129. if __name__ == '__main__':
  130. example_create_building()
  131. print("Example 6: That's it :)")
Add Comment
Please, Sign In to add comment