Modelica.Media.Examples

Demonstrate usage of property models

Information

Examples

Physical properties for fluids are needed in so many different variants that a library can only provide models for the most common situations. With the following examples we are going to demonstrate how to use the existing packages and functions in Modelica.Media to customize these models for advanced applications. The high level functions try to abstract as much as possible form the fact that different media are based on different variables, e.g., ideal gases need pressure and temperature, while many refrigerants are based on Helmholtz functions of density and temperature, and many water properties are based on pressure and specific enthalpy. Medium properties are needed in control volumes in the dynamic state equations and in many thermodynamic state locations that are independent of the dynamic states of a control volume, e.g., at a wall temperature, an isentropic reference state or at a phase boundary. The general structure of the library is such that:

A small library of generic volume, pipe, pump and ambient models is provided in Modelica.Media.Examples.Tests.Components to demonstrate how fluid components should be implemented that are using Modelica.Media models. This library is also used to test all media models in Modelica.Media.Examples.Tests.MediaTestModels.

Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).

Package Content

Name Description
Modelica.Media.Examples.SimpleLiquidWater SimpleLiquidWater Example for Water.SimpleLiquidWater medium model
Modelica.Media.Examples.IdealGasH2O IdealGasH2O IdealGas H20 medium model
Modelica.Media.Examples.WaterIF97 WaterIF97 WaterIF97 medium model
Modelica.Media.Examples.MixtureGases MixtureGases Test gas mixtures
Modelica.Media.Examples.MoistAir MoistAir Example for moist air
Modelica.Media.Examples.PsychrometricData PsychrometricData Produces plot data for psychrometric charts
Modelica.Media.Examples.TwoPhaseWater TwoPhaseWater Extension of the StandardWater package
Modelica.Media.Examples.ReferenceAir ReferenceAir Examples for detailed dry air and moist air medium models
Modelica.Media.Examples.R134a R134a Examples for R134a
Modelica.Media.Examples.SolveOneNonlinearEquation SolveOneNonlinearEquation Demonstrate how to solve one non-linear algebraic equation in one unknown
Modelica.Media.Examples.Utilities Utilities Functions, connectors and models needed for the media model tests

Modelica.Media.Examples.SimpleLiquidWater Modelica.Media.Examples.SimpleLiquidWater

Example for Water.SimpleLiquidWater medium model

Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

NameDescription
VVolume [m3]
H_flow_extConstant enthalpy flow rate into the volume [W]

Modelica.Media.Examples.IdealGasH2O Modelica.Media.Examples.IdealGasH2O

IdealGas H20 medium model

Information

An example for using ideal gas properties and how to compute isentropic enthalpy changes. The function that is implemented is approximate, but usually very good: the second medium record medium2 is given to compare the approximation.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica.Media.Examples.WaterIF97 Modelica.Media.Examples.WaterIF97

WaterIF97 medium model

Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

NameDescription
dVFixed time derivative of volume [m3/s]
m_flow_extFixed mass flow rate into volume [kg/s]
H_flow_extFixed enthalpy flow rate into volume [W]

Modelica.Media.Examples.MixtureGases Modelica.Media.Examples.MixtureGases

Test gas mixtures

Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

NameDescription
VFixed size of volume 1 and volume 2 [m3]
m_flow_extFixed mass flow rate into volume 1 and into volume 2 [kg/s]
H_flow_extFixed enthalpy flow rate into volume 1 and into volume 2 [W]

Modelica.Media.Examples.MoistAir Modelica.Media.Examples.MoistAir

Example for moist air

Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

NameDescription
MMx[2]Vector of molar masses (consisting of dry air and of steam) [kg/mol]

Modelica.Media.Examples.PsychrometricData Modelica.Media.Examples.PsychrometricData

Produces plot data for psychrometric charts

Information

This model produces psychrometric data from the moist air model in this library to be plotted in charts. The two most common chart varieties are the Mollier Diagram and the Psychrometric Chart. The first is widely used in some European countries while the second is more common in the Anglo-American world. Specific enthalpy is plotted over absolute humidity in the Mollier Diagram, it is the other way round in the Psychrometric Chart.
It must be noted that the relationship of both axis variables is not right-angled, the absolute humidity follows a slope which equals the enthalpy of vaporization at 0 °C. For better reading and in order to reduce the fog region the humidity axis is rotated to obtain a right-angled plot. Both charts usually contain additional information as isochores or auxiliary scales for e.g., heat ratios. Those information are omitted in this model and the charts below. Other important features of psychrometric chart data are that all mass specific variables (like absolute humidity, specific enthalpy etc.) are expressed in terms of kg dry air and that their baseline of 0 enthalpy is found at 0 °C and zero humidity.


Legend: blue - constant specific enthalpy, red - constant temperature, black - constant relative humidity

The model provides data for lines of constant specific enthalpy, temperature and relative humidity in a Mollier Diagram or Psychrometric Chart as they were used for the figures above. For limitations and ranges of validity please refer to the MoistAir package description. Absolute humidity x is increased with time in this model. The specific enthalpies adjusted for plotting are then obtained from:

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

NameDescription
p_constPressure [Pa]
n_TNumber of isotherms
T_minLowest isotherm [K]
T_stepTemperature step between two isotherms [K]
n_hNumber of lines with constant specific enthalpy
h_minLowest line of constant enthalpy [J/kg]
h_stepEnthalpy step between two lines of constant enthalpy [J/kg]
n_phiNumber of lines with constant relative humidity
phi_minLowest line of constant humidity
phi_stepStep between two lines of constant humidity
x_minMinimum diagram absolute humidity [1]
x_maxMaximum diagram absolute humidity [1]
tSimulation time [s]
Automatically generated Thu Oct 1 16:08:00 2020.