Skip to main content

Script functions

The module adds system.psychro, with 18 functions. They work in gateway scripts, Perspective scripts, Vision client scripts and the Designer, and the Designer shows their documentation in autocomplete.

Units are as in units and conventions. Every pressure is absolute, in Pa. Invalid inputs raise a java.lang.IllegalArgumentException.

The examples use p for the site's absolute pressure, for example:

p = system.psychro.pressureFromAltitude(1700)

dewPoint​

system.psychro.dewPoint(dryBulb, relHum)

Dew point over liquid water. Below 0 °C this is over supercooled water; use frostPoint for when frost forms.

ParameterDescription
dryBulbDry bulb temperature, °C
relHumRelative humidity, % (0 to 100), relative to liquid water at all temperatures

Returns: dew point, °C.

system.psychro.dewPoint(25, 50) # 13.864 °C

frostPoint​

system.psychro.frostPoint(dryBulb, relHum)

Dew or frost point: the frost point (over ice) when it is below 0 °C, otherwise the dew point.

ParameterDescription
dryBulbDry bulb temperature, °C
relHumRelative humidity, % (0 to 100), relative to liquid water at all temperatures

Returns: dew or frost point, °C.

system.psychro.frostPoint(-20, 80)

wetBulb​

system.psychro.wetBulb(dryBulb, relHum, pressure)

Thermodynamic wet bulb temperature (ASHRAE). Below 0 °C it is an ice bulb. Near 0 °C, where the wet bulb and ice bulb equations overlap, the wet bulb (liquid) value is returned.

ParameterDescription
dryBulbDry bulb temperature, °C
relHumRelative humidity, % (0 to 100), relative to liquid water at all temperatures
pressureAbsolute pressure, Pa. Use pressureFromAltitude(altitude) if the site has no barometer

Returns: wet bulb temperature, °C.

p = system.psychro.pressureFromAltitude(1700)
system.psychro.wetBulb(25, 50, p) # 17.402 °C

humidityRatio​

system.psychro.humidityRatio(dryBulb, relHum, pressure)

Humidity ratio (moisture content).

ParameterDescription
dryBulbDry bulb temperature, °C
relHumRelative humidity, % (0 to 100), relative to liquid water at all temperatures
pressureAbsolute pressure, Pa. Use pressureFromAltitude(altitude) if the site has no barometer

Returns: humidity ratio, kg water per kg dry air.

system.psychro.humidityRatio(25, 50, p)

absoluteHumidity​

system.psychro.absoluteHumidity(dryBulb, relHum)

Absolute humidity (water vapour density). Does not depend on pressure.

ParameterDescription
dryBulbDry bulb temperature, °C
relHumRelative humidity, % (0 to 100), relative to liquid water at all temperatures

Returns: absolute humidity, kg/m³.

system.psychro.absoluteHumidity(25, 50)

enthalpy​

system.psychro.enthalpy(dryBulb, relHum, pressure)

Moist air enthalpy, referenced to dry air and liquid water at 0 °C.

ParameterDescription
dryBulbDry bulb temperature, °C
relHumRelative humidity, % (0 to 100), relative to liquid water at all temperatures
pressureAbsolute pressure, Pa. Use pressureFromAltitude(altitude) if the site has no barometer

Returns: enthalpy, J per kg dry air.

system.psychro.enthalpy(25, 50, p)

specificVolume​

system.psychro.specificVolume(dryBulb, relHum, pressure)

Moist air specific volume.

ParameterDescription
dryBulbDry bulb temperature, °C
relHumRelative humidity, % (0 to 100), relative to liquid water at all temperatures
pressureAbsolute pressure, Pa. Use pressureFromAltitude(altitude) if the site has no barometer

Returns: specific volume, m³ per kg dry air.

system.psychro.specificVolume(25, 50, p)

density​

system.psychro.density(dryBulb, relHum, pressure)

Moist air density.

ParameterDescription
dryBulbDry bulb temperature, °C
relHumRelative humidity, % (0 to 100), relative to liquid water at all temperatures
pressureAbsolute pressure, Pa. Use pressureFromAltitude(altitude) if the site has no barometer

Returns: density, kg/m³.

system.psychro.density(25, 50, p)

vaporPressure​

system.psychro.vaporPressure(dryBulb, relHum)

Partial pressure of water vapour.

ParameterDescription
dryBulbDry bulb temperature, °C
relHumRelative humidity, % (0 to 100), relative to liquid water at all temperatures

