measures icon indicating copy to clipboard operation
measures copied to clipboard

Temperature calculation issue and workaround

Open mirkov opened this issue 6 years ago • 0 comments

Temperature is defined as a special measure with units "K" "R" "F" "C".

This precludes using Kelvin in physics and engineering calculations. For instance, writing explicitly the Boltmann constant

#M1.38e-23J/K

results in an error

Unbound variable: 1.38E-23J/K
   [Condition of type UNBOUND-VARIABLE]
...

A workaround is to write the Boltzmann constant like so

MS> (dim/ #M1.38e-23J #M1K)
#M0.0000000000000000000000138m2kg/s2K

One can then define it

MS> (defvar *K* (dim/ #M1.38e-23J #M1K))
*K*

and use it

MS> (dim* *K* #M300K)
#M0.00000000000000000000414J

Longer term, we may want to define "oK", "oR", "oC", "oF" as special temperatures to be used in, e.g. human scale related calculations and use "K" and "R" for calculations involving absolute temperature and energy and heat calculations.

Note that unit-defs.lisp has commented out code related delta-temperatures that uses "oK", "oR", "oC", "oF"

mirkov avatar May 15 '19 14:05 mirkov