Package 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 Contents

NameDescription
IdealGasH2OIdealGas H20 medium model
MixtureGasesTest gas mixtures
MoistAirExample for moist air
PsychrometricDataProduces plot data for psychrometric charts
R134aExamples for R134a
ReferenceAirExamples for detailed dry air and moist air medium models
SimpleLiquidWaterExample for Water.SimpleLiquidWater medium model
SolveOneNonlinearEquationDemonstrate how to solve one non-linear algebraic equation in one unknown
TestOnlyExamples to show the testing of media
TestsLibrary to test that all media models simulate and fulfill the expected structural properties
TwoPhaseWaterExtension of the StandardWater package
UtilitiesFunctions, connectors and models needed for the media model tests
WaterIF97WaterIF97 medium model

Model Modelica.​Media.​Examples.​SimpleLiquidWater
Example for Water.SimpleLiquidWater medium model

Information

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

Parameters

TypeNameDefaultDescription
VolumeV1Volume
EnthalpyFlowRateH_flow_ext1000000Constant enthalpy flow rate into the volume

Model 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).


Model Modelica.​Media.​Examples.​WaterIF97
WaterIF97 medium model

Information

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

Parameters

TypeNameDefaultDescription
VolumeFlowRatedV0Fixed time derivative of volume
MassFlowRatem_flow_ext0Fixed mass flow rate into volume
EnthalpyFlowRateH_flow_ext10000Fixed enthalpy flow rate into volume

Model Modelica.​Media.​Examples.​MixtureGases
Test gas mixtures

Information

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

Parameters

TypeNameDefaultDescription
VolumeV1Fixed size of volume 1 and volume 2
MassFlowRatem_flow_ext0.01Fixed mass flow rate in to volume 1 and in to volume 2
EnthalpyFlowRateH_flow_ext5000Fixed enthalpy flow rate in to volume and in to volume 2

Model Modelica.​Media.​Examples.​MoistAir
Example for moist air

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).

Parameters

TypeNameDefaultDescription
MolarMassMMx[2]{Medium.dryair.MM, Medium.steam.MM}Vector of molar masses (consisting of dry air and of steam)

Model 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

TypeNameDefaultDescription
Pressurep_const100000Pressure
Integern_T11Number of isotherms
TemperatureT_min253.15Lowest isotherm
TemperatureT_step10Temperature step between two isotherms
Integern_h16Number of lines with constant specific enthalpy
SpecificEnthalpyh_min-20000Lowest line of constant enthalpy
SpecificEnthalpyh_step10000Enthalpy step between two lines of constant enthalpy
Integern_phi10Number of lines with constant relative humidity
Realphi_min0.1Lowest line of constant humidity
Realphi_step0.1Step between two lines of constant humidity
MassFractionx_min0Minimum diagram absolute humidity
MassFractionx_max0.03Maximum diagram absolute humidity
Timet1Simulation time
final TemperatureT_const[n_T]{T_min - T_step + i * T_step for i in 1:n_T}Constant temperatures
final SpecificEnthalpyh_const[n_h]{(i - 1) * h_step + h_min for i in 1:n_h}Constant enthalpies
final Realphi_const[n_phi]{(i - 1) * phi_step + phi_min for i in 1:n_phi}Constant relative humidities
final RealdiagSlopeMedium.enthalpyOfVaporization(273.15)Rotation of diagram that zero degrees isotherm becomes horizontal outside the fog region
final MassFractionx_startx_minInitial absolute humidity in kg water/kg dry air

Generated 2018-12-12 12:13:42 EST by MapleSim.