1

Uninitialized Unit Conversion in OpenStudio SDK [closed]

Ummm, what does base unit 'BTU' is not is registered with the QuantityConverter mean?

 irb(main):037:0> OpenStudio.convert(10000, "m^2", "ft^2").get
=> 107639.10416709722
irb(main):038:0> OpenStudio.convert(10000, "GJ", "kBTU").get
[openstudio.units.QuantityConverter] <1> Cannot convert to a target Unit containing base unit 'BTU', because it is not registered with the QuantityConverter.
RuntimeError: Optional not initialized
    from (irb):38:in `get'
    from (irb):38
    from /usr/bin/irb:12:in `<main>'
__AmirRoth__'s avatar
4.4k
__AmirRoth__
asked 2016-01-25 18:28:49 -0500
edit flag offensive 0 remove flag reopen merge delete

Closed for the following reason "the question is answered, right answer was accepted" by __AmirRoth__ 2016-01-25 20:03:19 -0500

Comments

add a comment see more comments

1 Answer

4

Try OpenStudio.convert(10000, "GJ", "kBtu").get, the unit strings are case sensitive and I guess it only knows about "Btu".

For more information about how to use the converter and most of the common units you can use, please refer to the Unit Conversion section in the official documentation.

macumber's avatar
12k
macumber
answered 2016-01-25 18:59:25 -0500
Julien Marrec's avatar
29.7k
Julien Marrec
updated 2016-01-26 00:11:40 -0500
edit flag offensive 0 remove flag delete link

Comments

Pffffffffffffft

__AmirRoth__'s avatar __AmirRoth__ (2016-01-25 20:03:07 -0500) edit

Not the best answer but an answer nonetheless. What we really need is a list of all the units OpenStudio does support, @aparker or @David Goldwasser might know if that exists. It isn't easy to find this in the units code or scale code.

macumber's avatar macumber (2016-01-25 22:38:43 -0500) edit
2

@aparker put together a Unit Conversion section that has most of the common units used, and shows how to use them.

David Goldwasser's avatar David Goldwasser (2016-01-25 23:12:52 -0500) edit

One problem with the Unit Conversion section is that the * are understood as being markdown.If you look at R-value for example it displays "ft^2hR/Btu" instead of "ft^2*h*R/Btu"

Julien Marrec's avatar Julien Marrec (2016-02-02 04:41:09 -0500) edit

I'm not sure what it is but it isn't markdown. There are some methods that make units print in Latex format, or this prettyString. All these units methods might get refactored so use at your own risk.

macumber's avatar macumber (2016-02-02 11:10:19 -0500) edit
add a comment see more comments