Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Revision history [back]

For the second part of your question - I've found that learning to read and navigate the SDK documentation is really key for a non-programmer to get comfortable with reading and writing measure. I recommend first re-reading the 'Run' section of the Measure Writing guide, especially the sub-sections 'What Methods are Available?' and 'Understanding the Methods' (and probably reading them again after that). Some other tips:

  • From a given class reference page, say Space Class, clicking 'Inheritance diagram for openstudio::model::Space' will show all the classes whose methods the Space class inherits: image description

  • Similarly, clicking 'List of all members' at the top of the page will show a list of all the methods, inherited or native, that are available for a particular class. In that list, the method name is shown on the left, the method input type immediately follow in parentheses, and the method output type follows that. On the right side is the class that the method originates from. image description

    This opens up a lot of possibilities for navigating around and manipulating model objects.

  • If you need refreshing on the basics of programming or the syntax of Ruby, there are lots of good tutorials and resources online. I found the books 'Computer Science Programming Basics in Ruby' (basic stuff, specific to Ruby) and 'Programming Ruby' (more detailed) to be of great help. And as always, when in doubt, searching for "ruby [whatever I want to do]" on Google usually turns up a helpful StackExchange or other answer.

  • Finally, read and write lots of measures. Edit them, break 'em and fix 'em, find snippets that might be useful and do something different with them. Search the many OpenStudio-related Github repositories for code (Github search lets you choose by language, so you can filter to just see Ruby results) to see how a method or class is used, in addition to measures on the BCL. If you come across something you don't know, use the above resources to figure it out. It takes a little time to get comfortable, but it's time well spent when you can harness the power that measures give you.