Buildings.Utilities.Psychrometrics.Functions

Package with psychrometric functions

Information

This package contains functions for psychrometric calculations.

The nomenclature used in this package is described at Buildings.UsersGuide.Conventions.

Extends from Modelica.Icons.Package (Icon for standard packages).

Package Content

Name Description
Buildings.Utilities.Psychrometrics.Functions.TDewPoi_pW TDewPoi_pW Function to compute the water vapor partial pressure for a given dew point temperature of moist air
Buildings.Utilities.Psychrometrics.Functions.TDewPoi_pW_amb TDewPoi_pW_amb Function to compute the dew point temperature of moist air for a given water vapor partial pressure
Buildings.Utilities.Psychrometrics.Functions.X_pSatpphi X_pSatpphi Humidity ratio for given water vapor pressure
Buildings.Utilities.Psychrometrics.Functions.X_pTphi X_pTphi Absolute humidity for given pressure, dry bulb temperature and relative humidity
Buildings.Utilities.Psychrometrics.Functions.X_pW X_pW Mass fraction for given water vapor pressure
Buildings.Utilities.Psychrometrics.Functions.density_pTX density_pTX Density of air as a function of pressure, temperature and species concentration
Buildings.Utilities.Psychrometrics.Functions.pW_TDewPoi pW_TDewPoi Function to compute the water vapor partial pressure for a given dew point temperature of moist air
Buildings.Utilities.Psychrometrics.Functions.pW_TDewPoi_amb pW_TDewPoi_amb Function to compute the water vapor partial pressure for a given dew point temperature of moist air
Buildings.Utilities.Psychrometrics.Functions.pW_X pW_X Water vapor pressure for given humidity ratio
Buildings.Utilities.Psychrometrics.Functions.phi_pTX phi_pTX Relative humidity for given pressure, dry bulb temperature and moisture mass fraction
Buildings.Utilities.Psychrometrics.Functions.saturationPressure saturationPressure Saturation curve valid for 223.16 <= T <= 373.16 (and slightly outside with less accuracy)
Buildings.Utilities.Psychrometrics.Functions.saturationPressureLiquid saturationPressureLiquid Return saturation pressure of water as a function of temperature T in the range of 273.16 to 373.16 K
Buildings.Utilities.Psychrometrics.Functions.sublimationPressureIce sublimationPressureIce Return sublimation pressure of water as a function of temperature T between 190 and 273.16 K
Buildings.Utilities.Psychrometrics.Functions.Examples Examples Collection of models that illustrate model use and test models
Buildings.Utilities.Psychrometrics.Functions.BaseClasses BaseClasses Package with base classes for Buildings.Utilities.Psychrometrics.Functions

Buildings.Utilities.Psychrometrics.Functions.TDewPoi_pW Buildings.Utilities.Psychrometrics.Functions.TDewPoi_pW

Function to compute the water vapor partial pressure for a given dew point temperature of moist air

Information

Dew point temperature calculation for moist air above freezing temperature.

The correlation used in this model is valid for dew point temperatures between 0°C and 200°C. It is the correlation from 2005 ASHRAE Handbook, p. 6.2. In an earlier version of this model, the equation from Peppers has been used, but this equation yielded about 15 Kelvin lower dew point temperatures.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
Pressurep_w Water vapor partial pressure [Pa]

Outputs

TypeNameDescription
TemperatureTDew point temperature [K]

Modelica definition

function TDewPoi_pW "Function to compute the water vapor partial pressure for a given dew point temperature of moist air" extends Modelica.Icons.Function; input Modelica.Units.SI.Pressure p_w(displayUnit="Pa", min=200) "Water vapor partial pressure"; output Modelica.Units.SI.Temperature T "Dew point temperature"; protected function pW_TDewPoi_inversion "Internal function to solve eps=f(NTU, Z) for NTU for cross flow unmixed" extends Modelica.Math.Nonlinear.Interfaces.partialScalarFunction; input Modelica.Units.SI.Pressure p_w(displayUnit="Pa", min=200) "Water vapor partial pressure"; algorithm y :=Buildings.Utilities.Psychrometrics.Functions.pW_TDewPoi(T=u) - p_w; end pW_TDewPoi_inversion; algorithm T := Modelica.Math.Nonlinear.solveOneNonlinearEquation( f=function pW_TDewPoi_inversion(p_w=p_w), u_min=200, u_max=400); end TDewPoi_pW;

