Modelica.Media.IdealGases.Common.SingleGasNasa

Medium model of an ideal gas based on NASA source

Information


This model calculates medium properties for an ideal gas of a single substance, or for an ideal gas consisting of several substances where the mass fractions are fixed. Independent variables are temperature T and pressure p. Only density is a function of T and p. All other quantities are solely a function of T. The properties are valid in the range:

   200 K ≤ T ≤ 6000 K

The following quantities are always computed:

Variable Unit Description
h J/kg specific enthalpy h = h(T)
u J/kg specific internal energy u = u(T)
d kg/m^3 density d = d(p,T)

For the other variables, see the functions in Modelica.Media.IdealGases.Common.SingleGasNasa. Note, dynamic viscosity and thermal conductivity are only provided for gases that use a data record from Modelica.Media.IdealGases.FluidData. Currently these are the following gases:

  Ar
  C2H2_vinylidene
  C2H4
  C2H5OH
  C2H6
  C3H6_propylene
  C3H7OH
  C3H8
  C4H8_1_butene
  C4H9OH
  C4H10_n_butane
  C5H10_1_pentene
  C5H12_n_pentane
  C6H6
  C6H12_1_hexene
  C6H14_n_heptane
  C7H14_1_heptene
  C8H10_ethylbenz
  CH3OH
  CH4
  CL2
  CO
  CO2
  F2
  H2
  H2O
  He
  N2
  N2O
  NH3
  NO
  O2
  SO2
  SO3

Sources for model and literature:
Original Data: Computer program for calculation of complex chemical equilibrium compositions and applications. Part 1: Analysis Document ID: 19950013764 N (95N20180) File Series: NASA Technical Reports Report Number: NASA-RP-1311 E-8017 NAS 1.61:1311 Authors: Gordon, Sanford (NASA Lewis Research Center) Mcbride, Bonnie J. (NASA Lewis Research Center) Published: Oct 01, 1994.

Known limits of validity:
The data is valid for temperatures between 200 K and 6000 K. A few of the data sets for monatomic gases have a discontinuous 1st derivative at 1000 K, but this never caused problems so far.

This model has been copied from the ThermoFluid library and adapted to the Modelica.Media package.

Extends from Interfaces.PartialPureSubstance (base class for pure substances of one chemical substance).

Package Content

