Buildings.Utilities.Psychrometrics

Library with psychrometric functions

Information

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

Package Content

NameDescription
Buildings.Utilities.Psychrometrics.X_pW X_pW Humidity ratio for given water vapor pressure
Buildings.Utilities.Psychrometrics.pW_X pW_X Water vapor pressure for given humidity ratio
Buildings.Utilities.Psychrometrics.X_pTphi X_pTphi Return steam mass fraction as a function of relative humidity phi and temperature T
Buildings.Utilities.Psychrometrics.TDewPoi_pW TDewPoi_pW Model to compute the dew point temperature for given water vapor pressure of moist air
Buildings.Utilities.Psychrometrics.ToDryAir ToDryAir Block to convert absolute humidity from [kg/kg total air] to [kg/kg dry air]
Buildings.Utilities.Psychrometrics.ToTotalAir ToTotalAir Block to convert absolute humidity from [kg/kg dry air] to [kg/kg total air]
Buildings.Utilities.Psychrometrics.TWetBul_TDryBulXi TWetBul_TDryBulXi Model to compute the wet bulb temperature
Buildings.Utilities.Psychrometrics.pW_TDewPoi pW_TDewPoi Model to compute the water vapor pressure for a given dew point temperature of moist air
Buildings.Utilities.Psychrometrics.Functions Functions Package with psychrometric functions
Buildings.Utilities.Psychrometrics.Examples Examples Collection of models that illustrate model use and test models
Buildings.Utilities.Psychrometrics.BaseClasses BaseClasses Package with base classes for Buildings.Utilities.Psychrometrics


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

Humidity ratio for given water vapor pressure

Buildings.Utilities.Psychrometrics.X_pW

Information

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.

Extends from Buildings.Utilities.Psychrometrics.BaseClasses.HumidityRatioVaporPressure (Humidity ratio for given water vapor pressure).

Parameters

TypeNameDefaultDescription
Booleanuse_p_intrueGet the pressure from the input connector
Pressurep101325Fixed value of pressure [Pa]

Connectors

TypeNameDescription
input RealInputp_inAtmospheric Pressure [Pa]
output RealOutputX_wSpecies concentration at dry bulb temperature
input RealInputp_wWater vapor pressure [Pa]

Modelica definition

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) "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;

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

Water vapor pressure for given humidity ratio

Buildings.Utilities.Psychrometrics.pW_X

Information

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.

Extends from Buildings.Utilities.Psychrometrics.BaseClasses.HumidityRatioVaporPressure (Humidity ratio for given water vapor pressure).

Parameters

TypeNameDefaultDescription
Booleanuse_p_intrueGet the pressure from the input connector
Pressurep101325Fixed value of pressure [Pa]

Connectors

TypeNameDescription
input RealInputp_inAtmospheric Pressure [Pa]
input RealInputX_wSpecies concentration at dry bulb temperature
output RealOutputp_wWater vapor pressure [Pa]

Modelica definition

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;

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

Return steam mass fraction as a function of relative humidity phi and temperature T

Buildings.Utilities.Psychrometrics.X_pTphi

Information

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.

Extends from Buildings.Utilities.Psychrometrics.BaseClasses.HumidityRatioVaporPressure (Humidity ratio for given water vapor pressure).

Parameters

TypeNameDefaultDescription
Booleanuse_p_intrueGet the pressure from the input connector
Pressurep101325Fixed value of pressure [Pa]

Connectors

TypeNameDescription
input RealInputp_inAtmospheric Pressure [Pa]
input RealInputTTemperature [K]
input RealInputphiRelative humidity (0...1)
output RealOutputX[Medium.nX]Steam mass fraction

Modelica definition

block X_pTphi 
  "Return steam mass fraction as a function of relative humidity phi and temperature T"
  extends Buildings.Utilities.Psychrometrics.BaseClasses.HumidityRatioVaporPressure;
 replaceable package Medium =
      Modelica.Media.Interfaces.PartialCondensingGases "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](min = 0, 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 := Medium.saturationPressure(T);
  X[i_w] := phi*k/(k*phi+p_in_internal/psat-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;

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

Model to compute the dew point temperature for given water vapor pressure of moist air

Buildings.Utilities.Psychrometrics.TDewPoi_pW

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 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.

Extends from Modelica.Blocks.Interfaces.BlockIcon (Basic graphical layout of input/output block).

Connectors

TypeNameDescription
input RealInputp_wWater vapor partial pressure
output RealOutputTDew point temperature [K]

Modelica definition

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="Temperature",
                                         final unit="K",
                                         min = 0,
                                         displayUnit="degC") 
    "Dew point temperature";

