psychrometricsExt

A SkySpark extension that provides a set of psychrometric Axon functions
psychrometricsExt

Registered users on StackHub may elect to receive email notifications whenever new package versions are released.

v1.3.1

Axon functions

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)

References

  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³)

Notes

  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)

Computes standard atmospheric pressure given elevation. 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)

Computes standard atmospheric temperature given elevation. 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
wetBulb
wetBulb(tDB, rh, p: stdPressure(0m), maxIter: 5, tol: 1.0E-5, 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
  • maxIter: Maximum Newton-Raphson iterations (Default = 5)
  • tol: Relative tolerance target (Applied to calculated humidity ratios) (Default = 1E-5)
  • checked: If true, throws exception if tolerance is not met; if false returns 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 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.

Published by NREL

Packages by NREL

Free packages