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 2016-09-13 19:11:39 -0600

Karthick's avatar

updated 2016-10-18 14:09:17 -0600

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.

edit retag flag offensive close merge delete

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  ( 2016-09-13 20:34:03 -0600 )edit

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

Karthick's avatar Karthick  ( 2016-09-13 20:56:24 -0600 )edit

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  ( 2016-09-13 21:05:10 -0600 )edit

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  ( 2016-09-13 21:08:19 -0600 )edit

Thanks Kyle. That background is useful.

Karthick's avatar Karthick  ( 2016-09-13 22:32:49 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2016-09-13 20:43:52 -0600

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.

edit flag offensive delete link more

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  ( 2016-09-19 18:45:41 -0600 )edit

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: 2016-09-13 19:11:39 -0600

Seen: 276 times

Last updated: Sep 14 '16