Coverage for bim2sim/plugins/PluginTEASER/bim2sim_teaser/examples/e3_load_teaser_simulation_results.py: 0%

20 statements  

« prev     ^ index     » next       coverage.py v7.6.12, created at 2025-03-12 17:09 +0000

1from pathlib import Path 

2 

3import bim2sim 

4from bim2sim import Project, run_project, ConsoleDecisionHandler 

5from bim2sim.tasks import bps, common 

6import bim2sim.plugins.PluginTEASER.bim2sim_teaser.task as teaser_task 

7from e1_simple_project_bps_teaser import run_example_simple_building_teaser 

8 

9 

10def run_example_load_existing_project(): 

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

12 

13 This example runs a BPS with the TEASER backend. Specifies project 

14 directory and location of the IFC file. Then, it creates a bim2sim 

15 project with the TEASER backend. Workflow settings are specified (here, 

16 the zoning setup is specified to be with a medium level of detail), 

17 before the project is executed with the previously specified settings. 

18 """ 

19 # First run the previous example e1: run_example_simple_building_teaser 

20 project = run_example_simple_building_teaser() 

21 

22 # If we already ran a simulation and just want to use bim2sim 

23 # postprocessing, we don't need to run it again. Therefore we get the 

24 # project path from the previous run 

25 # 

26 print(project) 

27 project_path_existing = project.paths.root 

28 

29 # Set the project path to the previous executed project 

30 project_path = project_path_existing 

31 

32 # Instantiate a fresh project based on the existing project folder 

33 project = Project.create(project_path, plugin='teaser') 

34 

35 # TODO those 2 are not used but are needed currently as otherwise the 

36 # plotting tasks will be executed and weather file is mandatory 

37 # set weather file data 

38 project.sim_settings.weather_file_path = ( 

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

40 'test/resources/weather_files/DEU_NW_Aachen.105010_TMYx.mos') 

41 # Run a simulation directly with dymola after model creation 

42 project.sim_settings.dymola_simulation = True 

43 # Select results to output: 

44 project.sim_settings.sim_results = [ 

45 "heat_demand_total", "cool_demand_total", 

46 "heat_demand_rooms", "cool_demand_rooms", 

47 "heat_energy_total", "cool_energy_total", 

48 "heat_energy_rooms", "cool_energy_rooms", 

49 "operative_temp_rooms", "air_temp_rooms", "air_temp_out" 

50 ] 

51 project.sim_settings.create_plots = True 

52 # Just select the tasks that are needed to load the previous simulation 

53 # results and create the result plots 

54 project.plugin_cls.default_tasks = [ 

55 common.LoadIFC, 

56 common.DeserializeElements, 

57 teaser_task.LoadModelicaResults, 

58 teaser_task.CreateResultDF, 

59 bps.PlotBEPSResults, 

60 ] 

61 # Run the project with the ConsoleDecisionHandler. This allows interactive 

62 # input to answer upcoming questions regarding the imported IFC. 

63 run_project(project, ConsoleDecisionHandler()) 

64 

65 

66if __name__ == '__main__': 

67 run_example_load_existing_project()