 # psychrometricsExt

Psychrometric Axon functions
psychrometricsExtAxon funcs

Registered StackHub users may elect to receive email notifications whenever a new package version is released.

There are 6 watchers.

v1.4.3

dewPoint
dewPoint(p, w)

Computes dew-point temperature given ambient pressure and humidity ratio. Ported from `Dew_point` VBA function in Eric Kozubal's psychrometrics spreadsheet.

#### Parameters

• p: Ambient pressure
• w: Humidity ratio

#### Returns

Dew-point temperature (°C)

1. Equations (39)-(40), p. 1.9, ASHRAE Fundamentals Handbook (2013), SI Edition
dryAirDensity
dryAirDensity(tDB, w, p: stdPressure(0m))

Computes dry air density given dry bulb temperature, humidity ratio, and ambient pressure. Ported from `Dry_Air_Density` VBA function in Eric Kozubal's psychrometrics spreadsheet.

#### Parameters

• tDB: Dry bulb temperature
• w: Humidity ratio
• p: Ambient pressure

#### Returns

Dry air density (kg/m³)

1. Dry air density is developed as specific volume in the ASHRAE handbook; density is the reciprocal. Note that the total density of an air-water mixture is
`rho_moist_air = rho * (1 + w)`

in which w is the humidity ratio.

2. Output units are kilogram of dry air per cubic meter. However, because SkySpark does not have a standard unit `kg_dry/m³`, the (more ambiguous) unit `kg/m³` is used instead.
3. If no ambient pressure is specified, a pressure of 101.325 kPa (standard atmospheric pressure at sea level) is assumed.
4. At this time there is no IP unit for density supported by SkySpark. Therefore, converting the output of this function to IP requires some shenanigans. For instance, to convert to (lb/ft³) use:
`dryAirDensity(tDB, w, p).as(1) * 1kg.to(1lb) / 1m³.to(1ft³)`

This gets you the custom unit `_lb/ft³`.

#### References

1. Equation (28), p. 1.9, ASHRAE Fundamentals Handbook (2013), SI Edition
humidityRatio
humidityRatio(tDB, tWB, p: stdPressure(0m))

Computes humidity ratio given dry bulb temperature, wet bulb temperature, and ambient pressure. Ported from `Hum_rat` VBA function in Eric Kozubal's psychrometrics spreadsheet.

#### Parameters

• tDB: Dry bulb temperature
• tWB: Wet bulb temperature
• p: Ambient pressure

#### Returns

Humidity ratio (unitless)

#### Notes

1. If no ambient pressure is specified, a pressure of 101.325 kPa (standard atmospheric pressure at sea level) is assumed.
2. The output humidity ratio is unitless (kg/kg or lb/lb). SkySpark also supports the unit `gH₂O/kgAir`; to convert the output of this function to `gH₂O/kgAir` multiply by 1000.

#### References

1. Equation (23), p. 1.8, ASHRAE Fundamentals Handbook (2013), SI Edition
2. Equation (35), p. 1.9, ASHRAE Fundamentals Handbook (2013), SI Edition
3. Equation (37), p. 1.9, ASHRAE Fundamentals Handbook (2013), SI Edition
humidityRatio2
humidityRatio2(tDB, rh, p: stdPressure(0m))

Computes humidity ratio given dry bulb temperature, relative humidity, and ambient pressure. Ported from `Hum_rat2` VBA function in Eric Kozubal's psychrometrics spreadsheet.

#### Parameters

• tDB: Dry bulb temperature
• rh: Relative humidity
• p: Ambient pressure

#### Returns

Humidity ratio (unitless)

#### Notes

1. If no ambient pressure is specified, a pressure of 101.325 kPa (standard atmospheric pressure at sea level) is assumed.
2. The output humidity ratio is unitless (kg/kg or lb/lb). SkySpark also supports the unit `gH₂O/kgAir`; to convert the output of this function to `gH₂O/kgAir` multiply by 1000.

