First time here? Check our help page!
2

Converting units in Openstudio using a Measure

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 ?

Luis Lara's avatar
2.1k
Luis Lara
asked 2019-05-07 10:56:14 -0500
__AmirRoth__'s avatar
4.4k
__AmirRoth__
updated 2019-05-07 16:08:42 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

3

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

shorowit's avatar
11.8k
shorowit
answered 2019-05-07 11:05:48 -0500, updated 2019-05-07 11:08:40 -0500
edit flag offensive 0 remove flag delete link

Comments

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

Luis Lara's avatar Luis Lara (2019-05-07 11:10:29 -0500) edit
add a comment see more comments