Description: "Return thermodynamic state from p, T, and X or Xi"

- Home > Modelica

## Modelica.Media.Interfaces.PartialSimpleMedium.setState_pTX

Return thermodynamic state from p, T, and X or Xi

### Information

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

### Inputs

Type | Name | Default | Description
--- | --- | --- | ---
AbsolutePressure | p |  | Pressure [Pa]
Temperature | T |  | Temperature [K]
MassFraction | X[:] | reference_X | Mass fractions [kg/kg]

### Outputs

Type | Name | Description
--- | --- | ---
ThermodynamicState | state | Thermodynamic state record

### Modelica definition

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

## Modelica.Media.Interfaces.PartialSimpleMedium.setState_phX

Return thermodynamic state from p, h, and X or Xi

### Information

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

### Inputs

Type | Name | Default | Description
--- | --- | --- | ---
AbsolutePressure | p |  | Pressure [Pa]
SpecificEnthalpy | h |  | Specific enthalpy [J/kg]
MassFraction | X[:] | reference_X | Mass fractions [kg/kg]

### Outputs

Type | Name | Description
--- | --- | ---
ThermodynamicState | state | Thermodynamic state record

### Modelica definition

redeclare function setState_phX "Return thermodynamic state from p, h, and X or Xi" extends Modelica.Icons.Function; input AbsolutePressure p "Pressure"; input SpecificEnthalpy h "Specific enthalpy"; input MassFraction X[:]=reference_X "Mass fractions"; output ThermodynamicState state "Thermodynamic state record"; algorithm state := ThermodynamicState(p=p, T=T0 + h/cp_const); end setState_phX;

## Modelica.Media.Interfaces.PartialSimpleMedium.setState_psX

Return thermodynamic state from p, s, and X or Xi

### Information

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

### Inputs

Type | Name | Default | Description
--- | --- | --- | ---
AbsolutePressure | p |  | Pressure [Pa]
SpecificEntropy | s |  | Specific entropy [J/(kg.K)]
MassFraction | X[:] | reference_X | Mass fractions [kg/kg]

### Outputs

Type | Name | Description
--- | --- | ---
ThermodynamicState | state | Thermodynamic state record

### Modelica definition

redeclare replaceable function setState_psX "Return thermodynamic state from p, s, and X or Xi" extends Modelica.Icons.Function; input AbsolutePressure p "Pressure"; input SpecificEntropy s "Specific entropy"; input MassFraction X[:]=reference_X "Mass fractions"; output ThermodynamicState state "Thermodynamic state record"; algorithm state := ThermodynamicState(p=p, T=Modelica.Math.exp(s/cp_const + Modelica.Math.log(reference_T))) "Here the incompressible limit is used, with cp as heat capacity"; end setState_psX;

## Modelica.Media.Interfaces.PartialSimpleMedium.setState_dTX

Return thermodynamic state from d, T, and X or Xi

### Information

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

### Inputs

Type | Name | Default | Description
--- | --- | --- | ---
Density | d |  | Density [kg/m3]
Temperature | T |  | Temperature [K]
MassFraction | X[:] | reference_X | Mass fractions [kg/kg]

### Outputs

Type | Name | Description
--- | --- | ---
ThermodynamicState | state | Thermodynamic state record

### Modelica definition

redeclare function setState_dTX "Return thermodynamic state from d, T, and X or Xi" extends Modelica.Icons.Function; input Density d "Density"; input Temperature T "Temperature"; input MassFraction X[:]=reference_X "Mass fractions"; output ThermodynamicState state "Thermodynamic state record"; algorithm assert(false, "Pressure can not be computed from temperature and density for an incompressible fluid!"); end setState_dTX;

## Modelica.Media.Interfaces.PartialSimpleMedium.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

Type | Name | Default | Description
--- | --- | --- | ---
Real | x |  | m_flow or dp
ThermodynamicState | state_a |  | Thermodynamic state if x > 0
ThermodynamicState | state_b |  | Thermodynamic state if x < 0
Real | x_small |  | Smooth transition in the region -x_small < x < x_small

### Outputs

Type | Name | Description
--- | --- | ---
ThermodynamicState | state | Smooth 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.Interfaces.PartialSimpleMedium.dynamicViscosity

Return dynamic viscosity

### Information

Extends from (Return dynamic viscosity).

### Inputs

Type | Name | Default | Description
--- | --- | --- | ---
ThermodynamicState | state |  | Thermodynamic state record

### Outputs

