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

Revision history [back]

click to hide/show revision 1
initial version

In the off-chance you're interested to get your feet wet with Python, somebody asked basically the same question for energyplus and I composed the following script/module.

For situations like this calling for a large quantity of simulations, I prefer starting/developing my projects with eQUEST then leveraging the substantial speed gains from doe2 command line. The actual simulations will take only a fraction of the time.

This will simulate every combination of BIN and INP files located in the same directory in quick order, and will retain/name the associated SIM with unique naming for clarity:

"""Automate batch simulation for any number of doe2 input & weather files."""

import os
import glob
import subprocess
import shutil
import re

# Review these environment variables for running doe2 on command line
doe2_location = 'C:\doe22'
doe2_version = 'EXE48r' #<-- As would be entered for command line execution
doe2bat_location = doe2_location+'\DOE22.BAT' 
doe2_weather_directory = doe2_location+'\weather'

def weatherbatch(target_path):
    """This function will simulate every unique combination possible between a 
    group of co-located weather files (*.bin) and input files (*.inp) via doe2 
    commandline. 

    The argument 'target_path' is the directory containing the weather (*.bin) 
    and input (*.inp) files.

    When finished, BDL files and SIM output files with self-descriptive names 
    to indicate the associated weather / input combination should remain 
    alongside the targeted files.

    Be mindful limits to doe2 command line execution apply to this script as 
    well.  Excessive characters and the presence of any spaces in the input or
    weather file names will result in errors.
    """

    # store current working directory
    start_dir = os.getcwd()

    # move to the target directory containing the weather/input files
    os.chdir(target_path)

    for w in glob.glob('*.BIN'):
        # ensure a copy of the weatherfile exists in the doe2 weather directory
        shutil.copy(w, doe2_weather_directory)

        # strip '.BIN' from w for commandline execution 
        # (done via regex to make this case-insensitive)
        weather = re.sub('\.bin', '', w, flags=re.IGNORECASE)       

        for i in glob.glob('*.inp'):            
            # make a copy of 'Project.inp' called 'Project_in_weatherfile.inp'
            # (done via regex to make this case-insensitive)
            inputname = re.sub('\.inp', '', i, flags=re.IGNORECASE)
            renamedinp = inputname + '_in_' + weather + '.inp'
            shutil.copy(i, renamedinp)  

            # strip '.inp' from renamedinp for commandline execution
            input = renamedinp.replace('.inp','')

            # execute commandline doe2 for this weather + input combination
            subprocess.call([doe2bat_location, doe2_version, input, weather])

            # remove the renamedinp copy
            os.remove(renamedinp)

    # return to the original working directory
    os.chdir(start_dir)

# for testing purposes:
if __name__ == '__main__':
    """A subdirectory '/testing files' is kept alongside this module, 
    containing a plurality of .inp and .bin files.
    """
    #establish the target directory
    testing_path = os.getcwd()+'/testing files'

    #execute weatherbatch on the target directory
    weatherbatch(testing_path)

As with Aaron's answer, this requires installing doe2 for command line operation. Note also that to get "direct" doe2 playing nicely with eQUEST-borne projects there's an extra step where you'll want to copy the contents of the eq_lib.dat file inside your eQUEST installation directories into the usrlib.dat located in the doe2 installation. That's explained further here.

This additionally requires installing Python, so this answer is a step further from the original query after eQUEST's "baked in" batch simulation feature. The above has been tested and developed in Python 2.7, specifically.