Coverage for bim2sim/plugins/PluginOpenFOAM/bim2sim_openfoam/examples/e18_openfoam_import_IFC-HVAC_multi_overflow.py: 0%
38 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
9def run_example_18():
10 """
11 Prepare an OpenFOAM case with ventilation and a radiator including
12 meshing and running the simulation on linux.
14 This example runs a BPS with the EnergyPlus backend and a CFD simulation
15 with the OpenFOAM backend. It specifies project
16 directory and location of the IFC file. Then, it creates a bim2sim
17 project with the EnergyPlus backend. Simulation settings are specified
18 (EnergyPlus location needs to be specified according to your system,
19 other settings are set to default if not specified otherwise),
20 before the project is executed with the previously specified settings.
22 The EnergyPlus simulation is followed by the setup of the OpenFOAM
23 CFD use case, which bases on the same IFC input as the previously set
24 up EnergyPlus use case.
25 """
26 # Create a temp directory for the project, feel free to use a "normal"
27 # directory
28 tempfile.tempdir = '/mnt/sim/SimData/CFD-temp'
29 project_path = Path(
30 tempfile.TemporaryDirectory(prefix='bim2sim_openfoam18_').name)
32 # download additional test resources for arch domain, you might want to set
33 # force_new to True to update your test resources
34 # Set the ifc path to use and define which domain the IFC belongs to
35 ifc_paths = {
36 IFCDomain.arch:
37 Path(bim2sim.__file__).parent.parent /
38 'test/resources/arch/ifc/FM_ARC_DigitalHub_with_SB89.ifc',
39 IFCDomain.ventilation:
40 Path(bim2sim.__file__).parent.parent /
41 'test/resources/hydraulic/ifc/DigitalHub_Gebaeudetechnik'
42 '-LUEFTUNG_v2.ifc',
43 IFCDomain.hydraulic:
44 Path(bim2sim.__file__).parent.parent /
45 'test/resources/hydraulic/ifc/DigitalHub_Gebaeudetechnik-HEIZUNG_v2'
46 '.ifc',
47 }
49 # Create a project including the folder structure for the project with
50 # energyplus as backend
51 project = Project.create(project_path, ifc_paths, 'openfoam')
53 project.sim_settings.prj_custom_usages = (Path(
54 bim2sim.__file__).parent.parent /
55 "test/resources/arch/custom_usages/"
56 "customUsagesFM_ARC_DigitalHub_with_SB89.json")
58 # set weather file data
59 project.sim_settings.weather_file_path = (
60 Path(bim2sim.__file__).parent.parent /
61 'test/resources/weather_files/DEU_NW_Aachen.105010_TMYx.epw')
62 # Set the install path to your EnergyPlus installation according to your
63 # system requirements
64 # project.sim_settings.ep_install_path = 'C://EnergyPlusV9-4-0/'
66 # Set other simulation settings, otherwise all settings are set to default
67 project.sim_settings.cfd_export = True
68 # project.sim_settings.select_space_guid = '3GmoJyFk9FvAnea6mogixJ'
69 project.sim_settings.select_space_guid = '3hiy47ppf5B8MyZqbpTfpc'
71 # VR/AR lab: '2o3MylYZzAnR8q1ofuG3sg'
72 # Cafeteria: '3GmoJyFk9FvAnea6mogixJ'
73 project.sim_settings.inlet_type = 'Original'
74 project.sim_settings.outlet_type = 'Original'
75 project.sim_settings.add_heating = True
76 project.sim_settings.add_people = True
77 project.sim_settings.add_floorheating = False
78 project.sim_settings.add_airterminals = True
79 project.sim_settings.add_comfort = True
80 project.sim_settings.add_furniture = True
81 project.sim_settings.add_people = True
82 project.sim_settings.add_comfort = True
83 project.sim_settings.furniture_setting = 'Office'
84 project.sim_settings.furniture_amount = 8
85 project.sim_settings.people_amount = 4
86 project.sim_settings.people_setting = 'Seated'
87 project.sim_settings.run_meshing = True
88 project.sim_settings.run_cfd_simulation = True
89 project.sim_settings.radiation_precondition_time = 4000
90 project.sim_settings.radiation_model = 'preconditioned_fvDOM'
91 project.sim_settings.output_keys = ['output_outdoor_conditions',
92 'output_zone_temperature',
93 'output_zone', 'output_infiltration',
94 'output_meters',
95 'output_internal_gains']
96 # project.sim_settings.level_heat_balance = False
98 answers = ('Autodesk Revit','Autodesk Revit', *(None,)*13,
99 *('HVAC-AirTerminal',)*3,
100 *(None,)*2, 2015)
101 # Run the project with the ConsoleDecisionHandler. This allows interactive
102 # input to answer upcoming questions regarding the imported IFC.
103 run_project(project, DebugDecisionHandler(answers))
104 # run_project(project, ConsoleDecisionHandler())
107if __name__ == '__main__':
108 run_example_18()