Main Content

Modeling Moist Air Systems

Intended Applications

The Moist Air library contains basic elements, such as reservoirs, chambers, and pneumatic-mechanical converters, as well as sensors and sources. Use these blocks to model HVAC systems, environmental control systems, and other similar applications.

Relevant industries include automotive, aerospace, building. The key aspect of these applications is the need to keep track of humidity levels in different parts of the model over time. The moist air domain is a two-species gas domain, where the species are air and water vapor. Furthermore, the water vapor can condense out of the system. This effect is important to HVAC applications because latent heat of water condensation affects the thermodynamics of the fluid flow.

The moist air mixture is composed of dry air and water vapor. Trace gas is an optional third species in the moist air mixture. Example of the trace gas usage is to track carbon dioxide and pollutants such as nitrogen oxides (NOx). You specify the moist air properties in the connected loop by using the Moist Air Properties (MA) block. This block also gives you several options for modeling trace gas properties. You increase and decrease levels of moisture and trace gas in the air mixture by using the blocks in the Moisture & Trace Gas Sources library (see Modeling Moisture and Trace Gas Levels).

All gas species in the mixture are assumed to be semiperfect gas. This means that pressure, temperature, and density obey the ideal gas law. Other properties―specific enthalpy, specific heat, dynamic viscosity, and thermal conductivity―are functions of temperature only.

Unless explicitly stated otherwise, all pressures and temperatures used in modeling moist air systems are static pressure and static temperature.

Use the Moist Air domain and library to perform the following tasks:

  • Develop requirements of an HVAC system for an environment, such as a building, automobile, or aircraft

  • Ensure acceptable temperature, pressure, humidity, and condensation within the environment

  • Determine capacity of an HVAC system to match heating, cooling, and dehumidification requirements

  • Analyze HVAC system performance, efficiency, and cost

  • Validate HVAC system model against test data

  • Design and simulate HVAC components and tune component models to test rig data

  • Simulate models including an HVAC system, environment model, and controller

  • Design controllers for valves, fans, and compressors to ensure safe and optimal operation

  • Perform HIL testing

Network Variables for Moist Air Domain

The Across variables are pressure, temperature, specific humidity (water vapor mass fraction), and trace gas mass fraction. The Through variables are mixture mass flow rate, mixture energy flow rate, water vapor mass flow rate, and trace gas mass flow rate. Note that these choices result in a pseudo-bond graph, because the product of Across and Through variables is not power.

There is a separate domain for modeling moisture and trace gas levels in moist air systems. For more information, see Moist Air Source Domain.

Moist Air Properties

The default fluid properties for the moist air library correspond to dry air, water vapor, and carbon dioxide (the optional trace gas). However, you can modify the fluid properties in the Moist Air Properties (MA) block to model mixtures of other gases and vapors. You can replace dry air and carbon dioxide with other gas species. You can also change water vapor to another condensing vapor (or even to another noncondensing gas species, by supplying large enough values for the saturation pressure, so that it would never reach saturation during simulation). In this way, you can model any three-species gas mixture.

All gas species in the mixture are assumed to be semiperfect gas. This means that pressure p, temperature T, and density ρ of the constituents obey the ideal gas law:

pa=ρaRaT,pw=ρwRwT,pg=ρgRgT,

where R is the specific gas constant. Subscripts a, w, and g indicate dry air, water vapor, and trace gas, respectively.

Dalton’s law applies to ideal gases:

p=pa+pw+pg.

Therefore, the mixture also obeys the ideal gas law:

p=ρRT,

where:

ρ=ρa+ρw+ρg,R=xaRa+xwRw+xgRg.

xa, xw, and xg are mass fractions of dry air, water vapor, and trace gas, respectively.

Other properties of each constituent are assumed to be functions of temperature only:

  • ha(T), hw(T), hg(T) ― Specific enthalpy of dry air, water vapor, and trace gas, respectively.

  • μa(T), μw(T), μg(T) ― Dynamic viscosity of dry air, water vapor, and trace gas, respectively.

  • ka(T), kw(T), kg(T) ― Thermal conductivity of dry air, water vapor, and trace gas, respectively.

For ideal gases, the enthalpy of mixing is zero. Therefore, the mixture specific enthalpy is a combination of the constituent specific enthalpy based on their mass fractions:

h=xaha(T)+xwhw(T)+xghg(T).

