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

How do I get started with the OpenStudio 2.0 shared library?

asked 8 years ago

Karthick's avatar

updated 8 years ago

In Openstudio 2.0 we have a shared library openstudio.SO. Could anybody point me to some documentation as to how to get started with the shared library in Ruby/Python and come up with our own RESTful API?

I tried to go through GitHub and SDK documentation but didn't find any reference that would help me get started with implementing the shared lib.

Preview: (hide)

Comments

Karthick has an early build of OpenStudio 2.0 from me. The openstudio.so he is referring to here is the OpenStudio ruby bindings as they have always been, just packaged up in a single portable binary file called openstudio.so. In Ruby,require 'openstudio' works the same as it always has with this package, it is just much more compact with no more external dependencies.

Knowing that openstudio.so is just the OpenStudio Ruby bindings of the future perhaps folks can chime in with any experiences building web application on the OpenStudio SDK.

Kyle Benne's avatar Kyle Benne  ( 8 years ago )

Thanks Kyle. Correct me if I am wrong.. is openstudio.rb the source for openstudio.so... Am just asking.

Karthick's avatar Karthick  ( 8 years ago )

That is not exactly correct. In the OpenStudio 1.x series, openstudio.rb is the entry point to load up the API. I say entry point because openstudio.rb does not contain hardly any of the actual API methods. Instead openstudio.rb just loads up a series of dlls and resource files that encapsulate the core C++ API and make it available in Ruby.

In other words the vast majority of the OpenStudio API is not implemented in ruby (.rb) files at all. OpenStudio Ruby API is a big "native" extension writing in C++ and exported to ruby.

Kyle Benne's avatar Kyle Benne  ( 8 years ago )

In 2.0 we are focusing on making things more compact. To that end we are repacking the Ruby API into a single binary file called openstudio.so which has the all of those dlls and resource files that openstudio.rb depends on, statically linked. We create the .so in such a way that when you require 'openstudio' Ruby knows what to do. Loading a binary file like this is not unique to OpenStudio. This is commonly referred to as a Ruby native extension. Typically people create these types of extensions for performance reasons or to gain access to a large C/C++ API like OpenStudio.

Kyle Benne's avatar Kyle Benne  ( 8 years ago )

Thanks Kyle. That background is useful.

Karthick's avatar Karthick  ( 8 years ago )

1 Answer

Sort by » oldest newest most voted
2

answered 8 years ago

You might start learning your way around the OpenStudio API by reading select portions of the Measure Writing Guide. Much of this is specific to using the OpenStudio API inside the structure of a "measure", but there is some content that will explain the API itself. From the link, pay particular attention to the section titled "What Methods Are Available".

The API is ground zero. You will probably need to devise your own scheme to expose this API through a web service that meets the needs of your application. With any luck there are people in this community who can share their experiences in this area.

Preview: (hide)
link

Comments

Thanks Kyle. This is the approach I am taking at the moment. In the process of learning the API and also completely my spike. Thanks for the insights.

Karthick's avatar Karthick  ( 8 years ago )

Your Answer

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

Add Answer

Training Workshops

Careers

Question Tools

1 follower

Stats

Asked: 8 years ago

Seen: 299 times

Last updated: Sep 14 '16