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

Run ExpandObjects Programmatically in Ruby

asked 2016-04-29 09:30:41 -0500

Alex Bennett's avatar

updated 2016-04-29 09:53:20 -0500

I have been trying to run a reporting script through a web interface to output the electricity and gas heating usages. In my model I am setting the HVAC systems to Ideal Air Loads. I discovered though that for EnergyPlus to execute properly, ExpandObjects program has to be run on the model first in order to accept the HVACTemplate objects from the ideal air loads. The code I am working with is shown below. This is the 'setup_test' routine and I am struggling to find any documentation or ways to run the ExpandObjects program in Ruby. Thanks for the help!

 @@co =
def Reporting_Lib.setup_test(test_name, idf_output_requests,model_name,location)
    @@co.findTools(false, true, false, true)

if !File.exist?(Reporting_Lib.run_dir(test_name))

if File.exist?(Reporting_Lib.run_dir(test_name)) == false then return false end

if File.exist?(Reporting_Lib.report_path(test_name))
if File.exist?(Reporting_Lib.model_in_path(model_name)) == false then return false end

if File.exist?(Reporting_Lib.model_out_path(test_name))

# convert output requests to OSM for testing, OS App and PAT will add these to the E+ Idf 
workspace ="Draft".to_StrictnessLevel, "EnergyPlus".to_IddFileType)
rt =
request_model = rt.translateWorkspace(workspace)

model = OpenStudio::Model::Model.load(Reporting_Lib.model_in_path(model_name)).get
model.addObjects(request_model.objects), true)

puts "Running EnergyPlus"
wf ="modeltoidf->energypluspreprocess->energyplus")
# puts wf
# puts wf.add(@@co.getTools())
job = wf.create(,,

rm =

rm.enqueue(job, true)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-04-29 09:35:34 -0500

Try changing your workflow to this:

wf ="modeltoidf->expandobjects->energypluspreprocess->energyplus")
edit flag offensive delete link more


Thanks! That worked perfectly.

Alex Bennett's avatar Alex Bennett  ( 2016-04-29 10:09:27 -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

Question Tools


Asked: 2016-04-29 09:30:41 -0500

Seen: 115 times

Last updated: Apr 29 '16