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

Trying to understand the flow of Ruby and Measures

asked 2019-02-02 14:14:03 -0500

mark.stout's avatar

updated 2019-02-02 14:16:06 -0500

Okay, I'm not a neophyte. I have a little programming, e.g. PHP, Javascript. Am learning how to code in Ruby when I have a free moment. Just standardized on Sketchup, OpenStudio, and EnergyPlus for my energy modeling platform. I'm trying to understand how Ruby works with OpenStudio. I understand the classes and defs, and am slowly learning how Ruby uses them. What I seem to be missing is how Ruby scripts (.rb) files interact with OpenStudio and how to use them.

I've searched for some documentation but have only come up with "You can use ruby scripts to do . . .", which is exciting except I can't seem to find out "how" to use them.

Can someone point me to documentation that doesn't need a PhD to read and understand?

Thanks, Mark

edit retag flag offensive close merge delete

Comments

Could you give us a bit of information about what you want to do?

macumber's avatar macumber  ( 2019-02-04 09:31:50 -0500 )edit

I do energy audits on commercial and multifamily properties to show how they can reduce their energy use. This platform also support the various incentives that could help pay for the improvements. We are also doing new construction, but usually it's after the design phase or maybe install phase. We want to change that.

I'm learning Ruby and React for use with our home automation platform, and since Ruby is used to customize measures, it'll be a good fit. I saw one example of how a Ruby measure worked. Now I'm looking for the manual for the SDK so I know what function to call what and how.

mark.stout's avatar mark.stout  ( 2019-02-04 10:28:13 -0500 )edit

here's a link to some measures if you want to use as examples, etc measures

BrianLBall's avatar BrianLBall  ( 2019-02-04 12:06:38 -0500 )edit

I think the best place to start would be the measure writing guide David linked to, the OpenStudio Command Line Interface (CLI) documentation, and then looking at some example measures. The measures Brian linked to are good, you can also look on the BCL. The easiest way to start running measures is with the OpenStudio Application, once you get the hang of that it is easy to transition to the CLI.

macumber's avatar macumber  ( 2019-02-04 12:39:33 -0500 )edit

The full API documentation is a good reference once you are started.

macumber's avatar macumber  ( 2019-02-04 12:40:13 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-02-02 15:36:42 -0500

updated 2019-02-02 15:37:47 -0500

Have you reviewed the Measure Writer's Reference Guide? If not that is a good place to start. As far file management with OpenStudio measures, each measure passes in a model, runs the measure code in the `run' method, then passes a modified model out. So for basic measures you don't have to worry about ruby file management. Often scripts may load or write to CSV files. For that you need to have some basic understanding of ruby file management.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Careers

Question Tools

2 followers

Stats

Asked: 2019-02-02 14:14:03 -0500

Seen: 277 times

Last updated: Feb 02 '19