You can compute the entropy of mixing from the mole fractions:

Δsmix=xaRaln(ya)+xwRwln(yw)+xgRgln(yg),

where ya, yw, and yg are mole fractions of dry air, water vapor, and trace gas, respectively.

Therefore, the mixture specific entropy is

s=xasa+xwsw+xgsg+Δsmix.

Consistent Specific Enthalpy Reference Temperature

Since R2023b

Specific enthalpy is a thermodynamic quantity that is measured with respect to a reference state. To ensure consistency in a moist air mixture, all the specific enthalpies must have the same reference temperature. The moist air domain uses a consistent reference temperature of 0 degC. When you enter specific enthalpy vectors in the Moist Air Properties (MA) block, the block internally shifts these vectors to be 0 kJ/kg at 0 degC. The library blocks then use these adjusted values in the internal calculations. The simulation data log also displays the adjusted specific enthalpy values.

You can use the Enthalpy reference state parameter of the Thermodynamic Properties Sensor (MA) block to view the specific enthalpy values adjusted with respect to different reference states.

Humidity and Trace Gas Property Definitions

The equations describing humidity and trace gas properties use these symbols and property definitions. Subscripts a, w, and g indicate the properties of dry air, water vapor, and trace gas, respectively. Subscript ws indicates water vapor at saturation.

SymbolPropertyDefinition
pPressurePressure of the moist air mixture (as opposed to the partial pressure of water vapor or partial pressure of trace gas).
TTemperatureThe dry-bulb temperature, which is the temperature in the common thermodynamic sense. (The wet-bulb temperature is a different quantity, which measures the moisture level.)
RSpecific gas constant

Universal gas constant divided by the molar mass of the species. Specific gas constant of the mixture is

R=xaRa+xwRw+xgRg.

φwRelative humidity

Moles of water vapor as a fraction of the moles of water vapor needed to saturate at the same temperature. Water vapor saturation pressure is a property of water and is a function of temperature only, pws(T). The ideal gas law (due to the assumed semiperfect gas) means that mole fraction is equivalent to partial pressure fraction. The mole fraction yw cannot be greater than 1. Therefore, at high temperature or low pressure, it may not be possible to achieve relative humidity of 1.

φw=ywyws|T=ywppws(T)

xwSpecific humidity

Mass of water vapor as a fraction of the total mass of the moist air mixture. It is another term for water vapor mass fraction. It may not be possible to achieve specific humidity of 1 due to saturation.

xw=MwM=m˙wm˙

ywWater vapor mole fraction

Moles of water vapor as a fraction of the total moles of the moist air mixture. It may not be possible to achieve water vapor mole fraction of 1 due to saturation.

yw=NwN=pwp

rwHumidity ratio

Ratio of mass of water vapor to mass of dry air and trace gas. For conditions in typical HVAC applications, it is close to the specific humidity.

rw=MwMa+Mg

ρwAbsolute humidity

Mass of water vapor over the volume of the moist air mixture. It is another term for water vapor density.

ρw=MwV

xgTrace gas mass fraction

Mass of trace gas as a fraction of the total mass of the moist air mixture.

xg=MgM=m˙gm˙

ygTrace gas mole fraction

Moles of trace gas as a fraction of the total moles of the moist air mixture.

yg=NgN=pgp

Water vapor mole fraction is related to specific humidity (that is, to mass fraction) as follows:

yw=RwRxw.

Trace gas mole fraction is related to trace gas mass fraction as follows:

yg=RgRxg.

Blocks with Moist Air Volume

Components in the moist air domain are modeled using control volumes. A control volume encompasses the moist air inside the component and separates it from the surrounding environment and other components. Air flows and heat flows across the control surface are represented by ports. The moist air volume inside the component is represented using an internal node. This internal node is not visible, but you can access its parameters and variables using Simscape™ data logging. For more information, see About Simulation Data Logging.

For a moist air volume, you must specify the pressure, temperature, moisture level, and trace gas level. For more information, see Initial Conditions for Blocks with Finite Moist Air Volume.

The following blocks in the Moist Air library are modeled as components with a moist air volume. In the case of Controlled Reservoir (MA) and Reservoir (MA) blocks, the volume is assumed to be infinitely large.

BlockGas Volume
Constant Volume Chamber (MA)Finite
Pipe (MA)Finite
Rotational Mechanical Converter (MA)Finite
Translational Mechanical Converter (MA)Finite
Reservoir (MA)Infinite
Controlled Reservoir (MA)Infinite