Buildings.Utilities.Psychrometrics.Functions.TDewPoi_pW_amb Buildings.Utilities.Psychrometrics.Functions.TDewPoi_pW_amb

Function to compute the dew point temperature of moist air for a given water vapor partial pressure

Information

Dew point temperature calculation for moist air between 0°C and 30°C with partial pressure of water vapor as an input.

The correlation used in this model is valid for dew point temperatures between 0°C and 30°C. It is an approximation to the correlation from 2005 ASHRAE Handbook, p. 6.2, which is valid in a wider range of temperatures and implemented in Buildings.Utilities.Psychrometrics.Functions.pW_TDewPoi. The approximation error of this simplified function is below 5% for a temperature of 0°C to 30°C. The benefit of this simpler function is that it can be inverted analytically, whereas the other function requires a numerical solution.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
Pressurep_w Water vapor partial pressure [Pa]

Outputs

TypeNameDescription
TemperatureTDew point temperature [K]

Modelica definition

function TDewPoi_pW_amb "Function to compute the dew point temperature of moist air for a given water vapor partial pressure" annotation(derivative=BaseClasses.der_TDewPoi_pW_amb); extends Modelica.Icons.Function; input Modelica.Units.SI.Pressure p_w(displayUnit="Pa", min=100) "Water vapor partial pressure"; output Modelica.Units.SI.Temperature T "Dew point temperature"; protected constant Modelica.Units.SI.Temperature T1=283.15 "First support point"; constant Modelica.Units.SI.Temperature T2=293.15 "Second support point"; constant Modelica.Units.SI.Pressure p1=1227.97 "First support point"; constant Modelica.Units.SI.Pressure p2=2338.76 "Second support point"; constant Real a1=(Modelica.Math.log(p2) - Modelica.Math.log(p1)*T2/T1)/(1 - T2/T1); constant Real a2(unit="1/K")=(Modelica.Math.log(p1) - a1)/T1; algorithm T := (Modelica.Math.log(p_w) - a1)/a2; end TDewPoi_pW_amb;

Buildings.Utilities.Psychrometrics.Functions.X_pSatpphi Buildings.Utilities.Psychrometrics.Functions.X_pSatpphi

Humidity ratio for given water vapor pressure

Information

Function to compute the water vapor concentration based on saturation pressure, absolute pressure and relative humidity.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
AbsolutePressurepSat Saturation pressure [Pa]
Pressurep Pressure of the fluid [Pa]
Realphi Relative humidity

Outputs

TypeNameDescription
MassFractionX_wWater vapor concentration per total mass of air [1]

Modelica definition

function X_pSatpphi "Humidity ratio for given water vapor pressure" extends Modelica.Icons.Function; input Modelica.Units.SI.AbsolutePressure pSat "Saturation pressure"; input Modelica.Units.SI.Pressure p "Pressure of the fluid"; input Real phi(min=0, max=1) "Relative humidity"; output Modelica.Units.SI.MassFraction X_w( min=0, max=1, nominal=0.01) "Water vapor concentration per total mass of air"; protected constant Real k = 0.621964713077499 "Ratio of molar masses"; algorithm X_w := phi*k/(k*phi+p/pSat-phi); end X_pSatpphi;

Buildings.Utilities.Psychrometrics.Functions.X_pTphi Buildings.Utilities.Psychrometrics.Functions.X_pTphi

Absolute humidity for given pressure, dry bulb temperature and relative humidity

Information

Absolute humidity of air for given pressure, temperature and relative humidity.

Note that the absolute humidity is in kg/kg total air, and not dry air.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
Pressurep Absolute pressure of the medium [Pa]
TemperatureT Dry bulb temperature [K]
Realphi Relative humidity [1]

Outputs

TypeNameDescription
MassFractionX_wWater vapor mass fraction per unit mass total air [1]

Modelica definition

function X_pTphi "Absolute humidity for given pressure, dry bulb temperature and relative humidity" extends Modelica.Icons.Function; input Modelica.Units.SI.Pressure p "Absolute pressure of the medium"; input Modelica.Units.SI.Temperature T "Dry bulb temperature"; input Real phi(unit="1") "Relative humidity"; output Modelica.Units.SI.MassFraction X_w "Water vapor mass fraction per unit mass total air"; algorithm X_w:=phi/((p/saturationPressure(T)-phi) / Buildings.Utilities.Psychrometrics.Constants.k_mair + phi); end X_pTphi;

