def parameter_room1(): prj = Project(False) prj.name = "VDI_Verification_Room1" prj.load_project( utilities.get_full_path("examples/examplefiles/VDI6007_Room1.json")) prj.buildings[0].calc_building_parameter(number_of_elements=2, merge_windows=True, used_library='AixLib') return prj
def main(): prj = Project(load_data=True) prj.name = "ResidentialCommunityUK_rad" # Building types: detached, terrace, office_lowenergy-early1980s, office_highcost-mid1980s. # Community created based on prj = load_namespace('teaser_prj_residentialUK') prj.name = "ResidentialCommunityUK_rad_2elements" prj.used_library_calc = 'IBPSA' prj.number_of_elements_calc = 3 prj.weather_file_path = os.path.join('path_to_weather_file', 'Nottingham_TRY.mos') prj.calc_all_buildings(raise_errors=True) store_namespace('teaser_prj_residential',prj) bldg_list=[] for bldg in prj.buildings: bldg_list.append(bldg.name) store_namespace('teaser_bldgs_residential',bldg_list) prj.export_parameters_txt(path="\\models") prj.export_ibpsa( internal_id=None, path="\models\\" ) for bldg in prj.buildings: for zone in bldg.thermal_zones: path = os.path.join("\models\\", prj.name) create_ibpsa_mpc_model(prj,bldg,zone,path=path) create_ibpsa_PI_model(prj,bldg,zone,path=path)
def example_generate_simple_district_building(): """"This function demonstrates the generation of residential and non-residential archetype buildings using the API function of TEASER""" """First step: Import the TEASER API (called Project) into your Python module To use the API instantiate the Project class and rename the Project. The parameter load_data=True indicates that we load `iwu` typology archetype 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). Be careful: Dymola does not like whitespaces in names and filenames, thus we will delete them anyway in TEASER.""" prj = Project(load_data=True) prj.name = "Simple_District_Destest_AixLib" # There are two different types of archetype groups: residential and # non-residential buildings. Two API functions offer the opportunity to # generate specific archetypes. """To generate residential archetype buildings the function Project.add_residential() is used. Seven parameters are compulsory, additional parameters can be set according to the used method. `method` and `usage` are used to distinguish between different archetype methods. The name, year_of_construction, number and height of floors and net_leased_area need to be set to provide enough information for archetype generation. For specific information on the parameters please read the docs.""" bldg = prj.add_residential(method='tabula_de', usage='single_family_house', name="SimpleDistrictBuilding", year_of_construction=1980, number_of_floors=2, height_of_floors=3.5, net_leased_area=128, construction_type='tabula_standard') bldg.zone_area_factors = { "SingleDwelling": [0.5, "Living"], "BedRoom": [0.5, "Bed room"] } bldg.generate_archetype() return prj
def example_type_building(): """"First thing we need to do is to import our Project API module""" from teaser.project import Project """We instantiate the Project class. The parameter load_data = True indicates that we load the XML data bases into our Project. This can take a few sec.""" prj = Project(load_data=True) prj.name = "ArchetypeBuildings_Ref" """The five functions starting with type_bldg giving us the opportunity to create the specific type building (e.g. type_bldg_residential). The function automatically calculates all the necessary parameter. If not specified different it uses vdi calculation method.""" prj.type_bldg_residential(name="ResidentialBuilding", year_of_construction=1988, number_of_floors=2, height_of_floors=3.5, net_leased_area=100, with_ahu=True, residential_layout=1, neighbour_buildings=1, attic=1, cellar=1, construction_type="heavy", dormer=1) prj.type_bldg_office(name="Office1", year_of_construction=1988, number_of_floors=2, height_of_floors=3.5, net_leased_area=100, office_layout=1, window_layout=1, with_ahu=True, construction_type="heavy") ''' We need to set the projects calculation method. The library we want to use is AixLib, we are using a two element model and want an extra resistance for the windows. To export the parameters to a Modelica record, we use the export_aixlib function. path = None indicates, that we want to store the records in TEASER'S Output folder ''' prj.used_library_calc = 'AixLib' prj.number_of_elements_calc = 2 prj.merge_windows_calc = False prj.calc_all_buildings() ''' Export the Modelica Record. If you have a Dymola License you can export the model with a central AHU (MultizoneEquipped) (only default for office and institute buildings) ''' prj.export_aixlib(building_model="MultizoneEquipped", zone_model="ThermalZoneEquipped", corG=True, internal_id=None, path=None) ''' For OpenModelica you need to exclude the centralAHU (because it is using state machines). Therefore use the building_model "Multizone" ''' #prj.export_aixlib(building_model="Multizone", # zone_model="ThermalZoneEquipped", # corG=True, # internal_id=None, # path=None) '''Or we use Annex60 method (e.g with four elements). Which exports one Model per zone''' #prj.used_library_calc = 'Annex60' #prj.number_of_elements_calc = 4 #prj.merge_windows_calc = False #prj.calc_all_buildings() #prj.export_annex() """Now we retrofit all buildings in the year 2015 (EnEV2014). \ That includes new insulation layer and new windows. The name is changed \ to Retrofit""" prj.name = "ArchetypeBuildings_Retrofit" prj.retrofit_all_buildings(2015) prj.calc_all_buildings() '''You could also change the exports here as seen above''' prj.export_aixlib(building_model="MultizoneEquipped", zone_model="ThermalZoneEquipped", corG=True, internal_id=None, path=None) prj.save_project("Retrofit_Building", path=None) '''Save the human readable output txt''' prj.export_parameters_txt(path=None) ''' Save the human readable output txt ''' prj.save_citygml(path=None)
tz.use_conditions.max_ahu = ahu_dict[key][1] _i = 1 if _i == 0: warnings.warn( "The zone %s could not be found in your ahu_dict. Hence, " "no AHU flow is defined. The default value is " "0 (min_ahu = 0; max_ahu=0" % tz.name) return project, data if __name__ == "__main__": result_path = os.path.dirname(__file__) prj = Project(load_data=True) prj.name = "BuildingGeneratedviaExcelImport" prj.data.load_uc_binding() prj.weather_file_path = os.path.join( os.path.dirname(os.path.dirname(__file__)), "data", "input", "inputdata", "weatherdata", "DEU_BW_Mannheim_107290_TRY2010_12_Jahr_BBSR.mos", ) prj.modelica_info.weekday = 0 # 0-Monday, 6-Sunday prj.modelica_info.simulation_start = 0 # start time for simulation PathToExcel = os.path.join(os.path.dirname(__file__), "examplefiles", "ExcelBuildingData_Sample.xlsx") prj, Data = import_building_from_excel(prj,
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" 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 roof_north = Rooftop(parent=tz) roof_north.name = "Roof_North" roof_north.area = 75.0 roof_north.orientation = 0.0 roof_north.tilt = 55.0 roof_north.inner_convection = 1.7 roof_north.outer_convection = 20.0 roof_north.inner_radiation = 5.0 roof_north.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 # 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.name = "Insulation" material_s1.density = 120.0 material_s1.heat_capac = 0.04 material_s1.thermal_conduc = 1.0 # Second layer south layer_s2 = Layer(parent=roof_south, id=1) layer_s2.thickness = 0.15 material_s2 = Material(layer_s2) material_s2.name = "Tile" material_s2.density = 1400.0 material_s2.heat_capac = 0.6 material_s2.thermal_conduc = 2.5 # First layer north layer_n1 = Layer(parent=roof_north, id=0) layer_n1.thickness = 0.3 from teaser.logic.buildingobjects.buildingphysics.material import Material material_n1 = Material(layer_n1) material_n1.name = "Insulation" material_n1.density = 120.0 material_n1.heat_capac = 0.04 material_n1.thermal_conduc = 1.0 # Second layer north layer_n2 = Layer(parent=roof_north, id=1) layer_n2.thickness = 0.15 material_n2 = Material(layer_n2) material_n2.name = "Tile" material_n2.density = 1400.0 material_n2.heat_capac = 0.6 material_n2.thermal_conduc = 2.5 # Another option is to use the database for typical wall constructions, # but set area, tilt, orientation individually. To simplify code, # we save individual information for exterior walls, interior walls into # dictionaries. # outer walls # {'name_of_wall': [area, tilt, orientation]} # interior walls # {'name_of_wall': [area, tilt, orientation]} from teaser.logic.buildingobjects.buildingphysics.outerwall import OuterWall out_wall_dict = {"OuterWall_north": [10.0, 90.0, 0.0], "OuterWall_east": [14.0, 90.0, 90.0], "OuterWall_south": [10.0, 90.0, 180.0], "OuterWall_west": [14.0, 90.0, 270.0]} # For ground floors the orientation is always -2 ground_floor_dict = {"GroundFloor": [100.0, 0.0, -2]} from teaser.logic.buildingobjects.buildingphysics.innerwall import InnerWall in_wall_dict = {"InnerWall1": [10.0], "InnerWall2": [14.0], "InnerWall3": [10.0]} for key, value in out_wall_dict.items(): # Instantiate class, key is the name out_wall = OuterWall(parent=tz) out_wall.name = key # Use load_type_element() function of the building element, and pass # over the year of construction of the building and the type of # construction (in this case `heavy`). out_wall.load_type_element( year=bldg.year_of_construction, construction='heavy') # area, tilt and orientation need to be set individually. out_wall.area = value[0] out_wall.tilt = value[1] out_wall.orientation = value[2] # Repeat the procedure for inner walls and ground floors for key, value in in_wall_dict.items(): in_wall = InnerWall(parent=tz) in_wall.name = key in_wall.load_type_element( year=bldg.year_of_construction, construction='heavy') in_wall.area = value[0] from teaser.logic.buildingobjects.buildingphysics.groundfloor import \ GroundFloor for key, value in ground_floor_dict.items(): ground = GroundFloor(parent=tz) ground.name = key ground.load_type_element( year=bldg.year_of_construction, construction='heavy') ground.area = value[0] ground.tilt = value[1] ground.orientation = value[2] from teaser.logic.buildingobjects.buildingphysics.window import Window win_dict = {"Window_east": [5.0, 90.0, 90.0], "Window_south": [8.0, 90.0, 180.0], "Window_west": [5.0, 90.0, 270.0]} for key, value in win_dict.items(): win = Window(parent=tz) win.name = key win.area = value[0] win.tilt = value[1] win.orientation = value[2] # Additional to the already known attributes the window has # additional attributes. Window.g_value describes the solar gain # through windows, a_conv the convective heat transmission due to # absorption of the window on the inner side. shading_g_total and # shading_max_irr refers to the shading (solar gain reduction of the # shading and shading_max_irr the threshold of irradiance to # automatically apply shading). win.inner_convection = 1.7 win.inner_radiation = 5.0 win.outer_convection = 20.0 win.outer_radiation = 5.0 win.g_value = 0.789 win.a_conv = 0.03 win.shading_g_total = 0.0 win.shading_max_irr = 180.0 # One equivalent layer for windows win_layer = Layer(parent=win) win_layer.id = 1 win_layer.thickness = 0.024 # Material for glass win_material = Material(win_layer) win_material.name = "GlasWindow" win_material.thermal_conduc = 0.067 win_material.transmittance = 0.9
def from_scratch( number_of_elements, save=False, path=utilities.get_default_path()): """This function creates the test room from scratch. Notes: The standard defines an solar absorption coefficient for interior surfaces of 0.6. We do not consider this, but we could by multiplying the solar radiation after the window by 0.6. Parameters ---------- number_of_elements: int Number of elements of model path: str (optional) Path where Project should be stored as .teaserXML save: bool (optional) True if Project should be stored as .teaserXML at path Returns ------- prj: Project Project that contains the building with the test room """ prj = Project(load_data=True) prj.name = "ASHRAE140Verification" bldg = Building(parent=prj) bldg.name = "TestBuilding" tz = ThermalZone(parent=bldg) tz.name = "TestRoom900" tz.area = 8.0 * 6.0 tz.volume = tz.area * 2.7 tz.infiltration_rate = 0.41 tz.use_conditions = BoundaryConditions(parent=tz) roof = Rooftop(parent=tz) roof.name = "Roof" roof.area = 8.0 * 6.0 roof.orientation = -1.0 roof.tilt = 0.0 roof.inner_convection = 1 roof.outer_convection = 24.67 roof.inner_radiation = 5.13 roof.outer_radiation = 4.63 layer_r1 = Layer(parent=roof, id=0) layer_r1.thickness = 0.01 material_r1 = Material(layer_r1) material_r1.name = "Plasterboard" material_r1.density = 950.0 material_r1.heat_capac = 840.0 / 1000 material_r1.thermal_conduc = 0.16 material_r1.ir_emissivity = 0.9 layer_r2 = Layer(parent=roof, id=1) layer_r2.thickness = 0.1118 material_r2 = Material(layer_r2) material_r2.name = "Fiberglass" material_r2.density = 12 material_r2.heat_capac = 840 / 1000 material_r2.thermal_conduc = 0.04 layer_r3 = Layer(parent=roof, id=2) layer_r3.thickness = 0.019 material_r3 = Material(layer_r3) material_r3.name = "Roofdeck" material_r3.density = 530 material_r3.heat_capac = 900 / 1000 material_r3.thermal_conduc = 0.14 material_r3.solar_absorp = 0.6 material_r3.ir_emissivity = 0.9 out_wall_north = OuterWall(parent=tz) out_wall_north.name = "OuterWallNorth" out_wall_north.area = 8.0 * 2.7 out_wall_north.orientation = 0.0 out_wall_north.tilt = 90.0 out_wall_north.inner_convection = 3.16 out_wall_north.outer_convection = 24.67 out_wall_north.inner_radiation = 5.13 out_wall_north.outer_radiation = 4.63 layer_own1 = Layer(parent=out_wall_north, id=0) layer_own1.thickness = 0.1 material_own1 = Material(layer_own1) material_own1.name = "Concrete" material_own1.density = 1400.0 material_own1.heat_capac = 1000 / 1000 material_own1.thermal_conduc = 0.51 material_own1.ir_emissivity = 0.9 layer_own2 = Layer(parent=out_wall_north, id=1) layer_own2.thickness = 0.062 material_own2 = Material(layer_own2) material_own2.name = "FoamInsulation" material_own2.density = 10 material_own2.heat_capac = 1400 / 1000 material_own2.thermal_conduc = 0.04 layer_own3 = Layer(parent=out_wall_north, id=2) layer_own3.thickness = 0.009 material_own3 = Material(layer_own3) material_own3.name = "WoodSiding" material_own3.density = 530 material_own3.heat_capac = 900 / 1000 material_own3.thermal_conduc = 0.14 material_own3.solar_absorp = 0.6 material_own3.ir_emissivity = 0.9 out_wall_east = OuterWall(parent=tz) out_wall_east.name = "OuterWallEast" out_wall_east.area = 6.0 * 2.7 out_wall_east.orientation = 90.0 out_wall_east.tilt = 90.0 out_wall_east.inner_convection = 3.16 out_wall_east.outer_convection = 24.67 out_wall_east.inner_radiation = 5.13 out_wall_east.outer_radiation = 4.63 layer_owe1 = Layer(parent=out_wall_east, id=0) layer_owe1.thickness = 0.1 material_owe1 = Material(layer_owe1) material_owe1.name = "Concrete" material_owe1.density = 1400.0 material_owe1.heat_capac = 1000 / 1000 material_owe1.thermal_conduc = 0.51 material_owe1.ir_emissivity = 0.9 layer_owe2 = Layer(parent=out_wall_east, id=1) layer_owe2.thickness = 0.062 material_owe2 = Material(layer_owe2) material_owe2.name = "FoamInsulation" material_owe2.density = 10 material_owe2.heat_capac = 1400 / 1000 material_owe2.thermal_conduc = 0.04 layer_owe3 = Layer(parent=out_wall_east, id=2) layer_owe3.thickness = 0.009 material_owe3 = Material(layer_owe3) material_owe3.name = "WoodSiding" material_owe3.density = 530 material_owe3.heat_capac = 900 / 1000 material_owe3.thermal_conduc = 0.14 material_owe3.solar_absorp = 0.6 material_owe3.ir_emissivity = 0.9 out_wall_south = OuterWall(parent=tz) out_wall_south.name = "OuterWallSouth" out_wall_south.area = (8.0 * 2.7) - 2 * (3 * 2) # minus two windows out_wall_south.orientation = 180.0 out_wall_south.tilt = 90.0 out_wall_south.inner_convection = 3.16 out_wall_south.outer_convection = 24.67 out_wall_south.inner_radiation = 5.13 out_wall_south.outer_radiation = 4.63 layer_ows1 = Layer(parent=out_wall_south, id=0) layer_ows1.thickness = 0.1 material_ows1 = Material(layer_ows1) material_ows1.name = "Concrete" material_ows1.density = 1400.0 material_ows1.heat_capac = 1000.0 / 1000 material_ows1.thermal_conduc = 0.51 material_ows1.ir_emissivity = 0.9 layer_ows2 = Layer(parent=out_wall_south, id=1) layer_ows2.thickness = 0.062 material_ows2 = Material(layer_ows2) material_ows2.name = "FoamInsulation" material_ows2.density = 10 material_ows2.heat_capac = 1400 / 1000 material_ows2.thermal_conduc = 0.04 layer_ows3 = Layer(parent=out_wall_south, id=2) layer_ows3.thickness = 0.009 material_ows3 = Material(layer_ows3) material_ows3.name = "WoodSiding" material_ows3.density = 530 material_ows3.heat_capac = 900 / 1000 material_ows3.thermal_conduc = 0.14 material_ows3.solar_absorp = 0.6 material_ows3.ir_emissivity = 0.9 out_wall_west = OuterWall(parent=tz) out_wall_west.name = "OuterWallWest" out_wall_west.area = 6 * 2.7 out_wall_west.orientation = 270.0 out_wall_west.tilt = 90.0 out_wall_west.inner_convection = 3.16 out_wall_west.outer_convection = 24.67 out_wall_west.inner_radiation = 5.13 out_wall_west.outer_radiation = 4.63 layer_oww1 = Layer(parent=out_wall_west, id=0) layer_oww1.thickness = 0.1 material_oww1 = Material(layer_oww1) material_oww1.name = "Concrete" material_oww1.density = 1400.0 material_oww1.heat_capac = 1000.0 / 1000 material_oww1.thermal_conduc = 0.51 material_oww1.ir_emissivity = 0.9 layer_oww2 = Layer(parent=out_wall_west, id=1) layer_oww2.thickness = 0.062 material_oww2 = Material(layer_oww2) material_oww2.name = "FoamInsulation" material_oww2.density = 10 material_oww2.heat_capac = 1400 / 1000 material_oww2.thermal_conduc = 0.04 layer_oww3 = Layer(parent=out_wall_west, id=2) layer_oww3.thickness = 0.009 material_oww3 = Material(layer_oww3) material_oww3.name = "WoodSiding" material_oww3.density = 530 material_oww3.heat_capac = 900 / 1000 material_oww3.thermal_conduc = 0.14 material_oww3.solar_absorp = 0.6 material_oww3.ir_emissivity = 0.9 in_wall_floor = Floor(parent=tz) in_wall_floor.name = "InnerWallFloor" in_wall_floor.area = 6 * 8 in_wall_floor.orientation = -2.0 in_wall_floor.tilt = 0.0 in_wall_floor.inner_convection = 4.13 in_wall_floor.inner_radiation = 5.13 layer_iwf1 = Layer(parent=in_wall_floor, id=0) layer_iwf1.thickness = 0.025 material_iwf1 = Material(layer_iwf1) material_iwf1.name = "Concrete" material_iwf1.density = 1400 material_iwf1.heat_capac = 1000 / 1000 material_iwf1.thermal_conduc = 1.13 material_iwf1.ir_emissivity = 0.9 layer_iwf2 = Layer(parent=in_wall_floor, id=1) layer_iwf2.thickness = 1.007 material_iwf2 = Material(layer_iwf2) material_iwf2.name = "Insulation" material_iwf2.density = 0.000000000001 # 0.0001, as small as possible material_iwf2.heat_capac = 0.000000000001 # 0.0001, as small as possible material_iwf2.thermal_conduc = 0.04 win_1 = Window(parent=tz) win_1.name = "WindowSouthLeft" win_1.area = 3 * 2 win_1.tilt = 90.0 win_1.orientation = 180.0 win_1.inner_convection = 3.16 win_1.inner_radiation = 5.13 win_1.outer_convection = 16.37 win_1.outer_radiation = 4.63 win_1.g_value = 0.789 win_1.a_conv = 0.03 # for the given U-value extracted from VDI 6007-2/-3 win_1_layer = Layer(parent=win_1) win_1_layer.id = 1 win_1_layer.thickness = 0.024 win_1_material = Material(win_1_layer) win_1_material.name = "GlasWindow" win_1_material.thermal_conduc = 0.15 win_1_material.transmittance = 0.907 win_1_material.ir_emissivity = 0.9 win_2 = Window(parent=tz) win_2.name = "WindowSouthRight" win_2.area = 3 * 2 win_2.tilt = 90.0 win_2.orientation = 180.0 win_2.inner_convection = 3.16 win_2.inner_radiation = 5.13 win_2.outer_convection = 16.37 win_2.outer_radiation = 4.63 win_2.g_value = 0.789 win_2.a_conv = 0.03 # for the given U-value extracted from VDI 6007-2/-3 win_2_layer = Layer(parent=win_2) win_2_layer.id = 1 win_2_layer.thickness = 0.024 win_2_material = Material(win_2_layer) win_2_material.name = "GlasWindow" win_2_material.thermal_conduc = 0.15 win_2_material.transmittance = 0.907 win_2_material.ir_emissivity = 0.9 # This is a dummy ground floor to export three and four elements models. # Please set values for floor plate in three element and four element # models to default. if number_of_elements >= 3: out_wall_gf = GroundFloor(parent=tz) out_wall_gf.name = "ExtWallGroundFloor" out_wall_gf.area = 6 * 8 out_wall_gf.orientation = -2.0 out_wall_gf.tilt = 0.0 out_wall_gf.inner_convection = 4.13 out_wall_gf.inner_radiation = 5.13 layer_ofgw1 = Layer(parent=out_wall_gf, id=0) layer_ofgw1.thickness = 1.003 material_ofgw1 = Material(layer_ofgw1) material_ofgw1.name = "Insulation" material_ofgw1.density = 0.0001 # as small as possible material_ofgw1.heat_capac = 0.0001 # as small as possible material_ofgw1.thermal_conduc = 0.04 if save: prj.save_project(file_name='ASHRAE140_900', path=path) return prj
def example_type_building(): """"First thing we need to do is to import our Project API module""" from teaser.project import Project """We instantiate the Project class. The parameter load_data = True indicates that we load the XML data bases into our Project. This can take a few sec.""" prj = Project(load_data=True) prj.name = "ArchetypeBuildings" """The five functions starting with type_bldg giving us the opportunity to create the specific type building (e.g. type_bldg_residential). The function automatically calculates all the necessary parameter. If not specified different it uses vdi calculation method.""" prj.type_bldg_residential(name="ResidentialBuilding", year_of_construction=1988, number_of_floors=2, height_of_floors=3.5, net_leased_area=100, with_ahu=True, residential_layout=1, neighbour_buildings=1, attic=1, cellar=1, construction_type="heavy", dormer=1) prj.type_bldg_office(name="Office1", year_of_construction=1988, number_of_floors=2, height_of_floors=3.5, net_leased_area=100, office_layout=1, window_layout=1, with_ahu=True, construction_type="heavy") """We need to set the projects calculation method. The library we want to use is AixLib, we are using a two element model and want an extra resistance for the windows. To export the parameters to a Modelica record, we use the export_aixlib function. path = None indicates, that we want to store the records in \ TEASER'S Output folder""" prj.used_library_calc = 'AixLib' prj.number_of_elements_calc = 2 prj.merge_windows_calc = False prj.export_aixlib(building_model="MultizoneEquipped", zone_model="ThermalZoneEquipped", corG=True, internal_id=None, path=None) """or we could also use the Annex60 models""" #prj.used_library_calc = "Annex60" #prj.export_annex(number_of_elements=2, # merge_windows=False, # internal_id=None, # path=None) """Now we retrofit all buildings in the year 2015 (EnEV2014). \ That includes new insulation layer and new windows. The name is changed \ to Retrofit""" prj.name = "Project_Retrofit" prj.retrofit_all_buildings(2015) prj.calc_all_buildings(number_of_elements=2, merge_windows=False, used_library='AixLib') prj.export_aixlib(building_model="MultizoneEquipped", zone_model="ThermalZoneEquipped", corG=True, internal_id=None, path=None) prj.save_project("Retrofit_Building", path=None) '''Save the human readable output txt''' prj.export_parameters_txt(path=None) ''' Save the human readable output txt ''' prj.save_citygml(path=None)
def example_type_district(): """"First thing we need to do is to import our Project API module""" from teaser.project import Project from random import randint import buildingspy.simulate.Simulator as Si import time from multiprocessing import Pool """We instantiate the Project class. The parameter load_data = True indicates that we load the XML data bases into our Project. This can take a few sec.""" starttime = time.time() prj_est1 = Project(load_data=True) prj_est1.name = "EST1" prj_est4 = Project(load_data=True) prj_est4.name = "EST4" prj_est7 = Project(load_data=True) prj_est7.name = "EST7" """The functions starting with type_bldg giving us the opportunity to create the specific type building (e.g. type_bldg_residential). The function automatically calculates all the necessary parameter. If not specified different it uses vdi calculation method.""" number_of_buildings_est1 = 14 for building in range(1,round((number_of_buildings_est1)*0.67)+1): name_help = "Building" + str(building) year_of_construction_help = randint(1960,1980) prj_est1.type_bldg_est1a(name=name_help, year_of_construction=year_of_construction_help, number_of_floors=2, height_of_floors=3.15, net_leased_area=92, with_ahu=False, neighbour_buildings=0, construction_type="heavy") for building in range(round((number_of_buildings_est1)*0.67)+1, number_of_buildings_est1+1): name_help = "Building" + str(building) year_of_construction_help = randint(1960,1980) prj_est1.type_bldg_est1b(name=name_help, year_of_construction=year_of_construction_help, number_of_floors=2, height_of_floors=3.15, net_leased_area=92*2, with_ahu=False, neighbour_buildings=0, construction_type="heavy", number_of_apartments=2) number_of_buildings_est4 = 4 for building in range(1,number_of_buildings_est4+1): name_help = "Building" + str(building) year_of_construction_help = randint(1960,1980) prj_est4.type_bldg_est4b(name=name_help, year_of_construction=year_of_construction_help, number_of_floors=9, height_of_floors=2.6, net_leased_area=417*9, with_ahu=False, neighbour_buildings=2, construction_type="heavy", number_of_apartments=38) number_of_buildings_est7 = 29 for building in range(1,round((number_of_buildings_est7)*0.45)+1): name_help = "Building" + str(building) year_of_construction_help = randint(1900,1918) prj_est7.type_bldg_est7(name=name_help, year_of_construction=year_of_construction_help, number_of_floors=3, height_of_floors=3.88, net_leased_area=65*3, with_ahu=False, neighbour_buildings=2, construction_type="heavy", number_of_apartments=1) for building in range(round((number_of_buildings_est7)*0.45)+1, number_of_buildings_est7+1): name_help = "Building" + str(building) year_of_construction_help = randint(1900,1918) prj_est7.type_bldg_est7(name=name_help, year_of_construction=year_of_construction_help, number_of_floors=3, height_of_floors=3.88, net_leased_area=65*3, with_ahu=False, neighbour_buildings=2, construction_type="heavy", number_of_apartments=2) """To export the parameters to a Modelica record, we use the export_record function. path = None indicates, that we want to store the records in \ TEASER'S Output folder""" prj_est1.export_aixlib(building_model="MultizoneEquipped", zone_model="ThermalZoneEquipped", corG=True, internal_id=None, path=None) prj_est4.export_aixlib(building_model="MultizoneEquipped", zone_model="ThermalZoneEquipped", corG=True, internal_id=None, path=None) prj_est7.export_aixlib(building_model="MultizoneEquipped", zone_model="ThermalZoneEquipped", corG=True, internal_id=None, path=None) """Now we retrofit all buildings in the year 2015 (EnEV2014). \ That includes new insulation layer and new windows. The name is changed \ to Retrofit""" prj_est1.name = "EST1_Retrofit" prj_est1.retrofit_all_buildings(2015) prj_est1.export_aixlib(building_model="MultizoneEquipped", zone_model="ThermalZoneEquipped", corG=True, internal_id=None, path=None) prj_est4.name = "EST4_Retrofit" prj_est4.retrofit_all_buildings(2015) prj_est4.export_aixlib(building_model="MultizoneEquipped", zone_model="ThermalZoneEquipped", corG=True, internal_id=None, path=None) prj_est7.name = "EST7_Retrofit" prj_est7.retrofit_all_buildings(2015) prj_est7.export_aixlib(building_model="MultizoneEquipped", zone_model="ThermalZoneEquipped", corG=True, internal_id=None, path=None) endtime = time.time() print('Pre-processing lasts: ', endtime - starttime, ' seconds or ', (endtime - starttime) / 60, ' minutes! or', (endtime - starttime) / (60 * 60), 'hours.') starttime = time.time() """ Now we define the output directory where the simulation results should be stored, in addition we need to define the path where the exported models are""" outputdir_est1 = "D:/Dymola_workspace/EST1" packagedir_est1 = "C:/Users\mla\TEASEROutput/EST1" outputdir_est1_retrofit = "D:/Dymola_workspace/EST1_Retrofit" packagedir_est1_retrofit = "C:/Users\mla\TEASEROutput/EST1_Retrofit" outputdir_est4 = "D:/Dymola_workspace/EST4" packagedir_est4 = "C:/Users\mla\TEASEROutput/EST4" outputdir_est4_retrofit = "D:/Dymola_workspace/EST4_Retrofit" packagedir_est4_retrofit = "C:/Users\mla\TEASEROutput/EST4_Retrofit" outputdir_est7 = "D:/Dymola_workspace/EST7" packagedir_est7 = "C:/Users\mla\TEASEROutput/EST7" outputdir_est7_retrofit = "D:/Dymola_workspace/EST7_Retrofit" packagedir_est7_retrofit = "C:/Users\mla\TEASEROutput/EST7_Retrofit" """ Now we need to create a simulation list for buildingspy """ li_est1 = [] for bld in prj_est1.buildings: # this is necessary for the correct names in the simulation script name = "EST1." + bld.name + "." + bld.name s = Si.Simulator(name, "dymola", outputdir_est1, packagedir_est1) li_est1.append(s) li_est1_retrofit = [] for bld in prj_est1.buildings: # this is necessary for the correct names in the simulation script name = "EST1_Retrofit." + bld.name + "." + bld.name s = Si.Simulator(name, "dymola", outputdir_est1_retrofit, packagedir_est1_retrofit) li_est1_retrofit.append(s) li_est4 = [] for bld in prj_est4.buildings: # this is necessary for the correct names in the simulation script name = "EST4." + bld.name + "." + bld.name s = Si.Simulator(name, "dymola", outputdir_est4, packagedir_est4) li_est4.append(s) li_est4_retrofit = [] for bld in prj_est4.buildings: # this is necessary for the correct names in the simulation script name = "EST4_Retrofit." + bld.name + "." + bld.name s = Si.Simulator(name, "dymola", outputdir_est4_retrofit, packagedir_est4_retrofit) li_est4_retrofit.append(s) li_est7 = [] for bld in prj_est7.buildings: # this is necessary for the correct names in the simulation script name = "EST7." + bld.name + "." + bld.name s = Si.Simulator(name, "dymola", outputdir_est7, packagedir_est7) li_est7.append(s) li_est7_retrofit = [] for bld in prj_est7.buildings: # this is necessary for the correct names in the simulation script name = "EST7_Retrofit." + bld.name + "." + bld.name s = Si.Simulator(name, "dymola", outputdir_est7_retrofit, packagedir_est7_retrofit) li_est7_retrofit.append(s) po = Pool(processes=3) po.map(simulate_case, li_est1) po.map(simulate_case, li_est1_retrofit) po.map(simulate_case, li_est4) po.map(simulate_case, li_est4_retrofit) po.map(simulate_case, li_est7) po.map(simulate_case, li_est7_retrofit) # Timer endtime = time.time() print('Simulation lasts: ', endtime - starttime, ' seconds or ', (endtime - starttime) / 60, ' minutes! or', (endtime - starttime) / (60 * 60), 'hours.')
def example_generate_archetype(): """"This function demonstrates the generation of residential and non-residential archetype buildings using the API function of TEASER""" # 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 archetype 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. # Be careful: Dymola does not like whitespaces in names and filenames, # thus we will delete them anyway in TEASER. prj = Project(load_data=True) prj.name = "ArchetypeExample" # There are two different types of archetype groups: residential and # non-residential buildings. Two API functions offer the opportunity to # generate specific archetypes. # To generate residential archetype buildings the function # Project.add_residential() is used. Seven parameters are compulsory, # additional parameters can be set according to the used method. `method` # and `usage` are used to distinguish between different archetype # methods. The name, year_of_construction, number and height of floors # and net_leased_area need to be set to provide enough information for # archetype generation. For specific information on the parameters please # read the docs. prj.add_residential( method='iwu', usage='single_family_dwelling', name="ResidentialBuilding", year_of_construction=1988, number_of_floors=2, height_of_floors=3.2, net_leased_area=200) # To generate non-residential archetype buildings (in this case an # office and a laboratory (a.k.a. institute)) the function # Project.add_residential() is used. The meaning of compulsory parameters # does not differ from the residential archetype building. prj.add_non_residential( method='bmvbs', usage='office', name="OfficeBuilding", year_of_construction=1988, number_of_floors=4, height_of_floors=3.5, net_leased_area=4500) prj.add_non_residential( method='bmvbs', usage='institute', name="InstituteBuilding", year_of_construction=1952, number_of_floors=5, height_of_floors=4.0, net_leased_area=3400) return prj
def example_generate_archetype(): """"This function demonstrates the generation of residential and non-residential archetype buildings using the API function of TEASER""" # 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 `iwu` typology archetype # 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). Be careful: Dymola does not like whitespaces in names and # filenames, thus we will delete them anyway in TEASER. prj = Project(load_data=True) prj.name = "ArchetypeExample" # There are two different types of archetype groups: residential and # non-residential buildings. Two API functions offer the opportunity to # generate specific archetypes. # To generate residential archetype buildings the function # Project.add_residential() is used. Seven parameters are compulsory, # additional parameters can be set according to the used method. `method` # and `usage` are used to distinguish between different archetype # methods. The name, year_of_construction, number and height of floors # and net_leased_area need to be set to provide enough information for # archetype generation. For specific information on the parameters please # read the docs. prj.add_residential( method='iwu', usage='single_family_dwelling', name="ResidentialBuilding", year_of_construction=1988, number_of_floors=2, height_of_floors=3.2, net_leased_area=200) # To generate non-residential archetype buildings (in this case an # office and a laboratory (a.k.a. institute)) the function # Project.add_residential() is used. The meaning of compulsory parameters # does not differ from the residential archetype building. prj.add_non_residential( method='bmvbs', usage='office', name="OfficeBuilding", year_of_construction=1988, number_of_floors=4, height_of_floors=3.5, net_leased_area=4500) prj.add_non_residential( method='bmvbs', usage='institute', name="InstituteBuilding", year_of_construction=1952, number_of_floors=5, height_of_floors=4.0, net_leased_area=3400) # Besides `iwu` and `bmvbs` there is a third option for archetype # generation. We integrated the typology of TABULA Germany # (http://webtool.building-typology.eu/#bm) and other countries are about to # follow. To use TABULA archetype simple choose `tabula_de` as the method # and `single_family_house`, `multi_family_house`, `terraced_house` or # `apartment_block` as the usage. In addition you can specify the # construction type of TABULA, chose between `tabula_standard` (default), # `tabula_retrofit` or `tabula_adv_retrofit`. In this case we generate one # single and one multi family house with TABULA typology. # Please not: as we need to load ne construction information which are # rather big for TABULA, switching from one typology to another in the same # Project takes some seconds. If you know from beginning you will only use # TABULA typology you should instantiate you Project class without loading # data. Project(load_data=False). prj.add_residential( method='tabula_de', usage='single_family_house', name="ResidentialBuildingTabula", year_of_construction=1988, number_of_floors=3, height_of_floors=3.2, net_leased_area=280, construction_type='tabula_standard') prj.add_residential( method='tabula_de', usage='multi_family_house', name="ResidentialBuildingTabulaMulti", year_of_construction=1960, number_of_floors=4, height_of_floors=3.2, net_leased_area=600, construction_type='tabula_retrofit') return prj
def test_ahu_profiles(self): """Test setting AHU profiles of different lengths Related to issue 553 at https://github.com/RWTH-EBC/TEASER/issues/553 """ prj_test = Project(load_data=True) prj_test.name = "TestAHUProfiles" prj_test.add_non_residential( method="bmvbs", usage="office", name="OfficeBuilding", year_of_construction=2015, number_of_floors=4, height_of_floors=3.5, net_leased_area=1000.0, ) prj_test.used_library_calc = "AixLib" prj_test.number_of_elements_calc = 2 heating_profile_workday = [ 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, 293, ] heating_profile_week = [] for day in range(7): for val in heating_profile_workday: if day < 5: set_point = val else: set_point = 290.0 heating_profile_week.append(set_point) for zone in prj_test.buildings[-1].thermal_zones: zone.use_conditions.heating_profile = heating_profile_week zone.use_conditions.cooling_profile = heating_profile_week zone.use_conditions.persons_profile = heating_profile_week zone.use_conditions.machines_profile = heating_profile_week zone.use_conditions.lighting_profile = heating_profile_week assert (prj_test.buildings[-1].thermal_zones[-1].use_conditions. heating_profile == heating_profile_week) assert (prj_test.buildings[-1].thermal_zones[-1].use_conditions. cooling_profile == heating_profile_week) assert (prj_test.buildings[-1].thermal_zones[-1].use_conditions. persons_profile == heating_profile_week) assert (prj_test.buildings[-1].thermal_zones[-1].use_conditions. machines_profile == heating_profile_week) assert (prj_test.buildings[-1].thermal_zones[-1].use_conditions. lighting_profile == heating_profile_week)