equation 
 p_w = Buildings.Utilities.Psychrometrics.Functions.pW_TDewPoi(T=T);
end TDewPoi_pW;

Buildings.Utilities.Psychrometrics.ToDryAir Buildings.Utilities.Psychrometrics.ToDryAir

Block to convert absolute humidity from [kg/kg total air] to [kg/kg dry air]

Buildings.Utilities.Psychrometrics.ToDryAir

Information

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

Connectors

TypeNameDescription
output RealOutputXiDryWater vapor concentration in [kg/kg dry air]
input RealInputXiTotalAirWater vapor concentration in [kg/kg total air]

Modelica definition

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;

Buildings.Utilities.Psychrometrics.ToTotalAir Buildings.Utilities.Psychrometrics.ToTotalAir

Block to convert absolute humidity from [kg/kg dry air] to [kg/kg total air]

Buildings.Utilities.Psychrometrics.ToTotalAir

Information

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

Connectors

TypeNameDescription
output RealOutputXiTotalAirWater vapor concentration in [kg/kg total air]
input RealInputXiDryWater vapor concentration in [kg/kg dry air]
output RealOutputXNonVaporMass fraction of remaining substances

Modelica definition

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;

Buildings.Utilities.Psychrometrics.TWetBul_TDryBulXi Buildings.Utilities.Psychrometrics.TWetBul_TDryBulXi

Model to compute the wet bulb temperature

Buildings.Utilities.Psychrometrics.TWetBul_TDryBulXi

Information

Given a moist are medium model, this component computes the states of the medium at its wet bulb temperature.

For a use of this model, see for example Buildings.Fluid.Sensors.WetBulbTemperature

Extends from Modelica.Blocks.Interfaces.BlockIcon (Basic graphical layout of input/output block).

Connectors

TypeNameDescription
input RealInputTDryBulDry bulb temperature [K]
input RealInputpPressure [Pa]
output RealOutputTWetBulWet bulb temperature [K]
input RealInputXi[Medium.nXi]Species concentration at dry bulb temperature

Modelica definition

block TWetBul_TDryBulXi "Model to compute the wet bulb temperature"
  extends Modelica.Blocks.Interfaces.BlockIcon;
  replaceable package Medium =
    Modelica.Media.Interfaces.PartialCondensingGases "Medium model";

  Modelica.Blocks.Interfaces.RealInput TDryBul(
    start=303,
    final quantity="Temperature",
    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="Temperature",
    final unit="K",
    min=0) "Wet bulb temperature";
  Modelica.Blocks.Interfaces.RealInput Xi[Medium.nXi] 
    "Species concentration at dry bulb temperature";
protected 
  Medium.BaseProperties dryBul "Medium state at dry bulb temperature";
  Medium.BaseProperties wetBul(Xi(nominal=0.01*ones(Medium.nXi))) 
    "Medium state at wet bulb temperature";
 parameter Real s[Medium.nX](fixed=false) 
    "Vector with zero everywhere except where water is";
initial algorithm 

    for i in 1:Medium.nX loop
      if Modelica.Utilities.Strings.isEqual(string1=Medium.substanceNames[i],
                                            string2="Water", caseSensitive=false) then
        s[i] :=1;
      else
        s[i] :=0;
      end if;
    end for;
  assert(abs(1-sum(s)) < 1E-5, "Did not find medium species 'water' in the medium model. Change medium model.");
equation 
  dryBul.p = p;
  dryBul.T = TDryBul;
  dryBul.Xi = Xi;
  wetBul.phi = 1;
  wetBul.p = dryBul.p;
  wetBul.h = dryBul.h + s * (wetBul.X - dryBul.X)
         * Medium.enthalpyOfLiquid(dryBul.T);
  TWetBul = wetBul.T;
end TWetBul_TDryBulXi;

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

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

Buildings.Utilities.Psychrometrics.pW_TDewPoi

Information

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.

Extends from Modelica.Blocks.Interfaces.BlockIcon (Basic graphical layout of input/output block).

Connectors

TypeNameDescription
output RealOutputp_wWater vapor partial pressure
input RealInputTDew point temperature [K]

Modelica definition

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="Temperature",
                                         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;

Automatically generated Thu Dec 8 16:36:33 2011.