Coverage for bim2sim/plugins/PluginComfort/bim2sim_comfort/examples/e3_load_comfort_simulation_results.py: 0%
19 statements
« prev ^ index » next coverage.py v7.6.12, created at 2025-03-12 17:09 +0000
« prev ^ index » next coverage.py v7.6.12, created at 2025-03-12 17:09 +0000
1from pathlib import Path
3import bim2sim
4from bim2sim import Project, run_project, ConsoleDecisionHandler
5from bim2sim.plugins.PluginComfort.bim2sim_comfort.examples.e1_simple_project_comfort_energyplus import \
6 run_example_1
7from bim2sim.tasks import bps, common
8from bim2sim.plugins.PluginEnergyPlus.bim2sim_energyplus import \
9 task as ep_tasks
10from bim2sim.plugins.PluginComfort.bim2sim_comfort import task as comfort_tasks
13def run_example_load_existing_project():
14 """Run a building performance simulation with the EnergyPlus backend.
16 This example runs a BPS with the EnergyPlus backend. Specifies project
17 directory and location of the IFC file. Then, it creates a bim2sim
18 project with the EnergyPlus backend. Workflow settings are specified,
19 before the project is executed with the previously specified settings.
20 """
21 # First run the previous example e1: run_example_1
22 project = run_example_1()
24 # If we already ran a simulation and just want to use bim2sim
25 # postprocessing, we don't need to run it again. Therefore we get the
26 # project path from the previous run
27 #
28 project_path_existing = project.paths.root
29 # project_path_existing = Path(to/my/files)
31 # Set the project path to the previous executed project
32 project_path = project_path_existing
34 # Instantiate a fresh project based on the existing project folder
35 project = Project.create(project_path, plugin='comfort')
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 # Select results to output:
43 project.sim_settings.sim_results = [
44 "heat_demand_total", "cool_demand_total",
45 "heat_demand_rooms", "cool_demand_rooms",
46 "heat_energy_total", "cool_energy_total",
47 "heat_energy_rooms", "cool_energy_rooms",
48 "operative_temp_rooms", "air_temp_rooms", "air_temp_out"
49 ]
50 project.sim_settings.create_plots = True
51 # project.sim_settings.ep_install_path = 'C://EnergyPlusV9-4-0/'
53 # Just select the tasks that are needed to load the previous simulation
54 # results and create the result plots
55 project.plugin_cls.default_tasks = [
56 common.LoadIFC,
57 common.DeserializeElements,
58 ep_tasks.LoadEnergyPlusResults,
59 ep_tasks.CreateResultDF,
60 bps.PlotBEPSResults,
61 comfort_tasks.CreateResultDF,
62 comfort_tasks.PlotComfortResults,
63 ]
64 # project.sim_settings.plot_singe_zone_guid = '3hiy47ppf5B8MyZqbpTfpc'
66 # Run the project with the ConsoleDecisionHandler. This allows interactive
67 # input to answer upcoming questions regarding the imported IFC.
68 run_project(project, ConsoleDecisionHandler())
71if __name__ == '__main__':
72 run_example_load_existing_project()