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

OpenStudio Measure with long list of inputs -- best practice

I'm writing an OpenStudio measure with a long list of options for many of the input parameters. Initially, I tried to use a secondary file to host all the constants to keep the measure file tidy but found that if I imported parameters into the measure.rb file the OpenStudio application did not appear to populate my lists when I did this (although I could see them in the measure.xml ?) So I tried looking through other measures and found most folks just kind of listed them all out in the measure.rb file. Is there no better best practice?

Measure I'm working on and how I had to use a module inside of measure.rb to get it to work:

I would much rather have this list of inputs reference a dynamic reference that updates with the OpenStudio gem rather than have to update it in two places.

OpenStudio Measure with long list of inputs -- best practice

I'm writing an OpenStudio measure with a long list of options for many of the input parameters. Initially, I tried to use a secondary file to host all the constants to keep the measure file things tidy but found that if I imported importing parameters into the measure.rb file resulted in the OpenStudio application did not appear to populate populating my lists when I did this input dropdowns (although I could see them in the measure.xml ?) So I tried looking through other measures and found most folks just kind of listed them all out in the measure.rb file. Is there no better best practice?

Measure I'm working on and how I had to use a module inside of measure.rb to get it to work:

I would much rather have this list of inputs reference a dynamic reference that updates with the OpenStudio gem rather than have to update it in two places.

OpenStudio Measure with long list of inputs -- best practice

I'm writing an OpenStudio measure with a long list of options for many of the input parameters. Initially, I tried to use a secondary file to host all the constants to keep things tidy but found importing parameters into the measure.rb file resulted in the OpenStudio application not populating my input dropdowns (although I could see them in the measure.xml ?) So I tried looking through other measures and found most folks just kind of listed them all out in the measure.rb file. Is there no better best practice?

Measure I'm MCVE directories for a working on and how I had to use a broken example of what I mean can be found here:

You will see both measures populate the choice argument with a module called MyConstants:

choices_os_vector = OpenStudio::StringVector.new
option_list = MyConstants::CHOICE_LIST
option_list.each do |option|
  choices_os_vector << option
end

The only difference is that working example has the module inside of the measure.rb to get it to work:

from a separate file called my_choice_constants.rb.

I would much rather have this list of inputs reference a dynamic reference that updates with the OpenStudio something like the OpenStudio Standards gem rather than have to update it in two places.