PsychroLib API Documentation¶
psychrolib.py
Contains functions for calculating thermodynamic properties of gas-vapor mixtures and standard atmosphere suitable for most engineering, physical and meteorological applications.
Most of the functions are an implementation of the formulae found in the 2017 ASHRAE Handbook - Fundamentals, in both International System (SI), and Imperial (IP) units. Please refer to the information included in each function for their respective reference.
- Example
>>> import psychrolib >>> # Set the unit system, for example to SI (can be either psychrolib.SI or psychrolib.IP) >>> psychrolib.SetUnitSystem(psychrolib.SI) >>> # Calculate the dew point temperature for a dry bulb temperature of 25 C and a relative humidity of 80% >>> TDewPoint = psychrolib.GetTDewPointFromRelHum(25.0, 0.80) >>> print(TDewPoint) 21.309397163661785
- Copyright
- For the current library implementation
Copyright (c) 2018-2020 The PsychroLib Contributors.
- For equations and coefficients published ASHRAE Handbook — Fundamentals, Chapter 1
Copyright (c) 2017 ASHRAE Handbook — Fundamentals (https://www.ashrae.org)
- License
MIT (https://github.com/psychrometrics/psychrolib/LICENSE.txt)
- Note from the Authors
We have made every effort to ensure that the code is adequate, however, we make no representation with respect to its accuracy. Use at your own risk. Should you notice an error, or if you have a suggestion, please notify us through GitHub at https://github.com/psychrometrics/psychrolib/issues.
-
psychrolib.
ZERO_FAHRENHEIT_AS_RANKINE
= 459.67¶ Zero degree Fahrenheit (°F) expressed as degree Rankine (°R)
- Units:
°R
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 39
- Type
float
-
psychrolib.
ZERO_CELSIUS_AS_KELVIN
= 273.15¶ Zero degree Celsius (°C) expressed as Kelvin (K)
- Units:
K
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 39
- Type
float
-
psychrolib.
R_DA_IP
= 53.35¶ Universal gas constant for dry air (IP version)
- Units:
ft lb_Force lb_DryAir⁻¹ R⁻¹
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1
- Type
float
-
psychrolib.
R_DA_SI
= 287.042¶ Universal gas constant for dry air (SI version)
- Units:
J kg_DryAir⁻¹ K⁻¹
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1
- Type
float
-
psychrolib.
MAX_ITER_COUNT
= 100¶ Maximum number of iterations before exiting while loops.
- Type
int
-
psychrolib.
MIN_HUM_RATIO
= 1e-07¶ Minimum acceptable humidity ratio used/returned by any functions. Any value above 0 or below the MIN_HUM_RATIO will be reset to this value.
- Type
float
-
psychrolib.
FREEZING_POINT_WATER_IP
= 32.0¶ Freezing point of water in Fahrenheit.
- Type
float
-
psychrolib.
FREEZING_POINT_WATER_SI
= 0.0¶ Freezing point of water in Celsius.
- Type
float
-
psychrolib.
TRIPLE_POINT_WATER_IP
= 32.018¶ Triple point of water in Fahrenheit.
- Type
float
-
psychrolib.
TRIPLE_POINT_WATER_SI
= 0.01¶ Triple point of water in Celsius.
- Type
float
-
class
psychrolib.
UnitSystem
[source]¶ Private class not exposed used to set automatic enumeration values.
-
psychrolib.
SetUnitSystem
(Units)[source]¶ Set the system of units to use (SI or IP).
- Parameters
Units (
UnitSystem
) – string indicating the system of units chosen (SI or IP)
Notes
This function HAS TO BE CALLED before the library can be used
- Return type
None
-
psychrolib.
GetUnitSystem
()[source]¶ Return system of units in use.
- Return type
Optional
[UnitSystem
]
-
psychrolib.
GetTRankineFromTFahrenheit
(TFahrenheit)[source]¶ Utility function to convert temperature to degree Rankine (°R) given temperature in degree Fahrenheit (°F).
- Parameters
TRankine – Temperature in degree Fahrenheit (°F)
- Return type
float
- Returns
Temperature in degree Rankine (°R)
- Reference:
Reference: ASHRAE Handbook - Fundamentals (2017) ch. 1 section 3
Notes
Exact conversion.
-
psychrolib.
GetTFahrenheitFromTRankine
(TRankine)[source]¶ Utility function to convert temperature to degree Fahrenheit (°F) given temperature in degree Rankine (°R).
- Parameters
TRankine (
float
) – Temperature in degree Rankine (°R)- Return type
float
- Returns
Temperature in degree Fahrenheit (°F)
- Reference:
Reference: ASHRAE Handbook - Fundamentals (2017) ch. 1 section 3
Notes
Exact conversion.
-
psychrolib.
GetTKelvinFromTCelsius
(TCelsius)[source]¶ Utility function to convert temperature to Kelvin (K) given temperature in degree Celsius (°C).
- Parameters
TCelsius (
float
) – Temperature in degree Celsius (°C)- Return type
float
- Returns
Temperature in Kelvin (K)
- Reference:
Reference: ASHRAE Handbook - Fundamentals (2017) ch. 1 section 3
Notes
Exact conversion.
-
psychrolib.
GetTCelsiusFromTKelvin
(TKelvin)[source]¶ Utility function to convert temperature to degree Celsius (°C) given temperature in Kelvin (K).
- Parameters
TKelvin (
float
) – Temperature in Kelvin (K)- Return type
float
- Returns
Temperature in degree Celsius (°C)
- Reference:
Reference: ASHRAE Handbook - Fundamentals (2017) ch. 1 section 3
Notes
Exact conversion.
-
psychrolib.
GetTWetBulbFromTDewPoint
(TDryBulb, TDewPoint, Pressure)[source]¶ Return wet-bulb temperature given dry-bulb temperature, dew-point temperature, and pressure.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]TDewPoint (
float
) – Dew-point temperature in °F [IP] or °C [SI]Pressure (
float
) – Atmospheric pressure in Psi [IP] or Pa [SI]
- Return type
float
- Returns
Wet-bulb temperature in °F [IP] or °C [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1
-
psychrolib.
GetTWetBulbFromRelHum
(TDryBulb, RelHum, Pressure)[source]¶ Return wet-bulb temperature given dry-bulb temperature, relative humidity, and pressure.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]RelHum (
float
) – Relative humidity in range [0, 1]Pressure (
float
) – Atmospheric pressure in Psi [IP] or Pa [SI]
- Return type
float
- Returns
Wet-bulb temperature in °F [IP] or °C [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1
-
psychrolib.
GetRelHumFromTDewPoint
(TDryBulb, TDewPoint)[source]¶ Return relative humidity given dry-bulb temperature and dew-point temperature.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]TDewPoint (
float
) – Dew-point temperature in °F [IP] or °C [SI]
- Return type
float
- Returns
Relative humidity in range [0, 1]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 22
-
psychrolib.
GetRelHumFromTWetBulb
(TDryBulb, TWetBulb, Pressure)[source]¶ Return relative humidity given dry-bulb temperature, wet bulb temperature and pressure.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]TWetBulb (
float
) – Wet-bulb temperature in °F [IP] or °C [SI]Pressure (
float
) – Atmospheric pressure in Psi [IP] or Pa [SI]
- Return type
float
- Returns
Relative humidity in range [0, 1]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1
-
psychrolib.
GetTDewPointFromRelHum
(TDryBulb, RelHum)[source]¶ Return dew-point temperature given dry-bulb temperature and relative humidity.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]RelHum (
float
) – Relative humidity in range [0, 1]
- Return type
float
- Returns
Dew-point temperature in °F [IP] or °C [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1
-
psychrolib.
GetTDewPointFromTWetBulb
(TDryBulb, TWetBulb, Pressure)[source]¶ Return dew-point temperature given dry-bulb temperature, wet-bulb temperature, and pressure.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]TWetBulb (
float
) – Wet-bulb temperature in °F [IP] or °C [SI]Pressure (
float
) – Atmospheric pressure in Psi [IP] or Pa [SI]
- Return type
float
- Returns
Dew-point temperature in °F [IP] or °C [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1
-
psychrolib.
GetVapPresFromRelHum
(TDryBulb, RelHum)[source]¶ Return partial pressure of water vapor as a function of relative humidity and temperature.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]RelHum (
float
) – Relative humidity in range [0, 1]
- Return type
float
- Returns
Partial pressure of water vapor in moist air in Psi [IP] or Pa [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 12, 22
-
psychrolib.
GetRelHumFromVapPres
(TDryBulb, VapPres)[source]¶ Return relative humidity given dry-bulb temperature and vapor pressure.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]VapPres (
float
) – Partial pressure of water vapor in moist air in Psi [IP] or Pa [SI]
- Return type
float
- Returns
Relative humidity in range [0, 1]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 12, 22
-
psychrolib.
dLnPws_
(TDryBulb)[source]¶ Helper function returning the derivative of the natural log of the saturation vapor pressure as a function of dry-bulb temperature.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]- Return type
float
- Returns
Derivative of natural log of vapor pressure of saturated air in Psi [IP] or Pa [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 5 & 6
-
psychrolib.
GetTDewPointFromVapPres
(TDryBulb, VapPres)[source]¶ Return dew-point temperature given dry-bulb temperature and vapor pressure.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]VapPres (
float
) – Partial pressure of water vapor in moist air in Psi [IP] or Pa [SI]
- Return type
float
- Returns
Dew-point temperature in °F [IP] or °C [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn. 5 and 6
Notes
The dew point temperature is solved by inverting the equation giving water vapor pressure at saturation from temperature rather than using the regressions provided by ASHRAE (eqn. 37 and 38) which are much less accurate and have a narrower range of validity. The Newton-Raphson (NR) method is used on the logarithm of water vapour pressure as a function of temperature, which is a very smooth function Convergence is usually achieved in 3 to 5 iterations. TDryBulb is not really needed here, just used for convenience.
-
psychrolib.
GetVapPresFromTDewPoint
(TDewPoint)[source]¶ Return vapor pressure given dew point temperature.
- Parameters
TDewPoint (
float
) – Dew-point temperature in °F [IP] or °C [SI]- Return type
float
- Returns
Partial pressure of water vapor in moist air in Psi [IP] or Pa [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 36
-
psychrolib.
GetTWetBulbFromHumRatio
(TDryBulb, HumRatio, Pressure)[source]¶ Return wet-bulb temperature given dry-bulb temperature, humidity ratio, and pressure.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]HumRatio (
float
) – Humidity ratio in lb_H₂O lb_Air⁻¹ [IP] or kg_H₂O kg_Air⁻¹ [SI]Pressure (
float
) – Atmospheric pressure in Psi [IP] or Pa [SI]
- Return type
float
- Returns
Wet-bulb temperature in °F [IP] or °C [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 33 and 35 solved for Tstar
-
psychrolib.
GetHumRatioFromTWetBulb
(TDryBulb, TWetBulb, Pressure)[source]¶ Return humidity ratio given dry-bulb temperature, wet-bulb temperature, and pressure.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]TWetBulb (
float
) – Wet-bulb temperature in °F [IP] or °C [SI]Pressure (
float
) – Atmospheric pressure in Psi [IP] or Pa [SI]
- Return type
float
- Returns
Humidity ratio in lb_H₂O lb_Air⁻¹ [IP] or kg_H₂O kg_Air⁻¹ [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 33 and 35
-
psychrolib.
GetHumRatioFromRelHum
(TDryBulb, RelHum, Pressure)[source]¶ Return humidity ratio given dry-bulb temperature, relative humidity, and pressure.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]RelHum (
float
) – Relative humidity in range [0, 1]Pressure (
float
) – Atmospheric pressure in Psi [IP] or Pa [SI]
- Return type
float
- Returns
Humidity ratio in lb_H₂O lb_Air⁻¹ [IP] or kg_H₂O kg_Air⁻¹ [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1
-
psychrolib.
GetRelHumFromHumRatio
(TDryBulb, HumRatio, Pressure)[source]¶ Return relative humidity given dry-bulb temperature, humidity ratio, and pressure.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]HumRatio (
float
) – Humidity ratio in lb_H₂O lb_Air⁻¹ [IP] or kg_H₂O kg_Air⁻¹ [SI]Pressure (
float
) – Atmospheric pressure in Psi [IP] or Pa [SI]
- Return type
float
- Returns
Relative humidity in range [0, 1]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1
-
psychrolib.
GetHumRatioFromTDewPoint
(TDewPoint, Pressure)[source]¶ Return humidity ratio given dew-point temperature and pressure.
- Parameters
TDewPoint (
float
) – Dew-point temperature in °F [IP] or °C [SI]Pressure (
float
) – Atmospheric pressure in Psi [IP] or Pa [SI]
- Return type
float
- Returns
Humidity ratio in lb_H₂O lb_Air⁻¹ [IP] or kg_H₂O kg_Air⁻¹ [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 13
-
psychrolib.
GetTDewPointFromHumRatio
(TDryBulb, HumRatio, Pressure)[source]¶ Return dew-point temperature given dry-bulb temperature, humidity ratio, and pressure.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]HumRatio (
float
) – Humidity ratio in lb_H₂O lb_Air⁻¹ [IP] or kg_H₂O kg_Air⁻¹ [SI]Pressure (
float
) – Atmospheric pressure in Psi [IP] or Pa [SI]
- Return type
float
- Returns
Dew-point temperature in °F [IP] or °C [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1
-
psychrolib.
GetHumRatioFromVapPres
(VapPres, Pressure)[source]¶ Return humidity ratio given water vapor pressure and atmospheric pressure.
- Parameters
VapPres (
float
) – Partial pressure of water vapor in moist air in Psi [IP] or Pa [SI]Pressure (
float
) – Atmospheric pressure in Psi [IP] or Pa [SI]
- Return type
float
- Returns
Humidity ratio in lb_H₂O lb_Air⁻¹ [IP] or kg_H₂O kg_Air⁻¹ [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 20
-
psychrolib.
GetVapPresFromHumRatio
(HumRatio, Pressure)[source]¶ Return vapor pressure given humidity ratio and pressure.
- Parameters
HumRatio (
float
) – Humidity ratio in lb_H₂O lb_Air⁻¹ [IP] or kg_H₂O kg_Air⁻¹ [SI]Pressure (
float
) – Atmospheric pressure in Psi [IP] or Pa [SI]
- Return type
float
- Returns
Partial pressure of water vapor in moist air in Psi [IP] or Pa [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 20 solved for pw
-
psychrolib.
GetSpecificHumFromHumRatio
(HumRatio)[source]¶ Return the specific humidity from humidity ratio (aka mixing ratio).
- Parameters
HumRatio (
float
) – Humidity ratio in lb_H₂O lb_Dry_Air⁻¹ [IP] or kg_H₂O kg_Dry_Air⁻¹ [SI]- Return type
float
- Returns
Specific humidity in lb_H₂O lb_Air⁻¹ [IP] or kg_H₂O kg_Air⁻¹ [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 9b
-
psychrolib.
GetHumRatioFromSpecificHum
(SpecificHum)[source]¶ Return the humidity ratio (aka mixing ratio) from specific humidity.
- Parameters
SpecificHum (
float
) – Specific humidity in lb_H₂O lb_Air⁻¹ [IP] or kg_H₂O kg_Air⁻¹ [SI]- Return type
float
- Returns
Humidity ratio in lb_H₂O lb_Dry_Air⁻¹ [IP] or kg_H₂O kg_Dry_Air⁻¹ [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 9b (solved for humidity ratio)
-
psychrolib.
GetDryAirEnthalpy
(TDryBulb)[source]¶ Return dry-air enthalpy given dry-bulb temperature.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]- Return type
float
- Returns
Dry air enthalpy in Btu lb⁻¹ [IP] or J kg⁻¹ [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 28
-
psychrolib.
GetDryAirDensity
(TDryBulb, Pressure)[source]¶ Return dry-air density given dry-bulb temperature and pressure.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]Pressure (
float
) – Atmospheric pressure in Psi [IP] or Pa [SI]
- Return type
float
- Returns
Dry air density in lb ft⁻³ [IP] or kg m⁻³ [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1
Notes
Eqn 14 for the perfect gas relationship for dry air. Eqn 1 for the universal gas constant. The factor 144 in IP is for the conversion of Psi = lb in⁻² to lb ft⁻².
-
psychrolib.
GetDryAirVolume
(TDryBulb, Pressure)[source]¶ Return dry-air volume given dry-bulb temperature and pressure.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]Pressure (
float
) – Atmospheric pressure in Psi [IP] or Pa [SI]
- Return type
float
- Returns
Dry air volume in ft³ lb⁻¹ [IP] or in m³ kg⁻¹ [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1
Notes
Eqn 14 for the perfect gas relationship for dry air. Eqn 1 for the universal gas constant. The factor 144 in IP is for the conversion of Psi = lb in⁻² to lb ft⁻².
-
psychrolib.
GetTDryBulbFromEnthalpyAndHumRatio
(MoistAirEnthalpy, HumRatio)[source]¶ Return dry bulb temperature from enthalpy and humidity ratio.
- Parameters
MoistAirEnthalpy (
float
) – Moist air enthalpy in Btu lb⁻¹ [IP] or J kg⁻¹HumRatio (
float
) – Humidity ratio in lb_H₂O lb_Air⁻¹ [IP] or kg_H₂O kg_Air⁻¹ [SI]
- Return type
float
- Returns
Dry-bulb temperature in °F [IP] or °C [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 30
Notes
Based on the GetMoistAirEnthalpy function, rearranged for temperature.
-
psychrolib.
GetHumRatioFromEnthalpyAndTDryBulb
(MoistAirEnthalpy, TDryBulb)[source]¶ Return humidity ratio from enthalpy and dry-bulb temperature.
- Parameters
MoistAirEnthalpy (
float
) – Moist air enthalpy in Btu lb⁻¹ [IP] or J kg⁻¹TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]
- Return type
float
- Returns
Humidity ratio in lb_H₂O lb_Air⁻¹ [IP] or kg_H₂O kg_Air⁻¹ [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 30.
Notes
Based on the GetMoistAirEnthalpy function, rearranged for humidity ratio.
-
psychrolib.
GetSatVapPres
(TDryBulb)[source]¶ Return saturation vapor pressure given dry-bulb temperature.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]- Return type
float
- Returns
Vapor pressure of saturated air in Psi [IP] or Pa [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 5 & 6 Important note: the ASHRAE formulae are defined above and below the freezing point but have a discontinuity at the freezing point. This is a small inaccuracy on ASHRAE’s part: the formulae should be defined above and below the triple point of water (not the feezing point) in which case the discontinuity vanishes. It is essential to use the triple point of water otherwise function GetTDewPointFromVapPres, which inverts the present function, does not converge properly around the freezing point.
-
psychrolib.
GetSatHumRatio
(TDryBulb, Pressure)[source]¶ Return humidity ratio of saturated air given dry-bulb temperature and pressure.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]Pressure (
float
) – Atmospheric pressure in Psi [IP] or Pa [SI]
- Return type
float
- Returns
Humidity ratio of saturated air in lb_H₂O lb_Air⁻¹ [IP] or kg_H₂O kg_Air⁻¹ [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 36, solved for W
-
psychrolib.
GetSatAirEnthalpy
(TDryBulb, Pressure)[source]¶ Return saturated air enthalpy given dry-bulb temperature and pressure.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]Pressure (
float
) – Atmospheric pressure in Psi [IP] or Pa [SI]
- Return type
float
- Returns
Saturated air enthalpy in Btu lb⁻¹ [IP] or J kg⁻¹ [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1
-
psychrolib.
GetVaporPressureDeficit
(TDryBulb, HumRatio, Pressure)[source]¶ Return Vapor pressure deficit given dry-bulb temperature, humidity ratio, and pressure.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]HumRatio (
float
) – Humidity ratio in lb_H₂O lb_Air⁻¹ [IP] or kg_H₂O kg_Air⁻¹ [SI]Pressure (
float
) – Atmospheric pressure in Psi [IP] or Pa [SI]
- Return type
float
- Returns
Vapor pressure deficit in Psi [IP] or Pa [SI]
- Reference:
Oke (1987) eqn 2.13a
-
psychrolib.
GetDegreeOfSaturation
(TDryBulb, HumRatio, Pressure)[source]¶ Return the degree of saturation (i.e humidity ratio of the air / humidity ratio of the air at saturation at the same temperature and pressure) given dry-bulb temperature, humidity ratio, and atmospheric pressure.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]HumRatio (
float
) – Humidity ratio in lb_H₂O lb_Air⁻¹ [IP] or kg_H₂O kg_Air⁻¹ [SI]Pressure (
float
) – Atmospheric pressure in Psi [IP] or Pa [SI]
- Return type
float
- Returns
Degree of saturation in arbitrary unit
- Reference:
ASHRAE Handbook - Fundamentals (2009) ch. 1 eqn 12
Notes
This definition is absent from the 2017 Handbook. Using 2009 version instead.
-
psychrolib.
GetMoistAirEnthalpy
(TDryBulb, HumRatio)[source]¶ Return moist air enthalpy given dry-bulb temperature and humidity ratio.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]HumRatio (
float
) – Humidity ratio in lb_H₂O lb_Air⁻¹ [IP] or kg_H₂O kg_Air⁻¹ [SI]
- Return type
float
- Returns
Moist air enthalpy in Btu lb⁻¹ [IP] or J kg⁻¹
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 30
-
psychrolib.
GetMoistAirVolume
(TDryBulb, HumRatio, Pressure)[source]¶ Return moist air specific volume given dry-bulb temperature, humidity ratio, and pressure.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]HumRatio (
float
) – Humidity ratio in lb_H₂O lb_Air⁻¹ [IP] or kg_H₂O kg_Air⁻¹ [SI]Pressure (
float
) – Atmospheric pressure in Psi [IP] or Pa [SI]
- Return type
float
- Returns
Specific volume of moist air in ft³ lb⁻¹ of dry air [IP] or in m³ kg⁻¹ of dry air [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 26
Notes
In IP units, R_DA_IP / 144 equals 0.370486 which is the coefficient appearing in eqn 26 The factor 144 is for the conversion of Psi = lb in⁻² to lb ft⁻².
-
psychrolib.
GetTDryBulbFromMoistAirVolumeAndHumRatio
(MoistAirVolume, HumRatio, Pressure)[source]¶ Return dry-bulb temperature given moist air specific volume, humidity ratio, and pressure.
- Parameters
MoistAirVolume (
float
) – Specific volume of moist air in ft³ lb⁻¹ of dry air [IP] or in m³ kg⁻¹ of dry air [SI]HumRatio (
float
) – Humidity ratio in lb_H₂O lb_Air⁻¹ [IP] or kg_H₂O kg_Air⁻¹ [SI]Pressure (
float
) – Atmospheric pressure in Psi [IP] or Pa [SI]
- Returns
Dry-bulb temperature in °F [IP] or °C [SI]
- Return type
TDryBulb
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 26
Notes
In IP units, R_DA_IP / 144 equals 0.370486 which is the coefficient appearing in eqn 26 The factor 144 is for the conversion of Psi = lb in⁻² to lb ft⁻². Based on the GetMoistAirVolume function, rearranged for dry-bulb temperature.
-
psychrolib.
GetMoistAirDensity
(TDryBulb, HumRatio, Pressure)[source]¶ Return moist air density given humidity ratio, dry bulb temperature, and pressure.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]HumRatio (
float
) – Humidity ratio in lb_H₂O lb_Air⁻¹ [IP] or kg_H₂O kg_Air⁻¹ [SI]Pressure (
float
) – Atmospheric pressure in Psi [IP] or Pa [SI]
- Returns
Moist air density in lb ft⁻³ [IP] or kg m⁻³ [SI]
- Return type
MoistAirDensity
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 11
-
psychrolib.
GetStandardAtmPressure
(Altitude)[source]¶ Return standard atmosphere barometric pressure, given the elevation (altitude).
- Parameters
Altitude (
float
) – Altitude in ft [IP] or m [SI]- Return type
float
- Returns
Standard atmosphere barometric pressure in Psi [IP] or Pa [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 3
-
psychrolib.
GetStandardAtmTemperature
(Altitude)[source]¶ Return standard atmosphere temperature, given the elevation (altitude).
- Parameters
Altitude (
float
) – Altitude in ft [IP] or m [SI]- Return type
float
- Returns
Standard atmosphere dry-bulb temperature in °F [IP] or °C [SI]
- Reference:
ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 4
-
psychrolib.
GetSeaLevelPressure
(StationPressure, Altitude, TDryBulb)[source]¶ Return sea level pressure given dry-bulb temperature, altitude above sea level and pressure.
- Parameters
StationPressure (
float
) – Observed station pressure in Psi [IP] or Pa [SI]Altitude (
float
) – Altitude in ft [IP] or m [SI]TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]
- Return type
float
- Returns
Sea level barometric pressure in Psi [IP] or Pa [SI]
- Reference:
Hess SL, Introduction to theoretical meteorology, Holt Rinehart and Winston, NY 1959, ch. 6.5; Stull RB, Meteorology for scientists and engineers, 2nd edition, Brooks/Cole 2000, ch. 1.
Notes
The standard procedure for the US is to use for TDryBulb the average of the current station temperature and the station temperature from 12 hours ago.
-
psychrolib.
GetStationPressure
(SeaLevelPressure, Altitude, TDryBulb)[source]¶ Return station pressure from sea level pressure.
- Parameters
SeaLevelPressure (
float
) – Sea level barometric pressure in Psi [IP] or Pa [SI]Altitude (
float
) – Altitude in ft [IP] or m [SI]TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]
- Return type
float
- Returns
Station pressure in Psi [IP] or Pa [SI]
- Reference:
See ‘GetSeaLevelPressure’
Notes
This function is just the inverse of ‘GetSeaLevelPressure’.
-
psychrolib.
CalcPsychrometricsFromTWetBulb
(TDryBulb, TWetBulb, Pressure)[source]¶ Utility function to calculate humidity ratio, dew-point temperature, relative humidity, vapour pressure, moist air enthalpy, moist air volume, and degree of saturation of air given dry-bulb temperature, wet-bulb temperature, and pressure.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]TWetBulb (
float
) – Wet-bulb temperature in °F [IP] or °C [SI]Pressure (
float
) – Atmospheric pressure in Psi [IP] or Pa [SI]
- Return type
tuple
- Returns
Humidity ratio in lb_H₂O lb_Air⁻¹ [IP] or kg_H₂O kg_Air⁻¹ [SI] Dew-point temperature in °F [IP] or °C [SI] Relative humidity in range [0, 1] Partial pressure of water vapor in moist air in Psi [IP] or Pa [SI] Moist air enthalpy in Btu lb⁻¹ [IP] or J kg⁻¹ [SI] Specific volume of moist air in ft³ lb⁻¹ [IP] or in m³ kg⁻¹ [SI] Degree of saturation [unitless]
-
psychrolib.
CalcPsychrometricsFromTDewPoint
(TDryBulb, TDewPoint, Pressure)[source]¶ Utility function to calculate humidity ratio, wet-bulb temperature, relative humidity, vapour pressure, moist air enthalpy, moist air volume, and degree of saturation of air given dry-bulb temperature, dew-point temperature, and pressure.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]TDewPoint (
float
) – Dew-point temperature in °F [IP] or °C [SI]Pressure (
float
) – Atmospheric pressure in Psi [IP] or Pa [SI]
- Return type
tuple
- Returns
Humidity ratio in lb_H₂O lb_Air⁻¹ [IP] or kg_H₂O kg_Air⁻¹ [SI] Wet-bulb temperature in °F [IP] or °C [SI] Relative humidity in range [0, 1] Partial pressure of water vapor in moist air in Psi [IP] or Pa [SI] Moist air enthalpy in Btu lb⁻¹ [IP] or J kg⁻¹ [SI] Specific volume of moist air in ft³ lb⁻¹ [IP] or in m³ kg⁻¹ [SI] Degree of saturation [unitless]
-
psychrolib.
CalcPsychrometricsFromRelHum
(TDryBulb, RelHum, Pressure)[source]¶ Utility function to calculate humidity ratio, wet-bulb temperature, dew-point temperature, vapour pressure, moist air enthalpy, moist air volume, and degree of saturation of air given dry-bulb temperature, relative humidity and pressure.
- Parameters
TDryBulb (
float
) – Dry-bulb temperature in °F [IP] or °C [SI]RelHum (
float
) – Relative humidity in range [0, 1]Pressure (
float
) – Atmospheric pressure in Psi [IP] or Pa [SI]
- Return type
tuple
- Returns
Humidity ratio in lb_H₂O lb_Air⁻¹ [IP] or kg_H₂O kg_Air⁻¹ [SI] Wet-bulb temperature in °F [IP] or °C [SI] Dew-point temperature in °F [IP] or °C [SI]. Partial pressure of water vapor in moist air in Psi [IP] or Pa [SI] Moist air enthalpy in Btu lb⁻¹ [IP] or J kg⁻¹ [SI] Specific volume of moist air in ft³ lb⁻¹ [IP] or in m³ kg⁻¹ [SI] Degree of saturation [unitless]