#### References

1. Equation (22), p. 1.8, ASHRAE Fundamentals Handbook (2013), SI Edition
2. Equation (24), p. 1.8, ASHRAE Fundamentals Handbook (2013), SI Edition
moistAirDensity
moistAirDensity(tDB, w, p: stdPressure(0m))

Computes moist air density given dry bulb temperature, humidity ratio, and ambient pressure. Adapted from Greg Barker's `Rho_MoistAir_TandPandW_kgPm3` function for Campbell Scientific data loggers.

#### Parameters

• tDB: Dry bulb temperature
• w: Humidity ratio
• p: Ambient pressure

#### Returns

Moist air density (kg/m³)

#### Notes

1. If no ambient pressure is specified, a pressure of 101.325 kPa (standard atmospheric pressure at sea level) is assumed.
2. Note that at this time there is no IP unit for density supported by SkySpark. Therefore, converting the output of this function to IP requires some shenanigans. For instance, to convert to (lb/ft³) use:
`moistAirDensity(tDB, w, p).as(1) * 1kg.to(1lb) / 1m³.to(1ft³)`

This gets you the custom unit `_lb/ft³`.

#### References

1. Equation (11), p. 1.8, ASHRAE Fundamentals Handbook (2009), SI Edition
2. Equation (28), p. 1.9, ASHRAE Fundamentals Handbook (2009), SI Edition
moistAirEnthalpy
moistAirEnthalpy(tDB, w)

Computes moist air specific enthalpy given dry bulb temperature and humidity ratio. Ported from `Enthalpy_Air_H2O` VBA function in Eric Kozubal's psychrometrics spreadsheet.

#### Parameters

• tDB: Dry bulb temperature
• w: Humidity ratio

#### Returns

Moist air specific enthalpy (kJ/kg)

#### Notes

1. This function returns specific enthalpy in SI units,
`h = 1.006*tDB + w * (2501 + 1.86*tDB)`

in which

• h = specific enthalpy (kJ/kg),
• tDB = dry bulb temperature (°C), and
• w = humidity ratio.

The equivalent IP calculation is:

`h = 0.240*tDB + w * (1061 + 0.444*tDB)`

in which

• h = specific enthalpy (BTU/lb),
• tDB = dry bulb temperature (°F),
• w = humidity ratio.

Because SI specific enthalpy is referenced to 0°C and IP specific enthalpy to 0°F, there is the IP quantity is offset from the SI quantity by approximately 17.8 kJ/kg (7.66 BTU/lb). (Note that this offset drifts slightly between the SI and IP approximations depending on the temperature.) To convert the output of this function to IP units, use the approximation:

`(moistAirEnthalpy(tDB, w) + 17.8kJ/kg).to(BTU/lb)`
2. SkySpark supports two sets of units for enthalpy: energy per unit mass of moist air (e.g. `kJ/kg`) and energy per unit mass of dry air (e.g. `kJ/kg_dry`). The SI units are the same, but the interpretation is different. The ASHRAE Fundamentals Handbook, SI Edition, specifies enthalpy kilojoules per kilogram of dry air. Therefore, SkySpark output units are `kJ/kg_dry`.

#### References

1. Equation (32), p. 1.9, ASHRAE Fundamentals Handbook (2013), SI Edition
moistAirSpecificHeat
moistAirSpecificHeat(w)

Computes the specific heat of moist air given humidity ratio.

#### Parameters

• w: Humidity ratio

#### Returns

Specific heat of moist air (J/(kg_dry·K))

#### Notes