NameDescription
Modelica.Media.IdealGases.Common.SingleGasNasa.ThermodynamicState ThermodynamicState thermodynamic state variables for ideal gases
Modelica.Media.IdealGases.Common.SingleGasNasa.FluidConstants FluidConstants Extended fluid constants
excludeEnthalpyOfFormation=trueIf true, enthalpy of formation Hf is not included in specific enthalpy h
referenceChoice=Choices.ReferenceEnthalpy.ZeroAt0KChoice of reference enthalpy
h_offset=0.0User defined offset for reference enthalpy, if referenceChoice = UserDefined
dataData record of ideal gas substance
fluidConstantsconstant data for the fluid
Modelica.Media.IdealGases.Common.SingleGasNasa.BaseProperties BaseProperties Base properties of ideal gas medium
Modelica.Media.IdealGases.Common.SingleGasNasa.setState_pTX setState_pTX Return thermodynamic state as function of p, T and composition X
Modelica.Media.IdealGases.Common.SingleGasNasa.setState_phX setState_phX Return thermodynamic state as function of p, h and composition X
Modelica.Media.IdealGases.Common.SingleGasNasa.setState_psX setState_psX Return thermodynamic state as function of p, s and composition X
Modelica.Media.IdealGases.Common.SingleGasNasa.setState_dTX setState_dTX Return thermodynamic state as function of d, T and composition X
Modelica.Media.IdealGases.Common.SingleGasNasa.setSmoothState setSmoothState Return thermodynamic state so that it smoothly approximates: if x > 0 then state_a else state_b
Modelica.Media.IdealGases.Common.SingleGasNasa.pressure pressure return pressure of ideal gas
Modelica.Media.IdealGases.Common.SingleGasNasa.temperature temperature return temperature of ideal gas
Modelica.Media.IdealGases.Common.SingleGasNasa.density density return density of ideal gas
Modelica.Media.IdealGases.Common.SingleGasNasa.specificEnthalpy specificEnthalpy Return specific enthalpy
Modelica.Media.IdealGases.Common.SingleGasNasa.specificInternalEnergy specificInternalEnergy Return specific internal energy
Modelica.Media.IdealGases.Common.SingleGasNasa.specificEntropy specificEntropy Return specific entropy
Modelica.Media.IdealGases.Common.SingleGasNasa.specificGibbsEnergy specificGibbsEnergy Return specific Gibbs energy
Modelica.Media.IdealGases.Common.SingleGasNasa.specificHelmholtzEnergy specificHelmholtzEnergy Return specific Helmholtz energy
Modelica.Media.IdealGases.Common.SingleGasNasa.specificHeatCapacityCp specificHeatCapacityCp Return specific heat capacity at constant pressure
Modelica.Media.IdealGases.Common.SingleGasNasa.specificHeatCapacityCv specificHeatCapacityCv Compute specific heat capacity at constant volume from temperature and gas data
Modelica.Media.IdealGases.Common.SingleGasNasa.isentropicExponent isentropicExponent Return isentropic exponent
Modelica.Media.IdealGases.Common.SingleGasNasa.velocityOfSound velocityOfSound Return velocity of sound
Modelica.Media.IdealGases.Common.SingleGasNasa.isentropicEnthalpyApproximation isentropicEnthalpyApproximation approximate method of calculating h_is from upstream properties and downstream pressure
Modelica.Media.IdealGases.Common.SingleGasNasa.isentropicEnthalpy isentropicEnthalpy Return isentropic enthalpy
Modelica.Media.IdealGases.Common.SingleGasNasa.isobaricExpansionCoefficient isobaricExpansionCoefficient Returns overall the isobaric expansion coefficient beta
Modelica.Media.IdealGases.Common.SingleGasNasa.isothermalCompressibility isothermalCompressibility Returns overall the isothermal compressibility factor
Modelica.Media.IdealGases.Common.SingleGasNasa.density_derp_T density_derp_T Returns the partial derivative of density with respect to pressure at constant temperature
Modelica.Media.IdealGases.Common.SingleGasNasa.density_derT_p density_derT_p Returns the partial derivative of density with respect to temperature at constant pressure
Modelica.Media.IdealGases.Common.SingleGasNasa.density_derX density_derX Returns the partial derivative of density with respect to mass fractions at constant pressure and temperature
Modelica.Media.IdealGases.Common.SingleGasNasa.cp_T cp_T Compute specific heat capacity at constant pressure from temperature and gas data
Modelica.Media.IdealGases.Common.SingleGasNasa.cp_Tlow cp_Tlow Compute specific heat capacity at constant pressure, low T region
Modelica.Media.IdealGases.Common.SingleGasNasa.cp_Tlow_der cp_Tlow_der Compute specific heat capacity at constant pressure, low T region
Modelica.Media.IdealGases.Common.SingleGasNasa.h_T h_T Compute specific enthalpy from temperature and gas data; reference is decided by the refChoice input, or by the referenceChoice package constant by default
Modelica.Media.IdealGases.Common.SingleGasNasa.h_T_der h_T_der derivative function for h_T
Modelica.Media.IdealGases.Common.SingleGasNasa.h_Tlow h_Tlow Compute specific enthalpy, low T region; reference is decided by the refChoice input, or by the referenceChoice package constant by default
Modelica.Media.IdealGases.Common.SingleGasNasa.h_Tlow_der h_Tlow_der Compute specific enthalpy, low T region; reference is decided by the refChoice input, or by the referenceChoice package constant by default
Modelica.Media.IdealGases.Common.SingleGasNasa.s0_T s0_T Compute specific entropy from temperature and gas data
Modelica.Media.IdealGases.Common.SingleGasNasa.s0_Tlow s0_Tlow Compute specific entropy, low T region
Modelica.Media.IdealGases.Common.SingleGasNasa.dynamicViscosityLowPressure dynamicViscosityLowPressure Dynamic viscosity of low pressure gases
Modelica.Media.IdealGases.Common.SingleGasNasa.dynamicViscosity dynamicViscosity dynamic viscosity
Modelica.Media.IdealGases.Common.SingleGasNasa.thermalConductivityEstimate thermalConductivityEstimate Thermal conductivity of polyatomic gases(Eucken and Modified Eucken correlation)
Modelica.Media.IdealGases.Common.SingleGasNasa.thermalConductivity thermalConductivity thermal conductivity of gas
Modelica.Media.IdealGases.Common.SingleGasNasa.molarMass molarMass return the molar mass of the medium
Modelica.Media.IdealGases.Common.SingleGasNasa.T_h T_h Compute temperature from specific enthalpy
Modelica.Media.IdealGases.Common.SingleGasNasa.T_ps T_ps Compute temperature from pressure and specific entropy
Inherited
Modelica.Media.Interfaces.PartialPureSubstance.setState_pT setState_pT Return thermodynamic state from p and T
Modelica.Media.Interfaces.PartialPureSubstance.setState_ph setState_ph Return thermodynamic state from p and h
Modelica.Media.Interfaces.PartialPureSubstance.setState_ps setState_ps Return thermodynamic state from p and s
Modelica.Media.Interfaces.PartialPureSubstance.setState_dT setState_dT Return thermodynamic state from d and T
Modelica.Media.Interfaces.PartialPureSubstance.density_ph density_ph Return density from p and h
Modelica.Media.Interfaces.PartialPureSubstance.temperature_ph temperature_ph Return temperature from p and h
Modelica.Media.Interfaces.PartialPureSubstance.pressure_dT pressure_dT Return pressure from d and T
Modelica.Media.Interfaces.PartialPureSubstance.specificEnthalpy_dT specificEnthalpy_dT Return specific enthalpy from d and T
Modelica.Media.Interfaces.PartialPureSubstance.specificEnthalpy_ps specificEnthalpy_ps Return specific enthalpy from p and s
Modelica.Media.Interfaces.PartialPureSubstance.temperature_ps temperature_ps Return temperature from p and s
Modelica.Media.Interfaces.PartialPureSubstance.density_ps density_ps Return density from p and s
Modelica.Media.Interfaces.PartialPureSubstance.specificEnthalpy_pT specificEnthalpy_pT Return specific enthalpy from p and T
Modelica.Media.Interfaces.PartialPureSubstance.density_pT density_pT Return density from p and T
ThermoStatesEnumeration type for independent variables
mediumName="unusablePartialMedium"Name of the medium
substanceNames={mediumName}Names of the mixture substances. Set substanceNames={mediumName} if only one substance.
extraPropertiesNames=fill("", 0)Names of the additional (extra) transported properties. Set extraPropertiesNames=fill("",0) if unused
singleState= true, if u and d are not a function of pressure
reducedX=true= true if medium contains the equation sum(X) = 1.0; set reducedX=true if only one substance (see docu for details)
fixedX=false= true if medium contains the equation X = reference_X
reference_p=101325Reference pressure of Medium: default 1 atmosphere
reference_T=298.15Reference temperature of Medium: default 25 deg Celsius
reference_X=fill(1/nX, nX)Default mass fractions of medium
p_default=101325Default value for pressure of medium (for initialization)
T_default=Modelica.SIunits.Conversions.from_degC(20)Default value for temperature of medium (for initialization)
h_default=specificEnthalpy_pTX(p_default, T_default, X_default)Default value for specific enthalpy of medium (for initialization)
X_default=reference_XDefault value for mass fractions of medium (for initialization)
nS=size(substanceNames, 1)Number of substances
nX=nSNumber of mass fractions
nXi=if fixedX then 0 else if reducedX then nS - 1 else nSNumber of structurally independent mass fractions (see docu for details)
nC=size(extraPropertiesNames, 1)Number of extra (outside of standard mass-balance) transported properties
C_nominal=1.0e-6*ones(nC)Default for the nominal values for the extra properties
Modelica.Media.Interfaces.PartialMedium.prandtlNumber prandtlNumber Return the Prandtl number
Modelica.Media.Interfaces.PartialMedium.heatCapacity_cp heatCapacity_cp alias for deprecated name
Modelica.Media.Interfaces.PartialMedium.heatCapacity_cv heatCapacity_cv alias for deprecated name
Modelica.Media.Interfaces.PartialMedium.beta beta alias for isobaricExpansionCoefficient for user convenience
Modelica.Media.Interfaces.PartialMedium.kappa kappa alias of isothermalCompressibility for user convenience
Modelica.Media.Interfaces.PartialMedium.density_derp_h density_derp_h Return density derivative w.r.t. pressure at const specific enthalpy
Modelica.Media.Interfaces.PartialMedium.density_derh_p density_derh_p Return density derivative w.r.t. specific enthalpy at constant pressure
Modelica.Media.Interfaces.PartialMedium.specificEnthalpy_pTX specificEnthalpy_pTX Return specific enthalpy from p, T, and X or Xi
Modelica.Media.Interfaces.PartialMedium.specificEntropy_pTX specificEntropy_pTX Return specific enthalpy from p, T, and X or Xi
Modelica.Media.Interfaces.PartialMedium.density_pTX density_pTX Return density from p, T, and X or Xi
Modelica.Media.Interfaces.PartialMedium.temperature_phX temperature_phX Return temperature from p, h, and X or Xi
Modelica.Media.Interfaces.PartialMedium.density_phX density_phX Return density from p, h, and X or Xi
Modelica.Media.Interfaces.PartialMedium.temperature_psX temperature_psX Return temperature from p,s, and X or Xi
Modelica.Media.Interfaces.PartialMedium.density_psX density_psX Return density from p, s, and X or Xi
Modelica.Media.Interfaces.PartialMedium.specificEnthalpy_psX specificEnthalpy_psX Return specific enthalpy from p, s, and X or Xi
AbsolutePressure Type for absolute pressure with medium specific attributes
Density Type for density with medium specific attributes
DynamicViscosity Type for dynamic viscosity with medium specific attributes
EnthalpyFlowRate Type for enthalpy flow rate with medium specific attributes
MassFlowRate Type for mass flow rate with medium specific attributes
MassFraction Type for mass fraction with medium specific attributes
MoleFraction Type for mole fraction with medium specific attributes
MolarMass Type for molar mass with medium specific attributes
MolarVolume Type for molar volume with medium specific attributes
IsentropicExponent Type for isentropic exponent with medium specific attributes
SpecificEnergy Type for specific energy with medium specific attributes
SpecificInternalEnergy Type for specific internal energy with medium specific attributes
SpecificEnthalpy Type for specific enthalpy with medium specific attributes
SpecificEntropy Type for specific entropy with medium specific attributes
SpecificHeatCapacity Type for specific heat capacity with medium specific attributes
SurfaceTension Type for surface tension with medium specific attributes
Temperature Type for temperature with medium specific attributes
ThermalConductivity Type for thermal conductivity with medium specific attributes
PrandtlNumber Type for Prandtl number with medium specific attributes
VelocityOfSound Type for velocity of sound with medium specific attributes
ExtraProperty Type for unspecified, mass-specific property transported by flow
CumulativeExtraProperty Type for conserved integral of unspecified, mass specific property
ExtraPropertyFlowRate Type for flow rate of unspecified, mass-specific property
IsobaricExpansionCoefficient Type for isobaric expansion coefficient with medium specific attributes
DipoleMoment Type for dipole moment with medium specific attributes
DerDensityByPressure Type for partial derivative of density with resect to pressure with medium specific attributes
DerDensityByEnthalpy Type for partial derivative of density with resect to enthalpy with medium specific attributes
DerEnthalpyByPressure Type for partial derivative of enthalpy with resect to pressure with medium specific attributes
DerDensityByTemperature Type for partial derivative of density with resect to temperature with medium specific attributes
Modelica.Media.Interfaces.PartialMedium.Choices Choices Types, constants to define menu choices

Types and constants

  constant Boolean excludeEnthalpyOfFormation=true 
  "If true, enthalpy of formation Hf is not included in specific enthalpy h";

  constant ReferenceEnthalpy referenceChoice=Choices.
        ReferenceEnthalpy.ZeroAt0K "Choice of reference enthalpy";

  constant SpecificEnthalpy h_offset=0.0 
  "User defined offset for reference enthalpy, if referenceChoice = UserDefined";

  constant IdealGases.Common.DataRecord data 
  "Data record of ideal gas substance";

  constant FluidConstants[nS] fluidConstants "constant data for the fluid";


