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

Converting units in Openstudio using a Measure

asked 2019-05-07 10:56:14 -0500

updated 2019-05-07 16:08:42 -0500

I am trying to convert units from SI to IP. I am using the method described in this section of the documentation.

This is my code snippet:

space_items << Openstudio.convert(space.floorArea.round(8),"m^2","ft^2").get

But it returns the following error

Found error in state 'reporting_measures' with message [":/ruby/2.2.0/gems/openstudio-workflow-1.3.3/lib/openstudio/workflow/util/measure.rb failed with message Runner error :/ruby/2.2.0/gems/openstudio-workflow-1.3.3/lib/openstudio/workflow/util/measure.rb failed with uninitialized constant ExportInformationAboutEachSpaceToCSV::Openstudio, eval:283:in `const_missing'\nC:/Users/FAKEPATH/measure.rb:79

Where line 79 is the line where I am making the conversion.

Then, I did the conversion in two steps, as it is shown in the example:

area_si_units = space.floorArea.round(8)
space_items << Openstudio.convert(area_si_units,"m^2","ft^2").get

And it runs as intended. Why do I have to assign the result to a variable before using it in the convert method ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-05-07 11:05:48 -0500

updated 2019-05-07 11:08:40 -0500

Case is important. In both examples, it should be OpenStudio.convert(...) and not Openstudio.convert(...). (Note the uppercase "S". I don't think either of your examples should work as written.

For example:

image description

edit flag offensive delete link more


You are correct. I was looking at a different line of code. Both ways work with the correct case.

Luis Lara gravatar image Luis Lara  ( 2019-05-07 11:10:29 -0500 )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: 2019-05-07 10:56:14 -0500

Seen: 178 times

Last updated: May 07 '19