Units¶
-
class
thermochem.units.
Enthalpy
(data)[source]¶ Class that models an enthalpy measure with conversion utilities
Supported units are
- Joule per kg (default)
- Kilojoule per kg (kJkg)
- Kilocalorie per kg (kcalkg)
- BTU per pound (Btulb)
>>> h = Enthalpy(1000) >>> h.kJkg 1.0 >>> h.kcalkg 0.2390057361376... >>> h.Btulb 0.42992261392949266
-
Btulb
¶ Convert enthalpy to BTU per pound
-
kJkg
¶ Convert enthalpy to kilojoules per kg
-
kcalkg
¶ Convert enthalpy to kilocalories per kg
-
class
thermochem.units.
Length
(data)[source]¶ Class that models a length measure with conversion utilities
Supported units are
- meter (default)
- millimeter (mm)
- inch (inch)
- foot (ft)
>>> l = Length(1).unit('inch') >>> round(l.mm, 1) 25.4 >>> l.ft 0.0833333333333... >>> round(l, 4) 0.0254
-
ft
¶ Convert length to feet
-
inch
¶ Convert length to inches
-
mm
¶ Convert length to millimeters
-
class
thermochem.units.
Massflow
(data)[source]¶ Class that models a mass flow measure with conversion utilities
Supported units are
- kg per second (default)
- kg per hour (kgh)
- pounds per second (lbs)
- pounds per hour (lbh)
-
kgh
¶ Convert mass flow to kg per hour
-
lbh
¶ Convert mass flow to pounds per hour
-
lbs
¶ Convert mass flow to pounds per second
-
class
thermochem.units.
Massflowrate
(data)[source]¶ Class that models a mass flow measure with conversion utilities
Supported units are
- \(\frac{kg}{s\ m^2}\) (default)
- \(\frac{lb}{s\ ft^2}\) (Btu)
-
class
thermochem.units.
Pressure
(data)[source]¶ Class that models a Pressure measure with conversion utilities
Suported units are
- Pascal (Pa)
- Mega Pascal (MPa)
- Bar (bar)
- Pound per square inch (psi)
- Atmosphere (atm)
- Millimeters of water column (mmwc)
- Torricelli (torr)
Normal instantiation is pressure in Pa. How much is an athmosphere?
>>> p = Pressure(1.0).unit('atm') >>> p 101325.0 >>> p.torr 760.0 >>> p.mmwc 10285.839999999998 >>> p.psi 14.69594877551345
-
MPa
¶ Convert pressure to megapascals
-
atm
¶ Convert pressure to atmospheres (atm)
-
bar
¶ Convert pressure to bars
-
mmwc
¶ Convert pressure to millimeters of water column (mmwc)
-
psi
¶ Convert pressure to pounds per square inch (psi)
-
torr
¶ Convert pressure to torrs
-
class
thermochem.units.
Temperature
(data)[source]¶ Class that models a temperature measure with conversion utilities
Supported units are
- Kelvin
- Celsius
- Fahrenheit
Normal instantiation is a temperature in Kelvin
>>> T = Temperature(100) >>> T 100.0
But you can instantiate and specify if unit is Celsius or Fahrenheit
>>> T = Temperature(100).unit('F') >>> T 310.92777777777775
Unit conversion is as easy as it gets.
>>> T.C 37.777777777777... >>> T.F 99.999999999999...
You can compute with temperatures because inherits from the float built-in
>>> T1 = Temperature(200) >>> T2 = Temperature(0).unit('C') >>> round(T1+T2, 2) 473.15
If you don’t want to use the class’ attribute you can use the function getattr to get a value using the unit code.
>>> getattr(T,'C') 37.77777777777...
-
C
¶ Convert temperature to Celsius
-
F
¶ Convert temperature to Fahrenheit