BuildingSystems.Media.Air

# .BuildingSystems.Media.Air

Package with moist air model that decouples pressure and temperature

## Information

This medium package models moist air using a gas law in which pressure and temperature are independent, which often leads to significantly faster and more robust computations. The specific heat capacities at constant pressure and at constant volume are constant. The air is assumed to be not saturated.

This medium uses the gas law

ρ/ρstp = p/pstp,

where pstd and ρstp are constant reference temperature and density, rathern than the ideal gas law

ρ = p ⁄(R T),

where R is the gas constant and T is the temperature.

This formulation often leads to smaller systems of nonlinear equations because equations for pressure and temperature are decoupled. Therefore, if air inside a control volume such as room air is heated, it does not increase its specific volume. Consequently, merely heating or cooling a control volume does not affect the air flow calculations in a duct network that may be connected to that volume. Note that multizone air exchange simulation in which buoyancy drives the air flow is still possible as the models in BuildingSystems.Airflow.Multizone compute the mass density using the function BuildingSystems.Utilities.Psychrometrics.Functions.density_pTX in which density is a function of temperature.

Note that models in this package implement the equation for the internal energy as

u = h - pstp ⁄ ρstp,

where u is the internal energy per unit mass, h is the enthalpy per unit mass, pstp is the static pressure and ρstp is the mass density at standard pressure and temperature. The reason for this implementation is that in general,

h = u + p v,

from which follows that

u = h - p v = h - p ⁄ ρ = h - pstp ⁄ ρstd,

because p ⁄ ρ = pstp ⁄ ρstp in this medium model.

The enthalpy is computed using the convention that h=0 if T=0 °C and no water vapor is present.

## Contents

Name | Description
--- | ---
ThermodynamicState | ThermodynamicState record for moist air
BaseProperties | Base properties (p, d, T, h, u, R, MM and X and Xi) of a medium
density | Gas density
dynamicViscosity | Return the dynamic viscosity of dry air
enthalpyOfCondensingGas | Enthalpy of steam per unit mass of steam
enthalpyOfGas | Enthalpy of gas mixture per unit mass of gas mixture
enthalpyOfLiquid | Enthalpy of liquid (per unit mass of liquid) which is linear in the temperature
enthalpyOfNonCondensingGas | Enthalpy of non-condensing gas per unit mass of steam
enthalpyOfVaporization | Enthalpy of vaporization of water
gasConstant | Return ideal gas constant as a function from thermodynamic state, only valid for phi<1
pressure | Returns pressure of ideal gas as a function of the thermodynamic state record
isobaricExpansionCoefficient | Isobaric expansion coefficient beta
isothermalCompressibility | Isothermal compressibility factor
saturationPressure | Saturation curve valid for 223.16 <= T <= 373.16 (and slightly outside with less accuracy)
specificEntropy | Return the specific entropy, only valid for phi<1
density_derp_T | Return the partial derivative of density with respect to pressure at constant temperature
density_derT_p | Return the partial derivative of density with respect to temperature at constant pressure
density_derX | Return the partial derivative of density with respect to mass fractions at constant pressure and temperature
specificHeatCapacityCp | Specific heat capacity of gas mixture at constant pressure
specificHeatCapacityCv | Specific heat capacity of gas mixture at constant volume
setState_dTX | Return thermodynamic state as function of density d, temperature T and composition X
setState_phX | Return thermodynamic state as function of pressure p, specific enthalpy h and composition X
setState_pTX | Return thermodynamic state as function of p, T and composition X or Xi
setState_psX | Return the thermodynamic state as function of p, s and composition X or Xi
specificEnthalpy | Compute specific enthalpy from pressure, temperature and mass fraction
specificEnthalpy_pTX | Specific enthalpy
specificGibbsEnergy | Specific Gibbs energy
specificHelmholtzEnergy | Specific Helmholtz energy
isentropicEnthalpy | Return the isentropic enthalpy
specificInternalEnergy | Specific internal energy
temperature | Return temperature of ideal gas as a function of the thermodynamic state record
molarMass | Return the molar mass
temperature_phX | Compute temperature from specific enthalpy and mass fraction
thermalConductivity | Thermal conductivity of dry air as a polynomial in the temperature

