lib.refProp module

Library to multiparameter equation of state calculation using refprop and the python binding from https://github.com/BenThelen/python-refprop. This library implement an old unnofficial library wrapper compatible only with Refprop v.9, refprop dll must be installed from NIST package.

If available, this is a optional speed up method for mEoS internal library

All the functionality is included in the main class:

  • RefProp: Stream definition using refProp external library

API reference

class lib.refProp.RefProp(**kwargs)[source]

Bases: ThermoRefProp

Stream class using refProp external library Parameters needed to define it are:

-ref: reference state -ids: index of fluid -fraccionMolar: molar fraction

-T: Temperature, Kelvin -P: Pressure, Pa -rho: Density, kg/m3 -H: Enthalpy, J/kg -S: Entropy, J/kgK -U: Internal energy, J/kg -x: Quality, -

setref parameters setref(hrf=’DEF’, ixflag=1, x0=[1], h0=0, s0=0, t0=273, p0=100):

hrf–reference state for thermodynamic calculations [character*3]

‘NBP’: h,s = 0 at normal boiling point(s) ‘ASH’: h,s = 0 for sat liquid at -40 C (ASHRAE convention) ‘IIR’: h = 200, s = 1.0 for sat liq at 0 C (IIR convention) ‘DEF’: default reference state as specified in fluid file is

applied to each component (ixflag = 1 is used)

‘OTH’: other, as specified by h0, s0, t0, p0 (real gas state) ‘OT0’: other, as specified by h0, s0, t0, p0 (ideal gas state) ‘???’: change hrf to the current reference state and exit.

ixflag–composition flag:

1 = ref state applied to pure components 2 = ref state applied to mixture icomp

following input has meaning only if ixflag = 2
x0–composition for which h0, s0 apply; list(1:nc) [mol frac]

this is useful for mixtures of a predefined composition, e.g. refrigerant blends such as R410A

following inputs have meaning only if hrf = ‘OTH’

h0–reference state enthalpy at t0,p0 {icomp} [J/mol] s0–reference state entropy at t0,p0 {icomp} [J/mol-K] t0–reference state temperature [K]

t0 = -1 indicates saturated liquid at normal boiling point

(bubble point for a mixture)

p0–reference state pressure [kPa]

p0 = -1 indicates saturated liquid at t0 {and icomp} p0 = -2 indicates saturated vapor at t0 {and icomp}

setmod parameters: setmod(htype=’NBS’, hmix=’NBS’, *hcomp): inputs ‘in string format’:

htype - flag indicating which models are to be set [character*3]:

‘EOS’: equation of state for thermodynamic properties ‘ETA’: viscosity ‘TCX’: thermal conductivity ‘STN’: surface tension ‘NBS’: reset all of the above model types and all subsidiary

component models to ‘NBS’; values of hmix and hcomp are ignored

hmix–mixture model to use for the property specified in htype

[character*3]: ignored if number of components = 1 some allowable choices for hmix:

‘NBS’: use NIST recommendation for specified fluid/mixture ‘HMX’: mixture Helmholtz model for thermodynamic properties ‘ECS’: extended corresponding states for viscosity or th cond ‘STX’: surface tension mixture model

hcomp–component model(s) to use for property specified in htype
[array (1..nc) of character*3]:

‘NBS’: NIST recommendation for specified fluid/mixture

some allowable choices for an equation of state:

‘FEQ’: Helmholtz free energy model ‘BWR’: pure fluid modified Benedict-Webb-Rubin (MBWR) ‘ECS’: pure fluid thermo extended corresponding states

some allowable choices for viscosity:

‘ECS’: extended corresponding states (all fluids) ‘VS1’: the ‘composite’ model for R134a, R152a, NH3, etc. ‘VS2’: Younglove-Ely model for hydrocarbons ‘VS4’: Generalized friction theory of Quinones-Cisneros and

Deiters

‘VS5’: Chung et al. (1988) predictive model

some allowable choices for thermal conductivity:

‘ECS’: extended corresponding states (all fluids) ‘TC1’: the ‘composite’ model for R134a, R152a, etc. ‘TC2’: Younglove-Ely model for hydrocarbons ‘TC5’: Chung et al. (1988) predictive model

some allowable choices for surface tension:

‘ST1’: surface tension as f(tau); tau = 1 - T/Tc

setktv parameters setktv(icomp, jcomp, hmodij, fij=([0] * _nmxpar), hfmix=’HMX.BNC’):

icomp–component jcomp–component j hmodij–mixing rule for the binary pair i,j [character*3] e.g.:

‘LJ1’ (Lemmon-Jacobsen model) ‘LM1’ (modified Lemmon-Jacobsen model) or ‘LIN’ (linear mixing rules) ‘RST’ indicates reset all pairs to values from original call to

SETUP (i.e. those read from file) [all other inputs are ignored]

fij–binary mixture parameters [array of dimension nmxpar; currently

nmxpar is set to 6] the parameters will vary depending on hmodij; for example, for the Lemmon-Jacobsen model

(LJ1):

fij(1) = zeta fij(2) = xi fij(3) = Fpq fij(4) = beta fij(5) = gamma fij(6) = ‘not used’

hfmix–file name [character*255] containing generalized parameters

for the binary mixture model; this will usually be the same as the corresponding input to SETUP (e.g.,’:fluids:HMX.BNC’)

Attributes:
calculable

Check in the class is fully defined.

Methods

calculo()

Calculate procedure

cleanOldKwargs()

Convert alternative input parameters

cleanOldValues(**kwargs)

Convert alternative input parameters

args

fill

kwargs = {'D': 0.0, 'E': 0.0, 'H': 0.0, 'P': 0.0, 'Q': None, 'S': 0.0, 'T': 0.0, 'aga': False, 'caudalUnitarioMasico': [], 'caudalUnitarioMolar': [], 'fraccionMasica': [], 'fraccionMolar': [], 'gerg': False, 'h0': 0, 'hcomp': '', 'hmix': 'NBS', 'hrf': 'DEF', 'htype': 'NBS', 'ids': [], 'ixflag': 1, 'p0': 100000.0, 'preos': False, 'rho': 0.0, 's0': 0, 't0': 273, 'u': 0.0, 'x': None, 'x0': [1]}
property calculable

Check in the class is fully defined. The correct definition require two parts: * Thermodynamics definition: whatever pair properties between T, P,

h, s, v, rho, x

  • Compound definition: Ids for compound identification, and in

    multicomponent defintion any kind of mixture definition

args()[source]
_name()[source]
_x()[source]
_fixed()[source]

Calculate fixed properties with the chemical compound ids specified, valid only for one component

cleanOldValues(**kwargs)[source]

Convert alternative input parameters

cleanOldKwargs()[source]

Convert alternative input parameters

calculo()[source]

Calculate procedure

_initialization()[source]
_calculo()[source]
_cp0(flash)[source]

Set ideal properties to state

fill(fase, T, rho, x)[source]
_Melting_Pressure(T, x)[source]

Calculate the melting pressure.

Parameters:
Tfloat

Temperature, [K]

xlist

Molar fraction composition, [-]

Returns:
Pfloat

Melting pressure, [Pa]

_Sublimation_Pressure(T, x)[source]

Calculate the sublimation pressure.

Parameters:
Tfloat

Temperature, [K]

xlist

Molar fraction composition, [-]

Returns:
Pfloat

Sublimation pressure, [Pa]

References