Returns: vapour pressure, Pa.

system.psychro.vaporPressure(25, 50)

saturationPressure​

system.psychro.saturationPressure(temperature)

Saturation vapour pressure over liquid water (over supercooled water below 0 °C).

ParameterDescription
temperatureTemperature, °C

Returns: saturation vapour pressure, Pa.

system.psychro.saturationPressure(25)

vpd​

system.psychro.vpd(dryBulb, relHum)

Vapour pressure deficit: saturation pressure minus actual vapour pressure.

ParameterDescription
dryBulbDry bulb temperature, °C
relHumRelative humidity, % (0 to 100), relative to liquid water at all temperatures

Returns: vapour pressure deficit, Pa.

system.psychro.vpd(28, 75)

relHumFromDewPoint​

system.psychro.relHumFromDewPoint(dryBulb, dewPoint)

Relative humidity from dew point.

ParameterDescription
dryBulbDry bulb temperature, °C
dewPointDew point over liquid water, °C

Returns: relative humidity, %.

system.psychro.relHumFromDewPoint(25, 10)

relHumFromWetBulb​

system.psychro.relHumFromWetBulb(dryBulb, wetBulb, pressure)

Relative humidity from wet bulb temperature.

ParameterDescription
dryBulbDry bulb temperature, °C
wetBulbWet bulb temperature, °C
pressureAbsolute pressure, Pa. Use pressureFromAltitude(altitude) if the site has no barometer

Returns: relative humidity, %.

system.psychro.relHumFromWetBulb(25, 18, p)

relHumFromHumidityRatio​

system.psychro.relHumFromHumidityRatio(dryBulb, humidityRatio, pressure)

Relative humidity from humidity ratio.

ParameterDescription
dryBulbDry bulb temperature, °C
humidityRatioHumidity ratio, kg water per kg dry air
pressureAbsolute pressure, Pa. Use pressureFromAltitude(altitude) if the site has no barometer

Returns: relative humidity, %.

system.psychro.relHumFromHumidityRatio(25, 0.01, p)

humidityRatioFromDewPoint​

system.psychro.humidityRatioFromDewPoint(dewPoint, pressure)

Humidity ratio from dew point.

ParameterDescription
dewPointDew point over liquid water, °C
pressureAbsolute pressure, Pa. Use pressureFromAltitude(altitude) if the site has no barometer

Returns: humidity ratio, kg water per kg dry air.

system.psychro.humidityRatioFromDewPoint(10, p)

dewPointAtPressure​

system.psychro.dewPointAtPressure(dewPoint, fromPressure, toPressure)

Converts a dew point measured at one pressure to the dew point at another, for example atmospheric dew point to pressure dew point in compressed air. Pressures are absolute: add atmospheric pressure to a gauge reading. Real gas effects at line pressure are ignored, as in ASHRAE.

ParameterDescription
dewPointDew point at fromPressure, °C
fromPressureAbsolute pressure where dewPoint applies, Pa
toPressureAbsolute pressure where the dew point is wanted, Pa

Returns: dew point at toPressure, °C.

See the compressed air example for a call.

pressureFromAltitude​

system.psychro.pressureFromAltitude(altitude)

Standard atmosphere pressure at an altitude (ASHRAE). Use it when the site has no barometer.

ParameterDescription
altitudeAltitude above sea level, m (-1000 to 11000)

Returns: pressure, Pa.

system.psychro.pressureFromAltitude(1700)

state​

system.psychro.state(dryBulb, relHum, pressure)

Every property of the air state in one call. Script only: there is no expression function for it.

ParameterDescription
dryBulbDry bulb temperature, °C
relHumRelative humidity, % (0 to 100), relative to liquid water at all temperatures
pressureAbsolute pressure, Pa. Use pressureFromAltitude(altitude) if the site has no barometer

Returns: a dictionary with the keys dryBulb, relHum, pressure, dewPoint, frostPoint, wetBulb, humidityRatio, absoluteHumidity, vaporPressure, saturationPressure, vpd, enthalpy, specificVolume and density, in the units of the individual functions. dewPoint, frostPoint and wetBulb are None when they fall outside the valid range; the call itself only fails when the inputs are invalid.

p = system.psychro.pressureFromAltitude(1700)
system.psychro.state(25, 50, p)["humidityRatio"] # 0.01218 kg/kg dry air