How to implement a custom OpenStudio measure
Hi all,
I recently became interested in writing my own open studio measures to help automate some processes. I followed the steps found on NREL's github site titled Measure Writer's Reference Guide and have a very basic script I wanted to test to see if I'm understanding things correctly.
I'm likely being dense here, but now that I've written my ruby script, I want to begin debugging it and testing it. How does one go about applying their measure.rb script to a given osm? Is there a custom way for me to import it into OpenStudio to use like other OS measures from the BCL or should I be testing it in ruby elsewhere?
Any information regarding how to actually apply user generated scripts would be greatly appreciated. Thanks in advance!
did you create the measure from inside or outside OS/PAT?
I created it outside OS/PAT (I wrote it from scratch in RubyMine). From what I saw, if I create it from within OS, OS will create a sort of "template" for users to fill in the various parts of an OS measure (e.g. the arguments, run, and name function). Does it do more than that?
Starting a measure from the template also creates the
measure.xml
file that contains information about the measure that the application uses to run the measure using 'Apply Measure Now' or in the Measures tab. This way you can test/debug your measure by running it through the application. Another way is to set up a measure test, as explained in the Measure Testing section of the Measure Writing Reference Guide.