Coverage for bim2sim/plugins/PluginTEASER/bim2sim_teaser/examples/e2_complex_project_teaser.py: 0%
40 statements
« prev ^ index » next coverage.py v7.6.12, created at 2025-03-12 17:09 +0000
« prev ^ index » next coverage.py v7.6.12, created at 2025-03-12 17:09 +0000
1import tempfile
2from pathlib import Path
4import bim2sim
5from bim2sim import Project
6from bim2sim.kernel.decision.decisionhandler import DebugDecisionHandler
7from bim2sim.utilities.types import IFCDomain, LOD, ZoningCriteria
8from bim2sim.utilities.common_functions import download_library
11def run_example_complex_building_teaser():
12 """Run a building performance simulation with PluginTEASER.
14 This example creates a BEPS simulation model and performs the simulation
15 in Dymola based on the DigitalHub IFC using PluginTEASER.
16 """
17 # Create a temp directory for the project, feel free to use a "normal"
18 # directory
19 project_path = Path(
20 tempfile.TemporaryDirectory(prefix='bim2sim_example1').name)
22 # Set the ifc path to use and define which domain the IFC belongs to
23 ifc_paths = {
24 IFCDomain.arch:
25 Path(bim2sim.__file__).parent.parent /
26 'test/resources/arch/ifc/FM_ARC_DigitalHub_with_SB89.ifc',
27 }
29 # Create a project including the folder structure for the project with
30 # teaser as backend and no specified workflow (default workflow is taken)
31 project = Project.create(project_path, ifc_paths, 'teaser')
33 # specify simulation settings (please have a look at the documentation of
34 # all under concepts/sim_settings
35 # combine spaces to thermal zones based on their usage
36 project.sim_settings.zoning_criteria = ZoningCriteria.usage
37 # use cooling
38 project.sim_settings.cooling_tz_overwrite = True
39 project.sim_settings.setpoints_from_template = True
41 project.sim_settings.ahu_heating_overwrite = True
42 project.sim_settings.ahu_cooling_overwrite = True
43 project.sim_settings.ahu_heat_recovery_overwrite = True
45 # overwrite existing layer structures and materials based on templates
46 project.sim_settings.layers_and_materials = LOD.low
47 # specify templates for the layer and material overwrite
48 project.sim_settings.construction_class_walls = 'iwu_heavy'
49 project.sim_settings.construction_class_windows = \
50 'Alu- oder Stahlfenster, Waermeschutzverglasung, zweifach'
52 # set weather file data
53 project.sim_settings.weather_file_path = (
54 Path(bim2sim.__file__).parent.parent /
55 'test/resources/weather_files/DEU_NW_Aachen.105010_TMYx.mos')
56 # Run a simulation directly with dymola after model creation
57 project.sim_settings.dymola_simulation = True
58 # Make sure that AixLib modelica library exist on machine by cloning it and
59 # setting the path of it as a sim_setting
60 repo_url = "https://github.com/RWTH-EBC/AixLib.git"
61 branch_name = "main"
62 repo_name = "AixLib"
63 path_aixlib = (
64 Path(bim2sim.__file__).parent.parent / "local" / f"library_{repo_name}")
65 download_library(repo_url, branch_name, path_aixlib)
66 project.sim_settings.path_aixlib = path_aixlib / repo_name / 'package.mo'
67 # Select results to output:
68 project.sim_settings.sim_results = [
69 "heat_demand_total", "cool_demand_total",
70 "heat_demand_rooms", "cool_demand_rooms",
71 "heat_energy_total", "cool_energy_total",
72 "heat_energy_rooms", "cool_energy_rooms",
73 "operative_temp_rooms", "air_temp_rooms", "air_temp_out",
74 "internal_gains_machines_rooms", "internal_gains_persons_rooms",
75 "internal_gains_lights_rooms",
76 "heat_set_rooms",
77 "cool_set_rooms"
78 ]
79 project.sim_settings.prj_use_conditions = (Path(
80 bim2sim.__file__).parent.parent /
81 "test/resources/arch/custom_usages/"
82 "UseConditionsFM_ARC_DigitalHub.json")
83 project.sim_settings.prj_custom_usages = (Path(
84 bim2sim.__file__).parent.parent /
85 "test/resources/arch/custom_usages/"
86 "customUsagesFM_ARC_DigitalHub_with_SB89.json")
87 # create plots based on the results after simulation
88 project.sim_settings.create_plots = True
90 # Run the project with pre-configured answers for decisions
91 space_boundary_genenerator = 'Other'
92 handle_proxies = (*(None,) * 12,)
93 construction_year = 2015
94 answers = (space_boundary_genenerator,
95 *handle_proxies,
96 construction_year)
97 handler = DebugDecisionHandler(answers)
98 handler.handle(project.run())
101if __name__ == '__main__':
102 run_example_complex_building_teaser()