## Revisions

- September 9, 2022, by Michael Wetter:
  Set nominal attribute for `BaseProperties.Xi`.
  This is for #1634.
- September 28, 2020, by Michael Wetter:
  Reformulated `BaseProperties` to avoid event-triggering assertions.
  This is for #1401.
- January 11, 2019 by Michael Wetter:
  Reforulated assignment of `X_int` in `setState_psX`.
  This is for #1079.
- October 26, 2018, by Filip Jorissen and Michael Wetter:
  Now printing different messages if temperature is above or below its limit, and adding instance name as JModelica does not print the full instance name in the assertion. This is for #1045.
- November 4, 2016, by Michael Wetter:
  Set default value for `dT.start` in base properties.
  This is for #575.
- June 6, 2015, by Michael Wetter:
  Set `AbsolutePressure(start=p_default)` to avoid a translation error if BuildingSystems.Fluid.Sources.Examples.TraceSubstancesFlowSource is translated in pedantic mode in Dymola 2016. The reason is that pressures use `Medium.p_default` as start values, but Modelica.Media.Interfaces.Types sets a default value of 1E-5. A similar change has been done for pressure. This fixes #266.
- June 5, 2015, by Michael Wetter:
  Added `stateSelect` attribute in `BaseProperties.T` to allow correct use of `preferredMediumState` as described in Modelica.Media.Interfaces.PartialMedium. Note that the default is `preferredMediumState=false` and hence the same states are used as were used before. This is for #260.
- May 11, 2015, by Michael Wetter:
  Removed `p(stateSelect=if preferredMediumStates then StateSelect.prefer else StateSelect.default)` in declaration of `BaseProperties`. Otherwise, when models that contain a fluid volume are exported as an FMU, their pressure would be differentiated with respect to time. This would require the time derivative of the inlet pressure, which is not available, causing the translation to stop with an error.
- May 1, 2015, by Michael Wetter:
  Added `Inline=true` for issue 227.
- March 20, 2015, by Michael Wetter:
  Added missing term `state.p/reference_p` in function `specificEntropy`. #193.
- February 3, 2015, by Michael Wetter:
  Removed `stateSelect.prefer` for temperature. This is for #160.
- July 24, 2014, by Michael Wetter:
  Changed implementation to use BuildingSystems.Utilities.Psychrometrics.Constants. This was done to use consistent values throughout the library.
- November 16, 2013, by Michael Wetter:
  Revised and simplified the implementation.
- November 14, 2013, by Michael Wetter:
  Removed function `HeatCapacityOfWater` which is neither needed nor implemented in the Modelica Standard Library.
- November 13, 2013, by Michael Wetter:
  Removed non-used computations in `specificEnthalpy_pTX` and in `temperature_phX`.
- March 29, 2013, by Michael Wetter:
  Added `final standardOrderComponents=true` in the `BaseProperties` declaration. This avoids an error when models are checked in Dymola 2014 in the pedenatic mode.
- April 12, 2012, by Michael Wetter:
  Added keyword `each` to `Xi(stateSelect=...)`.
- April 4, 2012, by Michael Wetter:
  Added redeclaration of `ThermodynamicState` to avoid a warning during model check and translation.
- August 3, 2011, by Michael Wetter:
  Fixed bug in `u=h-R*T`, which is only valid for ideal gases. For this medium, the function is `u=h-pStd/dStp`.
- January 27, 2010, by Michael Wetter:
  Fixed bug in `else` branch of function `setState_phX` that lead to a run-time error when the constructor of this function was called.
- January 22, 2010, by Michael Wetter:
  Added implementation of function enthalpyOfNonCondensingGas and its derivative.
- January 13, 2010, by Michael Wetter:
  Fixed implementation of derivative functions.
- August 28, 2008, by Michael Wetter:
  First implementation.

Generated at 2026-05-09T18:18:56Z by OpenModelicaOpenModelica 1.26.7 using GenerateDoc.mos