Coverage for bim2sim/plugins/PluginComfort/bim2sim_comfort/task/ep_load_idf.py: 0%

22 statements  

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

1import logging 

2import os 

3 

4from geomeppy import IDF 

5 

6from bim2sim.tasks.base import ITask 

7 

8logger = logging.getLogger(__name__) 

9 

10 

11class LoadIdf(ITask): 

12 """Load the IDF file of an EnergyPlus Simulation. 

13 

14 Task to Load an IDF file from a previous BIM2SIM execution from project 

15 directory. 

16 """ 

17 

18 touches = ('idf',) 

19 

20 def run(self, workflow): 

21 """Execute all methods to load an existing IDF file.""" 

22 logger.info("Loading IDF File started ...") 

23 ep_install_path = workflow.ep_install_path 

24 IDF.setiddname(ep_install_path + 'Energy+.idd') 

25 idf_path = self.paths.export 

26 idf_name = None 

27 for file in os.listdir(idf_path): 

28 if file.endswith(".idf"): 

29 idf_name = os.path.join(idf_path, file) 

30 break # todo: handle multiple idfs (choose by name) 

31 if not idf_name: 

32 raise AssertionError("No IDF File found for loading!") 

33 idf = IDF(idf_name) 

34 logger.info("IDF File successfully loaded") 

35 

36 return idf,