Coverage for bim2sim/plugins/PluginEnergyPlus/bim2sim_energyplus/task/ep_run_simulation.py: 0%
21 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
1import re
2from pathlib import Path
4from geomeppy import IDF
6from bim2sim.tasks.base import ITask
7from bim2sim.plugins.PluginEnergyPlus.bim2sim_energyplus.utils import \
8 PostprocessingUtils
11class RunEnergyPlusSimulation(ITask):
12 """Run EnergyPlus simulation.
14 See run function for more details.
15 """
16 reads = ('idf', 'sim_results_path')
18 def run(self, idf: IDF, sim_results_path: Path):
19 """Run EneryPlus simulation.
21 This function is used to run EnergyPlus. The simulation is performed
22 according to the selected simulation settings. The simulation results
23 can be found under the simulation result path in the project name
24 directory.
26 Args:
27 idf (IDF): eppy idf, EnergyPlus input file
28 sim_results_path (Path): Path to simulation results.
30 """
31 # subprocess.run(['energyplus', '-x', '-c', '--convert-only', '-d', self.paths.export, idf.idfname])
32 export_path = sim_results_path / self.prj_name
33 ep_full = self.playground.sim_settings.run_full_simulation
34 design_day = False
35 if not ep_full and not self.playground.sim_settings.set_run_period:
36 design_day = True
38 idf.run(output_directory=export_path, readvars=True, annual=ep_full,
39 design_day=design_day)
40 self.playground.sim_settings.simulated = True
41 self.logger.info(f"Simulation successfully finished.")
42 if ep_full:
43 webtool_df_ep = PostprocessingUtils.export_df_for_webtool(
44 csv_name=export_path / 'eplusout.csv')
45 self.logger.info(f"Exported dataframe for postprocessing.")
46 else:
47 self.logger.info(f"No dataframe output for postprocessing "
48 "generated. Please set the workflow setting "
49 "'run_full_simulation' to True to enable the "
50 "postprocessing output.")
51 self.logger.info(f"You can find the results under "
52 f"{str(export_path)}")