Type | Name | Description
--- | --- | ---
DynamicViscosity | eta | Dynamic viscosity [Pa.s]

### Modelica definition

redeclare function extends dynamicViscosity "Return dynamic viscosity" algorithm eta := eta_const; end dynamicViscosity;

## Modelica.Media.Interfaces.PartialSimpleMedium.thermalConductivity

Return thermal conductivity

### Information

Extends from (Return thermal conductivity).

### Inputs

Type | Name | Default | Description
--- | --- | --- | ---
ThermodynamicState | state |  | Thermodynamic state record

### Outputs

Type | Name | Description
--- | --- | ---
ThermalConductivity | lambda | Thermal conductivity [W/(m.K)]

### Modelica definition

redeclare function extends thermalConductivity "Return thermal conductivity" algorithm lambda := lambda_const; end thermalConductivity;

## Modelica.Media.Interfaces.PartialSimpleMedium.pressure

Return pressure

### Information

Extends from (Return pressure).

### Inputs

Type | Name | Default | Description
--- | --- | --- | ---
ThermodynamicState | state |  | Thermodynamic state record

### Outputs

Type | Name | Description
--- | --- | ---
AbsolutePressure | p | Pressure [Pa]

### Modelica definition

redeclare function extends pressure "Return pressure" algorithm p := state.p; end pressure;

## Modelica.Media.Interfaces.PartialSimpleMedium.temperature

Return temperature

### Information

Extends from (Return temperature).

### Inputs

Type | Name | Default | Description
--- | --- | --- | ---
ThermodynamicState | state |  | Thermodynamic state record

### Outputs

Type | Name | Description
--- | --- | ---
Temperature | T | Temperature [K]

### Modelica definition

redeclare function extends temperature "Return temperature" algorithm T := state.T; end temperature;

## Modelica.Media.Interfaces.PartialSimpleMedium.density

Return density

### Information

Extends from (Return density).

### Inputs

Type | Name | Default | Description
--- | --- | --- | ---
ThermodynamicState | state |  | Thermodynamic state record

### Outputs

Type | Name | Description
--- | --- | ---
Density | d | Density [kg/m3]

### Modelica definition

redeclare function extends density "Return density" algorithm d := d_const; end density;

## Modelica.Media.Interfaces.PartialSimpleMedium.specificEnthalpy

Return specific enthalpy

### Information

Extends from (Return specific enthalpy).

### Inputs

Type | Name | Default | Description
--- | --- | --- | ---
ThermodynamicState | state |  | Thermodynamic state record

### Outputs

Type | Name | Description
--- | --- | ---
SpecificEnthalpy | h | Specific enthalpy [J/kg]

### Modelica definition

redeclare function extends specificEnthalpy "Return specific enthalpy" algorithm h := cp_const*(state.T - T0); end specificEnthalpy;

## Modelica.Media.Interfaces.PartialSimpleMedium.specificHeatCapacityCp

Return specific heat capacity at constant pressure

### Information

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

### Inputs

Type | Name | Default | Description
--- | --- | --- | ---
ThermodynamicState | state |  | Thermodynamic state record

### Outputs

Type | Name | Description
--- | --- | ---
SpecificHeatCapacity | cp | Specific heat capacity at constant pressure [J/(kg.K)]

### Modelica definition

redeclare function extends specificHeatCapacityCp "Return specific heat capacity at constant pressure" algorithm cp := cp_const; end specificHeatCapacityCp;

## Modelica.Media.Interfaces.PartialSimpleMedium.specificHeatCapacityCv

Return specific heat capacity at constant volume

### Information

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

### Inputs

Type | Name | Default | Description
--- | --- | --- | ---
ThermodynamicState | state |  | Thermodynamic state record

### Outputs

Type | Name | Description
--- | --- | ---
SpecificHeatCapacity | cv | Specific heat capacity at constant volume [J/(kg.K)]

### Modelica definition

redeclare function extends specificHeatCapacityCv "Return specific heat capacity at constant volume" algorithm cv := cv_const; end specificHeatCapacityCv;

## Modelica.Media.Interfaces.PartialSimpleMedium.isentropicExponent

Return isentropic exponent

### Information

Extends from (Return isentropic exponent).

### Inputs

Type | Name | Default | Description
--- | --- | --- | ---
ThermodynamicState | state |  | Thermodynamic state record

### Outputs

Type | Name | Description
--- | --- | ---
IsentropicExponent | gamma | Isentropic exponent [1]

### Modelica definition

redeclare function extends isentropicExponent "Return isentropic exponent" algorithm gamma := cp_const/cv_const; end isentropicExponent;

