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


asked 2018-06-22 11:38:24 -0600

updated 2018-06-23 10:43:25 -0600

I have noticed that OpenStudio 2.5 includes a new class: OpenStudio::Model::AdditionalProperties

I am trying to write some userscripts and measures and it would be very helpful to use this objet. The problem is I dont know how to create this object and how to assign it to the openstudio models.

Can anybody provide a simple use example?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-06-22 14:43:58 -0600

updated 2018-06-22 15:34:57 -0600

Every OpenStudio model object now has an AdditionalProperties object available on it to store meta information. If you ask for the object and it doesn't already exist, it is automatically created for you. Once you have the object, see the OpenStudio SDK documentation for all of the available methods.

For example:

mat =
props = mat.additionalProperties
props.setFeature("color", "white")
puts props.getFeatureAsString("color") # => "white"
edit flag offensive delete link more


It works. Thank you!

mapascual gravatar imagemapascual ( 2018-06-23 01:32:13 -0600 )edit

There is no way to get the AddditionalProperties associated with the OutputVariable . I added additionalproperties to each output variable in the openstudio core code ... but in the application code i am not able to retrieve them .... How can i retrieve the AddditionalProperties associated with each output variable ?

riteshsahoo gravatar imageriteshsahoo ( 2020-08-17 21:31:58 -0600 )edit

There is no way to get the std::vector<outputvariable> outputVariables() for the object ... must run simulation to generate data. why do we need to run ? How can i get the list of all the output variable ...not names ?

riteshsahoo gravatar imageriteshsahoo ( 2020-08-17 21:35:11 -0600 )edit

You're asking several questions as one in a comment thread, which is bad practice as it makes it hard to respond.

Here's an example using the ruby bindings and demonstrating that it works with OutputVariable.

 include OpenStudio::Model
 m =
 o ="Coucou", m)
 o.additionalProperties.setFeature("color", "blue")
 => true
 => "blue"
Julien Marrec gravatar imageJulien Marrec ( 2020-08-20 03:09:10 -0600 )edit

And if you need to list all output variables, this is, as with all other ModelObjects something you would retrieve from Model. In ruby that's m.getOutputVariables(), in C++ m.getConcreteModelObjects<OutputVariable>()(there's also a getModelObjects<T>() for non concrete ones).

Source: Model.hpp#L280-L315

Julien Marrec gravatar imageJulien Marrec ( 2020-08-20 03:12:21 -0600 )edit

Your Answer

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

Add Answer


Question Tools

1 follower


Asked: 2018-06-22 11:38:24 -0600

Seen: 165 times

Last updated: Jun 22 '18