Modelica.Media.IdealGases.Common.SingleGasNasa.ThermodynamicState Modelica.Media.IdealGases.Common.SingleGasNasa.ThermodynamicState

thermodynamic state variables for ideal gases

Information

Extends from (Minimal variable set that is available as input argument to every medium function).

Modelica definition

redeclare record extends ThermodynamicState 
  "thermodynamic state variables for ideal gases"
  AbsolutePressure p "Absolute pressure of medium";
  Temperature T "Temperature of medium";
end ThermodynamicState;

Modelica.Media.IdealGases.Common.SingleGasNasa.FluidConstants Modelica.Media.IdealGases.Common.SingleGasNasa.FluidConstants

Extended fluid constants

Information

Extends from (critical, triple, molecular and other standard data of fluid).

Modelica definition

redeclare record extends FluidConstants "Extended fluid constants"
  Temperature criticalTemperature "critical temperature";
  AbsolutePressure criticalPressure "critical pressure";
  MolarVolume criticalMolarVolume "critical molar Volume";
  Real acentricFactor "Pitzer acentric factor";
  Temperature triplePointTemperature "triple point temperature";
  AbsolutePressure triplePointPressure "triple point pressure";
  Temperature meltingPoint "melting point at 101325 Pa";
  Temperature normalBoilingPoint "normal boiling point (at 101325 Pa)";
  DipoleMoment dipoleMoment 
    "dipole moment of molecule in Debye (1 debye = 3.33564e10-30 C.m)";
  Boolean hasIdealGasHeatCapacity=false 
    "true if ideal gas heat capacity is available";
  Boolean hasCriticalData=false "true if critical data are known";
  Boolean hasDipoleMoment=false "true if a dipole moment known";
  Boolean hasFundamentalEquation=false "true if a fundamental equation";
  Boolean hasLiquidHeatCapacity=false 
    "true if liquid heat capacity is available";
  Boolean hasSolidHeatCapacity=false "true if solid heat capacity is available";
  Boolean hasAccurateViscosityData=false 
    "true if accurate data for a viscosity function is available";
  Boolean hasAccurateConductivityData=false 
    "true if accurate data for thermal conductivity is available";
  Boolean hasVapourPressureCurve=false 
    "true if vapour pressure data, e.g., Antoine coefficents are known";
  Boolean hasAcentricFactor=false "true if Pitzer accentric factor is known";
  SpecificEnthalpy HCRIT0=0.0 
    "Critical specific enthalpy of the fundamental equation";
  SpecificEntropy SCRIT0=0.0 
    "Critical specific entropy of the fundamental equation";
  SpecificEnthalpy deltah=0.0 
    "Difference between specific enthalpy model (h_m) and f.eq. (h_f) (h_m - h_f)";
  SpecificEntropy deltas=0.0 
    "Difference between specific enthalpy model (s_m) and f.eq. (s_f) (s_m - s_f)";
end FluidConstants;

Modelica.Media.IdealGases.Common.SingleGasNasa.BaseProperties Modelica.Media.IdealGases.Common.SingleGasNasa.BaseProperties

Base properties of ideal gas medium

Information

Extends from .

Parameters

TypeNameDefaultDescription
Advanced
BooleanpreferredMediumStatesfalse= true if StateSelect.prefer shall be used for the independent property variables of the medium

Modelica definition

redeclare model extends BaseProperties(
 T(stateSelect=if preferredMediumStates then StateSelect.prefer else StateSelect.default),
 p(stateSelect=if preferredMediumStates then StateSelect.prefer else StateSelect.default)) 
  "Base properties of ideal gas medium"
