Coverage for bim2sim/plugins/PluginOpenFOAM/bim2sim_openfoam/examples/e16_openfoam_import_IFC-HVAC.py: 0%
26 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_16():
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_openfoam16_').name)
32 # Set the ifc path to use and define which domain the IFC belongs to
33 ifc_paths = {
34 IFCDomain.arch:
35 Path(r'C:\Users\richter\sciebo\01-Studentenarbeiten\03-MA\05_MA_Bruns\08_Dateien\2024-04-23_3rooms_240317_Heater_AirTerminal_Table.ifc'),
36 }
38 # Create a project including the folder structure for the project with
39 # energyplus as backend
40 project = Project.create(project_path, ifc_paths, 'openfoam')
42 # set weather file data
43 project.sim_settings.weather_file_path = (
44 Path(bim2sim.__file__).parent.parent /
45 'test/resources/weather_files/DEU_NW_Aachen.105010_TMYx.epw')
46 # Set the install path to your EnergyPlus installation according to your
47 # system requirements
48 project.sim_settings.ep_install_path = 'C://EnergyPlusV9-4-0/'
50 # Set other simulation settings, otherwise all settings are set to default
51 project.sim_settings.cfd_export = True
52 project.sim_settings.select_space_guid = '2_p5o3S0b78AkDwuwKWtE8'
53 project.sim_settings.inlet_type = 'SimpleStlDiffusor'
54 project.sim_settings.outlet_type = 'SimpleStlDiffusor'
55 project.sim_settings.add_heating = True
56 project.sim_settings.add_people = False
57 project.sim_settings.add_floorheating = False
58 project.sim_settings.add_airterminals = True
59 project.sim_settings.add_comfort = True
60 project.sim_settings.output_keys = ['output_outdoor_conditions',
61 'output_zone_temperature',
62 'output_zone', 'output_infiltration',
63 'output_meters',
64 'output_internal_gains']
65 # project.sim_settings.level_heat_balance = False
67 answers = (*('HVAC-AirTerminal',)*2, None, 'HVAC-SpaceHeater')
68 # Run the project with the ConsoleDecisionHandler. This allows interactive
69 # input to answer upcoming questions regarding the imported IFC.
70 run_project(project, DebugDecisionHandler(answers))
71 # run_project(project, ConsoleDecisionHandler())
74if __name__ == '__main__':
75 run_example_16()