Package 'psychrolib'

Title: Psychrometric Properties of Moist and Dry Air
Description: Implementation of 'PsychroLib' <https://github.com/psychrometrics/psychrolib> library which contains functions to enable the calculation properties of moist and dry air in both metric (SI) and imperial (IP) systems of units. References: Meyer, D. and Thevenard, D (2019) <doi:10.21105/joss.01137>.
Authors: Hongyuan Jia [aut, cre] , The PsychroLib Contributors [ctb, cph] (Authors listed in inst/PSYCHROLIB_AUTHORS.txt), ASHRAE [cph] (Copyright 2017 ASHRAE Handbook Fundamentals (https://www.ashrae.org) for equations and coefficients published ASHRAE Handbook Fundamentals Chapter 1.)
Maintainer: Hongyuan Jia <[email protected]>
License: MIT + file LICENSE
Version: 2.5.2
Built: 2025-01-31 03:08:10 UTC
Source: https://github.com/hongyuanjia/psychrolib

Help Index


PsychroLib: Psychrometric Properties of Moist and Dry Air

Description

Contains functions for calculating thermodynamic properties of gas-vapor mixtures and standard atmosphere suitable for most engineering, physical and meteorological applications.

Details

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.

psychroLib is a port of the psychrolib library for R.

Pakcage options

  • psychrolib.units The default unit system. Should be either be "SI" or "IP".

Note

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.

Author(s)

  • Hongyuan Jia and Jason Banfelder for R implementation.

  • D. Thevenard and D. Meyer for the core library implementations.

  • Equations and coefficients published ASHRAE Handbook — Fundamentals, Chapter 1 Copyright (c) 2017 ASHRAE Handbook — Fundamentals (https://www.ashrae.org)

See Also

Useful links:

Examples

library(psychrolib)
# Set the unit system, for example to SI (can be either SI or IP)
SetUnitSystem("SI")

# Calculate the dew point temperature for a dry bulb temperature of 25 C
# and a relative humidity of 80%
GetTDewPointFromRelHum(25.0, 0.80)

Calculate psychrometric values from relative humidity.

Description

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.

Usage

CalcPsychrometricsFromRelHum(TDryBulb, RelHum, Pressure)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

RelHum

A numeric vector of relative humidity in range [0, 1]

Pressure

A numeric vector of atmospheric pressure in Psi [IP] or Pa [SI]

Value

A list with named components for each psychrometric value computed:

HumRatio

Humidity ratio in lb_H2O lb_Air-1 [IP] or kg_H2O kg_Air-1 [SI]

TWetBulb

Wet-bulb temperature in degreeF [IP] or degreeC [SI]

TDewPoint

Dew-point temperature in degreeF [IP] or degreeC [SI]

VapPres

Partial pressure of water vapor in moist air in Psi [IP] or Pa [SI]

MoistAirEnthalpy

Moist air enthalpy in Btu lb-1 [IP] or J kg-1 [SI]

MoistAirVolume

Specific volume of moist air in ft3 lb-1 [IP] or in m3 kg-1 [SI]

DegreeOfSaturation

Degree of saturation [unitless]

Examples

SetUnitSystem("IP")
CalcPsychrometricsFromRelHum(80:100, 0.13, 14.69)

SetUnitSystem("SI")
CalcPsychrometricsFromRelHum(25:40, 0.5, 101325.0)

Calculate psychrometric values from dew-point temperature.

Description

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.

Usage

CalcPsychrometricsFromTDewPoint(TDryBulb, TDewPoint, Pressure)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

TDewPoint

A numeric vector of dew-point temperature in degreeF [IP] or degreeC [SI]

Pressure

A numeric vector of atmospheric pressure in Psi [IP] or Pa [SI]

Value

A list with named components for each psychrometric value computed:

HumRatio

Humidity ratio in lb_H2O lb_Air-1 [IP] or kg_H2O kg_Air-1 [SI]

TWetBulb

Wet-bulb temperature in degreeF [IP] or degreeC [SI]

RelHum

Relative humidity in range [0, 1]

VapPres

Partial pressure of water vapor in moist air in Psi [IP] or Pa [SI]

MoistAirEnthalpy

Moist air enthalpy in Btu lb-1 [IP] or J kg-1 [SI]

MoistAirVolume

Specific volume of moist air in ft3 lb-1 [IP] or in m3 kg-1 [SI]

DegreeOfSaturation

Degree of saturation [unitless]

Examples

SetUnitSystem("IP")
CalcPsychrometricsFromTDewPoint(80:100, 40.0, 14.696)

SetUnitSystem("SI")
CalcPsychrometricsFromTDewPoint(25:40, 20.0, 101325.0)

Calculate psychrometric values from wet-bulb temperature.

Description

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.

Usage

CalcPsychrometricsFromTWetBulb(TDryBulb, TWetBulb, Pressure)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

TWetBulb

A numeric vector of wet-bulb temperature in degreeF [IP] or degreeC [SI]

Pressure

A numeric vector of atmospheric pressure in Psi [IP] or Pa [SI]

Value

A list with named components for each psychrometric value computed:

HumRatio

Humidity ratio in lb_H2O lb_Air-1 [IP] or kg_H2O kg_Air-1 [SI]

TDewPoint

Dew-point temperature in degreeF [IP] or degreeC [SI]

RelHum

Relative humidity in range [0, 1]

VapPres

Partial pressure of water vapor in moist air in Psi [IP] or Pa [SI]

MoistAirEnthalpy

Moist air enthalpy in Btu lb-1 [IP] or J kg-1 [SI]

MoistAirVolume

Specific volume of moist air in ft3 lb-1 [IP] or in m3 kg-1 [SI]

DegreeOfSaturation

Degree of saturation [unitless]

Examples

SetUnitSystem("IP")
CalcPsychrometricsFromTWetBulb(80:100, 65.0, 14.696)

SetUnitSystem("SI")
CalcPsychrometricsFromTWetBulb(25:40, 20, 101325.0)

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.

Description

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.

Usage

GetDegreeOfSaturation(TDryBulb, HumRatio, Pressure)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

HumRatio

A numeric vector of humidity ratio in lb_H2O lb_Air-1 [IP] or kg_H2O kg_Air-1 [SI]

Pressure

A numeric vector of atmospheric pressure in Psi [IP] or Pa [SI]

Value

A numeric vector of degree of saturation in arbitrary unit

Note

This definition is absent from the 2017 Handbook. Using 2009 version instead.

References

ASHRAE Handbook - Fundamentals (2009) ch. 1 eqn 12

Examples

SetUnitSystem("IP")
GetDegreeOfSaturation(80:100, 0.01, 14.175)

SetUnitSystem("SI")
GetDegreeOfSaturation(20:30, 0.01, 95461.0)

Return dry-air density given dry-bulb temperature and pressure.

Description

Return dry-air density given dry-bulb temperature and pressure.

Usage

GetDryAirDensity(TDryBulb, Pressure)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

Pressure

A numeric vector of atmospheric pressure in Psi [IP] or Pa [SI]

Value

A numeric vector of dry air density in lb ft-3 [IP] or kg m-3 [SI]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1

  • 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-2 to lb ft-2.

Examples

SetUnitSystem("IP")
GetDryAirDensity(77:87, 14.696)

SetUnitSystem("SI")
GetDryAirDensity(25:30, 101325)

Return dry-air enthalpy given dry-bulb temperature.

Description

Return dry-air enthalpy given dry-bulb temperature.

Usage

GetDryAirEnthalpy(TDryBulb)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

Value

A numeric vector of dry air enthalpy in Btu lb-1 [IP] or J kg-1 [SI]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 28

Examples

SetUnitSystem("IP")
GetDryAirEnthalpy(77:87)

SetUnitSystem("SI")
GetDryAirEnthalpy(10:30)

Return dry-air volume given dry-bulb temperature and pressure.

Description

Return dry-air volume given dry-bulb temperature and pressure.

Usage

GetDryAirVolume(TDryBulb, Pressure)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

Pressure

A numeric vector of atmospheric pressure in Psi [IP] or Pa [SI]

Value

A numeric vector of dry air volume in ft3 lb-1 [IP] or in m3 kg-1 [SI]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1

  • 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-2 to lb ft-2.

Examples

SetUnitSystem("IP")
GetDryAirVolume(77:87, 14.696)

SetUnitSystem("SI")
GetDryAirVolume(25:30, 101325)

Return humidity ratio from enthalpy and dry-bulb temperature.

Description

Return humidity ratio from enthalpy and dry-bulb temperature.

Usage

GetHumRatioFromEnthalpyAndTDryBulb(MoistAirEnthalpy, TDryBulb)

Arguments

MoistAirEnthalpy

A numeric vector of moist air enthalpy in Btu lb-1 [IP] or J kg-1

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

Value

A numeric vector of humidity ratio in lb_H2O lb_Air-1 [IP] or kg_H2O kg_Air-1 [SI]

Note

Based on the GetMoistAirEnthalpy function, rearranged for humidity ratio.

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 30.

Examples

SetUnitSystem("IP")
GetHumRatioFromEnthalpyAndTDryBulb(42.6168, 76:86)

SetUnitSystem("SI")
GetHumRatioFromEnthalpyAndTDryBulb(81316.0, 20:30)

Return humidity ratio given dry-bulb temperature, relative humidity, and pressure.

Description

Return humidity ratio given dry-bulb temperature, relative humidity, and pressure.

Usage

GetHumRatioFromRelHum(TDryBulb, RelHum, Pressure)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

RelHum

A numeric vector of relative humidity in range [0, 1]

Pressure

A numeric vector of atmospheric Pressure in Psi [IP] or Pa [SI]

Value

A numeric vector of humidity ratio in lb_H2O lb_Air-1 [IP] or kg_H2O kg_Air-1 [SI]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1

Examples

SetUnitSystem("IP")
GetHumRatioFromRelHum(80:100, 0.5, 14.175)

SetUnitSystem("SI")
GetHumRatioFromRelHum(20:30, 0.5, 95461.0)

Return the humidity ratio (aka mixing ratio) from specific humidity.

Description

Return the humidity ratio (aka mixing ratio) from specific humidity.

Usage

GetHumRatioFromSpecificHum(SpecificHum)

Arguments

SpecificHum

A numeric vector of specific humidity in lb_H2O lb_Air-1 [IP] or kg_H2O kg_Air-1 [SI]

Value

A numeric vector of humidity ratio in lb_H2O lb_Dry_Air-1 [IP] or kg_H2O kg_Dry_Air-1 [SI]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 9b (solved for humidity ratio)

Examples

SetUnitSystem("IP")
GetHumRatioFromSpecificHum(seq(0.006, 0.016, 0.001))

SetUnitSystem("SI")
GetHumRatioFromSpecificHum(seq(0.006, 0.016, 0.001))

Return humidity ratio given dew-point temperature and pressure.

Description

Return humidity ratio given dew-point temperature and pressure.

Usage

GetHumRatioFromTDewPoint(TDewPoint, Pressure)

Arguments

TDewPoint

A numeric vector of dew-point temperature in degreeF [IP] or degreeC [SI]

Pressure

A numeric vector of atmospheric Pressure in Psi [IP] or Pa [SI]

Value

A numeric vector of humidity ratio in lb_H2O lb_Air-1 [IP] or kg_H2O kg_Air-1 [SI]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 13

Examples

SetUnitSystem("IP")
GetHumRatioFromTDewPoint(50:80, 14.175)

SetUnitSystem("SI")
GetHumRatioFromTDewPoint(20:30, 95461.0)

Return humidity ratio given dry-bulb temperature, wet-bulb temperature, and pressure.

Description

Return humidity ratio given dry-bulb temperature, wet-bulb temperature, and pressure.

Usage

GetHumRatioFromTWetBulb(TDryBulb, TWetBulb, Pressure)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

TWetBulb

A numeric vector of wet-bulb temperature in degreeF [IP] or degreeC [SI]

Pressure

A numeric vector of atmospheric Pressure in Psi [IP] or Pa [SI]

Value

A numeric vector of humidity ratio in lb_H2O lb_Air-1 [IP] or kg_H2O kg_Air-1 [SI]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 33 and 35

Examples

SetUnitSystem("IP")
GetHumRatioFromTWetBulb(80:100, 77.0, 14.175)

SetUnitSystem("SI")
GetHumRatioFromTWetBulb(20:30, 19.0, 95461.0)

Return humidity ratio given water vapor pressure and atmospheric pressure.

Description

Return humidity ratio given water vapor pressure and atmospheric pressure.

Usage

GetHumRatioFromVapPres(VapPres, Pressure)

Arguments

VapPres

A numeric vector of partial pressure of water vapor in moist air in Psi [IP] or Pa [SI]

Pressure

A numeric vector of atmospheric pressure in Psi [IP] or Pa [SI]

Value

A numeric vector of humidity ratio in lb_H2O lb_Air-1 [IP] or kg_H2O kg_Air-1 [SI]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 20

Examples

SetUnitSystem("IP")
GetHumRatioFromVapPres(seq(0.4, 0.6, 0.01), 14.175)

SetUnitSystem("SI")
GetHumRatioFromVapPres(seq(3000, 4000, 100), 95461)

Return moist air density given humidity ratio, dry bulb temperature, and pressure.

Description

Return moist air density given humidity ratio, dry bulb temperature, and pressure.

Usage

GetMoistAirDensity(TDryBulb, HumRatio, Pressure)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

HumRatio

A numeric vector of humidity ratio in lb_H2O lb_Air-1 [IP] or kg_H2O kg_Air-1 [SI]

Pressure

A numeric vector of atmospheric pressure in Psi [IP] or Pa [SI]

Value

A numeric vector of moistAirDensity: Moist air density in lb ft-3 [IP] or kg m-3 [SI]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 11

Examples

SetUnitSystem("IP")
GetMoistAirDensity(80:100, 0.02, 14.175)

SetUnitSystem("SI")
GetMoistAirDensity(20:30, 0.02, 95461)

Return moist air enthalpy given dry-bulb temperature and humidity ratio.

Description

Return moist air enthalpy given dry-bulb temperature and humidity ratio.

Usage

GetMoistAirEnthalpy(TDryBulb, HumRatio)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

HumRatio

A numeric vector of humidity ratio in lb_H2O lb_Air-1 [IP] or kg_H2O kg_Air-1 [SI]

Value

A numeric vector of moist air enthalpy in Btu lb-1 [IP] or J kg-1

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 30

Examples

SetUnitSystem("IP")
GetMoistAirEnthalpy(80:100, 0.02)

SetUnitSystem("SI")
GetMoistAirEnthalpy(20:30, 0.02)

Return moist air specific volume given dry-bulb temperature, humidity ratio, and pressure.

Description

Return moist air specific volume given dry-bulb temperature, humidity ratio, and pressure.

Usage

GetMoistAirVolume(TDryBulb, HumRatio, Pressure)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

HumRatio

A numeric vector of humidity ratio in lb_H2O lb_Air-1 [IP] or kg_H2O kg_Air-1 [SI]

Pressure

A numeric vector of atmospheric pressure in Psi [IP] or Pa [SI]

Value

A numeric vector of specific volume of moist air in ft3 lb-1 of dry air [IP] or in m3 kg-1 of dry air [SI]

Note

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-2 to lb ft-2.

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 26

Examples

SetUnitSystem("IP")
GetMoistAirVolume(80:100, 0.02, 14.175)

SetUnitSystem("SI")
GetMoistAirVolume(20:30, 0.02, 95461)

Return relative humidity given dry-bulb temperature, humidity ratio, and pressure.

Description

Return relative humidity given dry-bulb temperature, humidity ratio, and pressure.

Usage

GetRelHumFromHumRatio(TDryBulb, HumRatio, Pressure)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

HumRatio

A numeric vector of humidity ratio in lb_H2O lb_Air-1 [IP] or kg_H2O kg_Air-1 [SI]

Pressure

A numeric vector of atmospheric Pressure in Psi [IP] or Pa [SI]

Value

A numeric vector of relative humidity in range [0, 1]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1

Examples

SetUnitSystem("IP")
GetRelHumFromHumRatio(80:100, 0.01, 14.175)

SetUnitSystem("SI")
GetRelHumFromHumRatio(20:30, 0.01, 95461.0)

Return relative humidity given dry-bulb temperature and dew-point temperature.

Description

Return relative humidity given dry-bulb temperature and dew-point temperature.

Usage

GetRelHumFromTDewPoint(TDryBulb, TDewPoint)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

TDewPoint

A numeric vector of dew-point temperature in degreeF [IP] or degreeC [SI]

Value

A numeric vector of relative humidity in range [0, 1]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 22

Examples

SetUnitSystem("IP")
GetRelHumFromTDewPoint(80:100, 65)

SetUnitSystem("SI")
GetRelHumFromTDewPoint(20:30, 15)

Return relative humidity given dry-bulb temperature, wet bulb temperature and pressure.

Description

Return relative humidity given dry-bulb temperature, wet bulb temperature and pressure.

Usage

GetRelHumFromTWetBulb(TDryBulb, TWetBulb, Pressure)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

TWetBulb

A numeric vector of wet-bulb temperature in degreeF [IP] or degreeC [SI]

Pressure

A numeric vector of atmospheric pressure in Psi [IP] or Pa [SI]

Value

A numeric vector of relative humidity in range [0, 1]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1

Examples

SetUnitSystem("IP")
GetRelHumFromTWetBulb(80:100, 79.9, 14.696)

SetUnitSystem("SI")
GetRelHumFromTWetBulb(25:40, 20, 101325.0)

Return relative humidity given dry-bulb temperature and vapor pressure.

Description

Return relative humidity given dry-bulb temperature and vapor pressure.

Usage

GetRelHumFromVapPres(TDryBulb, VapPres)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

VapPres

A numeric vector of partial pressure of water vapor in moist air in Psi [IP] or Pa [SI]

Value

A numeric vector of relative humidity in range [0, 1]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 12, 22

Examples

SetUnitSystem("IP")
GetRelHumFromVapPres(70:80, 0.0149)

SetUnitSystem("SI")
GetRelHumFromVapPres(20:30, 12581)

Return saturated air enthalpy given dry-bulb temperature and pressure.

Description

Return saturated air enthalpy given dry-bulb temperature and pressure.

Usage

GetSatAirEnthalpy(TDryBulb, Pressure)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

Pressure

A numeric vector of atmospheric pressure in Psi [IP] or Pa [SI]

Value

A numeric vector of saturated air enthalpy in Btu lb-1 [IP] or J kg-1 [SI]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1

Examples

SetUnitSystem("IP")
GetSatAirEnthalpy(80:100, 14.696)

SetUnitSystem("SI")
GetSatAirEnthalpy(20:30, 101325)

Return humidity ratio of saturated air given dry-bulb temperature and pressure.

Description

Return humidity ratio of saturated air given dry-bulb temperature and pressure.

Usage

GetSatHumRatio(TDryBulb, Pressure)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

Pressure

A numeric vector of atmospheric pressure in Psi [IP] or Pa [SI]

Value

A numeric vector of humidity ratio of saturated air in lb_H2O lb_Air-1 [IP] or kg_H2O kg_Air-1 [SI]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 36, solved for W

Examples

SetUnitSystem("IP")
GetSatHumRatio(80:100, 14.696)

SetUnitSystem("SI")
GetSatHumRatio(20:30, 101325)

Return saturation vapor pressure given dry-bulb temperature.

Description

Return saturation vapor pressure given dry-bulb temperature.

Usage

GetSatVapPres(TDryBulb)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

Value

A numeric vector of vapor pressure of saturated air in Psi [IP] or Pa [SI]

Note

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.

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 5 & 6

Examples

SetUnitSystem("IP")
GetSatVapPres(80:100)

SetUnitSystem("SI")
GetSatVapPres(20:30)

Return sea level pressure given dry-bulb temperature, altitude above sea level and pressure.

Description

Return sea level pressure given dry-bulb temperature, altitude above sea level and pressure.

Usage

GetSeaLevelPressure(StationPressure, Altitude, TDryBulb)

Arguments

StationPressure

A numeric vector of observed station pressure in Psi [IP] or Pa [SI]

Altitude

A numeric vector of altitude in ft [IP] or m [SI]

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

Value

A numeric vector of sea level barometric pressure in Psi [IP] or Pa [SI]

Note

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.

References

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.

Examples

SetUnitSystem("IP")
GetSeaLevelPressure(14.68, 300:400, 62.94)

SetUnitSystem("SI")
GetSeaLevelPressure(101226.5, 105:205, 17.19)

Return the specific humidity from humidity ratio (aka mixing ratio).

Description

Return the specific humidity from humidity ratio (aka mixing ratio).

Usage

GetSpecificHumFromHumRatio(HumRatio)

Arguments

HumRatio

A numeric vector of humidity ratio in lb_H2O lb_Dry_Air-1 [IP] or kg_H2O kg_Dry_Air-1 [SI]

Value

A numeric vector of specific humidity in lb_H2O lb_Air-1 [IP] or kg_H2O kg_Air-1 [SI]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 9b

Examples

SetUnitSystem("IP")
GetSpecificHumFromHumRatio(seq(0.006, 0.016, 0.001))

SetUnitSystem("SI")
GetSpecificHumFromHumRatio(seq(0.006, 0.016, 0.001))

Return standard atmosphere barometric pressure, given the elevation (altitude).

Description

Return standard atmosphere barometric pressure, given the elevation (altitude).

Usage

GetStandardAtmPressure(Altitude)

Arguments

Altitude

A numeric vector of altitude in ft [IP] or m [SI]

Value

A numeric vector of standard atmosphere barometric pressure in Psi [IP] or Pa [SI]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 3

Examples

SetUnitSystem("IP")
GetStandardAtmPressure(seq(-500, 1000, 100))

SetUnitSystem("SI")
GetStandardAtmPressure(seq(-500, 1000, 100))

Return standard atmosphere temperature, given the elevation (altitude).

Description

Return standard atmosphere temperature, given the elevation (altitude).

Usage

GetStandardAtmTemperature(Altitude)

Arguments

Altitude

A numeric vector of altitude in ft [IP] or m [SI]

Value

A numeric vector of standard atmosphere dry-bulb temperature in degreeF [IP] or degreeC [SI]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 4

Examples

SetUnitSystem("IP")
GetStandardAtmTemperature(seq(-500, 1000, 100))

SetUnitSystem("SI")
GetStandardAtmTemperature(seq(-500, 1000, 100))

Return station pressure from sea level pressure.

Description

Return station pressure from sea level pressure.

Usage

GetStationPressure(SeaLevelPressure, Altitude, TDryBulb)

Arguments

SeaLevelPressure

A numeric vector of sea level barometric pressure in Psi [IP] or Pa [SI]

Altitude

A numeric vector of altitude in ft [IP] or m [SI]

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

Value

A numeric vector of station pressure in Psi [IP] or Pa [SI]

Note

This function is just the inverse of GetSeaLevelPressure.

References

See GetSeaLevelPressure.

Examples

SetUnitSystem("IP")
GetStationPressure(14.68, 300:400, 62.94)

SetUnitSystem("SI")
GetStationPressure(101226.5, 105:205, 17.19)

Utility function to convert temperature to degree Celsius (degreeC) given temperature in Kelvin (K).

Description

Utility function to convert temperature to degree Celsius (degreeC) given temperature in Kelvin (K).

Usage

GetTCelsiusFromTKelvin(TKelvin)

Arguments

TKelvin

A numeric vector of temperature in degree Kelvin (K)

Value

A numeric vector of temperature in Celsius (degreeC)

Notes

Exact conversion.

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 section 3

Examples

GetTCelsiusFromTKelvin(300:400)

Return dew-point temperature given dry-bulb temperature, humidity ratio, and pressure.

Description

Return dew-point temperature given dry-bulb temperature, humidity ratio, and pressure.

Usage

GetTDewPointFromHumRatio(TDryBulb, HumRatio, Pressure)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

HumRatio

A numeric vector of humidity ratio in lb_H2O lb_Air-1 [IP] or kg_H2O kg_Air-1 [SI]

Pressure

A numeric vector of atmospheric Pressure in Psi [IP] or Pa [SI]

Value

A numeric vector of dew-point temperature in degreeF [IP] or degreeC [SI]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1

Examples

SetUnitSystem("IP")
GetTDewPointFromHumRatio(80:100, 0.01, 14.175)

SetUnitSystem("SI")
GetTDewPointFromHumRatio(20:30, 0.01, 95461.0)

Return dew-point temperature given dry-bulb temperature and relative humidity.

Description

Return dew-point temperature given dry-bulb temperature and relative humidity.

Usage

GetTDewPointFromRelHum(TDryBulb, RelHum)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

RelHum

A numeric vector of relative humidity in range [0, 1]

Value

A numeric vector of dew-point temperature in degreeF [IP] or degreeC [SI]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1

Examples

SetUnitSystem("IP")
GetTDewPointFromRelHum(80:100, 0.2)

SetUnitSystem("SI")
GetTDewPointFromRelHum(20:30, 0.4)

Return dew-point temperature given dry-bulb temperature, wet-bulb temperature, and pressure.

Description

Return dew-point temperature given dry-bulb temperature, wet-bulb temperature, and pressure.

Usage

GetTDewPointFromTWetBulb(TDryBulb, TWetBulb, Pressure)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

TWetBulb

A numeric vector of wet-bulb temperature in degreeF [IP] or degreeC [SI]

Pressure

A numeric vector of atmospheric pressure in Psi [IP] or Pa [SI]

Value

A numeric vector of dew-point temperature in degreeF [IP] or degreeC [SI]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1

Examples

SetUnitSystem("IP")
GetTDewPointFromTWetBulb(80:100, 65.0, 14.696)

SetUnitSystem("SI")
GetTDewPointFromTWetBulb(25:40, 20, 101325.0)

Return dew-point temperature given dry-bulb temperature and vapor pressure.

Description

Return dew-point temperature given dry-bulb temperature and vapor pressure.

Usage

GetTDewPointFromVapPres(TDryBulb, VapPres)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

VapPres

A numeric vector of partial pressure of water vapor in moist air in Psi [IP] or Pa [SI]

Value

A numeric vector of dew-point temperature in degreeF [IP] or degreeC [SI]

Note

  • 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.

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn. 5 and 6

Examples

SetUnitSystem("IP")
GetTDewPointFromVapPres(70:80, seq(0.0149, 0.0249, 0.001))

SetUnitSystem("SI")
GetTDewPointFromVapPres(70:80, 12581:12591)

Return dry bulb temperature from enthalpy and humidity ratio.

Description

Return dry bulb temperature from enthalpy and humidity ratio.

Usage

GetTDryBulbFromEnthalpyAndHumRatio(MoistAirEnthalpy, HumRatio)

Arguments

MoistAirEnthalpy

A numeric vector of moist air enthalpy in Btu lb-1 [IP] or J kg-1

HumRatio

A numeric vector of humidity ratio in lb_H2O lb_Air-1 [IP] or kg_H2O kg_Air-1 [SI]

Value

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

Note

Based on the GetMoistAirEnthalpy function, rearranged for temperature.

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 30

Examples

SetUnitSystem("IP")
GetTDryBulbFromEnthalpyAndHumRatio(42.6168, seq(0.01, 0.02, 0.001))

SetUnitSystem("SI")
GetTDryBulbFromEnthalpyAndHumRatio(81316.0, seq(0.01, 0.02, 0.001))

Return dry-bulb temperature given moist air specific volume, humidity ratio, and pressure.

Description

Return dry-bulb temperature given moist air specific volume, humidity ratio, and pressure.

Usage

GetTDryBulbFromMoistAirVolumeAndHumRatio(MoistAirVolume, HumRatio, Pressure)

Arguments

MoistAirVolume

A numeric vector of specific volume of moist air in ft3 lb-1 of dry air [IP] or in m3 kg-1 of dry air [SI]

HumRatio

A numeric vector of humidity ratio in lb_H2O lb_Air-1 [IP] or kg_H2O kg_Air-1 [SI]

Pressure

A numeric vector of atmospheric pressure in Psi [IP] or Pa [SI]

Value

A numeric vector of tDryBulb : Dry-bulb temperature in degreeF [IP] or degreeC [SI]

Note

  • 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-2 to lb ft-2.

  • Based on the 'GetMoistAirVolume' function, rearranged for dry-bulb temperature.

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 26

Examples

SetUnitSystem("IP")
GetTDryBulbFromMoistAirVolumeAndHumRatio(14.72, seq(0.02, 0.03, 0.001), 14.175)

SetUnitSystem("SI")
GetTDryBulbFromMoistAirVolumeAndHumRatio(0.94, seq(0.02, 0.03, 0.001), 95461)

Utility function to convert temperature to degree Fahrenheit (degreeF) given temperature in degree Rankine (degreeR).

Description

Utility function to convert temperature to degree Fahrenheit (degreeF) given temperature in degree Rankine (degreeR).

Usage

GetTFahrenheitFromTRankine(TRankine)

Arguments

TRankine

A numeric vector of temperature in degree Rankine (degreeR)

Value

A numeric vector of temperature in degree Fahrenheit (degreeF)

Notes

Exact conversion.

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 section 3

Examples

GetTFahrenheitFromTRankine(500:600)

Utility function to convert temperature to Kelvin (K) given temperature in degree Celsius (degreeC).

Description

Utility function to convert temperature to Kelvin (K) given temperature in degree Celsius (degreeC).

Usage

GetTKelvinFromTCelsius(TCelsius)

Arguments

TCelsius

A numeric vector of temperature in degree Celsius (degreeC)

Value

A numeric vector of temperature in Kelvin (K)

Notes

Exact conversion.

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 section 3

Examples

GetTKelvinFromTCelsius(20:30)

Utility function to convert temperature to degree Rankine (degreeR) given temperature in degree Fahrenheit (degreeF).

Description

Utility function to convert temperature to degree Rankine (degreeR) given temperature in degree Fahrenheit (degreeF).

Usage

GetTRankineFromTFahrenheit(TFahrenheit)

Arguments

TFahrenheit

A numeric vector of temperature in degree Fahrenheit (degreeF)

Value

A numeric vector of temperature in degree Rankine (degreeR)

Notes

Exact conversion.

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 section 3

Examples

GetTRankineFromTFahrenheit(1:100)

Return wet-bulb temperature given dry-bulb temperature, humidity ratio, and pressure.

Description

Return wet-bulb temperature given dry-bulb temperature, humidity ratio, and pressure.

Usage

GetTWetBulbFromHumRatio(TDryBulb, HumRatio, Pressure)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

HumRatio

A numeric vector of humidity ratio in lb_H2O lb_Air-1 [IP] or kg_H2O kg_Air-1 [SI]

Pressure

A numeric vector of atmospheric Pressure in Psi [IP] or Pa [SI]

Value

A numeric vector of wet-bulb temperature in degreeF [IP] or degreeC [SI]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 33 and 35 solved for Tstar

Examples

SetUnitSystem("IP")
GetTWetBulbFromHumRatio(80:100, 0.01, 14.175)

SetUnitSystem("SI")
GetTWetBulbFromHumRatio(20:30, 0.01, 95461)

Return wet-bulb temperature given dry-bulb temperature, relative humidity, and pressure.

Description

Return wet-bulb temperature given dry-bulb temperature, relative humidity, and pressure.

Usage

GetTWetBulbFromRelHum(TDryBulb, RelHum, Pressure)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

RelHum

A numeric vector of relative humidity in range [0, 1]

Pressure

A numeric vector of atmospheric pressure in Psi [IP] or Pa [SI]

Value

A numeric vector of wet-bulb temperature in degreeF [IP] or degreeC [SI]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1

Examples

SetUnitSystem("IP")
GetTWetBulbFromRelHum(80:100, 0.2, 14.696)

SetUnitSystem("SI")
GetTWetBulbFromRelHum(25:40, 0.2, 101325.0)

Return wet-bulb temperature given dry-bulb temperature, dew-point temperature, and pressure.

Description

Return wet-bulb temperature given dry-bulb temperature, dew-point temperature, and pressure.

Usage

GetTWetBulbFromTDewPoint(TDryBulb, TDewPoint, Pressure)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

TDewPoint

A numeric vector of dew-point temperature in degreeF [IP] or degreeC [SI]

Pressure

A numeric vector of atmospheric pressure in Psi [IP] or Pa [SI]

Value

A numeric vector of wet-bulb temperature in degreeF [IP] or degreeC [SI]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1

Examples

SetUnitSystem("IP")
GetTWetBulbFromTDewPoint(80:100, 40.0, 14.696)

SetUnitSystem("SI")
GetTWetBulbFromTDewPoint(25:40, 20.0, 101325.0)

Return system of units in use.

Description

Return system of units in use.

Usage

GetUnitSystem()

Value

A string indicating system of units in use ("SI" or "IP")


Return Vapor pressure deficit given dry-bulb temperature, humidity ratio, and pressure.

Description

Return Vapor pressure deficit given dry-bulb temperature, humidity ratio, and pressure.

Usage

GetVaporPressureDeficit(TDryBulb, HumRatio, Pressure)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

HumRatio

A numeric vector of humidity ratio in lb_H2O lb_Air-1 [IP] or kg_H2O kg_Air-1 [SI]

Pressure

A numeric vector of atmospheric pressure in Psi [IP] or Pa [SI]

Value

A numeric vector of vapor pressure deficit in Psi [IP] or Pa [SI]

References

Oke (1987) eqn 2.13a

Examples

SetUnitSystem("IP")
GetVaporPressureDeficit(80:100, 0.01, 14.175)

SetUnitSystem("SI")
GetVaporPressureDeficit(20:30, 0.01, 95461.0)

Return vapor pressure given humidity ratio and pressure.

Description

Return vapor pressure given humidity ratio and pressure.

Usage

GetVapPresFromHumRatio(HumRatio, Pressure)

Arguments

HumRatio

A numeric vector of humidity ratio in lb_H2O lb_Air-1 [IP] or kg_H2O kg_Air-1 [SI]

Pressure

A numeric vector of atmospheric pressure in Psi [IP] or Pa [SI]

Value

A numeric vector of partial pressure of water vapor in moist air in Psi [IP] or Pa [SI]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 20 solved for pw

Examples

SetUnitSystem("IP")
GetVapPresFromHumRatio(seq(0.02, 0.03, 0.001), 14.175)

SetUnitSystem("SI")
GetVapPresFromHumRatio(seq(0.02, 0.03, 0.001), 95461)

Return partial pressure of water vapor as a function of relative humidity and temperature.

Description

Return partial pressure of water vapor as a function of relative humidity and temperature.

Usage

GetVapPresFromRelHum(TDryBulb, RelHum)

Arguments

TDryBulb

A numeric vector of dry-bulb temperature in degreeF [IP] or degreeC [SI]

RelHum

A numeric vector of relative humidity in range [0, 1]

Value

A numeric vector of partial pressure of water vapor in moist air in Psi [IP] or Pa [SI]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 12, 22

Examples

SetUnitSystem("IP")
GetVapPresFromRelHum(77, seq(0.1, 0.8, 0.1))

SetUnitSystem("SI")
GetVapPresFromRelHum(20, seq(0.1, 0.8, 0.1))

Return vapor pressure given dew point temperature.

Description

Return vapor pressure given dew point temperature.

Usage

GetVapPresFromTDewPoint(TDewPoint)

Arguments

TDewPoint

A numeric vector of dew-point temperature in degreeF [IP] or degreeC [SI]

Value

A numeric vector of partial pressure of water vapor in moist air in Psi [IP] or Pa [SI]

References

ASHRAE Handbook - Fundamentals (2017) ch. 1 eqn 36

Examples

SetUnitSystem("IP")
GetVapPresFromTDewPoint(12:20)

SetUnitSystem("SI")
GetVapPresFromTDewPoint(12:20)

Check whether the system in use is IP or SI.

Description

Check whether the system in use is IP or SI.

Usage

isIP()

Value

TRUE if unit system is IP


Set the system of units to use (SI or IP).

Description

Set the system of units to use (SI or IP).

Usage

SetUnitSystem(units)

Arguments

units

A string indicating the system of units chosen. Should be either "SI" or "IP"