This package contains blocks and functions for psychrometric calculations.
The nomenclature used in this package is described at Buildings.UsersGuide.Conventions. Extends from Modelica.Icons.VariantsPackage (Icon for package containing variants).Name | Description |
---|---|
X_pW | Humidity ratio for given water vapor pressure |
pW_X | Water vapor pressure for given humidity ratio |
X_pTphi | Return steam mass fraction as a function of relative humidity phi and temperature T |
TDewPoi_pW | Model to compute the dew point temperature for given water vapor pressure of moist air |
ToDryAir | Block to convert absolute humidity from [kg/kg total air] to [kg/kg dry air] |
ToTotalAir | Block to convert absolute humidity from [kg/kg dry air] to [kg/kg total air] |
TWetBul_TDryBulPhi | Model to compute the wet bulb temperature based on relative humidity |
TWetBul_TDryBulXi | Model to compute the wet bulb temperature based on mass fraction |
pW_TDewPoi | Model to compute the water vapor pressure for a given dew point temperature of moist air |
WetBul_pTX | Block to compute the wet bulb condition for given dry bulb temperature and humidity |
Functions | Package with psychrometric functions |
Examples | Collection of models that illustrate model use and test models |
BaseClasses | Package with base classes for Buildings.Utilities.Psychrometrics |
Block to compute the humidity ratio for a given water vapor partial pressure.
If use_p_in
is false (default option), the p
parameter
is used as atmospheric pressure,
and the p_in
input connector is disabled;
if use_p_in
is true, then the p
parameter is ignored,
and the value provided by the input connector is used instead.
Type | Name | Default | Description |
---|---|---|---|
Boolean | use_p_in | true | Get the pressure from the input connector |
Pressure | p | 101325 | Fixed value of pressure [Pa] |
Type | Name | Description |
---|---|---|
input RealInput | p_in | Atmospheric Pressure [Pa] |
output RealOutput | X_w | Species concentration at dry bulb temperature |
input RealInput | p_w | Water vapor pressure [Pa] |
block X_pW "Humidity ratio for given water vapor pressure" extends Buildings.Utilities.Psychrometrics.BaseClasses.HumidityRatioVaporPressure;Modelica.Blocks.Interfaces.RealOutput X_w(min=0, max=1, nominal=0.01) "Species concentration at dry bulb temperature"; Modelica.Blocks.Interfaces.RealInput p_w(final quantity="Pressure", final unit="Pa", displayUnit="Pa", min = 0.003, start=2000, nominal=1000) "Water vapor pressure"; output Modelica.SIunits.MassFraction x_w(min=0, max=1, nominal=0.01, start=0.001) "Water mass fraction per mass of dry air"; equation X_w = Buildings.Utilities.Psychrometrics.Functions.X_pW(p_w=p_w, p=p_in_internal); x_w = X_w/(1-X_w);end X_pW;
Block to compute the water vapor partial pressure for a given humidity ratio.
If use_p_in
is false (default option), the p
parameter
is used as atmospheric pressure,
and the p_in
input connector is disabled;
if use_p_in
is true, then the p
parameter is ignored,
and the value provided by the input connector is used instead.
Type | Name | Default | Description |
---|---|---|---|
Boolean | use_p_in | true | Get the pressure from the input connector |
Pressure | p | 101325 | Fixed value of pressure [Pa] |
Type | Name | Description |
---|---|---|
input RealInput | p_in | Atmospheric Pressure [Pa] |
input RealInput | X_w | Species concentration at dry bulb temperature |
output RealOutput | p_w | Water vapor pressure [Pa] |
block pW_X "Water vapor pressure for given humidity ratio" extends Buildings.Utilities.Psychrometrics.BaseClasses.HumidityRatioVaporPressure;Modelica.Blocks.Interfaces.RealInput X_w(min=0, max=1, nominal=0.01) "Species concentration at dry bulb temperature"; Modelica.Blocks.Interfaces.RealOutput p_w(final quantity="Pressure", final unit="Pa", displayUnit="Pa", min = 0) "Water vapor pressure"; output Modelica.SIunits.MassFraction x_w(min=0, max=1, nominal=0.01, start=0.001) "Water mass fraction per mass of dry air"; equation p_w = Buildings.Utilities.Psychrometrics.Functions.pW_X(X_w=X_w, p=p_in_internal); x_w = X_w/(1-X_w);end pW_X;
Block to compute the water vapor concentration based on pressure, temperature and relative humidity.
If use_p_in
is false (default option), the p
parameter
is used as atmospheric pressure,
and the p_in
input connector is disabled;
if use_p_in
is true, then the p
parameter is ignored,
and the value provided by the input connector is used instead.
Type | Name | Default | Description |
---|---|---|---|
Boolean | use_p_in | true | Get the pressure from the input connector |
Pressure | p | 101325 | Fixed value of pressure [Pa] |
Type | Name | Description |
---|---|---|
input RealInput | p_in | Atmospheric Pressure [Pa] |
input RealInput | T | Temperature [K] |
input RealInput | phi | Relative humidity (0...1) |
output RealOutput | X[Medium.nX] | Steam mass fraction |
block X_pTphi "Return steam mass fraction as a function of relative humidity phi and temperature T" extends Buildings.Utilities.Psychrometrics.BaseClasses.HumidityRatioVaporPressure; package Medium = Buildings.Media.PerfectGases.MoistAirUnsaturated "Medium model";public Modelica.Blocks.Interfaces.RealInput T(final unit="K", displayUnit="degC", min = 0) "Temperature"; Modelica.Blocks.Interfaces.RealInput phi(min = 0, max=1) "Relative humidity (0...1)"; Modelica.Blocks.Interfaces.RealOutput X[Medium.nX](each min=0, each max=1) "Steam mass fraction"; protected constant Real k = 0.621964713077499 "Ratio of molar masses"; Modelica.SIunits.AbsolutePressure psat "Saturation pressure"; parameter Integer i_w(min=1, fixed=false) "Index for water substance"; parameter Integer i_nw(min=1, fixed=false) "Index for non-water substance"; parameter Boolean found(fixed=false) "Flag, used for error checking"; initial algorithm found:=false; i_w :=1; for i in 1:Medium.nXi loop if Modelica.Utilities.Strings.isEqual(string1=Medium.substanceNames[i], string2="water", caseSensitive=false) then i_w :=i; found:=true; end if; end for; i_nw := if i_w == 1 then 2 else 1; assert(found, "Did not find medium species 'water' in the medium model. Change medium model."); algorithm psat := Buildings.Media.PerfectGases.MoistAirUnsaturated.saturationPressure(T); X[i_w] := Buildings.Utilities.Psychrometrics.Functions.X_pSatpphi( pSat=psat, p=p_in_internal, phi=phi); //sum(X[:]) = 1; // The formulation with a sum in an equation section leads to a nonlinear equation system X[i_nw] := 1 - X[i_w];end X_pTphi;
Dew point temperature calculation for moist air above freezing temperature.
The correlation used in this model is valid for dew point temperatures between
0 degC
and 200 degC
. 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.
Type | Name | Description |
---|---|---|
input RealInput | p_w | Water vapor partial pressure |
output RealOutput | T | Dew point temperature [K] |
block TDewPoi_pW "Model to compute the dew point temperature for given water vapor pressure of moist air" extends Modelica.Blocks.Interfaces.BlockIcon;Modelica.Blocks.Interfaces.RealInput p_w "Water vapor partial pressure"; Modelica.Blocks.Interfaces.RealOutput T(start=278.15, final quantity="ThermodynamicTemperature", final unit="K", min = 0, displayUnit="degC") "Dew point temperature"; equation p_w = Buildings.Utilities.Psychrometrics.Functions.pW_TDewPoi(T=T);end TDewPoi_pW;
Block that converts humidity concentration from [kg/kg total air] to [kg/kg dry air].
Extends from Modelica.Blocks.Interfaces.BlockIcon (Basic graphical layout of input/output block).
Type | Name | Description |
---|---|---|
output RealOutput | XiDry | Water vapor concentration in [kg/kg dry air] |
input RealInput | XiTotalAir | Water vapor concentration in [kg/kg total air] |
block ToDryAir "Block to convert absolute humidity from [kg/kg total air] to [kg/kg dry air]" extends Modelica.Blocks.Interfaces.BlockIcon;Modelica.Blocks.Interfaces.RealOutput XiDry "Water vapor concentration in [kg/kg dry air]"; Modelica.Blocks.Interfaces.RealInput XiTotalAir "Water vapor concentration in [kg/kg total air]"; equation XiDry = XiTotalAir / (1-XiTotalAir);end ToDryAir;
Block that converts humidity concentration from [kg/kg dry air] to [kg/kg total air].
This block may be used, for example, to convert absolute humidity that is received from EnergyPlus to [kg/kg total air], which is the convention used by Modelica.Media.
Extends from Modelica.Blocks.Interfaces.BlockIcon (Basic graphical layout of input/output block).
Type | Name | Description |
---|---|---|
output RealOutput | XiTotalAir | Water vapor concentration in [kg/kg total air] |
input RealInput | XiDry | Water vapor concentration in [kg/kg dry air] |
output RealOutput | XNonVapor | Mass fraction of remaining substances |
block ToTotalAir "Block to convert absolute humidity from [kg/kg dry air] to [kg/kg total air]" extends Modelica.Blocks.Interfaces.BlockIcon;Modelica.Blocks.Interfaces.RealOutput XiTotalAir "Water vapor concentration in [kg/kg total air]"; Modelica.Blocks.Interfaces.RealInput XiDry "Water vapor concentration in [kg/kg dry air]"; Modelica.Blocks.Interfaces.RealOutput XNonVapor "Mass fraction of remaining substances"; equation XiTotalAir = XiDry / (1+XiDry); XNonVapor = 1 - XiTotalAir;end ToTotalAir;
This block computes the the wet bulb temperature for a given dry bulb temperature, relative air humidity and atmospheric pressure.
If the constant approximateWetBulb
is true
,
then the block uses the approximation of Stull (2011) to compute
the wet bulb temperature without requiring a nonlinear equation.
Otherwise, the model will introduce one nonlinear equation.
The approximation by Stull is valid for a relative humidity of 5% to 99%, a temperature range from -20ˆC to 50ˆC and standard sea level pressure. For this range of data, the approximation error is -1 Kelvin to +0.65 Kelvin, with a mean error of less than 0.3 Kelvin.
For a model that takes the mass fraction instead of the relative humidity as an input, see Buildings.Utilities.Psychrometrics.TWetBul_TDryBulXi.
Stull, Roland. Wet-Bulb Temperature from Relative Humidity and Air Temperature Roland Stull. Journal of Applied Meteorology and Climatology. Volume 50, Issue 11, pp. 2267-2269. November 2011 DOI: 10.1175/JAMC-D-11-0143.1
Extends from Modelica.Blocks.Interfaces.BlockIcon (Basic graphical layout of input/output block).
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | Modelica.Media.Interfaces.Pa... | Medium model | |
Boolean | approximateWetBulb | false | Set to true to approximate wet bulb temperature |
Type | Name | Description |
---|---|---|
replaceable package Medium | Medium model | |
input RealInput | TDryBul | Dry bulb temperature [K] |
input RealInput | phi | Relative air humidity |
input RealInput | p | Pressure [Pa] |
output RealOutput | TWetBul | Wet bulb temperature [K] |
block TWetBul_TDryBulPhi "Model to compute the wet bulb temperature based on relative humidity" extends Modelica.Blocks.Interfaces.BlockIcon; replaceable package Medium = Modelica.Media.Interfaces.PartialCondensingGases "Medium model"; parameter Boolean approximateWetBulb=false "Set to true to approximate wet bulb temperature";Modelica.Blocks.Interfaces.RealInput TDryBul( start=303, final quantity="ThermodynamicTemperature", final unit="K", min=0) "Dry bulb temperature"; Modelica.Blocks.Interfaces.RealInput phi(min=0, max=1) "Relative air humidity"; Modelica.Blocks.Interfaces.RealInput p( final quantity="Pressure", final unit="Pa", min = 0) "Pressure"; Modelica.Blocks.Interfaces.RealOutput TWetBul( start=293, final quantity="ThermodynamicTemperature", final unit="K", min=0) "Wet bulb temperature"; protected constant Modelica.Media.IdealGases.Common.DataRecord dryair = Modelica.Media.IdealGases.Common.SingleGasesData.Air; constant Modelica.Media.IdealGases.Common.DataRecord steam = Modelica.Media.IdealGases.Common.SingleGasesData.H2O; constant Real k_mair = steam.MM/dryair.MM "ratio of molar weights"; Modelica.SIunits.Conversions.NonSIunits.Temperature_degC TDryBul_degC "Dry bulb temperature in degree Celsius"; Real rh_per(min=0) "Relative humidity in percentage"; Modelica.SIunits.MassFraction XiDryBul "Water vapor mass fraction at dry bulb state"; Modelica.SIunits.MassFraction XiSat "Water vapor mass fraction at saturation"; constant Modelica.SIunits.SpecificHeatCapacity cpAir= Buildings.Media.PerfectGases.Common.SingleGasData.Air.cp "Specific heat capacity of air"; constant Modelica.SIunits.SpecificHeatCapacity cpSte= Buildings.Media.PerfectGases.Common.SingleGasData.H2O.cp "Specific heat capacity of water vapor"; constant Modelica.SIunits.SpecificEnthalpy h_fg = 2501014.5 "Specific heat capacity of water vapor"; equation if approximateWetBulb then TDryBul_degC = TDryBul - 273.15; rh_per = 100*phi; TWetBul = 273.15 + TDryBul_degC * Modelica.Math.atan(0.151977 * sqrt(rh_per + 8.313659)) + Modelica.Math.atan(TDryBul_degC + rh_per) - Modelica.Math.atan(rh_per-1.676331) + 0.00391838 * rh_per^(1.5) * Modelica.Math.atan( 0.023101 * rh_per) - 4.686035; XiSat = 0; XiDryBul = 0; else XiSat = Buildings.Utilities.Psychrometrics.Functions.X_pSatpphi( pSat= Medium.saturationPressureLiquid(Tsat=TWetBul), p= p, phi= 1); XiDryBul =Buildings.Utilities.Psychrometrics.Functions.X_pSatpphi( p=p, pSat=Medium.saturationPressureLiquid(Tsat=TDryBul), phi=phi); TWetBul = (TDryBul * ((1-XiDryBul) * cpAir + XiDryBul * cpSte) + (XiDryBul-XiSat) * h_fg)/ ( (1-XiSat)*cpAir + XiSat * cpSte); TDryBul_degC = 0; rh_per = 0; end if;end TWetBul_TDryBulPhi;
This block computes the the wet bulb temperature for a given dry bulb temperature, mass fraction and atmospheric pressure.
If the constant approximateWetBulb
is true
,
then the block uses the approximation of Stull (2011) to compute
the wet bulb temperature without requiring a nonlinear equation.
Otherwise, the model will introduce one nonlinear equation.
The approximation by Stull is valid for a relative humidity of 5% to 99%, a temperature range from -20ˆC to 50ˆC and standard sea level pressure. For this range of data, the approximation error is -1 Kelvin to +0.65 Kelvin, with a mean error of less than 0.3 Kelvin.
For a model that takes the relative humidity instead of the mass fraction as an input, see Buildings.Utilities.Psychrometrics.TWetBul_TDryBulPhi.
For a use of this model, see for example Buildings.Fluid.Sensors.WetBulbTemperature
Stull, Roland. Wet-Bulb Temperature from Relative Humidity and Air Temperature Roland Stull. Journal of Applied Meteorology and Climatology. Volume 50, Issue 11, pp. 2267-2269. November 2011 DOI: 10.1175/JAMC-D-11-0143.1
Extends from Modelica.Blocks.Interfaces.BlockIcon (Basic graphical layout of input/output block).
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | Modelica.Media.Interfaces.Pa... | Medium model | |
Boolean | approximateWetBulb | false | Set to true to approximate wet bulb temperature |
Type | Name | Description |
---|---|---|
replaceable package Medium | Medium model | |
input RealInput | TDryBul | Dry bulb temperature [K] |
input RealInput | p | Pressure [Pa] |
output RealOutput | TWetBul | Wet bulb temperature [K] |
input RealInput | Xi[Medium.nXi] | Species concentration at dry bulb temperature |
block TWetBul_TDryBulXi "Model to compute the wet bulb temperature based on mass fraction" extends Modelica.Blocks.Interfaces.BlockIcon; replaceable package Medium = Modelica.Media.Interfaces.PartialCondensingGases "Medium model"; parameter Boolean approximateWetBulb=false "Set to true to approximate wet bulb temperature";Modelica.Blocks.Interfaces.RealInput TDryBul( start=303, final quantity="ThermodynamicTemperature", final unit="K", min=0) "Dry bulb temperature"; Modelica.Blocks.Interfaces.RealInput p( final quantity="Pressure", final unit="Pa", min = 0) "Pressure"; Modelica.Blocks.Interfaces.RealOutput TWetBul( start=293, final quantity="ThermodynamicTemperature", final unit="K", min=0) "Wet bulb temperature"; Modelica.Blocks.Interfaces.RealInput Xi[Medium.nXi] "Species concentration at dry bulb temperature"; protected constant Modelica.Media.IdealGases.Common.DataRecord dryair = Modelica.Media.IdealGases.Common.SingleGasesData.Air; constant Modelica.Media.IdealGases.Common.DataRecord steam = Modelica.Media.IdealGases.Common.SingleGasesData.H2O; constant Real k_mair = steam.MM/dryair.MM "ratio of molar weights"; Modelica.SIunits.Conversions.NonSIunits.Temperature_degC TDryBul_degC "Dry bulb temperature in degree Celsius"; Real rh_per(min=0) "Relative humidity in percentage"; Modelica.SIunits.MassFraction XiSat(start=0.01, nominal=0.01) "Water vapor mass fraction at saturation"; parameter Integer iWat(fixed=false) "Index of water in medium composition vector"; constant Modelica.SIunits.SpecificHeatCapacity cpAir= Buildings.Media.PerfectGases.Common.SingleGasData.Air.cp "Specific heat capacity of air"; constant Modelica.SIunits.SpecificHeatCapacity cpSte= Buildings.Media.PerfectGases.Common.SingleGasData.H2O.cp "Specific heat capacity of water vapor"; constant Modelica.SIunits.SpecificEnthalpy h_fg = 2501014.5 "Specific heat capacity of water vapor"; initial algorithm iWat:=-1; for i in 1:Medium.nX loop if Modelica.Utilities.Strings.isEqual(string1=Medium.substanceNames[i], string2="Water", caseSensitive=false) then iWat :=i; end if; end for; assert(iWat > 0, "Did not find medium species 'water' in the medium model. Change medium model."); equation if approximateWetBulb then TDryBul_degC = TDryBul - 273.15; rh_per = 100 * p/min(Medium.saturationPressure(TDryBul),0.999*p)*Xi[iWat]/(Xi[iWat] + k_mair*(1-Xi[iWat])); TWetBul = 273.15 + TDryBul_degC * Modelica.Math.atan(0.151977 * sqrt(rh_per + 8.313659)) + Modelica.Math.atan(TDryBul_degC + rh_per) - Modelica.Math.atan(rh_per-1.676331) + 0.00391838 * rh_per^(1.5) * Modelica.Math.atan( 0.023101 * rh_per) - 4.686035; XiSat = 0; else XiSat = Buildings.Utilities.Psychrometrics.Functions.X_pSatpphi( pSat= Medium.saturationPressureLiquid(Tsat=TWetBul), p= p, phi= 1); TWetBul = (TDryBul * ((1-Xi[iWat]) * cpAir + Xi[iWat] * cpSte) + (Xi[iWat]-XiSat) * h_fg)/ ( (1-XiSat)*cpAir + XiSat * cpSte); TDryBul_degC = 0; rh_per = 0; end if;end TWetBul_TDryBulXi;
Block to compute the water vapor pressure for a given dew point temperature.
The correlation used in this model is valid for dew point temperatures between
0 degC
and 200 degC
. 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.
Type | Name | Description |
---|---|---|
output RealOutput | p_w | Water vapor partial pressure |
input RealInput | T | Dew point temperature [K] |
block pW_TDewPoi "Model to compute the water vapor pressure for a given dew point temperature of moist air" extends Modelica.Blocks.Interfaces.BlockIcon;Modelica.Blocks.Interfaces.RealOutput p_w "Water vapor partial pressure"; Modelica.Blocks.Interfaces.RealInput T(final quantity="ThermodynamicTemperature", final unit="K", min = 0, displayUnit="degC") "Dew point temperature"; equation p_w = Buildings.Utilities.Psychrometrics.Functions.pW_TDewPoi_amb(T=T);end pW_TDewPoi;
Block to compute the temperature and mass fraction at the wet bulb condition for a given dry bulb state.
Extends from Modelica.Blocks.Interfaces.BlockIcon (Basic graphical layout of input/output block).
Type | Name | Default | Description |
---|---|---|---|
replaceable package Medium | Modelica.Media.Interfaces.Pa... | Medium model |
Type | Name | Description |
---|---|---|
replaceable package Medium | Medium model | |
input RealInput | TDryBul | Dry bulb temperature [K] |
input RealInput | XDryBul | Dry bulb temperature [1] |
input RealInput | p | Pressure [Pa] |
output RealOutput | TWetBul | Wet bulb temperature [K] |
output RealOutput | XWetBul | Water vapor mass fraction at wet bulb temperature [1] |
block WetBul_pTX "Block to compute the wet bulb condition for given dry bulb temperature and humidity" extends Modelica.Blocks.Interfaces.BlockIcon; replaceable package Medium = Modelica.Media.Interfaces.PartialCondensingGases "Medium model";Modelica.Blocks.Interfaces.RealInput TDryBul( start=303, final quantity="ThermodynamicTemperature", final unit="K", min=0) "Dry bulb temperature"; Modelica.Blocks.Interfaces.RealInput XDryBul( start=0.01, final quantity="ThermodynamicTemperature", final unit="1", min=0) "Dry bulb temperature"; Modelica.Blocks.Interfaces.RealInput p( final quantity="Pressure", final unit="Pa", min = 0) "Pressure"; Modelica.Blocks.Interfaces.RealOutput TWetBul( start=293, final quantity="ThermodynamicTemperature", final unit="K", min=0) "Wet bulb temperature"; Modelica.Blocks.Interfaces.RealOutput XWetBul( min=0, max=1, start=0.012, unit="1", nominal=0.01) "Water vapor mass fraction at wet bulb temperature"; protected constant Modelica.SIunits.SpecificHeatCapacity cpAir= Buildings.Media.PerfectGases.Common.SingleGasData.Air.cp "Specific heat capacity of air"; constant Modelica.SIunits.SpecificHeatCapacity cpSte= Buildings.Media.PerfectGases.Common.SingleGasData.H2O.cp "Specific heat capacity of water vapor"; constant Modelica.SIunits.SpecificEnthalpy h_fg = 2501014.5 "Specific heat capacity of water vapor"; equation XWetBul = Buildings.Utilities.Psychrometrics.Functions.X_pSatpphi( pSat= Medium.saturationPressureLiquid(Tsat=TWetBul), p= p, phi= 1); TWetBul = (TDryBul * ((1-XDryBul) * cpAir + XDryBul * cpSte) + (XDryBul-XWetBul) * h_fg)/ ( (1-XWetBul)*cpAir + XWetBul * cpSte);end WetBul_pTX;