Other components have relatively small moist air volumes, so that the air mixture entering the component spends negligible time inside the component before exiting. These components are considered quasi-steady-state and they do not have an internal node.

Reference Node and Grounding Rules

Unlike mechanical and electrical domains, where each topologically distinct circuit within a domain must contain at least one reference block, moist air networks have different grounding rules.

Blocks with a moist air volume contain an internal node, which provides the pressure, temperature, moisture level, and trace gas level inside the component and therefore serves as a reference node for the moist air network. Each connected moist air network must have at least one reference node. This means that each connected moist air network must have at least one of the blocks listed in Blocks with Moist Air Volume. In other words, a moist air network that contains no air volume is an invalid network.

The Foundation Moist Air library contains the Absolute Reference (MA) block but, unlike other domains, you do not use it for grounding moist air circuits. The purpose of the Absolute Reference (MA) block is to provide a reference for the Pressure & Temperature Sensor (MA) block. However, starting in R2023a, the Pressure & Temperature Sensor (MA) block contains an implicit reference node, which makes using the Absolute Reference (MA) block with the Pressure & Temperature Sensor (MA) block unnecessary. If you use the Absolute Reference (MA) block elsewhere in a moist air network, it triggers a simulation assertion because air mixture pressure and temperature cannot be at absolute zero.

Initial Conditions for Blocks with Finite Moist Air Volume

This section discusses the specific initialization requirements for blocks modeled with finite moist air volume. These blocks are listed in Blocks with Moist Air Volume.

The fluid states of a moist air volume are pressure, temperature, moisture level, and trace gas level. These fluid states evolve dynamically based on the mixture mass conservation, water vapor mass conservation, trace gas mass conservation, and mixture energy conservation. Therefore, it is necessary to specify initial conditions for these blocks, to define the initial fluid states. The dialog box of each block modeled with finite moist air volume has an Initial Targets section, which lets you specify the initial conditions. To ensure consistent initial conditions, specify high priority targets for four variables:

  • Pressure of moist air volume

  • Temperature of moist air volume

  • One of the variables representing the moisture level:

    • Relative humidity of moist air volume

    • Specific humidity of moist air volume

    • Water vapor mole fraction of moist air volume

    • Humidity ratio of moist air volume

  • One of the variables representing the trace gas level:

    • Trace gas mass fraction of moist air volume

    • Trace gas mole fraction of moist air volume

It is important that only four variables, as described, have their priorities set to High for each block with a finite moist air volume. Placing high-priority constraints on additional variables results in overspecification, with the solver being unable to find an initialization solution that satisfies the desired initial values. Set the priority of remaining variables to None. You can use the equations in Humidity and Trace Gas Property Definitions and Trace Gas Modeling Options to convert values from one moisture or trace gas measure to another. For more information on variable initialization and dealing with overspecification, see Initialize Variables for a Mass-Spring-Damper System.

The fluid states of moist air volume in these blocks are reported by the physical signal output port F. Connect port F to the Measurement Selector (MA) block to extract the measurements of pressure, temperature, moisture level, and trace gas level during simulation.

In blocks that are modeled with an infinitely large moist air volume, the state of the volume is assumed quasisteady and there is no need to specify an initial condition. Instead, these blocks represent boundary conditions for the moist air network.

Saturation and Condensation

Blocks with finite moist air volume (listed in Blocks with Moist Air Volume) can become saturated when the relative humidity φw reaches the relative humidity at saturation φws. The saturated state represents the maximum amount of moisture that the moist air volume can hold at that pressure and temperature. Any additional moisture condenses into liquid water.

By definition, the relative humidity at saturation is 1. However, you can specify a different value for φws to model some empirical effect or other phenomenon. When φws > 1, water vapor partial pressure can become greater than the water vapor saturation pressure. When φws < 1, moisture can condense before the water vapor partial pressure reaches the water vapor saturation pressure.

Condensation does not occur instantaneously. Consequently, it is possible for φw to be slightly greater than φws. The condensation time constant represents the characteristic time it takes to condense out enough moisture to bring φw back to φws. A larger value of the time constant causes φw to exceed φws to a greater degree, but is more numerically robust.

