How to Locally Test OpenStudio Models - NatLabRockies/alfalfa GitHub Wiki
In order to troubleshoot OpenStudio models with Alfalfa, it can be useful to run your models locally within OpenStudio to ensure they are working correctly independent of Alfalfa. However, if you have configured custom OpenStudio measures in order to expose points to Alfalfa, these points will not have an initialized value and therefore an additional measure will need to be run in the OSW in order to run a model configured for Alfalfa within OpenStudio.
An Example of such a program is written below:
def create_input(model, name, freq, init_val)
# [...]
# same as create_input method above
# [...]
# add EMS initialization program
init_prgm = OpenStudio::Model::EnergyManagementSystemProgram.new(model)
init_prgm.setName('Init_' + name)
init_prgm.addLine("SET #{name} = #{init_val}")
init_prgm.addLine("SET #{name}_Enable = 1")
# add EMS initialization program calling manager
init_prgm_mngr = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(model)
init_prgm_mngr.setName('Init ' + name)
init_prgm_mngr.setCallingPoint('BeginNewEnvironment')
init_prgm_mngr.addProgram(init_prgm)
endThese initializations will NOT extend to Alfalfa; instead, Alfalfa will initialize the values to nil and the <NAME>_Enable to 0. If the user sets the value of a writeable point (Alfalfa input) the <NAME>_Enable will automatically be set to 1.
Set <init_value> as desired and run the OSW locally, typically with a command like:
/path/to/openstudio_binary run --workflow /path/to/my.oswThen verify that the model behaved as desired, typically by confirming with a set of timeseries EnergyPlus Output:Variable objects from the EnergyPlus variable dictionary (eplusout.rdd). Once local testing is complete, make sure to remove this temporary code from the run method otherwise collisions with Alfalfa may occur.