First time here? Check out the Help page!
1 | initial version |
FWIW, I have had good success with the following, after "import openstudio" and creating or loading a model.
# Make sure measure path is what it needs to be
model.workflowJSON().addMeasurePath(absolute_measure_path)
# Check on existing measure steps
measure_types = ["ModelMeasure","EnergyPlusMeasure","UtilityMeasure","ReportingMeasure"]
for measure_type in measure_types:
measure_type = openstudio.MeasureType(measure_type)
measure_steps = model.workflowJSON().getMeasureSteps(measure_type)
print(measure_type,measure_steps)
# Define a measure step
measure_type = openstudio.MeasureType(measure_types[1])
measure_step = openstudio.MeasureStep(measure_folder) # measure_folder is a sub_folder under absolute_measure_path, containing measure.rb and measure.xml and resources
measure_step.setDescription("Description")
measure_step.setModelerDescription("ModelerDescription")
arguments = {key1:value1,key2:value2,key3:value3} # Whatever the measure arguments need to be
measure_step.clearArguments()
for key,value in arguments.items():
measure_step.setArgument(key,value)
# Add measure step to the workflow and save
model.workflowJSON().setMeasureSteps(measure_type,[measure_step]) # note that this requires a Python list!
model.workflowJSON().save()
When you check the workflow.osw file, you should see the new measure step. The measures sub-folder will likely not have any measures under it yet, but when you start OpenStudioApp, under the Measures tab, the new measure step should appear properly.
I realize this does not get you to an .IDF, but it may be a start, plus, you might be able to run the OpenStudio CLI instead?