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?
MCVE directories for a working and 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 the measure.rb
file while the broken example references the module 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 something like the OpenStudio Standards gem rather than have to update it in two places.
More interestingly, can you please make a Minimum Complete Verifiable Example (MCVE) for the "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" so we can try to reproduce / see if we can fix it?
Thanks Julien, the MVCE has been uploaded and the question updated to reflect it. Let me know if that is more in line with what you were thinking.