Buildings.Utilities.Psychrometrics.Functions.X_pW Buildings.Utilities.Psychrometrics.Functions.X_pW

Mass fraction for given water vapor pressure

Information

Function to compute the mass fraction for a given water vapor partial pressure.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
Pressurep_w Water vapor pressure [Pa]
Pressurep101325Total pressure [Pa]

Outputs

TypeNameDescription
MassFractionX_wSpecies concentration at dry bulb temperature [1]

Modelica definition

function X_pW "Mass fraction for given water vapor pressure" extends Modelica.Icons.Function; input Modelica.Units.SI.Pressure p_w( displayUnit="Pa", min=0.003, nominal=1000) "Water vapor pressure"; input Modelica.Units.SI.Pressure p=101325 "Total pressure"; output Modelica.Units.SI.MassFraction X_w( min=0, max=1, nominal=0.01) "Species concentration at dry bulb temperature"; protected Modelica.Units.SI.MassFraction x_w(nominal=0.01) "Water mass fraction per mass of dry air"; algorithm x_w := 0.62198*p_w/(p - p_w); X_w := x_w/(1 + x_w); end X_pW;

Buildings.Utilities.Psychrometrics.Functions.density_pTX Buildings.Utilities.Psychrometrics.Functions.density_pTX

Density of air as a function of pressure, temperature and species concentration

Information

Function to compute the density of moist air for given pressure, temperature and water vapor mass fraction.

Note that the water vapor mass fraction is in kg/kg total air.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
Pressurep Absolute pressure of the medium [Pa]
TemperatureT Dry bulb temperature [K]
MassFractionX_w Water vapor mass fraction per unit mass total air [1]

Outputs

TypeNameDescription
DensitydMass density [kg/m3]

Modelica definition

function density_pTX "Density of air as a function of pressure, temperature and species concentration" extends Modelica.Icons.Function; input Modelica.Units.SI.Pressure p "Absolute pressure of the medium"; input Modelica.Units.SI.Temperature T "Dry bulb temperature"; input Modelica.Units.SI.MassFraction X_w "Water vapor mass fraction per unit mass total air"; output Modelica.Units.SI.Density d "Mass density"; protected Modelica.Units.SI.SpecificHeatCapacity R "Gas constant (of mixture if applicable)"; algorithm R :=Modelica.Media.IdealGases.Common.SingleGasesData.Air.R_s*(1 - X_w) + Modelica.Media.IdealGases.Common.SingleGasesData.H2O.R_s*X_w; d := p/(R*T); end density_pTX;

Buildings.Utilities.Psychrometrics.Functions.pW_TDewPoi Buildings.Utilities.Psychrometrics.Functions.pW_TDewPoi

Function to compute the water vapor partial pressure for a given dew point temperature of moist air

Information

Dew point temperature calculation for moist air above freezing temperature.

The correlation used in this model is valid for dew point temperatures between 0°C and 200°C. It is the correlation from 2005 ASHRAE Handbook, p. 6.2. In an earlier version of this model, the equation from Peppers has been used, but this equation yielded about 15 Kelvin lower dew point temperatures.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
TemperatureT Dew point temperature [K]

Outputs

TypeNameDescription
Pressurep_wWater vapor partial pressure [Pa]

Modelica definition

function pW_TDewPoi "Function to compute the water vapor partial pressure for a given dew point temperature of moist air" annotation(derivative=BaseClasses.der_pW_TDewPoi); extends Modelica.Icons.Function; input Modelica.Units.SI.Temperature T(min=100) "Dew point temperature"; output Modelica.Units.SI.Pressure p_w(displayUnit="Pa", min=100) "Water vapor partial pressure"; protected constant Real C8=-5.800226E3; constant Real C9=1.3914993E0; constant Real C10=-4.8640239E-2; constant Real C11=4.1764768E-5; constant Real C12=-1.4452093E-8; constant Real C13=6.5459673E0; algorithm p_w := Modelica.Math.exp(C8/T + C9 + T*(C10 + T*(C11 + T*C12)) + C13* Modelica.Math.log(T)); end pW_TDewPoi;

Buildings.Utilities.Psychrometrics.Functions.pW_TDewPoi_amb Buildings.Utilities.Psychrometrics.Functions.pW_TDewPoi_amb

Function to compute the water vapor partial pressure for a given dew point temperature of moist air

Information

Dew point temperature calculation for moist air between 0 degC and 30 degC.

