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

eQUEST Batch Simulation Runs

asked 2016-12-01 10:17:05 -0600

dpud12 gravatar image

updated 2016-12-01 10:17:54 -0600

Does anyone know how to use the batch feature of eQUEST to run a large number of simulations? I have a single model that I would like to run across 16 climate zones and it would be much easier if there were an automated alternative to changing the BIN file and doing the simulations by hand.

I have been unable to find documentation on this feature and the only online guides that I have found have been incomplete and unhelpful.

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
3

answered 2016-12-01 11:15:08 -0600

updated 2016-12-01 11:16:58 -0600

Check out this presentation, it has pretty much everything you need. If you are not able to create a batch to change the weather file, send me an email, I can send you an example.

edit flag offensive delete link more

Comments

@Jeremy Thank you very much, this is exactly what I was looking for!

dpud12 gravatar image dpud12  ( 2016-12-01 11:56:39 -0600 )edit
4

answered 2016-12-01 14:20:15 -0600

If you have any interest in working with DOE2 directly, you can do this relatively easy using the following .bat file as a template. In this example, the file "BatchTest.inp" is run for two locations. The results are stored in "BatchTest_1.sim" and "BatchTest_2.sim". You can add as many locations as you'd like to the end of the file.

:: Script to run DOE2 simulations over multiple locations
:: Do not include .inp extension in file name.
:: By default, the doe22.bat script does not allow spaces in input file.
set inp_file=BatchTest
set doe_cmd=c:\\doe22\\doe22.bat exe48r

:: First run is Memphis, TN.  Do not include the .bin extension in 
:: weather file name
set weather=TN_Memphis_International
call %doe_cmd% %inp_file% %weather%
copy %inp_file%.sim %inp_file%_1.sim

:: Second run is Jackson, MS.  This procedure can be followed for any number
:: of locations.
set weather=MS_Jackson_International
call %doe_cmd% %inp_file% %weather%
copy %inp_file%.sim %inp_file%_2.sim
edit flag offensive delete link more

Comments

@aaron thanks! glad to see so many different ways that I could make this work

dpud12 gravatar image dpud12  ( 2016-12-06 11:08:40 -0600 )edit
4

answered 2016-12-02 04:53:52 -0600

Nick Caton gravatar image

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 ... (more)

edit flag offensive delete link more

Comments

@Nick Caton Thanks! I have yet to use python but would like to learn it in the near future, maybe this would be a good first project

dpud12 gravatar image dpud12  ( 2016-12-06 11:07:41 -0600 )edit

Digging way back...... The batch file creates the inp files at run time. The script above simulates already created inp files. How are /were inp files created above? I assume a separate script to import/modify/save the separate inps?

dradair gravatar image dradair  ( 2020-12-14 17:18:49 -0600 )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

Question Tools

2 followers

Stats

Asked: 2016-12-01 10:17:05 -0600

Seen: 1,129 times

Last updated: Dec 02 '16