## Modelica.Media.Interfaces.PartialSimpleMedium.velocityOfSound

Return velocity of sound

### Information

Extends from (Return velocity of sound).

### Inputs

Type | Name | Default | Description
--- | --- | --- | ---
ThermodynamicState | state |  | Thermodynamic state record

### Outputs

Type | Name | Description
--- | --- | ---
VelocityOfSound | a | Velocity of sound [m/s]

### Modelica definition

redeclare function extends velocityOfSound "Return velocity of sound" algorithm a := a_const; end velocityOfSound;

## Modelica.Media.Interfaces.PartialSimpleMedium.specificEnthalpy_pTX

Return specific enthalpy from p, T, and X or Xi

### Information

This function computes the specific enthalpy of the fluid, but neglects the (small) influence of the pressure term p/d.

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

### Inputs

Type | Name | Default | Description
--- | --- | --- | ---
AbsolutePressure | p |  | Pressure [Pa]
Temperature | T |  | Temperature [K]
MassFraction | X[nX] |  | Mass fractions [kg/kg]

### Outputs

Type | Name | Description
--- | --- | ---
SpecificEnthalpy | h | Specific enthalpy [J/kg]

### Modelica definition

redeclare function specificEnthalpy_pTX "Return specific enthalpy from p, T, and X or Xi" extends Modelica.Icons.Function; input AbsolutePressure p "Pressure"; input Temperature T "Temperature"; input MassFraction X[nX] "Mass fractions"; output SpecificEnthalpy h "Specific enthalpy"; algorithm h := cp_const*(T - T0); end specificEnthalpy_pTX;

## Modelica.Media.Interfaces.PartialSimpleMedium.temperature_phX

Return temperature from p, h, and X or Xi

### Information

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

### Inputs

Type | Name | Default | Description
--- | --- | --- | ---
AbsolutePressure | p |  | Pressure [Pa]
SpecificEnthalpy | h |  | Specific enthalpy [J/kg]
MassFraction | X[nX] |  | Mass fractions [kg/kg]

### Outputs

Type | Name | Description
--- | --- | ---
Temperature | T | Temperature [K]

### Modelica definition

redeclare function temperature_phX "Return temperature from p, h, and X or Xi" extends Modelica.Icons.Function; input AbsolutePressure p "Pressure"; input SpecificEnthalpy h "Specific enthalpy"; input MassFraction X[nX] "Mass fractions"; output Temperature T "Temperature"; algorithm T := T0 + h/cp_const; end temperature_phX;

## Modelica.Media.Interfaces.PartialSimpleMedium.density_phX

Return density from p, h, and X or Xi

### Information

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

### Inputs

Type | Name | Default | Description
--- | --- | --- | ---
AbsolutePressure | p |  | Pressure [Pa]
SpecificEnthalpy | h |  | Specific enthalpy [J/kg]
MassFraction | X[nX] |  | Mass fractions [kg/kg]

### Outputs

Type | Name | Description
--- | --- | ---
Density | d | Density [kg/m3]

### Modelica definition

redeclare function density_phX "Return density from p, h, and X or Xi" extends Modelica.Icons.Function; input AbsolutePressure p "Pressure"; input SpecificEnthalpy h "Specific enthalpy"; input MassFraction X[nX] "Mass fractions"; output Density d "Density"; algorithm d := density(setState_phX( p, h, X)); end density_phX;

## Modelica.Media.Interfaces.PartialSimpleMedium.specificInternalEnergy

Return specific internal energy

### Information

This function computes the specific internal energy of the fluid, but neglects the (small) influence of the pressure term p/d.

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

### Inputs

Type | Name | Default | Description
--- | --- | --- | ---
ThermodynamicState | state |  | Thermodynamic state record

### Outputs

Type | Name | Description
--- | --- | ---
SpecificEnergy | u | Specific internal energy [J/kg]

### Modelica definition

redeclare function extends specificInternalEnergy "Return specific internal energy" extends Modelica.Icons.Function; algorithm // u := cv_const*(state.T - T0) - reference_p/d_const; u := cv_const*(state.T - T0); end specificInternalEnergy;

## Modelica.Media.Interfaces.PartialSimpleMedium.specificEntropy

Return specific entropy

### Information

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

### Inputs

Type | Name | Default | Description
--- | --- | --- | ---
ThermodynamicState | state |  | Thermodynamic state record

### Outputs

Type | Name | Description
--- | --- | ---
SpecificEntropy | s | Specific entropy [J/(kg.K)]