The correlation used in this model is valid for dew point temperatures between 0°C and 30°C. It is an approximation to the correlation from 2005 ASHRAE Handbook, p. 6.2, which is valid in a wider range of temperatures and implemented in Buildings.Utilities.Psychrometrics.Functions.pW_TDewPoi. The approximation error of this simplified function is below 5% for a temperature of 0°C to 30°C. The benefit of this simpler function is that it can be inverted analytically, whereas the other function requires a numerical solution.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
TemperatureT Dew point temperature [K]

Outputs

TypeNameDescription
Pressurep_wWater vapor partial pressure [Pa]

Modelica definition

function pW_TDewPoi_amb "Function to compute the water vapor partial pressure for a given dew point temperature of moist air" annotation(derivative=BaseClasses.der_pW_TDewPoi_amb); extends Modelica.Icons.Function; input Modelica.Units.SI.Temperature T "Dew point temperature"; output Modelica.Units.SI.Pressure p_w(displayUnit="Pa", min=100) "Water vapor partial pressure"; protected constant Modelica.Units.SI.Temperature T1=283.15 "First support point"; constant Modelica.Units.SI.Temperature T2=293.15 "Second support point"; constant Modelica.Units.SI.Pressure p1=1227.97 "First support point"; constant Modelica.Units.SI.Pressure p2=2338.76 "Second support point"; constant Real a1=(Modelica.Math.log(p2) - Modelica.Math.log(p1)*T2/T1)/(1 - T2/T1); constant Real a2(unit="1/K")=(Modelica.Math.log(p1) - a1)/T1; algorithm p_w := Modelica.Math.exp(a1 + a2*T); end pW_TDewPoi_amb;

Buildings.Utilities.Psychrometrics.Functions.pW_X Buildings.Utilities.Psychrometrics.Functions.pW_X

Water vapor pressure for given humidity ratio

Information

Function to compute the water vapor partial pressure for a given humidity ratio.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
MassFractionX_w Species concentration at dry bulb temperature [1]
Pressurep101325Total pressure [Pa]

Outputs

TypeNameDescription
Pressurep_wWater vapor pressure [Pa]

Modelica definition

function pW_X "Water vapor pressure for given humidity ratio" annotation(derivative=BaseClasses.der_pW_X); extends Modelica.Icons.Function; input Modelica.Units.SI.MassFraction X_w( min=0, max=0.99999, nominal=0.01) "Species concentration at dry bulb temperature"; input Modelica.Units.SI.Pressure p=101325 "Total pressure"; output Modelica.Units.SI.Pressure p_w(displayUnit="Pa") "Water vapor pressure"; protected Modelica.Units.SI.MassFraction x_w(nominal=0.01) "Water mass fraction per mass of dry air"; algorithm x_w := X_w/(1 - X_w); p_w := p*x_w/(0.62198 + x_w); end pW_X;

Buildings.Utilities.Psychrometrics.Functions.phi_pTX Buildings.Utilities.Psychrometrics.Functions.phi_pTX

Relative humidity for given pressure, dry bulb temperature and moisture mass fraction

Information

Relative humidity of air for given pressure, temperature and water vapor mass fraction.

Note that the water vapor mass fraction must be in kg/kg total air, and not dry air.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
Pressurep Absolute pressure of the medium [Pa]
TemperatureT Dry bulb temperature [K]
MassFractionX_w Water vapor mass fraction per unit mass total air [1]

Outputs

TypeNameDescription
RealphiRelative humidity [1]

Modelica definition

function phi_pTX "Relative humidity for given pressure, dry bulb temperature and moisture mass fraction" extends Modelica.Icons.Function; input Modelica.Units.SI.Pressure p "Absolute pressure of the medium"; input Modelica.Units.SI.Temperature T "Dry bulb temperature"; input Modelica.Units.SI.MassFraction X_w "Water vapor mass fraction per unit mass total air"; output Real phi(unit="1") "Relative humidity"; algorithm phi :=p/saturationPressure(T)*X_w/(X_w + Buildings.Utilities.Psychrometrics.Constants.k_mair*(1-X_w)); end phi_pTX;

Buildings.Utilities.Psychrometrics.Functions.saturationPressure Buildings.Utilities.Psychrometrics.Functions.saturationPressure

Saturation curve valid for 223.16 <= T <= 373.16 (and slightly outside with less accuracy)

Information

Saturation pressure of water, computed from temperature, according to Wagner et al. (1993). The range of validity is between 190 and 373.16 Kelvin.

References

