Coverage for bim2sim/plugins/PluginEnergyPlus/bim2sim_energyplus/examples/e3_load_energyplus_simulation_results.py: 0%
18 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.tasks import bps, common
6from bim2sim.plugins.PluginEnergyPlus.bim2sim_energyplus import \
7 task as ep_tasks
8from e1_simple_project_energyplus import run_example_1
11def run_example_load_existing_project():
12 """Run a building performance simulation with the EnergyPlus backend.
14 This example runs a BPS with the EnergyPlus backend. Specifies project
15 directory and location of the IFC file. Then, it creates a bim2sim
16 project with the EnergyPlus backend. Workflow settings are specified,
17 before the project is executed with the previously specified settings.
18 """
19 # First run the previous example e1: run_example_1
20 project = run_example_1()
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 project_path_existing = project.paths.root
27 # project_path_existing = Path(to/your/own/file)
29 # Set the project path to the previous executed project
30 project_path = project_path_existing
32 # Instantiate a fresh project based on the existing project folder
33 project = Project.create(project_path, plugin='energyplus')
35 # set weather file data
36 project.sim_settings.weather_file_path = (
37 Path(bim2sim.__file__).parent.parent /
38 'test/resources/weather_files/DEU_NW_Aachen.105010_TMYx.mos')
39 # Run a simulation directly with dymola after model creation
40 # Select results to output:
41 project.sim_settings.sim_results = [
42 "heat_demand_total", "cool_demand_total",
43 "heat_demand_rooms", "cool_demand_rooms",
44 "heat_energy_total", "cool_energy_total",
45 "heat_energy_rooms", "cool_energy_rooms",
46 "operative_temp_rooms", "air_temp_rooms", "air_temp_out"
47 ]
48 project.sim_settings.create_plots = True
49 # project.sim_settings.ep_install_path = 'C://EnergyPlusV9-4-0/'
51 # Just select the tasks that are needed to load the previous simulation
52 # results and create the result plots
53 project.plugin_cls.default_tasks = [
54 common.LoadIFC,
55 common.DeserializeElements,
56 ep_tasks.LoadEnergyPlusResults,
57 ep_tasks.CreateResultDF,
58 bps.PlotBEPSResults,
59 ]
60 # Run the project with the ConsoleDecisionHandler. This allows interactive
61 # input to answer upcoming questions regarding the imported IFC.
62 run_project(project, ConsoleDecisionHandler())
65if __name__ == '__main__':
66 run_example_load_existing_project()