NIST RefProp Legacy API Functions

The NIST RefProp Add-in Custom Functions make calls to th NIST RefProp fluid properties DLL. All RefProp functions are prefixed with rp_ followed by the function name. Please note that a fluid string must be passed as the first parameter to any fluid property functions. A description of the functions follows below.

Fluid Setup

"fluid_string" - All property functions are called with a fluid string as the first parameter.

The fluids file must be loaded from the NIST RefProp installation directory. Typically,

C:\Program Files (x86)\RefProp

or from another path identified by the user's environment variable, NIST_PATH.

NOTE: Each fluid property function makes a call internally to the RefProp SETUP routine which loads the fluid file from the database location. However, if the requested fluid is already loaded, no action is taken; dramatically cutting down on overhead.

Details:



Ad-Hoc Mixtures Setup

RefProp provides facility for embedding multiple mixture components right in the fluid string passed to the interface functions. The Mathcad Add-In interface, takes this a step further and allows not only the component names, but also the mole fractions of each component to be embedded in the fluid string. The format for mixture fluids is as follows. Within the fluid string,

For example, a binary representation for Air could be input with the following fluid string:

"Oxygen[0.21]&Nitrogen[0.79]"

A more accurate representation for Air could be input with the following quaternary mixture string:

"Oxygen[0.20948]&Nitrogen[0.78084]&Argon[0.00934]&CO2[0.00034]"

Information Functions

rp_extrap(flag) sets a flag that allows extrapolation to 1.5 x Tmax and returns a verification string.

Argument:

rp_getname(flstr,icomp) returns the full name of the fluid or mixture previously loaded by rp_function calls.

Argument:

rp_getname(flstr,icomp) returns the CAS number of the fluid previously loaded by rp_function calls.

Argument:

rp_getvers(idum) returns the version of the RefProp Mathcad Add-in.

Argument:

rp_getNIST(idum) returns the full version of the NIST REFPROP library as a string.

Argument:

rp_getRPnum(idum) returns the version of the loaded NIST REFPROP library as a numeric value for easy comparison calculations.

Argument:

rp_getpath(idum) returns the path to the NIST REFPROP DLL in use. This will be either the path to REFPROP.DLL (32-bit, used by Mathcad 15) or REFPRP64.DLL (64-bit, used by Mathcad Prime).

Argument:

rp_getx(fluid) returns the composition of a loaded mixture in a vector of mole fractions, one for each component in the mixture.

Argument:

rp_setx(mfrac) sets a new composition for the currently loaded mixture without changing the loaded mixture component fluids. Returns a text message indicating that the new composition has been set. SATSPLN will be called automatically for the new mixture composition.

If a changing the component fluids, do not call this function. Simply call another low-level function with the new mixture file or ad-hoc mixture string.

Argument:

Fluid Constant Functions

rp_wmol(flstr,icomp) returns the current fluid molecular weight [gm/mol] or [kg/kmol].

Argument:

rp_ttrip(flstr,icomp) returns the current fluid triple point temperature [K].

Argument:

rp_ptrip(flstr,icomp) returns the current fluid triple point pressure [MPa].

Argument:

rp_rhotrip(flstr,icomp) returns the current fluid triple point density [kg/m³].

Argument:

rp_tcrit(flstr,icomp) returns the current fluid critical point temperature [K].

Argument:

rp_pcrit(flstr,icomp) returns the current fluid critical point pressure [MPa].

Argument:

rp_rhocrit(flstr,icomp) returns the current fluid critical point density [kg/m³].

Argument:

rp_zcrit(flstr,icomp) returns the current fluid critical point compressibility [dimensionless].

Argument:

rp_rgas(flstr,icomp) Returns the ideal gas constant used by the loaded fluid [J/(mol*K)] or [kJ/(kmol*K)].
This function is provided because there may be slight differences in the ideal gas constant in the definition of each fluid. The "mixture" constant is calculated as the mole weighted average of each component model's value.

Argument:

rp_maxX(flstr,X) Returns an array containing the temperature [K], pressure [MPa], and density [kg/m³] at the point of maximum saturation pressure (Cricondenbar) or maximum saturation temperature (Cricondentherm), depending on the character passed in X.

Argument:

Saturation Curve Functions

rp_tsatp(flstr,p) returns the saturation temperature [K] of the pure fluid, as a function of the saturation pressure, p.

Argument:

rp_tsatpf(flstr,p) returns the liquid saturation temperature [K] of the mixture, as a function of the saturation pressure, p.

Argument:

rp_tsatpg(flstr,p) returns the vapor saturation temperature [K] of the fluid or mixture, as a function of the saturation pressure, p.

Argument:

rp_psatt(flstr,t) returns the saturation pressure [MPa] of the fluid or mixture, as a function of the saturation temperature, t.

Argument:

rp_psattf(flstr,p) returns the liquid saturation temperature [K] of the mixture, as a function of the saturation pressure, p.

Argument:

rp_psattg(flstr,p) returns the vapor saturation temperature [K] of the fluid or mixture, as a function of the saturation pressure, p.

Argument:

Fluid Property Functions

The fluid property functions all follow a standard naming convention.

All functions begin with rp_ followed by the property symbol (rho, h, u, s, Cp, Cv, w, k, mu).

The property symbol is followed by

The phase character is then followed by the required parameter symbol(s) (ie. t, p, tp, ph, ps).

The table below lists a summary of all the thermodynamic and transport property functions with the units of the returned quantity and the required input variables.
Please note that each function requires a fluid string (see above) as the first parameter, in addition to the parameters listed in the table.

Table 4 : Property Function Summary