Wagner W., A. Saul, A. Pruss. International equations for the pressure along the melting and along the sublimation curve of ordinary water substance, equation 3.5. 1993. http://aip.scitation.org/doi/pdf/10.1063/1.555947?class=pdf.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
TemperatureTSat Saturation temperature [K]

Outputs

TypeNameDescription
AbsolutePressurepSatSaturation pressure [Pa]

Modelica definition

function saturationPressure "Saturation curve valid for 223.16 <= T <= 373.16 (and slightly outside with less accuracy)" extends Modelica.Icons.Function; input Modelica.Units.SI.Temperature TSat(displayUnit="degC", nominal=300) "Saturation temperature"; output Modelica.Units.SI.AbsolutePressure pSat(displayUnit="Pa", nominal=1000) "Saturation pressure"; algorithm pSat := Buildings.Utilities.Math.Functions.regStep( y1=Buildings.Utilities.Psychrometrics.Functions.saturationPressureLiquid(TSat), y2=Buildings.Utilities.Psychrometrics.Functions.sublimationPressureIce(TSat), x=TSat-273.16, x_small=1.0); end saturationPressure;

Buildings.Utilities.Psychrometrics.Functions.saturationPressureLiquid Buildings.Utilities.Psychrometrics.Functions.saturationPressureLiquid

Return saturation pressure of water as a function of temperature T in the range of 273.16 to 373.16 K

Information

Saturation pressure of water above the triple point temperature computed from temperature according to Wagner et al. (1993). The range of validity is between 273.16 and 373.16 Kelvin.

References

Wagner W., A. Saul, A. Pruss. International equations for the pressure along the melting and along the sublimation curve of ordinary water substance, equation 3.5. 1993. http://aip.scitation.org/doi/pdf/10.1063/1.555947?class=pdf.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
TemperatureTSat Saturation temperature [K]

Outputs

TypeNameDescription
AbsolutePressurepSatSaturation pressure [Pa]

Modelica definition

function saturationPressureLiquid "Return saturation pressure of water as a function of temperature T in the range of 273.16 to 373.16 K" annotation(derivative=Buildings.Utilities.Psychrometrics.Functions.BaseClasses.der_saturationPressureLiquid); extends Modelica.Icons.Function; input Modelica.Units.SI.Temperature TSat(displayUnit="degC", nominal=300) "Saturation temperature"; output Modelica.Units.SI.AbsolutePressure pSat(displayUnit="Pa", nominal=1000) "Saturation pressure"; algorithm pSat := 611.657*Modelica.Math.exp(17.2799 - 4102.99/(TSat - 35.719)); end saturationPressureLiquid;

Buildings.Utilities.Psychrometrics.Functions.sublimationPressureIce Buildings.Utilities.Psychrometrics.Functions.sublimationPressureIce

Return sublimation pressure of water as a function of temperature T between 190 and 273.16 K

Information

Sublimation pressure of water below the triple point temperature, computed from temperature, according to Wagner et al. (1993). The range of validity is between 190 and 273.16 Kelvin.

References

Wagner W., A. Saul, A. Pruss. International equations for the pressure along the melting and along the sublimation curve of ordinary water substance, equation 3.5. 1993. http://aip.scitation.org/doi/pdf/10.1063/1.555947?class=pdf.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
TemperatureTSat Saturation temperature [K]

Outputs

TypeNameDescription
AbsolutePressurepSatSaturation pressure [Pa]

Modelica definition

function sublimationPressureIce "Return sublimation pressure of water as a function of temperature T between 190 and 273.16 K" annotation(derivative=Buildings.Utilities.Psychrometrics.Functions.BaseClasses.der_sublimationPressureIce); extends Modelica.Icons.Function; input Modelica.Units.SI.Temperature TSat(displayUnit="degC", nominal=300) "Saturation temperature"; output Modelica.Units.SI.AbsolutePressure pSat(displayUnit="Pa", nominal=1000) "Saturation pressure"; protected Modelica.Units.SI.Temperature TTriple=273.16 "Triple point temperature"; Modelica.Units.SI.AbsolutePressure pTriple=611.657 "Triple point pressure"; Real r1=TSat/TTriple "Common subexpression"; Real a[2]={-13.9281690,34.7078238} "Coefficients a[:]"; Real n[2]={-1.5,-1.25} "Coefficients n[:]"; algorithm pSat := exp(a[1] - a[1]*r1^n[1] + a[2] - a[2]*r1^n[2])*pTriple; end sublimationPressureIce;