Coverage for bim2sim/plugins/PluginOpenFOAM/bim2sim_openfoam/examples/e2_complex_project_bps_comfort_journal.py: 0%

43 statements  

« prev     ^ index     » next       coverage.py v7.10.7, created at 2025-10-01 10:24 +0000

1import tempfile 

2from pathlib import Path 

3 

4import bim2sim 

5from bim2sim import Project, ConsoleDecisionHandler 

6from bim2sim.kernel.decision.decisionhandler import DebugDecisionHandler 

7from bim2sim.utilities.types import IFCDomain, LOD, ZoningCriteria 

8 

9 

10def run_example_complex_building_openfoam(): 

11 """Run a building performance simulation with the energyplus backend. 

12 

13 ... 

14 """ 

15 # Create a temp directory for the project, feel free to use a "normal" 

16 # directory 

17 project_path = Path( 

18 tempfile.TemporaryDirectory(prefix='bim2sim_example1').name) 

19 

20 # Set the ifc path to use and define which domain the IFC belongs to 

21 ifc_paths = { 

22 IFCDomain.arch: 

23 Path(bim2sim.__file__).parent.parent / 

24 'test/resources/arch/ifc/FM_ARC_DigitalHub_with_SB89.ifc', 

25 } 

26 

27 # Create a project including the folder structure for the project with 

28 # teaser as backend and no specified workflow (default workflow is taken) 

29 project = Project.create(project_path, ifc_paths, 'openfoam') 

30 project.sim_settings.prj_use_conditions = \ 

31 (Path(bim2sim.plugins.PluginComfort.bim2sim_comfort.__file__).parent / 

32 "assets/UseConditionsComfort_FM_ARC_DigitalHub_with_SB89.json") 

33 # specify simulation settings (please have a look at the documentation of 

34 # all under concepts/sim_settings 

35 

36 # Set the install path to your EnergyPlus installation according to your 

37 # system requirements 

38 project.sim_settings.ep_install_path = 'C://EnergyPlusV9-4-0/' 

39 

40 # combine spaces to thermal zones based on their usage 

41 # use cooling 

42 project.sim_settings.cooling = True 

43 project.sim_settings.setpoints_from_template = True 

44 

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 = 'heavy' 

49 project.sim_settings.construction_class_windows = \ 

50 'Alu- oder Stahlfenster, Waermeschutzverglasung, zweifach' 

51 

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.epw') 

56 # Run a simulation directly with dymola after model creation 

57 

58 # Select results to output: 

59 project.sim_settings.sim_results = [ 

60 "heat_demand_total", "cool_demand_total", 

61 "heat_demand_rooms", "cool_demand_rooms", 

62 "heat_energy_total", "cool_energy_total", 

63 "heat_energy_rooms", "cool_energy_rooms", 

64 "operative_temp_rooms", "air_temp_rooms", "air_temp_out", 

65 "internal_gains_machines_rooms", "internal_gains_persons_rooms", 

66 "internal_gains_lights_rooms", 

67 "heat_set_rooms", 

68 "cool_set_rooms" 

69 ] 

70 project.sim_settings.prj_custom_usages = (Path( 

71 bim2sim.__file__).parent.parent / 

72 "test/resources/arch/custom_usages/" 

73 "customUsagesFM_ARC_DigitalHub_with_SB89.json") 

74 # create plots based on the results after simulation 

75 project.sim_settings.cfd_export = True 

76 # project.sim_settings.identify_critical_zones = True 

77 project.sim_settings.set_run_period = True 

78 project.sim_settings.run_period_start_month = 2 

79 project.sim_settings.run_period_start_day = 2 

80 project.sim_settings.run_period_end_month = 2 

81 project.sim_settings.run_period_end_day = 8 

82 project.sim_settings.select_space_guid = '3hiy47ppf5B8MyZqbpTfpc' 

83 project.sim_settings.simulation_time = 15 

84 project.sim_settings.simulation_date = '02/05' 

85 project.sim_settings.run_meshing = False 

86 project.sim_settings.run_cfd_simulation = False 

87 project.sim_settings.add_heating = False 

88 project.sim_settings.add_floorheating = False 

89 project.sim_settings.add_airterminals = False 

90 project.sim_settings.add_people = False 

91 

92 # # Run the project with pre configured answers for decisions 

93 space_boundary_genenerator = 'Other' 

94 handle_proxies = (*(None,) * 12,) 

95 construction_year = 2015 

96 answers = (space_boundary_genenerator, 

97 *handle_proxies, 

98 construction_year) 

99 handler = DebugDecisionHandler(answers) 

100 handler.handle(project.run()) 

101 

102if __name__ == '__main__': 

103 run_example_complex_building_openfoam()