Phase Saturated Liquid Saturated Vapor Sub-cooled Liquid
or
Superheated Vapor
Input Parameter(s): T [K] P [MPa] T [K] P [MPa] T [K], P [MPa]
Density, rho
[kg/m³]
rp_rhoft rp_rhofp rp_rhogt rp_rhogp tp_rhotp
Enthalpy, h
[kJ/kg]
rp_hft rp_hfp rp_hgt rp_hgp tp_htp
Internal Energy, u
[kJ/kg]
rp_uft rp_ufp rp_ugt rp_ugp tp_utp
Entropy, s
[kJ/(kg-K)]
rp_sft rp_sfp rp_sgt rp_sgp tp_stp
Specific Heat, Cp (isobaric)
[kJ/(kg-K)]
rp_cpft rp_cpfp rp_cpgt rp_cpgp tp_cptp
Specific Heat, Cv (isochoric)
[kJ/(kg-K)]
rp_cvft rp_cvfp rp_cvgt rp_cvgp tp_cvtp
Sonic Velocity, w
[m/s]
rp_wft rp_wfp rp_wgt rp_wgp tp_wtp
Thermal Conductivity, k
[W/m-K]
rp_kft rp_kfp rp_kgt rp_kgp tp_ktp
Viscosity, µ
[µPa-s]
rp_muft rp_mufp rp_mugt rp_mugp tp_mutp
Prandtl Number, Pr
[-]
rp_prft rp_prfp rp_prgt rp_prgp tp_prtp
Compressibility, Z
[-]
rp_zft rp_zfp rp_zgt rp_zgp tp_ztp
Thermal Expansion Coef., Beta
[1/K]
rp_betaft rp_betafp rp_betagt rp_betagp tp_betatp
Cp/Cv Ratio, Gamma
[-]
rp_gammaft rp_gammafp rp_gammagt rp_gammagp tp_gammatp
surface tension, s
[kg/s²]
rp_surften n/a* rp_surften n/a* n/a*

*Surface Tension is only a function of temperature, and only valid at the liquid/vapor interface along the saturation curve (ie. Ttrip < T < Tcrit)

Reverse Functions

Standard engineering calculations sometimes require the reverse calculation of temperature or pressure in terms of other thermodynamic properties. Only the two most common functions are implemented here. These functions perform an iterative search for the temperature and may be slower than the other thermodynamic functions.

rp_tph(flstr,p,h) returns the temperature [K] of the fluid or mixture, as a function of the pressure and enthalpy. The state point specified may be in any single phase vapor or liquid region, or in the two phase vapor/liquid region.

Arguments:

rp_tps(flstr,p,s) returns the temperature [K] of the fluid or mixture, as a function of the pressure and entropy. The state point specified may be in any single phase vapor or liquid region, or in the two phase vapor/liquid region.

Arguments:

rp_ths(flstr,p,s) Returns the fluid temperature [K] in any phase, as a function of the enthalpy and entropy. The state point specified may be in any single phase vapor or liquid region, or in the two phase vapor/liquid region.

Arguments:

rp_phs(flstr,h,s) Returns the fluid pressure [MPa] in any phase, as a function of the enthalpy and entropy. The state point specified may be in any single phase vapor or liquid region, or in the two phase vapor/liquid region.

Arguments:

rp_pth(flstr,t,h,r) Returns the fluid pressure [MPa] in any phase, as a function of the temperatures and enthalpy. The state point specified may be in any single phase vapor or liquid region, or in the two phase vapor/liquid region.

Arguments:

rp_pts(flstr,t,s,r) Returns the fluid pressure [MPa] in any phase, as a function of the temperatures and entropy. The state point specified may be in any single phase vapor or liquid region, or in the two phase vapor/liquid region.

Arguments:

rp_rhoth(flstr,t,h,r) Returns the fluid density [kg/m³] in any phase, as a function of the temperature and enthalpy. The state point specified may be in any single phase vapor or liquid region, or in the two phase vapor/liquid region.

Arguments:

rp_rhots(flstr,t,s,r) Returns the fluid density [kg/m³] in any phase, as a function of the temperature and entropy. The state point specified may be in any single phase vapor or liquid region, or in the two phase vapor/liquid region.

Arguments:

rp_rhoph(flstr,p,h) Returns the fluid density [kg/m³] in any phase, as a function of the pressure and enthalpy. The state point specified may be in any single phase vapor or liquid region, or in the two phase vapor/liquid region.

Arguments:

rp_rhops(flstr,p,s) Returns the fluid density [kg/m³] in any phase, as a function of the pressure and entropy. The state point specified may be in any single phase vapor or liquid region, or in the two phase vapor/liquid region.

Arguments:

rp_sph(flstr,p,h) Returns the fluid entropy [kJ/(kg-K)] in any phase, as a function of the pressure and enthalpy. The state point specified may be in any single phase vapor or liquid region, or in the two phase vapor/liquid region.

Arguments:

rp_hps(flstr,p,s) Returns the fluid enthalpy [kJ/(kg-K)] in any phase, as a function of the pressure and entropy. The state point specified may be in any single phase vapor or liquid region, or in the two phase vapor/liquid region.

Arguments:

rp_sth(flstr,t,h,r) Returns the fluid entropy [kJ/(kg-K)] in any phase, as a function of the temperature and enthalpy. The state point specified may be in any single phase vapor or liquid region, or in the two phase vapor/liquid region. This function is not single valued so the desired root must be specified as well using the parameter r.

Arguments:

rp_hts(flstr,t,s) Returns the fluid enthalpy [kJ/(kg-K)] in any phase, as a function of the temperature and entropy. The state point specified may be in any single phase vapor or liquid region, or in the two phase vapor/liquid region.

Arguments: