packageAir
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 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 Buildings.Airflow.Multizone compute the mass density using the function Buildings.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.
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Media.Interfaces.Choices.IndependentVariables | ThermoStates (from PartialMedium) | Enumeration type for independent variables | |
| String | mediumName (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 |
| Boolean | singleState (from PartialMedium) | = true, if u and d are not a function of pressure | |
| Boolean | reducedX (from PartialMedium) | true | = true, if medium contains the equation sum(X) = 1.0; set reducedX=true, if only one substance (see docu for details) |
| Boolean | fixedX (from PartialMedium) | false | = true, if medium contains the equation X = reference_X |
| AbsolutePressure | reference_p (from PartialMedium) | 101325 | Reference pressure of Medium: default 1 atmosphere |
| Temperature | reference_T (from PartialMedium) | 298.15 | Reference temperature of Medium: default 25 deg Celsius |
| MassFraction[nX] | reference_X (from PartialMedium) | fill(1/nX, nX) | Default mass fractions of medium |
| AbsolutePressure | p_default (from PartialMedium) | 101325 | Default value for pressure of medium (for initialization) |
| Temperature | T_default (from PartialMedium) | Modelica.Units.Conversions.from_degC(20) | Default value for temperature of medium (for initialization) |
| SpecificEnthalpy | h_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_X | Default 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) |
| Integer | nS (from PartialMedium) | size(substanceNames, 1) | Number of substances |
| Integer | nX (from PartialMedium) | nS | Number of mass fractions |
| Integer | nXi (from PartialMedium) | if fixedX then 0 else if reducedX then nS - 1 else nS | Number of structurally independent mass fractions (see docu for details) |
| Integer | nC (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 |
| FluidConstants | fluidConstants (from PartialMixtureMedium) | Constant data for the fluid | |
| Integer | Water | 1 | Index of water (in substanceNames, massFractions X, etc.) |
| Integer | Air | 2 | Index of air (in substanceNames, massFractions X, etc.) |
| GasProperties | dryair | Dry air properties | |
| GasProperties | steam | Steam properties | |
| Real | k_mair | steam.MM/dryair.MM | Ratio of molar weights |
| Modelica.Units.SI.MolarMass | MMX | {steam.MM, dryair.MM} | Molar masses of components |
| AbsolutePressure | pStp | reference_p | Pressure for which fluid density is defined |
| Density | dStp | 1.2 | Fluid density at pressure pStp |
Contents
| Name | Description |
|---|---|
| ThermodynamicState record for moist air | |
| Base properties (p, d, T, h, u, R, MM and X and Xi) of a medium | |
| Gas density | |
| Return the dynamic viscosity of dry air | |
| Enthalpy of steam per unit mass of steam | |
| Enthalpy of gas mixture per unit mass of gas mixture | |
| Enthalpy of liquid (per unit mass of liquid) which is linear in the temperature | |
| Enthalpy of non-condensing gas per unit mass of steam | |
| Enthalpy of vaporization of water | |
| Return ideal gas constant as a function from thermodynamic state, only valid for phi<1 | |
| Returns pressure of ideal gas as a function of the thermodynamic state record | |
| Isobaric expansion coefficient beta | |
| Isothermal compressibility factor | |
| Saturation curve valid for 223.16 <= T <= 373.16 (and slightly outside with less accuracy) | |
| Return the specific entropy, only valid for phi<1 | |
| Return the partial derivative of density with respect to pressure at constant temperature | |
| Return the partial derivative of density with respect to temperature at constant pressure | |
| Return the partial derivative of density with respect to mass fractions at constant pressure and temperature | |
| Specific heat capacity of gas mixture at constant pressure | |
| Specific heat capacity of gas mixture at constant volume | |
| Return thermodynamic state as function of density d, temperature T and composition X | |
| Return thermodynamic state as function of pressure p, specific enthalpy h and composition X | |
| Return thermodynamic state as function of p, T and composition X or Xi | |
| Return the thermodynamic state as function of p, s and composition X or Xi | |
| Compute specific enthalpy from pressure, temperature and mass fraction | |
| Specific enthalpy | |
| Specific Gibbs energy | |
| Specific Helmholtz energy | |
| Return the isentropic enthalpy | |
| Specific internal energy | |
| Return temperature of ideal gas as a function of the thermodynamic state record | |
| Return the molar mass | |
| Compute temperature from specific enthalpy and mass fraction | |
| Thermal conductivity of dry air as a polynomial in the temperature | |
| Coefficient data record for properties of perfect gases | |
| Temperature derivative of enthalpy of liquid per unit mass of liquid | |
| Derivative of enthalpy of steam per unit mass of steam | |
| Enthalpy of dry air per unit mass of dry air | |
| Derivative of enthalpy of dry air per unit mass of dry air | |
| Derivative of enthalpy of non-condensing gas per unit mass of steam | |
| Derivative of specific heat capacity of gas mixture at constant pressure | |
| Derivative of specific heat capacity of gas mixture at constant volume |
Revisions
-
June 18, 2024, by Michael Wetter:
Addedstartandnominalattributes to avoid warnings in OpenModelica due to conflicting values.
This is for IBPSA, #1890. -
September 9, 2022, by Michael Wetter:
Set nominal attribute forBaseProperties.Xi.
This is for #1634. -
September 28, 2020, by Michael Wetter:
ReformulatedBasePropertiesto avoid event-triggering assertions.
This is for #1401. -
January 11, 2019 by Michael Wetter:
Reforulated assignment ofX_intinsetState_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 fordT.startin base properties.
This is for #575. -
June 6, 2015, by Michael Wetter:
SetAbsolutePressure(start=p_default)to avoid a translation error if Buildings.Fluid.Sources.Examples.TraceSubstancesFlowSource is translated in pedantic mode in Dymola 2016. The reason is that pressures useMedium.p_defaultas 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:
AddedstateSelectattribute inBaseProperties.Tto allow correct use ofpreferredMediumStateas described in Modelica.Media.Interfaces.PartialMedium. Note that the default ispreferredMediumState=falseand hence the same states are used as were used before. This is for #260. -
May 11, 2015, by Michael Wetter:
Removedp(stateSelect=if preferredMediumStates then StateSelect.prefer else StateSelect.default)in declaration ofBaseProperties. 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:
AddedInline=truefor issue 227. -
March 20, 2015, by Michael Wetter:
Added missing termstate.p/reference_pin functionspecificEntropy. #193. -
February 3, 2015, by Michael Wetter:
RemovedstateSelect.preferfor temperature. This is for #160. -
July 24, 2014, by Michael Wetter:
Changed implementation to use Buildings.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 functionHeatCapacityOfWaterwhich is neither needed nor implemented in the Modelica Standard Library. -
November 13, 2013, by Michael Wetter:
Removed non-used computations inspecificEnthalpy_pTXand intemperature_phX. -
March 29, 2013, by Michael Wetter:
Addedfinal standardOrderComponents=truein theBasePropertiesdeclaration. This avoids an error when models are checked in Dymola 2014 in the pedenatic mode. -
April 12, 2012, by Michael Wetter:
Added keywordeachtoXi(stateSelect=...). -
April 4, 2012, by Michael Wetter:
Added redeclaration ofThermodynamicStateto avoid a warning during model check and translation. -
August 3, 2011, by Michael Wetter:
Fixed bug inu=h-R*T, which is only valid for ideal gases. For this medium, the function isu=h-pStd/dStp. -
January 27, 2010, by Michael Wetter:
Fixed bug inelsebranch of functionsetState_phXthat 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.