[Boost-users] [units] "Simple" conversion from Kelvin to Celsius

243 views
Skip to first unread message

Michael Powell

unread,
Aug 14, 2013, 3:39:56 PM8/14/13
to boost...@lists.boost.org
Hello,

It's been a couple of years since I've done any work with Boost.Units,
and I am finding that I want to make a dimensionally-safe conversion
from Kelvin to Celsius.

I've got an I2C controller that reports in Kelvin, but I want to
report it to the end-user in Celsius.

The examples I am finding seem to "almost" fit the bill, but I am
having a difficult time extrapolating a sane conversion.

First, would help if I understood what the Boost.Units SI (my assumed
base-system) base-temperature units were. I gather Fahrenheit? Or is
it indeed Kelvin? I could be mistaken.

Thank you...

Regards,

Michael Powell
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Jason Roehm

unread,
Aug 14, 2013, 3:45:28 PM8/14/13
to boost...@lists.boost.org

On 08/14/2013 03:39 PM, Michael Powell wrote:
> Hello,
>
> It's been a couple of years since I've done any work with Boost.Units,
> and I am finding that I want to make a dimensionally-safe conversion
> from Kelvin to Celsius.
>
> I've got an I2C controller that reports in Kelvin, but I want to
> report it to the end-user in Celsius.
>
> The examples I am finding seem to "almost" fit the bill, but I am
> having a difficult time extrapolating a sane conversion.
>
> First, would help if I understood what the Boost.Units SI (my assumed
> base-system) base-temperature units were. I gather Fahrenheit? Or is
> it indeed Kelvin? I could be mistaken.
>
The SI system uses Kelvin as its temperature unit. This is reflected in
the Boost.Units documentation here:

http://www.boost.org/doc/libs/1_54_0/doc/html/boost_units/Reference.html#header.boost.units.systems.si.temperature_hpp

Jason

Matthias Schabel

unread,
Aug 22, 2013, 1:25:20 PM8/22/13
to boost...@lists.boost.org
There are some subtleties for temperature conversions, depending on whether you want to convert relative temperatures (differences) or absolute temperatures. See here for example :

http://www.boost.org/doc/libs/1_54_0/doc/html/boost_units/Examples.html#boost_units.Examples.AbsoluteRelativeTemperatureExample

Matthias

Marshall Clow

unread,
Aug 22, 2013, 2:49:36 PM8/22/13
to boost...@lists.boost.org
On Aug 22, 2013, at 10:25 AM, Matthias Schabel <bo...@schabel-family.org> wrote:

> There are some subtleties for temperature conversions, depending on whether you want to convert relative temperatures (differences) or absolute temperatures. See here for example :
>
> http://www.boost.org/doc/libs/1_54_0/doc/html/boost_units/Examples.html#boost_units.Examples.AbsoluteRelativeTemperatureExample

Oh yes.
My daughter bought a sun-shade to go inside her car, and on the packaging it says "Keeps your vehicle up to 44°F/7°C cooler"

Ouch.

-- Marshall

Marshall Clow Idio Software <mailto:mclow...@gmail.com>

A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
-- Yu Suzuki

Michael Powell

unread,
Aug 22, 2013, 3:22:30 PM8/22/13
to boost...@lists.boost.org
Well...

As it turns out, our little fuel gauge, while it can report
temperatures, OT, UT (over/under), and so on, the temperature parts
are not hooked up. I haven't read the data sheet that closely, but my
guess is that's temperature from a known reference voltage, usually
converted to/from a DAC somewhere.

Anyhow, thank you those who responded or are following this for the
clarification.

Regards,

Michael Powell
Reply all
Reply to author
Forward
0 new messages