### Modelica definition

redeclare function extends specificEntropy "Return specific entropy" extends Modelica.Icons.Function; algorithm s := cv_const*Modelica.Math.log(state.T/T0); end specificEntropy;

## Modelica.Media.Interfaces.PartialSimpleMedium.specificGibbsEnergy

Return specific Gibbs energy

### Information

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

### Inputs

Type | Name | Default | Description
--- | --- | --- | ---
ThermodynamicState | state |  | Thermodynamic state record

### Outputs

Type | Name | Description
--- | --- | ---
SpecificEnergy | g | Specific Gibbs energy [J/kg]

### Modelica definition

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

## Modelica.Media.Interfaces.PartialSimpleMedium.specificHelmholtzEnergy

Return specific Helmholtz energy

### Information

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

### Inputs

Type | Name | Default | Description
--- | --- | --- | ---
ThermodynamicState | state |  | Thermodynamic state record

### Outputs

Type | Name | Description
--- | --- | ---
SpecificEnergy | f | Specific Helmholtz energy [J/kg]

### Modelica definition

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

## Modelica.Media.Interfaces.PartialSimpleMedium.isentropicEnthalpy

Return isentropic enthalpy

### Information

Extends from (Return isentropic enthalpy).

### Inputs

Type | Name | Default | Description
--- | --- | --- | ---
AbsolutePressure | p_downstream |  | Downstream pressure [Pa]
ThermodynamicState | refState |  | Reference state for entropy

### Outputs

Type | Name | Description
--- | --- | ---
SpecificEnthalpy | h_is | Isentropic enthalpy [J/kg]

### Modelica definition

redeclare function extends isentropicEnthalpy "Return isentropic enthalpy" algorithm h_is := cp_const*(temperature(refState) - T0); end isentropicEnthalpy;

## Modelica.Media.Interfaces.PartialSimpleMedium.isobaricExpansionCoefficient

Returns overall the isobaric expansion coefficient beta

### Information

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

### Inputs

Type | Name | Default | Description
--- | --- | --- | ---
ThermodynamicState | state |  | Thermodynamic state record

### Outputs

Type | Name | Description
--- | --- | ---
IsobaricExpansionCoefficient | beta | Isobaric expansion coefficient [1/K]

### Modelica definition

redeclare function extends isobaricExpansionCoefficient "Returns overall the isobaric expansion coefficient beta" algorithm beta := 0.0; end isobaricExpansionCoefficient;

## Modelica.Media.Interfaces.PartialSimpleMedium.isothermalCompressibility

Returns overall the isothermal compressibility factor

### Information

Extends from (Return overall the isothermal compressibility factor).

### Inputs

Type | Name | Default | Description
--- | --- | --- | ---
ThermodynamicState | state |  | Thermodynamic state record

### Outputs

Type | Name | Description
--- | --- | ---
IsothermalCompressibility | kappa | Isothermal compressibility [1/Pa]

### Modelica definition

redeclare function extends isothermalCompressibility "Returns overall the isothermal compressibility factor" algorithm kappa := 0; end isothermalCompressibility;

## Modelica.Media.Interfaces.PartialSimpleMedium.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

Type | Name | Default | Description
--- | --- | --- | ---
ThermodynamicState | state |  | Thermodynamic state record

### Outputs

Type | Name | Description
--- | --- | ---
DerDensityByPressure | ddpT | Density 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 := 0; end density_derp_T;

## Modelica.Media.Interfaces.PartialSimpleMedium.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

Type | Name | Default | Description
--- | --- | --- | ---
ThermodynamicState | state |  | Thermodynamic state record

### Outputs

Type | Name | Description
--- | --- | ---
DerDensityByTemperature | ddTp | Density 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 := 0; end density_derT_p;

## Modelica.Media.Interfaces.PartialSimpleMedium.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

Type | Name | Default | Description
--- | --- | --- | ---
ThermodynamicState | state |  | Thermodynamic state record

### Outputs

Type | Name | Description
--- | --- | ---
Density | dddX[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.Interfaces.PartialSimpleMedium.molarMass

Return the molar mass of the medium

### Information

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

### Inputs

Type | Name | Default | Description
--- | --- | --- | ---
ThermodynamicState | state |  | Thermodynamic state record

### Outputs

Type | Name | Description
--- | --- | ---
MolarMass | MM | Mixture molar mass [kg/mol]

### Modelica definition

redeclare function extends molarMass "Return the molar mass of the medium" algorithm MM := MM_const; end molarMass;