packagePerfectGas

Model for air as a perfect gas

Extends from Modelica.Media.Interfaces.PartialCondensingGases (Base class for mixtures of condensing and non-condensing gases), Modelica.Icons.Package (Icon for standard packages).

Information

This package contains a thermally perfect model of moist air.

A medium is called thermally perfect if

  • it is in thermodynamic equilibrium,
  • it is chemically not reacting, and
  • internal energy and enthalpy are functions of temperature only.

In addition, this medium model is calorically perfect, i.e., the specific heat capacities at constant pressure cp and constant volume cv are both constant (Bower 1998).

This medium uses the ideal gas law

ρ = p ⁄(R T),

where ρ is the density, p is the pressure, R is the gas constant and T is the temperature.

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

Note that for typical building simulations, the media Buildings.Media.Air should be used as it leads generally to faster simulation.

References

Bower, William B. A primer in fluid mechanics: Dynamics of flows in one space dimension. CRC Press. 1998.

Parameters

TypeNameDefaultDescription
Modelica.Media.Interfaces.Choices.IndependentVariablesThermoStates (from PartialMedium)Enumeration type for independent variables
StringmediumName (from PartialMedium)"unusablePartialMedium"Name of the medium
String[:]substanceNames (from PartialMedium){mediumName}Names of the mixture substances. Set substanceNames={mediumName} if only one substance.
String[:]extraPropertiesNames (from PartialMedium)fill("", 0)Names of the additional (extra) transported properties. Set extraPropertiesNames=fill("",0) if unused
BooleansingleState (from PartialMedium)= true, if u and d are not a function of pressure
BooleanreducedX (from PartialMedium)true= true, if medium contains the equation sum(X) = 1.0; set reducedX=true, if only one substance (see docu for details)
BooleanfixedX (from PartialMedium)false= true, if medium contains the equation X = reference_X
AbsolutePressurereference_p (from PartialMedium)101325Reference pressure of Medium: default 1 atmosphere
Temperaturereference_T (from PartialMedium)298.15Reference temperature of Medium: default 25 deg Celsius
MassFraction[nX]reference_X (from PartialMedium)fill(1/nX, nX)Default mass fractions of medium
AbsolutePressurep_default (from PartialMedium)101325Default value for pressure of medium (for initialization)
TemperatureT_default (from PartialMedium)Modelica.Units.Conversions.from_degC(20)Default value for temperature of medium (for initialization)
SpecificEnthalpyh_default (from PartialMedium)specificEnthalpy_pTX(p_default, T_default, X_default)Default value for specific enthalpy of medium (for initialization)
MassFraction[nX]X_default (from PartialMedium)reference_XDefault value for mass fractions of medium (for initialization)
ExtraProperty[nC]C_default (from PartialMedium)fill(0, nC)Default value for trace substances of medium (for initialization)
IntegernS (from PartialMedium)size(substanceNames, 1)Number of substances
IntegernX (from PartialMedium)nSNumber of mass fractions
IntegernXi (from PartialMedium)if fixedX then 0 else if reducedX then nS - 1 else nSNumber of structurally independent mass fractions (see docu for details)
IntegernC (from PartialMedium)size(extraPropertiesNames, 1)Number of extra (outside of standard mass-balance) transported properties
Real[nC]C_nominal (from PartialMedium)1.0e-6*ones(nC)Default for the nominal values for the extra properties
FluidConstantsfluidConstants (from PartialMixtureMedium)Constant data for the fluid
IntegerWater1Index of water (in substanceNames, massFractions X, etc.)
IntegerAir2Index of air (in substanceNames, massFractions X, etc.)

Contents

NameDescription
ThermodynamicStateThermodynamicState record for moist air
BaseProperties
XsaturationSteam water mass fraction of saturation boundary in kg_water/kg_moistair
setState_pTXThermodynamic state as function of p, T and composition X
setState_phXThermodynamic state as function of p, h and composition X
setState_dTXThermodynamic state as function of d, T and composition X
gasConstantGas constant
saturationPressureLiquidReturn saturation pressure of water as a function of temperature T in the range of 273.16 to 373.16 K
saturationPressureLiquid_derTime derivative of saturationPressureLiquid
sublimationPressureIceSaturation curve valid for 223.16 <= T <= 273.16. Outside of these limits a (less accurate) result is returned
sublimationPressureIce_derDerivative function for 'sublimationPressureIce'
saturationPressureSaturation curve valid for 223.16 <= T <= 373.16 (and slightly outside with less accuracy)
pressureGas pressure
temperatureGas temperature
densityGas density
specificEntropySpecific entropy (liquid part neglected, mixing entropy included)
enthalpyOfVaporizationEnthalpy of vaporization of water
HeatCapacityOfWaterSpecific heat capacity of water (liquid only) which is constant
enthalpyOfLiquidEnthalpy of liquid (per unit mass of liquid) which is linear in the temperature
der_enthalpyOfLiquidTemperature derivative of enthalpy of liquid per unit mass of liquid
enthalpyOfCondensingGasEnthalpy of steam per unit mass of steam
der_enthalpyOfCondensingGasDerivative of enthalpy of steam per unit mass of steam
enthalpyOfNonCondensingGasEnthalpy of non-condensing gas per unit mass of steam
der_enthalpyOfNonCondensingGasDerivative of enthalpy of non-condensing gas per unit mass of steam
enthalpyOfGasEnthalpy of gas mixture per unit mass of gas mixture
enthalpyOfDryAirEnthalpy of dry air per unit mass of dry air
der_enthalpyOfDryAirDerivative of enthalpy of dry air per unit mass of dry air
specificHeatCapacityCpSpecific heat capacity of gas mixture at constant pressure
der_specificHeatCapacityCpDerivative of specific heat capacity of gas mixture at constant pressure
specificHeatCapacityCvSpecific heat capacity of gas mixture at constant volume
der_specificHeatCapacityCvDerivative of specific heat capacity of gas mixture at constant volume
dynamicViscositydynamic viscosity of dry air
thermalConductivityThermal conductivity of dry air as a polynomial in the temperature
specificEnthalpySpecific enthalpy
specificEnthalpy_pTXSpecific enthalpy
specificInternalEnergySpecific internal energy
specificGibbsEnergySpecific Gibbs energy
specificHelmholtzEnergySpecific Helmholtz energy
temperature_phXCompute temperature from specific enthalpy and mass fraction
GasPropertiesprotectedCoefficient data record for properties of perfect gases
s_pTXprotectedReturn specific entropy of moist air as a function of pressure p, temperature T and composition X (only valid for phi<1)
s_pTX_derprotectedReturn specific entropy of moist air as a function of pressure p, temperature T and composition X (only valid for phi<1)

Revisions

  • September 9, 2022, by Michael Wetter:
    Set nominal attribute for BaseProperties.Xi.
    This is for #1634.
  • 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.
  • March 15, 2016, by Michael Wetter:
    Replaced spliceFunction with regStep. This is for issue 300.
  • November 13, 2014, by Michael Wetter:
    Removed phi and removed non-required computations.
  • 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.
  • January 27, 2010, by Michael Wetter:
    Added function enthalpyOfNonCondensingGas and its derivative.
  • January 27, 2010, by Michael Wetter:
    Fixed bug with temperature offset in T_phX.
  • August 18, 2008, by Michael Wetter:
    First implementation.