Coverage for bim2sim/plugins/PluginOpenFOAM/bim2sim_openfoam/examples/e17_openfoam_import_IFC-HVAC_multi_files.py: 0%
34 statements
« prev ^ index » next coverage.py v7.10.7, created at 2025-10-01 10:24 +0000
« prev ^ index » next coverage.py v7.10.7, created at 2025-10-01 10:24 +0000
1import tempfile
2from pathlib import Path
4import bim2sim
5from bim2sim import Project, run_project, ConsoleDecisionHandler
6from bim2sim.kernel.decision.decisionhandler import DebugDecisionHandler
7from bim2sim.utilities.types import IFCDomain
10def run_example_17():
11 """
12 Prepare an OpenFOAM case with ventilation and a radiator including
13 meshing and running the simulation on linux.
15 This example runs a BPS with the EnergyPlus backend and a CFD simulation
16 with the OpenFOAM backend. It specifies project
17 directory and location of the IFC file. Then, it creates a bim2sim
18 project with the EnergyPlus backend. Simulation settings are specified
19 (EnergyPlus location needs to be specified according to your system,
20 other settings are set to default if not specified otherwise),
21 before the project is executed with the previously specified settings.
23 The EnergyPlus simulation is followed by the setup of the OpenFOAM
24 CFD use case, which bases on the same IFC input as the previously set
25 up EnergyPlus use case.
26 """
27 # Create a temp directory for the project, feel free to use a "normal"
28 # directory
29 project_path = Path(
30 tempfile.TemporaryDirectory(prefix='bim2sim_openfoam17_').name)
32 # Set the ifc path to use and define which domain the IFC belongs to
33 ifc_paths = {
34 IFCDomain.arch:
35 Path(bim2sim.__file__).parent.parent /
36 'test/resources/arch/ifc/FM_ARC_DigitalHub_with_SB89.ifc',
37 IFCDomain.ventilation:
38 Path(bim2sim.__file__).parent.parent /
39 'test/resources/hydraulic/ifc/DigitalHub_Gebaeudetechnik'
40 '-LUEFTUNG_v2.ifc',
41 IFCDomain.hydraulic:
42 Path(bim2sim.__file__).parent.parent /
43 'test/resources/hydraulic/ifc/DigitalHub_Gebaeudetechnik-HEIZUNG_v2'
44 '.ifc',
45 }
47 # Create a project including the folder structure for the project with
48 # energyplus as backend
49 project = Project.create(project_path, ifc_paths, 'openfoam')
51 project.sim_settings.prj_custom_usages = (Path(
52 bim2sim.__file__).parent.parent /
53 "test/resources/arch/custom_usages/"
54 "customUsagesFM_ARC_DigitalHub_with_SB89.json")
56 # set weather file data
57 project.sim_settings.weather_file_path = (
58 Path(bim2sim.__file__).parent.parent /
59 'test/resources/weather_files/DEU_NW_Aachen.105010_TMYx.epw')
60 # Set the install path to your EnergyPlus installation according to your
61 # system requirements
62 project.sim_settings.ep_install_path = 'C://EnergyPlusV9-4-0/'
64 # Set other simulation settings, otherwise all settings are set to default
65 project.sim_settings.cfd_export = True
66 project.sim_settings.select_space_guid = '2o3MylYZzAnR8q1ofuG3sg'
67 # project.sim_settings.select_space_guid = '3hiy47ppf5B8MyZqbpTfpc'
69 # VR/AR lab: '2o3MylYZzAnR8q1ofuG3sg'
70 # Cafeteria: '3GmoJyFk9FvAnea6mogixJ'
71 project.sim_settings.inlet_type = 'Original'
72 project.sim_settings.outlet_type = 'Original'
73 project.sim_settings.add_heating = True
74 project.sim_settings.add_people = True
75 project.sim_settings.add_floorheating = False
76 project.sim_settings.add_airterminals = True
77 project.sim_settings.add_comfort = True
78 project.sim_settings.add_furniture = True
79 project.sim_settings.add_people = True
80 project.sim_settings.add_comfort = True
81 project.sim_settings.furniture_setting = 'Office'
82 project.sim_settings.furniture_amount = 12
83 project.sim_settings.people_amount = 7
84 project.sim_settings.people_setting = 'Seated'
85 project.sim_settings.output_keys = ['output_outdoor_conditions',
86 'output_zone_temperature',
87 'output_zone', 'output_infiltration',
88 'output_meters',
89 'output_internal_gains']
90 # project.sim_settings.level_heat_balance = False
92 answers = ('Autodesk Revit','Autodesk Revit', *(None,)*13,
93 *('HVAC-AirTerminal',)*3,
94 *(None,)*2, 2015)
95 # Run the project with the ConsoleDecisionHandler. This allows interactive
96 # input to answer upcoming questions regarding the imported IFC.
97 run_project(project, DebugDecisionHandler(answers))
98 # run_project(project, ConsoleDecisionHandler())
101if __name__ == '__main__':
102 run_example_17()