Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question
1

How to run models with many different weather files and set output excel name accordingly ?

asked 2020-12-09 19:56:48 -0500

BL's avatar

updated 2020-12-09 20:10:54 -0500

How to run a model with many different weather files and set output excel name accordingly ? For instance, I have two models and 20 weather files, how can I automate the simulation process and have outputs ? Is there any tutorial with this ? Is it doable with Python ? Thank you

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2020-12-10 05:53:57 -0500

updated 2020-12-10 08:21:23 -0500

The EP-Launch program allows you to do that if you're on windows. See the "Group of Input Files" tab.

Otherwise yes, use a python (or whatever language) script. I would recommend not bothering trying to rename the output files, instead use the -d, --output-directory ARG arg to set the output directory.

I started throwing a small example to get you started, and then I figured I might as well take another couple of minutes and turn it into a github repo so it can be used by others. So here's a crude way of running multiple simulations in parallel using python: just paste your own .epw and .idf into the root folder and python Run_EnergyPlus_Simulations_In_Parallel.py.

Under the hood it uses multiprocessing to run simulations in parallel, and offloads to subprocess for runs.

Github: jmarrec/RunMultipleSimulationsInParallel

And here is the direct link to the python snippet: Run_EnergyPlus_Simulations_In_Parallel.py


Note that if you really want filenames and not output directories to uniquely identify each sim, it'd be terribly easy to add this here on line 49: https://github.com/jmarrec/RunMultipl...

if res.returncode != 0:
     ...
else:
    # simulation worked, copy the output file
    out_file = os.path.join(out_dir, "eplusout.csv")
    dest_file = os.path.join("Reports", f"{idf}_-_{epw}.csv")
    shutil.copyfile(out_file, dest_file)

(of course, import shutil at top of file)

edit flag offensive delete link more

Comments

Thank you so much for the response. I downloaded the example folder and run it in jupyter notebook. It get stuck in the last cell. Do I need to change the ROOT_DIR and args of run_single_simulation ? What else do I need to change for the example files ?
Also I run in in pycharm IDE, it gave me following erros: FileNotFoundError: [WinError 2] The system cannot find the file specified

I placed the entire example folder under the Energyplu root folder

BL's avatar BL  ( 2020-12-10 09:12:41 -0500 )edit

Can you run the .py script and give me the actual traceback output...? Did you pip/conda install tqdm too?

Julien Marrec's avatar Julien Marrec  ( 2020-12-10 09:39:28 -0500 )edit

The way I (again, VERY QUICKLY) coded this is that you would drop your IDF/EPW into the root folder after cloning it. If you want to run it against the C:\EnergyPlusV-9-4-0\ExampleFiles\ dir, you have to make minor modifications to the way I compute paths. I'm not going to do customer service on this one, I'm sure you'll figure it out.

Julien Marrec's avatar Julien Marrec  ( 2020-12-10 09:41:06 -0500 )edit

AS fdor the FileNotFoundError, I would reckon you do not have energyplus.exein your path. Either add the directory of E+ to your path or Change this line https://github.com/jmarrec/RunMultipl...

cmd = f"C:\EnergyPlus-V-4-0\energyplus.exe -w {epw_path} -d {out_dir} {idf_path}"

Julien Marrec's avatar Julien Marrec  ( 2020-12-10 09:45:47 -0500 )edit

File "C:\Users\user\anaconda3\lib\multiprocessing\pool.py", line 125, in worker result = (True, func(args, kwds)) File "C:\Users\user\Desktop\RunMultipleSimulationsInParallel-main\Run_EnergyPlus_Simulations_In_Parallel.py", line 43, in run_single_simulation res = subprocess.run(shlex.split(cmd), capture_output=True) File "C:\Users\user\anaconda3\lib\subprocess.py", line 489, in run with Popen(popenargs, **kwargs) as process: File "C:\Users\\anaconda3\lib\subprocess.py", line 854, in __init__ self._execute_child(args, executable, preexec_fn, close_fds

BL's avatar BL  ( 2020-12-10 09:49:05 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Training Workshops

Careers

Question Tools

3 followers

Stats

Asked: 2020-12-09 19:56:48 -0500

Seen: 312 times

Last updated: Dec 10 '20