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

Uninitialized Unit Conversion in OpenStudio SDK [closed]

asked 2016-01-25 18:28:49 -0500

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>'
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by __AmirRoth__
close date 2016-01-25 20:03:19.793735

1 Answer

Sort by ยป oldest newest most voted
4

answered 2016-01-25 18:59:25 -0500

updated 2016-01-26 00:11:40 -0500

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.

edit flag offensive delete link more

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

Training Workshops

Careers

Question Tools

1 follower

Stats

Asked: 2016-01-25 18:28:49 -0500

Seen: 130 times

Last updated: Jan 26 '16