Moisture that condenses is considered to have left the moist air network, therefore, the mass and energy of condensed liquid water is subtracted from the moist air volume. The rate of condensation is reported by the physical signal output port W. If you want to model the flow of the condensed liquid water, you can use the rate of condensation as an input for another fluid network (hydraulic, thermal liquid, two-phase fluid, or another moist air network). The following example shows how to use the thermal liquid network to model the condensate that drains from a Constant Volume Chamber (MA) through a pipe.

If you have a Simscape Fluids™ license, you can also use the Tank (TL) block to model a condensation collection tray. The liquid level in the tank represents the amount of condensation collected but not yet drained from the tank.

Choked Flow

Moist air flow through Local Restriction (MA), Variable Local Restriction (MA), or Pipe (MA) blocks can become choked. Choking occurs when the flow velocity reaches the local speed of sound. When the flow is choked, the velocity at the point of choking cannot increase any further. However, the mass flow rate can still increase if the density of the air mixture increases. This can be achieved, for example, by increasing the pressure upstream of the point of choking. The effect of choking on a moist air network is that the mass flow rate through the branch containing the choked block depends completely on the upstream pressure and temperature. As long as the choking condition is maintained, this choked mass flow rate is independent of any changes occurring in the pressure downstream.

The following model illustrates the choked flow. In this model, the Ramp block has a slope of 0.005 and the start time of 10. The Simulink-PS Converter block has Input signal unit set to MPa. All other blocks have default parameter values. Simulation time is 50 s. When you simulate the model, the pressure at port A of the Local Restriction (MA) block increases linearly from atmospheric pressure, starting at 10 s. The pressure at port B is fixed at atmospheric pressure.

The following two plots show the logged simulation data for the Local Restriction (MA) block. The Mach number at the restriction (Mach) reaches 1 at around 20 s, indicating that the flow is choked. The mass flow rate (mdot_A) before the flow is choked follows the typical quadratic behavior with respect to an increasing pressure difference. However, the mass flow rate after the flow is choked becomes linear because the choked mass flow rate depends only on the upstream pressure and temperature, and the upstream pressure is increasing linearly.

The fact that the choked mass flow rate depends only on the upstream conditions can cause an incompatibility with a Mass Flow Rate Source (MA) or a Controlled Mass Flow Rate Source (MA) block connected downstream of the choked block. Consider this model, which contains the Controlled Mass Flow Rate Source (MA) block instead of the Controlled Pressure Source (MA) block.

If the source commanded an increasing mass flow rate from left to right through the Local Restriction (MA) block, the simulation would succeed even if the flow became choked because the Controlled Mass Flow Rate Source (MA) block would be upstream of the choked block. However, in this model, the Gain block reverses the flow direction, so that the Controlled Mass Flow Rate Source (MA) block is downstream of the choked block. The pressure upstream of the Local Restriction (MA) block is fixed at atmospheric pressure. Therefore, the choked mass flow rate in this situation is constant. As the commanded mass flow rate increases, eventually it will become greater than this constant value of choked mass flow rate. At this point, the commanded mass flow rate and the choked mass flow rate cannot be reconciled and the simulation fails. Viewing the logged simulation data in the Simscape Results Explorer shows that simulation fails just at the point when the Mach number reaches 1 and the flow becomes choked.

In general, if a model is likely to choke, use pressure sources rather than mass flow rate sources. If a model contains mass flow rate source blocks and the simulation fails, use the Simscape Results Explorer to inspect the Mach number variables in all Local Restriction (MA), Variable Local Restriction (MA), and Pipe (MA) blocks connected along the same branch as the mass flow rate source. If the simulation failure occurs when the Mach number reaches 1, it is likely that there is a downstream mass flow rate source trying to command a mass flow rate greater than the possible choked mass flow rate.

Cross-Sectional Area at Block Ports

Many blocks in the moist air domain let you specify the cross-sectional area at the inlet and outlet ports as a block parameter. It is recommended that you specify the same cross-sectional area for ports that are connected together. For example, if you have port A of a Constant Volume Chamber (MA) block connected to a Pipe (MA) block, set the Cross-sectional area at port A parameter of the Constant Volume Chamber (MA) block to the same value as the Cross-sectional area parameter of the Pipe (MA) block.

Especially for high-speed flows, where Mach number is close to 1, differences in the connected port areas can result in unexpected temperature differences. For more information, see Specifying the Cross-Sectional Area at Ports.

Related Topics