1. Per ASHRAE Standard 37, the specific heat of air is used primarily for calculating sensible cooling capacity. Therefore, despite being defined for moist air, it is reported per unit mass of dry air, i.e. per `kg_dry`. This allows direct use in the various ASHRAE Standard 37 capacity equations.
2. At this time, SkySpark does not support any unit for specific heat. Therefore, this function returns the custom unit `_J/kg_dry/K`.
3. The specific heat of dry air actually varies with temperature, but is approximately 1005 J/(kg_dry·K) (the value used in this function) at typical room temperature. Similarly, the specific heat of water vapor also varies with temperature, but this function uses the fixed value 1805 J/(kg·K), following the equations in ASHRAE Standard 37 Section 7.3.3.

#### References

1. Section 7.3.3, p. 11, Methods of Testing for Rating Electrically Driven Unitary Air-Conditioning and Heat Pump Equipment, ASHRAE Standard 37-2009.
partialPressure
partialPressure(p, w)

Computes water vapor partial pressure given ambient pressure and humidity ratio. Ported from `Part_press` VBA function in Eric Kozubal's psychrometrics spreadsheet.

#### Parameters

• p: Ambient pressure
• w: Humidity ratio

#### Returns

Water vapor partial pressure (kPa)

#### References

1. Equation (38), p. 1.9, ASHRAE Fundamentals Handbook (2013), SI Edition
relativeHumidity
relativeHumidity(tDB, tWB, p: stdPressure(0m))

Computes relative humidity given dry bulb temperature, wet bulb temperature, and ambient pressure. Ported from `Rel_hum` VBA function in Eric Kozubal's psychrometrics spreadsheet.

#### Parameters

• tDB: Dry bulb temperature
• tWB: Wet bulb temperature
• p: Ambient pressure

#### Returns

Relative humidity (%RH)

#### Notes

1. If no ambient pressure is specified, a pressure of 101.325 kPa (standard atmospheric pressure at sea level) is assumed.

#### References

1. Equation (24), p. 1.8, ASHRAE Fundamentals Handbook (2013), SI Edition
relativeHumidity2
relativeHumidity2(tDB, w, p: stdPressure(0m))

Computes relative humidity given dry bulb temperature, humidity ratio, and ambient pressure.

Ported from `Rel_hum2` VBA function in Eric Kozubal's psychrometrics spreadsheet.

#### Parameters

• tDB: Dry bulb temperature
• w: Humidity ratio
• p: Ambient pressure

#### Returns

Relative humidity (%RH)

#### Notes

1. If no ambient pressure is specified, a pressure of 101.325 kPa (standard atmospheric pressure at sea level) is assumed.

#### References

1. Equation (24), p. 1.8, ASHRAE Fundamentals Handbook (2013), SI Edition
saturationPressure
saturationPressure(t)

Computes water vapor saturation pressure given ambient temperature. Ported from `Sat_press` VBA function in Eric Kozubal's psychrometrics spreadsheet.

#### Parameters

• t: Ambient temperature

#### Returns

Water vapor saturation pressure (kPa)

#### References

1. Equations (5)-(6), p. 1.2, ASHRAE Fundamentals Handbook (2013), SI Edition
stdPressure
stdPressure(elev: 0m)

Computes standard atmospheric pressure given elevation. If no elevation is specified, sea level is assumed. Ported from `STD_Press` VBA function in Eric Kozubal's psychrometrics spreadsheet.

#### Parameters

• elev: Elevation

#### Returns

Standard atmospheric pressure (kPa)

#### References

1. Equation (3), p. 1.1, ASHRAE Fundamentals Handbook (2013), SI Edition
stdTemp
stdTemp(elev: 0m)

Computes standard atmospheric temperature given elevation. If no elevation is specified, sea level is assumed. Ported from `STD_Temp` VBA function in Eric Kozubal's psychrometrics spreadsheet.

#### Parameters

• elev: Elevation

#### Returns

Standard atmospheric temperature (°C)

#### References

1. Equation (4), p. 1.1, ASHRAE Fundamentals Handbook (2013), SI Edition
waterDensity
waterDensity(t, p: stdPressure(0m))

