AixLib.Media.Refrigerants.Interfaces.PartialHybridTwoPhaseMediumFormula

# .AixLib.Media.Refrigerants.Interfaces.PartialHybridTwoPhaseMediumFormula

Base class for two phase medium using a hybrid approach without records

## Information

This package provides the implementation of a refrigerant modelling approach using a hybrid approach. The hybrid approach is developed by Sangi et al. and consists of both the Helmholtz equation of state and fitted formula for thermodynamic state properties at bubble or dew line (e.g. psat or hl,sat) and thermodynamic state properties depending on two independent state properties (e.g. T_ph or T_ps). In the following, the basic formulas of the hybrid approach are given.

The Helmholtz equation of state

The Helmholtz equation of state (EoS) allows the accurate description of fluids' thermodynamic behaviour and uses the Helmholtz energy as fundamental thermodynamic relation with temperature and density as independent variables. Furthermore, the EoS allows determining all thermodynamic state properties from its partial derivatives and its general formula is given below:

As it can be seen, the general formula of the EoS can be divided in two part: The ideal gas part (left summand) and the residual part (right summand). Both parts' formulas are given below:

Both, the ideal gas part and the residual part can be divided in three subparts (i.e. the summations) that contain different coefficients (e.g. nL, li, pi or ei). These coefficients are fitting coefficients and must be obtained during a fitting procedure. While the fitting procedure, the general formula of the EoS is fitted to external data (e.g. obtained from measurements or external media libraries) and the fitting coefficients are determined. Finally, the formulas obtained during the fitting procedure are implemented in an explicit form.

For further information of the EoS and its partial derivatives, please read the paper " HelmholtzMedia - A fluid properties library" by Thorade and Saadat as well as the paper " Partial derivatives of thermodynamic state properties for dynamic simulation" by Thorade and Saadat.

Fitted formulas

Fitted formulas allow to reduce the overall computing time of the refrigerant model. Therefore, both thermodynamic state properties at bubble and dew line and thermodynamic state properties depending on two independent state properties are expresses as fitted formulas. The fitted formulas' approaches implemented in this package are developed by Sangi et al. within their "Fast_Propane" model and given below:

"Formulas for calculating saturation properties" cellspacing="0" cellpadding="2" border="1" width="80%" style= "border-collapse:collapse;">

Saturation pressure |
Saturation temperature |
Bubble density |
Dew density |
Bubble Enthalpy |
Dew Enthalpy |
Bubble Entropy |
Dew Entropy |

"Formulas for calculating thermodynamic properties at superheated and supercooled regime" cellspacing="0" cellpadding="3" border="1" width="80%" style= "border-collapse:collapse;">

Temperature_ph | First Input |
Second Input |
Temperature_ps | First Input |
Second Input |
Density_pT | First Input |
Second Input |
Functional approach |

As it can be seen, the fitted formulas consist basically of the coefficients ei, ci as well as of the parameters Meani and Stdi. These coefficients are the fitting coefficients and must be obtained during a fitting procedure. While the fitting procedure, the formulas presented above are fitted to external data (e.g. obtained from measurements or external media libraries) and the fitting coefficients are determined. Finally, the formulas obtained during the fitting procedure are implemented in an explicit form.

For further information of the hybrid approach, please read the paper "A Medium Model for the Refrigerant Propane for Fast and Accurate Dynamic Simulations" by Sangi et al..

Smooth transition

To ensure a smooth transition between different regions (e.g. from supercooled region to two-phase region) and, therefore, to avoid discontinuities as far as possible, Sangi et al. implemented functions for a smooth transition between the regions. An example (i.e. specificEnthalpy_ps) of these functions is given below:

"Calculation procedures to avoid numerical instability at phase change" cellspacing="0" cellpadding="2" border="1" width="80%" style= "border-collapse:collapse;">

From supercooled region to bubble line and vice versa |
From dew line to superheated region and vice versa |
From bubble or dew line to two-phase region and vice versa |

#### Assumptions and limitations

Two limitations are known for this package:

1. The modelling approach implemented in this package is a hybrid approach and, therefore, is based on the Helmholtz equation of state as well as on fitted formula. Hence, the refrigerant model is just valid within the valid range of the fitted formula.
2. It may be possible to have discontinuities when moving from one region to another (e.g. from supercooled region to two-phase region). However, functions are implemented to reach a smooth transition between the regions and to avoid these discontinuities as far as possible. (Sangi et al., 2014)

#### Typical use and important parameters

The refrigerant models provided in this package are typically used for heat pumps and refrigerating machines. However, it is just a partial package and, hence, it must be completed before usage. In order to allow an easy completion of the package, a template is provided in AixLib.Media.Refrigerants.Interfaces.TemplateHybridTwoPhaseMediumFormula.

#### References