equation 
  assert(T >= 200 and T <= 6000, "
Temperature T (= "
                 + String(T) + " K) is not in the allowed range
200 K <= T <= 6000 K required from medium model \""
                                                  + mediumName + "\".
");
  MM = data.MM;
  R = data.R;
  h = h_T(data, T, excludeEnthalpyOfFormation, referenceChoice, h_offset);
  u = h - R*T;

  // Has to be written in the form d=f(p,T) in order that static
  // state selection for p and T is possible
  d = p/(R*T);
  // connect state with BaseProperties
  state.T = T;
  state.p = p;
end BaseProperties;

Modelica.Media.IdealGases.Common.SingleGasNasa.setState_pTX Modelica.Media.IdealGases.Common.SingleGasNasa.setState_pTX

Return thermodynamic state as function of p, T and composition X

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
AbsolutePressurep Pressure [Pa]
TemperatureT Temperature [K]
MassFractionX[:]reference_XMass fractions [kg/kg]

Outputs

TypeNameDescription
ThermodynamicStatestate 

Modelica definition

redeclare function setState_pTX 
  "Return thermodynamic state as function of p, T and composition X"
  extends Modelica.Icons.Function;
  input AbsolutePressure p "Pressure";
  input Temperature T "Temperature";
  input MassFraction X[:]=reference_X "Mass fractions";
  output ThermodynamicState state;
algorithm 
  state := ThermodynamicState(p=p,T=T);
end setState_pTX;

Modelica.Media.IdealGases.Common.SingleGasNasa.setState_phX Modelica.Media.IdealGases.Common.SingleGasNasa.setState_phX

Return thermodynamic state as function of p, h and composition X

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
AbsolutePressurep Pressure [Pa]
SpecificEnthalpyh Specific enthalpy [J/kg]
MassFractionX[:]reference_XMass fractions [kg/kg]

Outputs

TypeNameDescription
ThermodynamicStatestate 

Modelica definition

redeclare function setState_phX 
  "Return thermodynamic state as function of p, h and composition X"
  extends Modelica.Icons.Function;
  input AbsolutePressure p "Pressure";
  input SpecificEnthalpy h "Specific enthalpy";
  input MassFraction X[:]=reference_X "Mass fractions";
  output ThermodynamicState state;
algorithm 
  state := ThermodynamicState(p=p,T=T_h(h));
end setState_phX;

Modelica.Media.IdealGases.Common.SingleGasNasa.setState_psX Modelica.Media.IdealGases.Common.SingleGasNasa.setState_psX

Return thermodynamic state as function of p, s and composition X

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
AbsolutePressurep Pressure [Pa]
SpecificEntropys Specific entropy [J/(kg.K)]
MassFractionX[:]reference_XMass fractions [kg/kg]

Outputs

TypeNameDescription
ThermodynamicStatestate 

Modelica definition

redeclare function setState_psX 
  "Return thermodynamic state as function of p, s and composition X"
  extends Modelica.Icons.Function;
  input AbsolutePressure p "Pressure";
  input SpecificEntropy s "Specific entropy";
  input MassFraction X[:]=reference_X "Mass fractions";
  output ThermodynamicState state;
algorithm 
  state := ThermodynamicState(p=p,T=T_ps(p,s));
end setState_psX;

Modelica.Media.IdealGases.Common.SingleGasNasa.setState_dTX Modelica.Media.IdealGases.Common.SingleGasNasa.setState_dTX

Return thermodynamic state as function of d, T and composition X

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
Densityd density [kg/m3]
TemperatureT Temperature [K]
MassFractionX[:]reference_XMass fractions [kg/kg]

Outputs

TypeNameDescription
ThermodynamicStatestate 

Modelica definition

redeclare function setState_dTX 
  "Return thermodynamic state as function of d, T and composition X"
  extends Modelica.Icons.Function;
  input Density d "density";
  input Temperature T "Temperature";
  input MassFraction X[:]=reference_X "Mass fractions";
  output ThermodynamicState state;
algorithm 
  state := ThermodynamicState(p=d*data.R*T,T=T);
end setState_dTX;

Modelica.Media.IdealGases.Common.SingleGasNasa.setSmoothState Modelica.Media.IdealGases.Common.SingleGasNasa.setSmoothState

Return thermodynamic state so that it smoothly approximates: if x > 0 then state_a else state_b

Information

Extends from (Return thermodynamic state so that it smoothly approximates: if x > 0 then state_a else state_b).

Inputs

TypeNameDefaultDescription
Realx m_flow or dp
ThermodynamicStatestate_a Thermodynamic state if x > 0
ThermodynamicStatestate_b Thermodynamic state if x < 0
Realx_small Smooth transition in the region -x_small < x < x_small

Outputs

TypeNameDescription
ThermodynamicStatestateSmooth thermodynamic state for all x (continuous and differentiable)

Modelica definition

redeclare function extends setSmoothState 
  "Return thermodynamic state so that it smoothly approximates: if x > 0 then state_a else state_b"
algorithm 
  state := ThermodynamicState(p=Media.Common.smoothStep(x, state_a.p, state_b.p, x_small),
                              T=Media.Common.smoothStep(x, state_a.T, state_b.T, x_small));
end setSmoothState;

Modelica.Media.IdealGases.Common.SingleGasNasa.pressure Modelica.Media.IdealGases.Common.SingleGasNasa.pressure

return pressure of ideal gas

Information

Extends from (Return pressure).

Inputs

TypeNameDefaultDescription
ThermodynamicStatestate thermodynamic state record

Outputs

TypeNameDescription
AbsolutePressurepPressure [Pa]

Modelica definition

redeclare function extends pressure "return pressure of ideal gas"
algorithm 
  p := state.p;
end pressure;

Modelica.Media.IdealGases.Common.SingleGasNasa.temperature Modelica.Media.IdealGases.Common.SingleGasNasa.temperature

return temperature of ideal gas

Information

Extends from (Return temperature).

Inputs

TypeNameDefaultDescription
ThermodynamicStatestate thermodynamic state record

Outputs

TypeNameDescription
TemperatureTTemperature [K]

Modelica definition

redeclare function extends temperature 
  "return temperature of ideal gas"
algorithm 
  T := state.T;
end temperature;

Modelica.Media.IdealGases.Common.SingleGasNasa.density Modelica.Media.IdealGases.Common.SingleGasNasa.density

return density of ideal gas

Information

Extends from (Return density).

Inputs

TypeNameDefaultDescription
ThermodynamicStatestate thermodynamic state record

Outputs

TypeNameDescription
DensitydDensity [kg/m3]

Modelica definition

redeclare function extends density "return density of ideal gas"
algorithm 
  d := state.p/(data.R*state.T);
end density;

Modelica.Media.IdealGases.Common.SingleGasNasa.specificEnthalpy Modelica.Media.IdealGases.Common.SingleGasNasa.specificEnthalpy

Return specific enthalpy

Information

Extends from Modelica.Icons.Function (Icon for functions), (Return specific enthalpy).

Inputs

TypeNameDefaultDescription
ThermodynamicStatestate thermodynamic state record

Outputs

TypeNameDescription
SpecificEnthalpyhSpecific enthalpy [J/kg]

Modelica definition

redeclare function extends specificEnthalpy 
  "Return specific enthalpy"
  extends Modelica.Icons.Function;
algorithm 
  h := h_T(data,state.T);
end specificEnthalpy;

Modelica.Media.IdealGases.Common.SingleGasNasa.specificInternalEnergy Modelica.Media.IdealGases.Common.SingleGasNasa.specificInternalEnergy

Return specific internal energy

Information

Extends from Modelica.Icons.Function (Icon for functions), (Return specific internal energy).

Inputs

TypeNameDefaultDescription
ThermodynamicStatestate thermodynamic state record

Outputs

TypeNameDescription
SpecificEnergyuSpecific internal energy [J/kg]

Modelica definition

redeclare function extends specificInternalEnergy 
  "Return specific internal energy"
  extends Modelica.Icons.Function;
algorithm 
  u := h_T(data,state.T) - data.R*state.T;
end specificInternalEnergy;

Modelica.Media.IdealGases.Common.SingleGasNasa.specificEntropy Modelica.Media.IdealGases.Common.SingleGasNasa.specificEntropy

Return specific entropy

Information

Extends from Modelica.Icons.Function (Icon for functions), (Return specific entropy).

Inputs

TypeNameDefaultDescription
ThermodynamicStatestate thermodynamic state record

Outputs

TypeNameDescription
SpecificEntropysSpecific entropy [J/(kg.K)]

Modelica definition

redeclare function extends specificEntropy "Return specific entropy"
  extends Modelica.Icons.Function;
algorithm 
  s := s0_T(data, state.T) - data.R*Modelica.Math.log(state.p/reference_p);
end specificEntropy;

Modelica.Media.IdealGases.Common.SingleGasNasa.specificGibbsEnergy Modelica.Media.IdealGases.Common.SingleGasNasa.specificGibbsEnergy

Return specific Gibbs energy

Information

Extends from Modelica.Icons.Function (Icon for functions), (Return specific Gibbs energy).

Inputs

TypeNameDefaultDescription
ThermodynamicStatestate thermodynamic state record

Outputs

TypeNameDescription
SpecificEnergygSpecific Gibbs energy [J/kg]

Modelica definition

redeclare function extends specificGibbsEnergy 
  "Return specific Gibbs energy"
  extends Modelica.Icons.Function;
algorithm 
  g := h_T(data,state.T) - state.T*specificEntropy(state);
end specificGibbsEnergy;

Modelica.Media.IdealGases.Common.SingleGasNasa.specificHelmholtzEnergy Modelica.Media.IdealGases.Common.SingleGasNasa.specificHelmholtzEnergy

Return specific Helmholtz energy

Information

Extends from Modelica.Icons.Function (Icon for functions), (Return specific Helmholtz energy).

Inputs

TypeNameDefaultDescription
ThermodynamicStatestate thermodynamic state record

Outputs

TypeNameDescription
SpecificEnergyfSpecific Helmholtz energy [J/kg]

Modelica definition

redeclare function extends specificHelmholtzEnergy 
  "Return specific Helmholtz energy"
  extends Modelica.Icons.Function;
algorithm 
  f := h_T(data,state.T) - data.R*state.T - state.T*specificEntropy(state);
end specificHelmholtzEnergy;

Modelica.Media.IdealGases.Common.SingleGasNasa.specificHeatCapacityCp Modelica.Media.IdealGases.Common.SingleGasNasa.specificHeatCapacityCp

Return specific heat capacity at constant pressure

Information

Extends from (Return specific heat capacity at constant pressure).

Inputs

TypeNameDefaultDescription
ThermodynamicStatestate thermodynamic state record

Outputs

TypeNameDescription
SpecificHeatCapacitycpSpecific heat capacity at constant pressure [J/(kg.K)]

Modelica definition

redeclare function extends specificHeatCapacityCp 
  "Return specific heat capacity at constant pressure"
algorithm 
  cp := cp_T(data, state.T);
end specificHeatCapacityCp;

Modelica.Media.IdealGases.Common.SingleGasNasa.specificHeatCapacityCv Modelica.Media.IdealGases.Common.SingleGasNasa.specificHeatCapacityCv

Compute specific heat capacity at constant volume from temperature and gas data

Information

Extends from (Return specific heat capacity at constant volume).

Inputs

TypeNameDefaultDescription
ThermodynamicStatestate thermodynamic state record

Outputs

TypeNameDescription
SpecificHeatCapacitycvSpecific heat capacity at constant volume [J/(kg.K)]

Modelica definition

redeclare function extends specificHeatCapacityCv 
  "Compute specific heat capacity at constant volume from temperature and gas data"
algorithm 
  cv := cp_T(data, state.T) - data.R;
end specificHeatCapacityCv;

Modelica.Media.IdealGases.Common.SingleGasNasa.isentropicExponent Modelica.Media.IdealGases.Common.SingleGasNasa.isentropicExponent

Return isentropic exponent

Information

Extends from (Return isentropic exponent).

Inputs

TypeNameDefaultDescription
ThermodynamicStatestate thermodynamic state record

Outputs

TypeNameDescription
IsentropicExponentgammaIsentropic exponent [1]

Modelica definition

redeclare function extends isentropicExponent 
  "Return isentropic exponent"
algorithm 
  gamma := specificHeatCapacityCp(state)/specificHeatCapacityCv(state);
end isentropicExponent;

Modelica.Media.IdealGases.Common.SingleGasNasa.velocityOfSound Modelica.Media.IdealGases.Common.SingleGasNasa.velocityOfSound

Return velocity of sound

Information

Extends from Modelica.Icons.Function (Icon for functions), (Return velocity of sound).

Inputs

TypeNameDefaultDescription
ThermodynamicStatestate thermodynamic state record

Outputs

TypeNameDescription
VelocityOfSoundaVelocity of sound [m/s]

Modelica definition

redeclare function extends velocityOfSound "Return velocity of sound"
  extends Modelica.Icons.Function;
algorithm 
  a := sqrt(max(0,data.R*state.T*cp_T(data, state.T)/specificHeatCapacityCv(state)));
end velocityOfSound;

Modelica.Media.IdealGases.Common.SingleGasNasa.isentropicEnthalpyApproximation Modelica.Media.IdealGases.Common.SingleGasNasa.isentropicEnthalpyApproximation

approximate method of calculating h_is from upstream properties and downstream pressure

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
Pressurep2 downstream pressure [Pa]
ThermodynamicStatestate properties at upstream location
BooleanexclEnthFormexcludeEnthalpyOfFormationIf true, enthalpy of formation Hf is not included in specific enthalpy h
ReferenceEnthalpyrefChoicereferenceChoiceChoice of reference enthalpy
SpecificEnthalpyh_offh_offsetUser defined offset for reference enthalpy, if referenceChoice = UserDefined [J/kg]

Outputs

TypeNameDescription
SpecificEnthalpyh_isisentropic enthalpy [J/kg]

Modelica definition

function isentropicEnthalpyApproximation 
  "approximate method of calculating h_is from upstream properties and downstream pressure"
  extends Modelica.Icons.Function;
  input SI.Pressure p2 "downstream pressure";
  input ThermodynamicState state "properties at upstream location";
  input Boolean exclEnthForm=excludeEnthalpyOfFormation 
    "If true, enthalpy of formation Hf is not included in specific enthalpy h";
  input ReferenceEnthalpy refChoice=referenceChoice 
    "Choice of reference enthalpy";
  input SpecificEnthalpy h_off=h_offset 
    "User defined offset for reference enthalpy, if referenceChoice = UserDefined";
  output SI.SpecificEnthalpy h_is "isentropic enthalpy";
protected 
  IsentropicExponent gamma =  isentropicExponent(state) "Isentropic exponent";
algorithm 
  h_is := h_T(data,state.T,exclEnthForm,refChoice,h_off) +
    gamma/(gamma - 1.0)*state.p/density(state)*((p2/state.p)^((gamma - 1)/gamma) - 1.0);
end isentropicEnthalpyApproximation;

Modelica.Media.IdealGases.Common.SingleGasNasa.isentropicEnthalpy Modelica.Media.IdealGases.Common.SingleGasNasa.isentropicEnthalpy

Return isentropic enthalpy

Information

Extends from (Return isentropic enthalpy).

Inputs

TypeNameDefaultDescription
BooleanexclEnthFormexcludeEnthalpyOfFormationIf true, enthalpy of formation Hf is not included in specific enthalpy h
ReferenceEnthalpyrefChoicereferenceChoiceChoice of reference enthalpy
SpecificEnthalpyh_offh_offsetUser defined offset for reference enthalpy, if referenceChoice = UserDefined [J/kg]
AbsolutePressurep_downstream downstream pressure [Pa]
ThermodynamicStaterefState reference state for entropy

Outputs

TypeNameDescription
SpecificEnthalpyh_isIsentropic enthalpy [J/kg]

Modelica definition

redeclare function extends isentropicEnthalpy 
  "Return isentropic enthalpy"
input Boolean exclEnthForm=excludeEnthalpyOfFormation 
    "If true, enthalpy of formation Hf is not included in specific enthalpy h";
input ReferenceEnthalpy refChoice=referenceChoice 
    "Choice of reference enthalpy";
input SpecificEnthalpy h_off=h_offset 
    "User defined offset for reference enthalpy, if referenceChoice = UserDefined";
algorithm 
  h_is := isentropicEnthalpyApproximation(p_downstream,refState,exclEnthForm,refChoice,h_off);
end isentropicEnthalpy;

Modelica.Media.IdealGases.Common.SingleGasNasa.isobaricExpansionCoefficient Modelica.Media.IdealGases.Common.SingleGasNasa.isobaricExpansionCoefficient

Returns overall the isobaric expansion coefficient beta

Information

Extends from (Return overall the isobaric expansion coefficient beta).

Inputs

TypeNameDefaultDescription
ThermodynamicStatestate thermodynamic state record

Outputs

TypeNameDescription
IsobaricExpansionCoefficientbetaIsobaric expansion coefficient [1/K]

Modelica definition

redeclare function extends isobaricExpansionCoefficient 
  "Returns overall the isobaric expansion coefficient beta"
algorithm 
  beta := 1/state.T;
end isobaricExpansionCoefficient;

Modelica.Media.IdealGases.Common.SingleGasNasa.isothermalCompressibility Modelica.Media.IdealGases.Common.SingleGasNasa.isothermalCompressibility

Returns overall the isothermal compressibility factor

Information

Extends from (Return overall the isothermal compressibility factor).

Inputs

TypeNameDefaultDescription
ThermodynamicStatestate thermodynamic state record

Outputs

TypeNameDescription
IsothermalCompressibilitykappaIsothermal compressibility [1/Pa]

Modelica definition

redeclare function extends isothermalCompressibility 
  "Returns overall the isothermal compressibility factor"
algorithm 
  kappa := 1.0/state.p;
end isothermalCompressibility;

Modelica.Media.IdealGases.Common.SingleGasNasa.density_derp_T Modelica.Media.IdealGases.Common.SingleGasNasa.density_derp_T

Returns the partial derivative of density with respect to pressure at constant temperature

Information

Extends from (Return density derivative w.r.t. pressure at const temperature).

Inputs

TypeNameDefaultDescription
ThermodynamicStatestate thermodynamic state record

Outputs

TypeNameDescription
DerDensityByPressureddpTDensity derivative w.r.t. pressure [s2/m2]

Modelica definition

redeclare function extends density_derp_T 
  "Returns the partial derivative of density with respect to pressure at constant temperature"
algorithm 
  ddpT := 1/(state.T*data.R);
end density_derp_T;

Modelica.Media.IdealGases.Common.SingleGasNasa.density_derT_p Modelica.Media.IdealGases.Common.SingleGasNasa.density_derT_p

Returns the partial derivative of density with respect to temperature at constant pressure

Information

Extends from (Return density derivative w.r.t. temperature at constant pressure).

Inputs

TypeNameDefaultDescription
ThermodynamicStatestate thermodynamic state record

Outputs

TypeNameDescription
DerDensityByTemperatureddTpDensity derivative w.r.t. temperature [kg/(m3.K)]

Modelica definition

redeclare function extends density_derT_p 
  "Returns the partial derivative of density with respect to temperature at constant pressure"
algorithm 
  ddTp := -state.p/(state.T*state.T*data.R);
end density_derT_p;

Modelica.Media.IdealGases.Common.SingleGasNasa.density_derX Modelica.Media.IdealGases.Common.SingleGasNasa.density_derX

Returns the partial derivative of density with respect to mass fractions at constant pressure and temperature

Information

Extends from (Return density derivative w.r.t. mass fraction).

Inputs

TypeNameDefaultDescription
ThermodynamicStatestate thermodynamic state record

Outputs

TypeNameDescription
DensitydddX[nX]Derivative of density w.r.t. mass fraction [kg/m3]

Modelica definition

redeclare function extends density_derX 
  "Returns the partial derivative of density with respect to mass fractions at constant pressure and temperature"
algorithm 
  dddX := fill(0,nX);
end density_derX;

Modelica.Media.IdealGases.Common.SingleGasNasa.cp_T Modelica.Media.IdealGases.Common.SingleGasNasa.cp_T

Compute specific heat capacity at constant pressure from temperature and gas data

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
DataRecorddata Ideal gas data
TemperatureT Temperature [K]

Outputs

TypeNameDescription
SpecificHeatCapacitycpSpecific heat capacity at temperature T [J/(kg.K)]

Modelica definition

function cp_T 
  "Compute specific heat capacity at constant pressure from temperature and gas data"
  extends Modelica.Icons.Function;
  input IdealGases.Common.DataRecord data "Ideal gas data";
  input SI.Temperature T "Temperature";
  output SI.SpecificHeatCapacity cp "Specific heat capacity at temperature T";
algorithm 
  cp := smooth(0,if T < data.Tlimit then data.R*(1/(T*T)*(data.alow[1] + T*(
    data.alow[2] + T*(1.*data.alow[3] + T*(data.alow[4] + T*(data.alow[5] + T
    *(data.alow[6] + data.alow[7]*T))))))) else data.R*(1/(T*T)*(data.ahigh[1]
     + T*(data.ahigh[2] + T*(1.*data.ahigh[3] + T*(data.ahigh[4] + T*(data.
    ahigh[5] + T*(data.ahigh[6] + data.ahigh[7]*T))))))));
end cp_T;

Modelica.Media.IdealGases.Common.SingleGasNasa.cp_Tlow Modelica.Media.IdealGases.Common.SingleGasNasa.cp_Tlow

Compute specific heat capacity at constant pressure, low T region

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
DataRecorddata Ideal gas data
TemperatureT Temperature [K]

Outputs

TypeNameDescription
SpecificHeatCapacitycpSpecific heat capacity at temperature T [J/(kg.K)]

Modelica definition

function cp_Tlow 
  "Compute specific heat capacity at constant pressure, low T region"
  annotation(derivative=cp_Tlow_der);
  extends Modelica.Icons.Function;
  input IdealGases.Common.DataRecord data "Ideal gas data";
  input SI.Temperature T "Temperature";
  output SI.SpecificHeatCapacity cp "Specific heat capacity at temperature T";
algorithm 
  cp := data.R*(1/(T*T)*(data.alow[1] + T*(
    data.alow[2] + T*(1.*data.alow[3] + T*(data.alow[4] + T*(data.alow[5] + T
    *(data.alow[6] + data.alow[7]*T)))))));
end cp_Tlow;

Modelica.Media.IdealGases.Common.SingleGasNasa.cp_Tlow_der Modelica.Media.IdealGases.Common.SingleGasNasa.cp_Tlow_der

Compute specific heat capacity at constant pressure, low T region

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
DataRecorddata Ideal gas data
TemperatureT Temperature [K]
RealdT Temperature derivative

Outputs

TypeNameDescription
Realcp_derDerivative of specific heat capacity

Modelica definition

function cp_Tlow_der 
  "Compute specific heat capacity at constant pressure, low T region"
  extends Modelica.Icons.Function;
  input IdealGases.Common.DataRecord data "Ideal gas data";
  input SI.Temperature T "Temperature";
  input Real dT "Temperature derivative";
  output Real cp_der "Derivative of specific heat capacity";
algorithm 
  cp_der := dT*data.R/(T*T*T)*(-2*data.alow[1] + T*(
    -data.alow[2] + T*T*(data.alow[4] + T*(2.*data.alow[5] + T
    *(3.*data.alow[6] + 4.*data.alow[7]*T)))));
end cp_Tlow_der;

Modelica.Media.IdealGases.Common.SingleGasNasa.h_T Modelica.Media.IdealGases.Common.SingleGasNasa.h_T

Compute specific enthalpy from temperature and gas data; reference is decided by the refChoice input, or by the referenceChoice package constant by default

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
DataRecorddata Ideal gas data
TemperatureT Temperature [K]
BooleanexclEnthFormexcludeEnthalpyOfFormationIf true, enthalpy of formation Hf is not included in specific enthalpy h
ReferenceEnthalpyrefChoicereferenceChoiceChoice of reference enthalpy
SpecificEnthalpyh_offh_offsetUser defined offset for reference enthalpy, if referenceChoice = UserDefined [J/kg]

Outputs

TypeNameDescription
SpecificEnthalpyhSpecific enthalpy at temperature T [J/kg]

Modelica definition

function h_T "Compute specific enthalpy from temperature and gas data; reference is decided by the
    refChoice input, or by the referenceChoice package constant by default"
    import Modelica.Media.Interfaces.PartialMedium.Choices;
  extends Modelica.Icons.Function;
  input IdealGases.Common.DataRecord data "Ideal gas data";
  input SI.Temperature T "Temperature";
  input Boolean exclEnthForm=excludeEnthalpyOfFormation 
    "If true, enthalpy of formation Hf is not included in specific enthalpy h";
  input Choices.ReferenceEnthalpy refChoice=referenceChoice 
    "Choice of reference enthalpy";
  input SI.SpecificEnthalpy h_off=h_offset 
    "User defined offset for reference enthalpy, if referenceChoice = UserDefined";
  output SI.SpecificEnthalpy h "Specific enthalpy at temperature T";
    //     annotation (InlineNoEvent=false, Inline=false,
    //                 derivative(zeroDerivative=data,
    //                            zeroDerivative=exclEnthForm,
    //                            zeroDerivative=refChoice,
    //                            zeroDerivative=h_off) = h_T_der);
algorithm 
  h := smooth(0,(if T < data.Tlimit then data.R*((-data.alow[1] + T*(data.
    blow[1] + data.alow[2]*Math.log(T) + T*(1.*data.alow[3] + T*(0.5*data.
    alow[4] + T*(1/3*data.alow[5] + T*(0.25*data.alow[6] + 0.2*data.alow[7]*T))))))
    /T) else data.R*((-data.ahigh[1] + T*(data.bhigh[1] + data.ahigh[2]*
    Math.log(T) + T*(1.*data.ahigh[3] + T*(0.5*data.ahigh[4] + T*(1/3*data.
    ahigh[5] + T*(0.25*data.ahigh[6] + 0.2*data.ahigh[7]*T))))))/T)) + (if 
    exclEnthForm then -data.Hf else 0.0) + (if (refChoice
     == Choices.ReferenceEnthalpy.ZeroAt0K) then data.H0 else 0.0) + (if 
    refChoice == Choices.ReferenceEnthalpy.UserDefined then h_off else 
          0.0));
end h_T;

Modelica.Media.IdealGases.Common.SingleGasNasa.h_T_der Modelica.Media.IdealGases.Common.SingleGasNasa.h_T_der

derivative function for h_T

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
DataRecorddata Ideal gas data
TemperatureT Temperature [K]
BooleanexclEnthFormexcludeEnthalpyOfFormationIf true, enthalpy of formation Hf is not included in specific enthalpy h
ReferenceEnthalpyrefChoicereferenceChoiceChoice of reference enthalpy
SpecificEnthalpyh_offh_offsetUser defined offset for reference enthalpy, if referenceChoice = UserDefined [J/kg]
RealdT Temperature derivative

Outputs

TypeNameDescription
Realh_derSpecific enthalpy at temperature T

Modelica definition

function h_T_der "derivative function for h_T"
    import Modelica.Media.Interfaces.PartialMedium.Choices;
  extends Modelica.Icons.Function;
  input IdealGases.Common.DataRecord data "Ideal gas data";
  input SI.Temperature T "Temperature";
  input Boolean exclEnthForm=excludeEnthalpyOfFormation 
    "If true, enthalpy of formation Hf is not included in specific enthalpy h";
  input Choices.ReferenceEnthalpy refChoice=referenceChoice 
    "Choice of reference enthalpy";
  input SI.SpecificEnthalpy h_off=h_offset 
    "User defined offset for reference enthalpy, if referenceChoice = UserDefined";
  input Real dT "Temperature derivative";
  output Real h_der "Specific enthalpy at temperature T";
algorithm 
  h_der := dT*cp_T(data,T);
end h_T_der;

Modelica.Media.IdealGases.Common.SingleGasNasa.h_Tlow Modelica.Media.IdealGases.Common.SingleGasNasa.h_Tlow

Compute specific enthalpy, low T region; reference is decided by the refChoice input, or by the referenceChoice package constant by default

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
DataRecorddata Ideal gas data
TemperatureT Temperature [K]
BooleanexclEnthFormexcludeEnthalpyOfFormationIf true, enthalpy of formation Hf is not included in specific enthalpy h
ReferenceEnthalpyrefChoicereferenceChoiceChoice of reference enthalpy
SpecificEnthalpyh_offh_offsetUser defined offset for reference enthalpy, if referenceChoice = UserDefined [J/kg]

Outputs

TypeNameDescription
SpecificEnthalpyhSpecific enthalpy at temperature T [J/kg]

Modelica definition

function h_Tlow "Compute specific enthalpy, low T region; reference is decided by the
    refChoice input, or by the referenceChoice package constant by default"
    import Modelica.Media.Interfaces.PartialMedium.Choices;
  extends Modelica.Icons.Function;
  input IdealGases.Common.DataRecord data "Ideal gas data";
  input SI.Temperature T "Temperature";
  input Boolean exclEnthForm=excludeEnthalpyOfFormation 
    "If true, enthalpy of formation Hf is not included in specific enthalpy h";
  input Choices.ReferenceEnthalpy refChoice=referenceChoice 
    "Choice of reference enthalpy";
  input SI.SpecificEnthalpy h_off=h_offset 
    "User defined offset for reference enthalpy, if referenceChoice = UserDefined";
  output SI.SpecificEnthalpy h "Specific enthalpy at temperature T";
    //     annotation (Inline=false,InlineNoEvent=false, derivative(zeroDerivative=data,
    //                                zeroDerivative=exclEnthForm,
    //                                zeroDerivative=refChoice,
    //                                zeroDerivative=h_off) = h_Tlow_der);
algorithm 
  h := data.R*((-data.alow[1] + T*(data.
    blow[1] + data.alow[2]*Math.log(T) + T*(1.*data.alow[3] + T*(0.5*data.
    alow[4] + T*(1/3*data.alow[5] + T*(0.25*data.alow[6] + 0.2*data.alow[7]*T))))))
    /T) + (if 
    exclEnthForm then -data.Hf else 0.0) + (if (refChoice
     == Choices.ReferenceEnthalpy.ZeroAt0K) then data.H0 else 0.0) + (if 
    refChoice == Choices.ReferenceEnthalpy.UserDefined then h_off else 
          0.0);
end h_Tlow;

Modelica.Media.IdealGases.Common.SingleGasNasa.h_Tlow_der Modelica.Media.IdealGases.Common.SingleGasNasa.h_Tlow_der

Compute specific enthalpy, low T region; reference is decided by the refChoice input, or by the referenceChoice package constant by default

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
DataRecorddata Ideal gas data
TemperatureT Temperature [K]
BooleanexclEnthFormexcludeEnthalpyOfFormationIf true, enthalpy of formation Hf is not included in specific enthalpy h
ReferenceEnthalpyrefChoicereferenceChoiceChoice of reference enthalpy
SpecificEnthalpyh_offh_offsetUser defined offset for reference enthalpy, if referenceChoice = UserDefined [J/kg]
RealdT Temperature derivative [K/s]

Outputs

TypeNameDescription
Realh_derDerivative of specific enthalpy at temperature T [J/(kg.s)]

Modelica definition

function h_Tlow_der "Compute specific enthalpy, low T region; reference is decided by the
    refChoice input, or by the referenceChoice package constant by default"
    import Modelica.Media.Interfaces.PartialMedium.Choices;
  extends Modelica.Icons.Function;
  input IdealGases.Common.DataRecord data "Ideal gas data";
  input SI.Temperature T "Temperature";
  input Boolean exclEnthForm=excludeEnthalpyOfFormation 
    "If true, enthalpy of formation Hf is not included in specific enthalpy h";
  input Choices.ReferenceEnthalpy refChoice=referenceChoice 
    "Choice of reference enthalpy";
  input SI.SpecificEnthalpy h_off=h_offset 
    "User defined offset for reference enthalpy, if referenceChoice = UserDefined";
  input Real dT(unit="K/s") "Temperature derivative";
  output Real h_der(unit="J/(kg.s)") 
    "Derivative of specific enthalpy at temperature T";
algorithm 
  h_der := dT*cp_Tlow(data,T);
end h_Tlow_der;

Modelica.Media.IdealGases.Common.SingleGasNasa.s0_T Modelica.Media.IdealGases.Common.SingleGasNasa.s0_T

Compute specific entropy from temperature and gas data

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
DataRecorddata Ideal gas data
TemperatureT Temperature [K]

Outputs

TypeNameDescription
SpecificEntropysSpecific entropy at temperature T [J/(kg.K)]

Modelica definition

function s0_T 
  "Compute specific entropy from temperature and gas data"
  extends Modelica.Icons.Function;
  input IdealGases.Common.DataRecord data "Ideal gas data";
  input SI.Temperature T "Temperature";
  output SI.SpecificEntropy s "Specific entropy at temperature T";
algorithm 
  s := noEvent(if T < data.Tlimit then data.R*(data.blow[2] - 0.5*data.alow[
    1]/(T*T) - data.alow[2]/T + data.alow[3]*Math.log(T) + T*(
    data.alow[4] + T*(0.5*data.alow[5] + T*(1/3*data.alow[6] + 0.25*data.alow[
    7]*T)))) else data.R*(data.bhigh[2] - 0.5*data.ahigh[1]/(T*T) - data.
    ahigh[2]/T + data.ahigh[3]*Math.log(T) + T*(data.ahigh[4]
     + T*(0.5*data.ahigh[5] + T*(1/3*data.ahigh[6] + 0.25*data.ahigh[7]*T)))));
end s0_T;

Modelica.Media.IdealGases.Common.SingleGasNasa.s0_Tlow Modelica.Media.IdealGases.Common.SingleGasNasa.s0_Tlow

Compute specific entropy, low T region

Information

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
DataRecorddata Ideal gas data
TemperatureT Temperature [K]

Outputs

TypeNameDescription
SpecificEntropysSpecific entropy at temperature T [J/(kg.K)]

Modelica definition

function s0_Tlow "Compute specific entropy, low T region"
  extends Modelica.Icons.Function;
  input IdealGases.Common.DataRecord data "Ideal gas data";
  input SI.Temperature T "Temperature";
  output SI.SpecificEntropy s "Specific entropy at temperature T";
algorithm 
  s := data.R*(data.blow[2] - 0.5*data.alow[
    1]/(T*T) - data.alow[2]/T + data.alow[3]*Math.log(T) + T*(
    data.alow[4] + T*(0.5*data.alow[5] + T*(1/3*data.alow[6] + 0.25*data.alow[
    7]*T))));
end s0_Tlow;

Modelica.Media.IdealGases.Common.SingleGasNasa.dynamicViscosityLowPressure Modelica.Media.IdealGases.Common.SingleGasNasa.dynamicViscosityLowPressure

Dynamic viscosity of low pressure gases

Information


The used formula are based on the method of Chung et al (1984, 1988) referred to in ref [1] chapter 9. The formula 9-4.10 is the one being used. The Formula is given in non-SI units, the follwong onversion constants were used to transform the formula to SI units:

References:

[1] Bruce E. Poling, John E. Prausnitz, John P. O'Connell, "The Properties of Gases and Liquids" 5th Ed. Mc Graw Hill.

Author

T. Skoglund, Lund, Sweden, 2004-08-31

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
Temp_KT Gas temperature [K]
Temp_KTc Critical temperature of gas [K]
MolarMassM Molar mass of gas [kg/mol]
MolarVolumeVc Critical molar volume of gas [m3/mol]
Realw Acentric factor of gas
DipoleMomentmu Dipole moment of gas molecule [debye]
Realk0.0Special correction for highly polar substances

Outputs

TypeNameDescription
DynamicViscosityetaDynamic viscosity of gas [Pa.s]

Modelica definition

function dynamicViscosityLowPressure 
  "Dynamic viscosity of low pressure gases"
  extends Modelica.Icons.Function;
  input SI.Temp_K T "Gas temperature";
  input SI.Temp_K Tc "Critical temperature of gas";
  input SI.MolarMass M "Molar mass of gas";
  input SI.MolarVolume Vc "Critical molar volume of gas";
  input Real w "Acentric factor of gas";
  input DipoleMoment mu "Dipole moment of gas molecule";
  input Real k =  0.0 "Special correction for highly polar substances";
  output SI.DynamicViscosity eta "Dynamic viscosity of gas";
protected 
  parameter Real Const1_SI=40.785*10^(-9.5) 
    "Constant in formula for eta converted to SI units";
  parameter Real Const2_SI=131.3/1000.0 
    "Constant in formula for mur converted to SI units";
  Real mur=Const2_SI*mu/sqrt(Vc*Tc) 
    "Dimensionless dipole moment of gas molecule";
  Real Fc=1 - 0.2756*w + 0.059035*mur^4 + k 
    "Factor to account for molecular shape and polarities of gas";
  Real Tstar "Dimensionless temperature defined by equation below";
  Real Ov "Viscosity collision integral for the gas";

algorithm 
  Tstar := 1.2593*T/Tc;
  Ov := 1.16145*Tstar^(-0.14874) + 0.52487*exp(-0.7732*Tstar) + 2.16178*exp(-2.43787
    *Tstar);
  eta := Const1_SI*Fc*sqrt(M*T)/(Vc^(2/3)*Ov);
end dynamicViscosityLowPressure;

Modelica.Media.IdealGases.Common.SingleGasNasa.dynamicViscosity Modelica.Media.IdealGases.Common.SingleGasNasa.dynamicViscosity

dynamic viscosity

Information

Extends from (Return dynamic viscosity).

Inputs

TypeNameDefaultDescription
ThermodynamicStatestate thermodynamic state record

Outputs

TypeNameDescription
DynamicViscosityetaDynamic viscosity [Pa.s]

Modelica definition

redeclare replaceable function extends dynamicViscosity 
  "dynamic viscosity"
algorithm 
  assert(fluidConstants[1].hasCriticalData,
  "Failed to compute dynamicViscosity: For the species \"" + mediumName + "\" no critical data is available.");
  assert(fluidConstants[1].hasDipoleMoment,
  "Failed to compute dynamicViscosity: For the species \"" + mediumName + "\" no critical data is available.");
  eta := dynamicViscosityLowPressure(state.T,
                     fluidConstants[1].criticalTemperature,
                     fluidConstants[1].molarMass,
                     fluidConstants[1].criticalMolarVolume,
                     fluidConstants[1].acentricFactor,
                     fluidConstants[1].dipoleMoment);
end dynamicViscosity;

Modelica.Media.IdealGases.Common.SingleGasNasa.thermalConductivityEstimate Modelica.Media.IdealGases.Common.SingleGasNasa.thermalConductivityEstimate

Thermal conductivity of polyatomic gases(Eucken and Modified Eucken correlation)

Information


This function provides two similar methods for estimating the thermal conductivity of polyatomic gases. The Eucken method (input method == 1) gives good results for low temperatures, but it tends to give an underestimated value of the thermal conductivity (lambda) at higher temperatures.
The Modified Eucken method (input method == 2) gives good results for high-temperatures, but it tends to give an overestimated value of the thermal conductivity (lambda) at low temperatures.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
SpecificHeatCapacityCp Constant pressure heat capacity [J/(kg.K)]
DynamicViscosityeta Dynamic viscosity [Pa.s]
Integermethod11: Eucken Method, 2: Modified Eucken Method

Outputs

TypeNameDescription
ThermalConductivitylambdaThermal conductivity [W/(m.k)] [W/(m.K)]

Modelica definition

function thermalConductivityEstimate 
  "Thermal conductivity of polyatomic gases(Eucken and Modified Eucken correlation)"
  extends Modelica.Icons.Function;
  input SpecificHeatCapacity Cp "Constant pressure heat capacity";
  input DynamicViscosity eta "Dynamic viscosity";
  input Integer method(min=1,max=2)=1 
    "1: Eucken Method, 2: Modified Eucken Method";
  output ThermalConductivity lambda "Thermal conductivity [W/(m.k)]";
algorithm 
  lambda := if method == 1 then eta*(Cp - data.R + (9/4)*data.R) else eta*(Cp
     - data.R)*(1.32 + 1.77/((Cp/Modelica.Constants.R) - 1.0));
end thermalConductivityEstimate;

Modelica.Media.IdealGases.Common.SingleGasNasa.thermalConductivity Modelica.Media.IdealGases.Common.SingleGasNasa.thermalConductivity

thermal conductivity of gas

Information

Extends from (Return thermal conductivity).

Inputs

TypeNameDefaultDescription
Integermethod11: Eucken Method, 2: Modified Eucken Method
ThermodynamicStatestate thermodynamic state record

Outputs

TypeNameDescription
ThermalConductivitylambdaThermal conductivity [W/(m.K)]

Modelica definition

redeclare replaceable function extends thermalConductivity 
  "thermal conductivity of gas"
  input Integer method=1 "1: Eucken Method, 2: Modified Eucken Method";
algorithm 
  assert(fluidConstants[1].hasCriticalData,
  "Failed to compute thermalConductivity: For the species \"" + mediumName + "\" no critical data is available.");
  lambda := thermalConductivityEstimate(specificHeatCapacityCp(state),
    dynamicViscosity(state), method=method);
end thermalConductivity;

Modelica.Media.IdealGases.Common.SingleGasNasa.molarMass Modelica.Media.IdealGases.Common.SingleGasNasa.molarMass

return the molar mass of the medium

Information

Extends from (Return the molar mass of the medium).

Inputs

TypeNameDefaultDescription
ThermodynamicStatestate thermodynamic state record

Outputs

TypeNameDescription
MolarMassMMMixture molar mass [kg/mol]

Modelica definition

redeclare function extends molarMass 
  "return the molar mass of the medium"
algorithm 
  MM := data.MM;
end molarMass;

Modelica.Media.IdealGases.Common.SingleGasNasa.T_h

Compute temperature from specific enthalpy

Inputs

TypeNameDefaultDescription
SpecificEnthalpyh Specific enthalpy [J/kg]

Outputs

TypeNameDescription
TemperatureTTemperature [K]

Modelica definition

function T_h "Compute temperature from specific enthalpy"
  input SpecificEnthalpy h "Specific enthalpy";
  output Temperature T "Temperature";

protected 
package Internal 
    "Solve h(data,T) for T with given h (use only indirectly via temperature_phX)"
  extends Modelica.Media.Common.OneNonLinearEquation;
  redeclare record extends f_nonlinear_Data 
      "Data to be passed to non-linear function"
    extends Modelica.Media.IdealGases.Common.DataRecord;
  end f_nonlinear_Data;

  redeclare function extends f_nonlinear
  algorithm 
      y := h_T(f_nonlinear_data,x);
  end f_nonlinear;

  // Dummy definition has to be added for current Dymola
  redeclare function extends solve
  end solve;
end Internal;

algorithm 
  T := Internal.solve(h, 200, 6000, 1.0e5, {1}, data);
end T_h;

Modelica.Media.IdealGases.Common.SingleGasNasa.T_ps

Compute temperature from pressure and specific entropy

Inputs

TypeNameDefaultDescription
AbsolutePressurep Pressure [Pa]
SpecificEntropys Specific entropy [J/(kg.K)]

Outputs

TypeNameDescription
TemperatureTTemperature [K]

Modelica definition

function T_ps 
  "Compute temperature from pressure and specific entropy"
  input AbsolutePressure p "Pressure";
  input SpecificEntropy s "Specific entropy";
  output Temperature T "Temperature";

protected 
package Internal 
    "Solve h(data,T) for T with given h (use only indirectly via temperature_phX)"
  extends Modelica.Media.Common.OneNonLinearEquation;
  redeclare record extends f_nonlinear_Data 
      "Data to be passed to non-linear function"
    extends Modelica.Media.IdealGases.Common.DataRecord;
  end f_nonlinear_Data;

  redeclare function extends f_nonlinear
  algorithm 
      y := s0_T(f_nonlinear_data,x)- data.R*Modelica.Math.log(p/reference_p);
  end f_nonlinear;

  // Dummy definition has to be added for current Dymola
  redeclare function extends solve
  end solve;
end Internal;

algorithm 
  T := Internal.solve(s, 200, 6000, p, {1}, data);
end T_ps;

Automatically generated Fri Nov 12 16:31:32 2010.