Approximates the density of pure liquid water as a function of temperature. Models are fit from reference data in Table 13.2 of Wagner and Pruß (2002) and are valid within 0.1% for all temperatures between freezing and boiling and pressures between 50 and 1000 kPa.

#### Parameters

• t: Water temperature
• p: Water pressure

#### Returns

Water density (kg/m³)

#### Notes

1. If no pressure is specified, a pressure of 101.325 kPa (standard atmospheric pressure at sea level) is assumed.
2. Note that at this time there is no IP unit for density supported by SkySpark. Therefore, converting the output of this function to IP requires some shenanigans. For instance, to convert to (lb/ft³) use:
`waterDensity(t).as(1) * 1kg.to(1lb) / 1m³.to(1ft³)`

This gets you the custom unit `_lb/ft³`.

#### References

1. W. Wagner and A. Pruß, "The IAPWS Formulation 1995 for the Thermodynamic Properties of Ordinary Water Substance for General and Scientific Use," Journal of Physical and Chemical Reference Data, vol. 31, no. 2, pp. 387-535, 2002.
waterSpecificHeat
waterSpecificHeat(t, p: stdPressure(0m))

Approximates the specific heat of pure liquid water as a function of temperature. Models are fit from reference data in Table 13.2 of Wagner and Pruß (2002) and are valid within 0.1% for all temperatures between freezing and boiling and pressures between 50 and 1000 kPa.

#### Parameters

• t: Water temperature
• p: Water pressure

#### Returns

Water density (kg/m³)

#### Notes

1. If no pressure is specified, a pressure of 101.325 kPa (standard atmospheric pressure at sea level) is assumed.
2. The SkySpark unit of specific heat is, somewhat confusingly, J/kg°K, although the SI units for energy, mass, and absolute temperature are J, kg, and K, respectively. (Note the lack of °.)
3. There is no IP unit for specific heat defined in SkySpark.

#### References

1. W. Wagner and A. Pruß, "The IAPWS Formulation 1995 for the Thermodynamic Properties of Ordinary Water Substance for General and Scientific Use," Journal of Physical and Chemical Reference Data, vol. 31, no. 2, pp. 387-535, 2002.
wetBulb
wetBulb(tDB, rh, p: stdPressure(0m), opts: {maxIter:5, tol:1.0E-5, delta:0.001Δ°C, checked:false})

Computes wet-bulb temperature given dry bulb temperature, relative humidity, and ambient pressure. Uses Newton-Raphson (NR) method to converge to correct wet bulb temperature, typically within 2-3 iterations. Ported from `Wet_bulb` VBA function in Eric Kozubal's psychrometrics spreadsheet.

#### Parameters

• tDB: Dry bulb temperature
• rh: Relative humidity
• p: Ambient pressure
• opts: A dict of control options; see Options

#### Options

The following control options are supported:

• `maxIter`: Maximum Newton-Raphson iterations (Default = 5)
• `tol`: Relative tolerance target; applied to calculated humidity ratios (Default = 1E-5)
• `delta`: Delta for computing derivative (Default = 0.001Δ°C)
• `checked`: Governs action if tolerance is not met: if true, throw exception; if false return NA (Default = false)

#### Returns

Wet bulb temperature (°C)

#### Notes

1. This function computes the correct wet bulb temperature numerically by comparing output from humidityRatio and humidityRatio2. Iterations terminate when the two humidity ratio calculations match within absolute tolerance `tol` or after `maxIter` iterations, whichever comes first.
2. Since Axon has no while loop construct, this function uses a recursive approach.
3. Set option `checked` to true to throw an exception if the function does not terminate with the two humidity ratios within the specified tolerance. The default value of `checked:false` causes the function to return NA if the humidity ratios do not match within tolerance.
4. If no ambient pressure is specified, a pressure of 101.325 kPa (standard atmospheric pressure at sea level) is assumed.

#### References

See documentation for humidityRatio and humidityRatio2.