Thorade, Matthis; Saadat, Ali (2012): HelmholtzMedia - A fluid properties library. In: Proceedings of the 9th International Modelica Conference; September 3-5; 2012; Munich; Germany. Linköping University Electronic Press, S. 63–70.

Thorade, Matthis; Saadat, Ali (2013): Partial derivatives of thermodynamic state properties for dynamic simulation. In: Environmental earth sciences 70 (8), S. 3497–3503.

Sangi, Roozbeh; Jahangiri, Pooyan; Klasing, Freerk; Streblow, Rita; Müller, Dirk (2014): A Medium Model for the Refrigerant Propane for Fast and Accurate Dynamic Simulations. In: The 10th International Modelica Conference. Lund, Sweden, March 10-12, 2014: Linköping University Electronic Press (Linköping Electronic Conference Proceedings), S. 1271–1275

Klasing,Freerk: A New Design for Direct Exchange Geothermal Heat Pumps - Modeling, Simulation and Exergy Analysis. Master thesis

## Contents

Name | Description
--- | ---
BaseProperties | Base properties of refrigerant
ThermodynamicState | Thermodynamic state
SmoothTransition | Record that contains ranges to calculate a smooth transition between different regions
f_Idg | Dimensionless Helmholtz energy (Ideal gas contribution alpha_0)
f_Res | Dimensionless Helmholtz energy (Residual part alpha_r)
t_fIdg_t | Short form for tau*(dalpha_0/dtau)_delta=const
tt_fIdg_tt | Short form for tau*tau*(ddalpha_0/(dtau*dtau))_delta=const
t_fRes_t | Short form for tau*(dalpha_r/dtau)_delta=const
tt_fRes_tt | Short form for tau*tau*(ddalpha_r/(dtau*dtau))_delta=const
d_fRes_d | Short form for delta*(dalpha_r/(ddelta))_tau=const
dd_fRes_dd | Short form for delta*delta(ddalpha_r/(ddelta*delta))_tau=const
td_fRes_td | Short form for tau*delta*(ddalpha_r/(dtau*ddelta))
ttt_fIdg_ttt | Short form for tau*tau*tau*(dddalpha_0/(dtau*dtau*dtau))_delta=const
ttt_fRes_ttt | Short form for tau*tau*tau*(dddalpha_r/(dtau*dtau*dtau))_delta=const
ddd_fRes_ddd | Short form for delta*delta*delta* (dddalpha_r/(ddelta*ddelta*ddelta))_tau=const
tdd_fRes_tdd | Short form for tau*delta*delta*(dddalpha_r/(dtau*ddelta*ddelta))
ttd_fRes_ttd | Short form for tau*tau*delta*(dddalpha_r/(dtau*dtau*ddelta))
setSmoothState | Return thermodynamic state so that it smoothly approximates: if x > 0 then state_a else state_b
setDewState | Return thermodynamic state of refrigerant on the dew line
setBubbleState | Return thermodynamic state of refrigerant on the bubble line
setState_dTX | Return thermodynamic state of refrigerant as function of d and T
setState_pTX | Return thermodynamic state of refrigerant as function of p and T
setState_phX | Return thermodynamic state of refrigerant as function of p and h
setState_psX | Return thermodynamic state of refrigerant as function of p and s
pressure | Pressure of refrigerant
temperature | Temperature of refrigerant
density | Density of refrigerant
specificEnthalpy | Specific enthalpy of refrigerant
specificInternalEnergy | Specific internal energy of refrigerant
specificGibbsEnergy | Specific Gibbs energy of refrigerant
specificHelmholtzEnergy | Specific Helmholtz energy of refrigerant
specificEntropy | Specific entropy of refrigerant
specificHeatCapacityCp | Specific heat capacity at constant pressure of refrigerant
specificHeatCapacityCv | Specific heat capacity at constant volume of refrigerant
velocityOfSound | Velocity of sound of refrigerant
isobaricExpansionCoefficient | Isobaric expansion coefficient beta of refrigerant
isentropicExponent | Isentropic exponent defined as -v/p*(dp/dv)_s=const
isentropicEnthalpy | Isentropic enthalpy calculated by downstream pressure and reference state
isothermalCompressibility | Isothermal compressibility factor of refrigerant
isothermalThrottlingCoefficient | Isothermal throttling coefficient of refrigerant
jouleThomsonCoefficient | Joule-Thomson coefficient of refrigerant
pressure_dT | Computes pressure as a function of density and temperature
density_ph | Computes density as a function of pressure and enthalpy
density_ps | Computes density as a function of pressure and entropy
specificEnthalpy_pT | Computes specific enthalpy as a function of pressure and temperature
specificEnthalpy_dT | Computes specific enthalpy as a function of density and temperature
specificEnthalpy_ps | Computes specific enthalpy as a function of pressure and entropy
pressure_derd_T | Calculates pressure derivative (dp/dd)_T=const
pressure_derT_d | Calculates pressure derivative (dp/dT)_d=const
specificEnthalpy_derT_d | Calculates enthalpy derivative (dh/dT)_d=const
specificEnthalpy_derd_T | Calculates enthalpy derivative (dh/dd)_T=const
specificEntropy_derd_T | Calculates derivative (ds/dd)_T=const.
specificEntropy_derT_d | Calculates derivative (ds/dT)_d=const.
specificInternalEnergy_derT_d | Calculated derivative (du/dT)_d=const.
specificInternalEnergy_derd_T | Calculated derivative (du/dd)_T=const.
density_derp_T | Calculates the derivative (dd/dp)_T=const.
density_derT_p | Calculates the derivative (dd/dT)_p=const.
temperature_derp_h | Calculates temperature derivative (dT/dp)_h=const.
temperature_derp_s | Calculates temperature derivative (dT/dp)_s=const.
temperature_ders_p | Calculates temperature derivative (dT/ds)@p=const.
temperature_derh_p | Calculates temperature derivative (dT/dh)_p=const.
density_derp_h | Calculates density derivative (dd/dp)_h=const.
density_derh_p | Calculates density derivative (dd/dh)_p=const.
density_derp_s | Calculates density derivative (dd/dp)_s=const.
density_ders_p | Calculates density derivative (dd/ds)_p=const.
specificEnthalpy_derp_T | Calculates derivative (dh/dp)_T=const.
specificEnthalpy_derT_p | Calculates derivative (dh/dT)_p=const.
specificEnthalpy_ders_p | Calculates derivative (dh/ds)_p=const.
specificEnthalpy_derp_s | Calculates derivative (dh/dp)_s=const.
saturationPressure_derT | Calculates derivative (dp/dT)_saturation
saturationTemperature_derp | Calculates derivative (dT/dp)_saturation
dBubbleDensity_dPressure | Calculates bubble point density derivative
dDewDensity_dPressure | Calculates dew point density derivative
dBubbleEnthalpy_dPressure | Calculates bubble point enthalpy derivative
dDewEnthalpy_dPressure | Calculates dew point enthalpy derivative
dBubbleEntropy_dPressure | Calculates bubble point entropy derivative
dDewEntropy_dPressure | Calculates dew point entropy derivative
dBubbleDensity_dTemperature | Calculates bubble point density derivative
dDewDensity_dTemperature | Calculates dew point debsity derivative
dBubbleEnthalpy_dTemperature | Calculates bubble point enthalpy derivative
dDewEnthalpy_dTemperature | Calculates dew point enthalpy derivative
dBubbleInternalEnergy_dTemperature | Calculates bubble point internal energy derivative
dDewInternalEnergy_dTemperature | Calculates dew point internal energy derivative
f_Idg_der | Calculates time derivative of f_Idg
f_Res_der | Calculates time derivative of f_Res
t_fIdg_t_der | Calculates time derivative of t_fIdg_t
tt_fIdg_tt_der | Calculates time derivative of tt_fIdg_tt
t_fRes_t_der | Calculates time derivative of t_fRes_t
tt_fRes_tt_der | Calculates time derivative of tt_fRes_tt
d_fRes_d_der | Calculates time derivative of d_fRes_d
dd_fRes_dd_der | Calculates time derivative of dd_fRes_dd
td_fRes_td_der | Calculates time derivative of td_fRes_td
setState_dTX_der | Calculates time derivative of the thermodynamic state record calculated by d and T
setState_pTX_der | Calculates time derivative of the thermodynamic state record calculated by p and T
setState_phX_der | Calculates time derivative of the thermodynamic state record calculated by p and h
setState_psX_der | Calculates time derivative of the thermodynamic state record calculated by p and s
pressure_der | Calculates time derivative of pressure calculated by thermodynamic state record
temperature_der | Calculates time derivative of temperature calculated by thermodynamic state record
density_der | Calculates time derivative of density calculated by thermodynamic state record
specificEnthalpy_der | Calculates time derivative of specific enthalpy calculated by thermodynamic state record
pressure_dT_der | Calculates time derivative of pressure_dT
temperature_ph_der | Calculates time derivative of temperature_ph
temperature_ps_der | Calculates time derivative of temperature_ps
density_ph_der | Calculates time derivative of density_ph
density_pT_der | Calculates time derivative of density_pT
density_ps_der | Calculates time derivative of density_ps
specificEnthalpy_pT_der | Calculates time derivative of specificEnthalpy_pT
specificEnthalpy_dT_der | Calculates time derivative of specificEnthalpy_dT
specificEnthalpy_ps_der | Calculates time derivative of specificEnthalpy_ps

## Revisions

- June 6, 2017, by Mirko Engelpracht, Christian Vering:
  First implementation (see issue 408).

Generated at 2026-05-12T20:19:03Z by OpenModelicaOpenModelica 1.26.7 using GenerateDoc.mos