Professional Documents
Culture Documents
FluidProp is a standard interface to several software libraries for the calculation of thermodynamic and
transport properties of fluids. This program is developed by P. Colonna and T.P. van der Stelt , Energy
Technology Section, Delft University of Technology.
Each thermodynamic library implements one or more thermodynamic models for a number of different
fluids and mixtures. Fig. 1 schematically shows the main structure of the program.
FluidProp makes it easy to obtain fluid properties in different MS Windows? programs and development
environments because it is a COM server , i.e. it follows the Component Object Model standard, a
software architecture developed by Microsoft to build component-based applications. COM objects are
discrete components, each with a unique identity, which expose interfaces that allow applications and
other components to access their features. COM objects are more versatile than Win32 DLLs because
they are completely language-independent, have built-in interprocess communications capability, and
easily fit into an object-oriented program design. COM was first released in 1993 with OLE2, largely to
replace the interprocess communication mechanism DDE used by the initial release of OLE. ActiveX also
is based on COM. Server means that it provides calculated values to a main program, which is usually
defined as a client; therefore both programs implement a client-server architecture. The new Microsoft
.NET runtime environment is fully compatible with the COM standard.
FluidProp provides a common interface to the following thermodynamic libraries:
GasMix
IF97
RefProp (not included in the FluidProp package, must be obtained from NIST )
StanMix
TPSI
Independently from the syntax of the client program, the procedure for the calculation of a property is
as follows:
First call the SetFluid procedure to define the thermodynamic library and the fluid, e.g.
SetFluid( LibName , FluidName )
This function also returns an object identifier (ObjID ) or "memory address" which defines where the
input information about the chosen fluid is stored in the memory of the computer.
Secondly call the procedure for the desired property and supply the object identifier, the input
specification that defines the thermodynamic state and the corresponding values, e.g.
Enthalpy( ObjID , InputSpecifier , Value1 , Value2 )
Many thermodynamic properties can be computed by FluidProp with a large number of combinations of
input properties to define the thermodynamic state:
Available Thermodynamic and Transport Properties
Available Thermodynamic State Definitions
One innovative feature of FluidProp is that for all thermodynamic models, except for IF97, it is possible
to calculate some derived thermodynamic functions (see Table of available Thermodynamic and
Transport Properties ) that are demanded e.g. by up-to-date CFD or process dynamics software. In this
respect, see e.g.:
1 . Colonna, P. and Silva, P., May 2003. ''Dense Gas Thermodynamic Properties of Single and Multi-
Component Fluids for Fluid Dynamics Simulations.'' J. Fluids Engrg. , 125 , pp. 414-427.
2 . Colonna, P. and Rebay, S., 2004. ''Numerical simulation of dense gas flows on unstructured
grids with an implicit high resolution upwind Euler solver.'' Int. J. Numer. Meth. Fluids .
Accepted for publication.
At the moment the following programs and programming environments have been tested with FluidProp:
Every program or development environment supporting the COM standard can be client of the FluidProp
server.
The following methods (or functions), ordered by category, are available in FluidProp:
Object creation and cleanup Working fluid definition Simultaneous calculation of
CreateObject SetFluid all properties
ReleaseObjects GetFluid AllProps
GetFluidNames AllPropsSat
GetCompSet (obsolete) Solve
P. Colonna, T.P. van der Stelt, 2004, FluidProp: a program for the estimation of thermo physical
properties of fluids, Energy Technology Section, Delft University of Technology, The
Netherlands (www.FluidProp.com).
1 . Gordon, S., McBride, B.J. Computer Program for Calcu lation of complex Chemical Equilibrium
Compositions. Lewis Research Center , NASA SP-273, 1971.
Details of the theory and fluid data for these methods can be found in:
3. Reid, R.C., Prausnitz, J.M. and Sherwood, T.K. The Properties of Gases and Liquids, 3rd ed., McGraw-Hill, 1977.
The GasMix components can be used as pure fluids or in a mixture. GasMix provides thermodynamic and
transport properties for the fluids in Table 1. The listed FluidProp names (either short or long ) must be
used to specify the fluid name in the SetFluid method. For GasMix the short FluidProp name equals the
chemical formula of the fluid. For a given fluid, the FluidProp name is the same in all thermodynamic
libraries in which the fluid is available.
Table 1
Carbon dioxide CO2 carbon dioxide 44.0098 26.85 4726.85 300 5000
Nitrous oxide N2O nitrous oxide 44.0128 26.85 4726.85 300 5000
Sulfur dioxide SO2 sulfur dioxide 64.0627 26.85 4726.85 300 5000
Sulfur trioxide SO3 sulfur trioxide 80.0621 26.85 4726.85 300 5000
Water H2O water 18.0152 26.85 4726.85 300 5000
IF97
IF97 implements models for the thermodynamic and transport properties of water and steam according
to the IAPWS -IF97 industrial standard and documented in:
Wagner, W., Kruse, A. Properties of Water and Steam, The Industrial Standard IAPWS-IF97 for the Thermodynamic
Properties and Supplementary Equations for Other Properties, Springer-Verlag Berlin Heidelberg, 1998.
Table 1
������
The predefined mixtures of RefProp are also available through this version of the FluidProp interface.
These mixtures are listed in table 2. The listed FluidProp names (either short or long ) must be used to
specify the fluid name in the SetFluid method.
Table 2
1. Colonna, P., June 1995. Properties of Fluid Mixtures for Thermodynamic Cycles Applications.Tech. rep., Stanford
University, Stanford, CA.
2. Angelino, G. and Colonna, P., 1998. ''Multicomponent Working fluids for Organic Rankine Cycles (ORCs).'' Energy ,
23 , pp. 449-463.
The PRSV cubic equation of state, which is a modified Peng Robinson equation of state particularly
suited for the accurate estimation of saturation properties, is described in
3. Stryjeck, R. and Vera, J.?H., 1986. ``PRSV: An Improved Peng-Robinson Equation Of State For Pure Compounds
And Mixtures.'' Can. J. Chem. Eng. , 64, pp. 323-333.
The Wong and Sandler mixing rules which are suitable for the modeling of highly non-ideal mixtures are
documented e.g. in:
4. Wong, D. S. H., Sandler, S. I., and Orbey, H., 1992. ``Equation Of State Mixing Rule For Nonideal Mixtures Using
Available Activity Coefficient Model Parameters And That Allows Extrapolation Over Large Ranges Of Temperature
And Pressure.'' Ind. Eng. Chem. Res. , 31, pp. 2033-2039.
5. Wong, D. S. H. and Sandler, S. I., 1992. ``A Theoretically Correct Mixing Rule for Cubic Equations of State.'' AIChE
Journal , 38, pp. 671-680.
6. Huang, H. and Sandler, S. I., 1993. ``Prediction of Vapor-Liquid Equilibria at High Pressures Using Activity
Coefficient Parameters Obtained from Low Pressure Data: A comparison of Two Equation of State Mixing Rules.''
Ind. Eng. Chem. Res. , 32, pp. 1498-1503.
7. Orbey, H. and Sandler, S. I., 1993. ``Accurate Equation of State Predictions at high temperatures and pressures
using the existing UNIFAC model.'' Fluid Phase Equilib. , 85, pp. 41-54.
8. Sandler, S. I. et al. , 1994. Models For Thermodynamic And Phase Equilibria Calculations . Marcel Dekker, New York.
9. Orbey, H. and Sandler, S. I., 1995. ``On the Combination of Equation of State and Excess Free Energy Models.''
Fluid Phase Equilib. , 111, pp. 53-70.
10. Orbey, H. and Sandler, S. I., 1995. ``Reformulation of Wong-Sandler Mixing Rules for Cubic Equations of State.''
AIChE J. , 41.
11. Orbey, H. and Sandler, S. I., 1995. ``Equation of State modeling of Refrigerant Mixtures.'' Ind. Eng. Chem. Res. ,
34, pp. 2520-2525.
12. Orbey, H. and Sandler, S. I., 1997. ``A Comparison of Huron-Vidal Type Mixing Rules of Mixtures of Compounds
with Large Size Differences, and a New Mixing Rule.'' Fluid Phase Equilib. , 132, pp. 1-14.
13. Shiflett, M. B. and Sandler, S. I., June 1998. ``Modeling Fluorocarbon Vapor Liquid Equilibria using the Wong-
Sandler model.'' Fluid Phase Equilib. , 147, pp. 145-162.
IMPORTANT NOTE : at the moment StanMix implements a simple Successive Substitution Method for
the solution of saturation calculations that is known to fail for close-to-critical states and performs worse
for highly non-ideal mixtures.
The critical point calculation for a mixture is implemented as the pseudo-critical point calculation if the
composition is specified by the user, therefore the result is highly inaccurate, but an estimate is
necessary for all other type of calculations. For predefined mixtures the critical point is calculated with a
"climbing" method, that is the bubble point calculation is repeated by increasing the temperature in ever
small steps until it does not converge anymore. This is also an inaccurate estimate even if much better
than the pseudo-critical point calculation. We plan to improve these calculations.
StanMix provides thermodynamic properties for the pure fluids listed in Table 1 and 2. The listed
FluidProp names (either short or long ) must be used to specify the fluid name the SetFluid method. For
a given fluid, the FluidProp name is the same in all thermodynamic libraries in which the fluid is
available.
Table 1
14. Various authors. DECHEMA Chemistry Data Series, Frankfurt am Main (1977 and thereafter).
16. Infotherm : Experimental thermodynamic and physical properties of mixtures and pure substances
17. DIPPR : Evaluated Process Design Data of the AIChE Design Institute of Physical Properties
For a mixture:
Tmin = Max[Tmin (i )]; i = 1,2,..., ncomponents
Tmax = Min[Tmax (i )]; i = 1,2,..., ncomponents
Pmin = P (Tmin , q = 0)
Pmax = P (Tmax , v = 1/2 vc,min ),
vc,min = Max[vc (i )] ; i = 1,2,..., ncomponents
TPSI
TPSI implements the computer programs described in:
1. Reynolds, W.C., Thermodynamic properties in S.I. , Department of Mechanical Engineering - Stanford University,
Stanford, CA, 1979.
A first version of the program was written by Prof. W.C. Reynolds and distributed as a DOS executable
program. The program was later modified and expanded with more fluids and properties, as documented
in:
2. ?Colonna, P., Rebay, S., and Silva, P., Computer Simulations of Dense Gas Flows Using Complex Equations of State
for Pure Fluids and Mixtures and State of the Art Numerical Schemes. Tech. Rep., Universit? di Brescia, Via Branze,
38, 25123 Brescia, Italy, March 2002.
TPSI provides thermodynamic properties for the fluids listed in Table 1. The listed FluidProp names
(either short or long ) must be used to specify the fluid name in the SetFluid method. For a given fluid,
the FluidProp name is the same in all thermodynamic libraries in which the fluid is available.
?
Table 1
(1) In this model air and H2O vapor are treated as perfect gas with variable specific heats. The liquid is
treated as incompressible. It uses specific heat and saturation equations from the appropriate TPSI
subroutines of the other fluids.
Basics and conventions
Each client program and development environment uses a different syntax. Several examples are
provided:
The Mathworks Matlab and Simulink
Microsoft Visual Basic
Compaq Visual Fortran
Intel Visual Fortran
Microsoft Visual C++
Borland C++
Borland C++ Builder
Microsoft Excel
Maple Example
These examples are provided as an illustration for the use of the FluidProp methods in various
programming languages and environments.
In the description of each method provided in this section of the help file a general syntax is adopted
(see e.g. Enthalpy). The example can be adapted to the particular syntax of each client program or
development environment.
Table of available Thermodynamic State
definitions
The set of possible combinations of independent thermodynamic variables which can be used as an input
for one of the FluidProp methods to compute another thermodynamic variable is listed in Table 1. Not all
combinations are available for all the libraries.
The state definition gives a string which defines the input variables for a FluidProp method (see e.g.
Enthalpy).
Table 1
Legend:
n/a = not available
P = Pressure
T = Temperature
v = Specific volume
d = Density
h = Enthalpy
s = Entropy
u = Internal energy
q = Vapor quality
Table of available Thermodynamic and
Transport Properties
The properties listed in Table 1 can be computed by FluidProp. The corresponding symbol is used to
define the combination to set a thermodynamic state as an input for a method.
Table 1
Temperature Temperature T ?C
(Alpha)
(Beta)
(Chi)
Secondary thermodynamic property Fi 1/K
(Fi)
(Ksi)
(Psi)
(Zeta)
(Gamma)
Not all properties can be computed by all the libraries interfaced to FluidProp. Table 2 lists the available
properties for each library.
Table 2
Thermophysical property FluidProp TPSI StanMix IF97 GasMix RefProp
method
Pressure Pressure
Temperature Temperature
Density Density
Enthalpy Enthalpy
Entropy Entropy
Internal Energy IntEnergy
Fi (1) n/a
Table 1
Legend:
= available
n/a = not available
Available Units and Unit sets
The default units for the thermophysical properties listed in Table 1 can be altered by using the base
units listed in Table 2 using the SetUnits method. In addition to the default (FluidProp) unit set, two
different unit sets can be specified: the SI and the Anglo-Saxon unit set. Units are per mass by default
(cF. Table 1) but can be specified per mole as well. Non-dimensional properties can be obtained by
defining a reference state by using the SetRefState method.
Table 1
Temperature T °C K °F
Table 2
Property name Base units
Length m in ft yd mi
Mass g lb oz
Time s min h d y
Temperature K °C °F °R
Temperature difference K °C °F °R
Area m2 a sq in sq ft sq yd acre
Volume m3 L cu in cu ft cu yd cc
Force N gf lbf
Power W hp
Base units can be preceded (if applicable) by the prefixes listed in Table 3.
Table 3
Base units, possibly preceded by a prefix, can be used together in arbitrary combinations. For instance
the unit of the specific heat capacity (J/kgK) can be formed by combining the units of energy, mass and
temperature difference dT by means of the operators listed in Table 4.
Table 4
Operator Name Meaning
symbol
. period multiply
/ slash divide
^ circumflex power
A compound unit consists of a row of base units, possibly raised to a certain power, separated by a
period or a slash. A base unit raised to a power consists of base unit followed by circumflex and after
that a positive or negative number. If no power is specified, the power defaults to 1. For example if a
pressure is to be specified as Newton per square meter then it can be written as N/m^2 (or N.m^-2).
The number of base units in a compound unit is unlimited. Each base unit and its power form a unit
itself. This means that a period or slash in front of the preceding unit does not affect the unit thereafter.
Therefore the unit of the specific heat capacity must be written as J/kg/K, or J.kg^-1.K^-1, or J/kg.K^-
1, or J.kg^-1/K and certainly not as J/kg.K.
This method need not to be used if the SetFluid method is employed, because SetFluid itself calls the
CreateObject method internally.
The CreateObject method can also be used to test if a certain thermodynamic library is available. For
example, suppose that the RefProp library is not installed, then CreateObject( &ldots;, "RefProp",
ErrorMsg) yields ErrorMsg = "Error in FluidProp: library RefProp not available.".
Arguments:
Syntax:
ReleaseObjects()
Custom defined mixturesMixtures for which the composition is defined by the user by providing the Conc() vector
Custom defined mixtures
Mixtures for which the composition is defined by the user by providing the Conc() vector
SetFluid
It defines the library to be used for the calculation of the fluid properties and the fluid.
It returns an Object Identifier to which methods for property calculation can refer (see e.g. Enthalpy).
Arguments:
Comp(): String Array, names of components (IMPORTANT: it must match exactly the string
returned by the GetFluidNames method but it is not case dependent; both short and
long names can be used.)
Notes:
FluidProp 2 uses fluid names for all available fluids (returned by the GetFluidNames method) that are
common to all libraries; FluidProp 1 employed fluid names that were specific to each good sentence
library (returned by the obsolete GetCompSetmethod); for compatibility issues both names can still be
used.
Examples:
Comp(1) = "R32"
Conc(1) = 0.69762
Comp(2) = "R125"
Conc(2) = 0.30238
SetFluid("RefProp", 2, Comp, Conc, ErrorMsg)
Comp(1) = "benzene"
Conc(1) = 0.7
Comp(2) = "toluene"
Conc(2) = 0.3
SetFluid("StanMix", 2, Comp, Conc, ErrorMsg)
Excel example:
SetFluid("TPSI", "propane", "", A1)
Notes: A1 is a cell containing the value returned by SetUnits. Using default FluidProp units it is just:
SetFluid("TPSI", "propane")
The error message is not in the arguments list; in case an error occurs during the calculation, the
value returned by the function is a string containing the error description.
GetFluid
It returns the library name and composition of the working fluid.
Arguments:
ErrorMsg: String
Arguments:
Type: a string containing either "short", "s", "long" or "l", which indicates the wanted format
for the names (input)
Library: a string containing the library name; if Library is blank (" ") or "all" then all names of all
fluids available are returned (input)
nFluids: number of fluids in the library (output)
Excel Examples:
GetFluidNames("s", "all")
GetFluidNames("s", "GasMix")
GetFluidNames("l", "RefProp")
GetFluidNames("short", "StanMix")
GetFluidNames("Long", "TPSI")
Note: in case an error occurs during execution, the value returned by the function is a string containing
the error description.
GetCompSet
OBSOLETE
This method has been maintained for compatibility with FluidProp 1. Use GetFluidNames instead.
AllProps
It returns all available thermophysical properties, given 2 input thermodynamic variables as defined by
the InputSpec argument (see Thermodynamic State definitions).
The properties that are calculated and the default units are listed in the table of available
Thermodynamic and Transport Properties.
The general syntax for procedural programming languages like Fortran is:
call AllProps( FluidObj, InputSpec, Value1, Value2, P, T, v, d, h, s, u, q, x, y, cv, cp, c, alpha, beta,
chi, fi, ksi, psi, zeta, theta, kappa, gamma, eta, lambda, ErrorMsg)
The syntax for object oriented programming languages like VB, C++ and Matlab is:
FluidObj.AllProps( InputSpec, Value1, Value2, P, T, v, d, h, s, u, q, x, y, cv, cp, c, alpha, beta, chi,
fi, ksi, psi, zeta, theta, kappa, gamma, eta, lambda, ErrorMsg)
The general syntax for Excel is:
AllProps( FluidObj, InputSpec, Value1, Value2)
Arguments:
InputSpec: String
cv, cp, c,
Double (output)
alpha, beta,
chi, fi, ksi,
psi, zeta,
theta,
kappa,
gamma,
eta, lambda:
Excel Example:
The thermophysical properties that are calculated and the default units are listed in the table of available
Thermodynamic and Transport Properties. The following saturation properties are calculated (default
units):
dd_liq_dP first-order partial derivative of the saturated liquid density with respect to [kg/m3.bar]
the pressure
dd_vap_dP first-order partial derivative of the saturated vapor density with respect to [kg/m3.bar]
the pressure
dh_liq_dP first-order partial derivative of the saturated liquid enthalpy with respect to [kJ/kg.bar]
the pressure
dh_vap_dP first-order partial derivative of the saturated vapor enthalpy with respect to [kJ/kg.bar]
the pressure
dT_sat_dP first-order derivative of the saturation temperature with respect to the [K/bar]
pressure
The general syntax for procedural programming languages like Fortran is:
call AllPropsSat( FluidObj, InputSpec, Value1, Value2, P, T, v, d, h, s, u, q, x, y, cv, cp, c, alpha,
beta, chi, fi, ksi, psi, zeta, theta, kappa, gamma, eta, lambda, d_liq, d_vap,
h_liq, h_vap, T_sat, dd_liq_dP, dd_vap_dP, dh_liq_dP, dh_vap_dP, dT_sat_dT,
ErrorMsg)
The syntax for object oriented programming languages like VB, C++ and Matlab is:
FluidObj.AllPropsSat( InputSpec, Value1, Value2, P, T, v, d, h, s, u, q, x, y, cv, cp, c, alpha, beta,
chi, fi, ksi, psi, zeta, theta, kappa, gamma, eta, lambda, d_liq, d_vap, h_liq,
h_vap, T_sat, dd_liq_dP, dd_vap_dP, dh_liq_dP, dh_vap_dP, dT_sat_dT,
ErrorMsg)
The general syntax for Excel is:
AllPropsSat( FluidObj, InputSpec, Value1, Value2)
Arguments:
FluidObj: In Excel it is the variable returned by SetFluid, in other programs or programming
environments it is an object variable created at runtime.
InputSpec: String
Value1: Double (input)
Value2: Double (input)
x, y: 1-dimensional double array (output)
ErrorMsg: String (output)
The remaining arguments are all type Double (output):
P, T, v, d, h, s, u, q, cv, cp, c,alpha, beta, chi, fi, ksi, psi, zeta, theta, kappa, gamma, eta, lambda,
d_liq, d_vap, h_liq, h_vap, T_sat, dd_liq_dP, dd_vap_dP, dh_liq_dP, dh_vap_dP, dT_sat_dT
Excel Example:
The general syntax for programs like Excel and programming languages like Fortran is:
Root = Solve( FluidObj, FuncSpec, FuncVal, InputSpec, Target, FixedVal, MinVal, MaxVal,
ErrorMsg)
The syntax for object oriented programming languages like VB, C++ and Matlab is:
Root = FluidObj.Solve( FuncSpec, FuncVal, InputSpec, Target, FixedVal, MinVal, MaxVal,
ErrorMsg)
Arguments:
Target: Integer, indicates which is the running variable, i.e. Target = 1 for Tmd1 or Target = 2
for Tmd2
FixedVal: Double, fixed Value, i.e. Tmd1 (Target = 2) or Tmd2 (Target = 1)
MinVal: Lower boundary for the running variable
ErrorMsg: String
T = Solve( A1,"Gamma",1.008,"Tv",1,0.3723,0,200)
The general syntax for programs like Excel and programming languages like Fortran is:
P = Pressure( FluidObj, InputSpec, Value1, Value2, ErrorMsg)
The syntax for object oriented programming languages like VB, C++ and Matlab is:
P = FluidObj.Pressure( InputSpec, Value1, Value2, ErrorMsg)
Arguments:
InputSpec: String
Value1: Double
Value2: Double
ErrorMsg: String
Excel Example:
Default unit: °C
The general syntax for programs like Excel and programming languages like Fortran is:
T = Temperature( FluidObj, InputSpec, Value1, Value2, ErrorMsg)
The syntax for object oriented programming languages like VB, C++ and Matlab is:
T = FluidObj.Temperature( InputSpec, Value1, Value2, ErrorMsg)
Arguments:
InputSpec: String
Value1: Double
Value2: Double
ErrorMsg: String
Excel Example:
The general syntax for programs like Excel and programming languages like Fortran is:
v = SpecVolume( FluidObj, InputSpec, Value1, Value2, ErrorMsg)
The syntax for object oriented programming languages like VB, C++ and Matlab is:
v = FluidObj.SpecVolume( InputSpec, Value1, Value2, ErrorMsg)
Arguments:
InputSpec: String
Value1: Double
Value2: Double
ErrorMsg: String
Excel Example:
The general syntax for programs like Excel and programming languages like Fortran is:
Arguments:
InputSpec: String
Value1: Double
Value2: Double
ErrorMsg: String
Excel Example:
The general syntax for programs like Excel and programming languages like Fortran is:
h = Enthalpy( FluidObj, InputSpec, Value1, Value2, ErrorMsg)
The syntax for object oriented programming languages like VB, C++ and Matlab is:
h = FluidObj.Enthalpy( InputSpec, Value1, Value2, ErrorMsg)
Arguments:
InputSpec: String
Value1: Double
Value2: Double
ErrorMsg: String
Excel Example:
The general syntax for programs like Excel and programming languages like Fortran is:
s = Entropy( FluidObj, InputSpec, Value1, Value2, ErrorMsg)
The syntax for object oriented programming languages like VB, C++ and Matlab is:
s = FluidObj.Entropy( InputSpec, Value1, Value2, ErrorMsg)
Arguments:
InputSpec: String
Value1: Double
Value2: Double
ErrorMsg: String
Excel Example:
The general syntax for programs like Excel and programming languages like Fortran is:
u = IntEnergy( FluidObj, InputSpec, Value1, Value2, ErrorMsg)
The syntax for object oriented programming languages like VB, C++ and Matlab is:
u = FluidObj.IntEnergy( InputSpec, Value1, Value2, ErrorMsg)
Arguments:
InputSpec: String
Value1: Double
Value2: Double
ErrorMsg: String
Excel Example:
The general syntax for programs like Excel and programming languages like Fortran is:
q = VaporQual( FluidObj, InputSpec, Value1, Value2, ErrorMsg)
The syntax for object oriented programming languages like VB, C++ and Matlab is:
q = FluidObj.VaporQual( InputSpec, Value1, Value2, ErrorMsg)
Arguments:
InputSpec: String
Value1: Double
Value2: Double
ErrorMsg: String
Excel Example:
Because the output is an array, the general syntax for a programming language like Fortran is:
call VaporCmp( FluidObj, InputSpec, Value1, Value2, y, ErrorMsg)
The syntax for object oriented programming languages like VB, C++ and Matlab is:
y = FluidObj.VaporCmp( InputSpec, Value1, Value2, ErrorMsg)
The general syntax for Excel is:
y = VaporCmp( FluidObj, InputSpec, Value1, Value2)
Arguments:
InputSpec: String
Value1: Double
Value2: Double
ErrorMsg: String
Excel Example:
Because the output is an array, the general syntax for a programming language like Fortran is:
call LiquidCmp( FluidObj, InputSpec, Value1, Value2, x, ErrorMsg)
The syntax for object oriented programming languages like VB, C++ and Matlab is:
x = FluidObj.LiquidCmp( InputSpec, Value1, Value2, ErrorMsg)
The general syntax for Excel is:
x = LiquidCmp( FluidObj, InputSpec, Value1, Value2)
Arguments:
InputSpec: String
Value1: Double
Value2: Double
ErrorMsg: String
Excel Example:
The general syntax for programs like Excel and programming languages like Fortran is:
cv = HeatCapV( FluidObj, InputSpec, Value1, Value2, ErrorMsg)
The syntax for object oriented programming languages like VB, C++ and Matlab is:
cv = FluidObj.HeatCapV( InputSpec, Value1, Value2, ErrorMsg)
Arguments:
InputSpec: String
Value1: Double
Value2: Double
ErrorMsg: String
Excel Example:
The general syntax for programs like Excel and programming languages like Fortran is:
cp = HeatCapP( FluidObj, InputSpec, Value1, Value2, ErrorMsg)
The syntax for object oriented programming languages like VB, C++ and Matlab is:
cp = FluidObj.HeatCapP( InputSpec, Value1, Value2, ErrorMsg)
Arguments:
InputSpec: String
Value1: Double
Value2: Double
ErrorMsg: String
Excel Example:
The general syntax for programs like Excel and programming languages like Fortran is:
c = SoundSpeed( FluidObj, InputSpec, Value1, Value2, ErrorMsg)
The syntax for object oriented programming languages like VB, C++ and Matlab is:
c = FluidObj.SoundSpeed( InputSpec, Value1, Value2, ErrorMsg)
Arguments:
InputSpec: String
Value1: Double
Value2: Double
ErrorMsg: String
Excel Example:
,
given 2 input thermodynamic variables as defined by the InputSpec argument.
The general syntax for programs like Excel and programming languages like Fortran is:
Arguments:
InputSpec: String
Value1: Double
Value2: Double
ErrorMsg: String
Excel Example:
,
given 2 input thermodynamic variables as defined by the InputSpec argument.
The general syntax for programs like Excel and programming languages like Fortran is:
Arguments:
InputSpec: String
Value1: Double
Value2: Double
ErrorMsg: String
Excel Example:
,
given 2 input thermodynamic variables as defined by the InputSpec argument.
The general syntax for programs like Excel and programming languages like Fortran is:
Arguments:
InputSpec: String
Value1: Double
Value2: Double
ErrorMsg: String
Excel Example:
,
given 2 input thermodynamic variables as defined by the InputSpec argument.
The general syntax for programs like Excel and programming languages like Fortran is:
Arguments:
InputSpec: String
Value1: Double
Value2: Double
ErrorMsg: String
Excel Example:
,
given 2 input thermodynamic variables as defined by the InputSpec argument.
The general syntax for programs like Excel and programming languages like Fortran is:
Arguments:
InputSpec: String
Value1: Double
Value2: Double
ErrorMsg: String
Excel Example:
,
given 2 input thermodynamic variables as defined by the InputSpec argument.
The general syntax for programs like Excel and programming languages like Fortran is:
Arguments:
InputSpec: String
Value1: Double
Value2: Double
ErrorMsg: String
Excel Example:
,
given 2 input thermodynamic variables as defined by the InputSpec argument.
The general syntax for programs like Excel and programming languages like Fortran is:
Arguments:
InputSpec: String
Value1: Double
Value2: Double
ErrorMsg: String
Excel Example:
The general syntax for programs like Excel and programming languages like Fortran is:
Arguments:
InputSpec: String
Value1: Double
Value2: Double
ErrorMsg: String
Excel Example:
,
given 2 input thermodynamic variables as defined by the InputSpec argument.
The general syntax for programs like Excel and programming languages like Fortran is:
Arguments:
InputSpec: String
Value1: Double
Value2: Double
ErrorMsg: String
Excel Example:
Default unit: -
The general syntax for programs like Excel and programming languages like Fortran is:
Arguments:
InputSpec: String
Value1: Double
Value2: Double
ErrorMsg: String
Excel Example:
The general syntax for programs like Excel and programming languages like Fortran is:
Arguments:
InputSpec: String
Value1: Double
Value2: Double
ErrorMsg: String
Excel Example:
The general syntax for programs like Excel and programming languages like Fortran is:
Arguments:
InputSpec: String
Value1: Double
Value2: Double
ErrorMsg: String
Excel Example:
The general syntax for programs like Excel and programming languages like Fortran is:
M = Mmol( FluidObj, ErrorMsg)
The syntax for object oriented programming languages like VB, C++ and Matlab is:
M = FluidObj.Mmol( ErrorMsg)
Arguments:
ErrorMsg: String
Excel Example:
M = Mmol( A1)
Default unit: °C
The general syntax for programs like Excel and programming languages like Fortran is:
T = Tcrit( FluidObj, ErrorMsg)
The syntax for object oriented programming languages like VB, C++ and Matlab is:
T = FluidObj.Tcrit( ErrorMsg)
Arguments:
ErrorMsg: String
Excel Example:
T = Tcrit( A1)
The general syntax for programs like Excel and programming languages like Fortran is:
P = Pcrit( FluidObj, ErrorMsg)
The syntax for object oriented programming languages like VB, C++ and Matlab is:
P = FluidObj.Pcrit( ErrorMsg)
Arguments:
ErrorMsg: String
Excel Example:
P = Pcrit( A1)
Default unit: °C
The general syntax for programs like Excel and programming languages like Fortran is:
T = Tmin( FluidObj, ErrorMsg)
The syntax for object oriented programming languages like VB, C++ and Matlab is:
T = FluidObj.Tmin( ErrorMsg)
Arguments:
ErrorMsg: String
Excel Example:
T = Tmin( A1)
Default unit: °C
The general syntax for programs like Excel and programming languages like Fortran is:
T = Tmax( FluidObj, ErrorMsg)
The syntax for object oriented programming languages like VB, C++ and Matlab is:
T = FluidObj.Tmax( ErrorMsg)
Arguments:
ErrorMsg: String
Excel Example:
T = Tmax( A1)
Default units:
Molar mass: kg/mol,
Pressures: bar
Temperatures: °C
The general syntax for programs like Excel and programming languages like Fortran is:
AllInfo( FluidObj, Mmol, Tcrit, Pcrit, Tmin, TMax, ErrorMsg)
The syntax for object oriented programming languages like VB, C++ and Matlab is:
FluidObj.AllInfo(Mmol, Tcrit, Pcrit, Tmin, TMax, ErrorMsg)
The general syntax for Excel is:
AllInfo( FluidObj)
Arguments:
Tmin: Lower limit of the temperature validity range for the working fluid (Double)
Tmax: Upper limit of the temperature validity range for the working fluid (Double)
ErrorMsg: String
Excel Example:
AllInfo( A1)
The syntax for defining the unit set for Excel is as follows:
SetUnits(UnitSet, MassOrMole, Properties, Units)
The syntax for programming languages like Fortran is:
SetUnits( FluidObj, UnitSet, MassOrMole, Properties, Units)
The syntax for object oriented programming languages like VB, C++ and Matlab is:
FluidObj.SetUnits( UnitSet, MassOrMole, Properties, Units)
Important note
In order to use the SetUnits method, an object variable must already have been created. The unit
settings defined by the SetUnits method apply to all object variables that are used in the current
application.
In Excel the handling of fluid objects is different: the units must be defined for each working
fluid defined with the SetUnits function. Hence the SetUnits function returns an Object Identifier to which
the SetFluid method can refer.
The provided example might further clarify the use of the SetUnits function in Excel.
Arguments
UnitSet: String indicating the name of the unit set to be used (see Table 1 in Available Units
and Unit sets);
It can be:
- " ", "FP", or "FluidProp" (default)
- "SI"
- "Anglo-Saxon"
MassOrMole: String that specifies the base unit for the selected properties;
It can be:
- "PerMass" or " " (default)
- "PerMole"
This modifier overwrites the specification possibly set with UnitSet.
Properties: String indicating a list with one or more properties (separated by commas) for which
the user wants to specify a unit different from the specified unit set.
If no units are to be modified then a blank must be entered (" ").
This modifier overwrites the unit specification of the specified properties in UnitSet
and MassOrMole.
For example: to modify the units of pressure and temperature, Properties is: "P,T"
Units: String indicating a list with one or more units separated by commas in the same
order as the property symbols in Properties. For the available units, see Table 2 in
Available Units and Unit sets).
The number of unit symbols must the same as the number of property symbols in
Properties. If no properties have been specified in Properties then a blank (" ") must
be entered.
For example: to modify the units of pressure and temperature in pounds per square
inch and degrees Fahrenheit, Units must be: "psia, °F".
Examples
To specify the SI unit set for all units except for the pressure and temperature, which should be in bar
and in Celsius degrees, enter:
To specify that all units of the specified unit set must be per mole instead of per mass, enter:
To specify the FluidProp unit set for all units except for the enthalpy and the entropy, which have to be
in Megajoules instead of Kilojoules and except for the pressure, which has to be in Newton per square
meter, enter:
SetUnits( " ", " ", "h, s, P", "MJ/kg, MJ/kg/K, N/m^2")
To specify the Anglo-Saxon unit set for all units, except that all units have to be per mole instead of per
pound, enter:
Notes
In order to use the SetRefState method, an object variable must have been created. The reference state
defined by the SetRefState method applies to all object variables that are used in the current application.
This method is not available in Excel.
Arguments
FluidObj: An object variable created at runtime.
T_ref: Reference temperature, double, unit: °C
P_ref: Reference pressure, double, unit: bar
ErrorMsg: Error message if reference state cannot be set, string
Example
To define the reference state to be T = 50 °C and P = 2 bar:
SetRefState( 50, 2, ErrorMsg)
General Information
The folder <FluidProp folder>\ Sample Clients contains examples of client programs for the
following programs or development environments:
9. Maple 9
In all examples the same calculations are executed. The Visual Basic and C++ Builder examples are
applications based on MS-Windows scrollable windows, while the Fortran, Visual C++ and Borland C++
client are just console applications. Once FluidProp is installed properly, you can run all the executables.
In order to adapt or extend an example you must have the corresponding programming system and
open the enclosed project file.
In order to use C++ Builder as we did, special installation steps should be accomplished. See the
Readme.txt file in the C++ Builder folder.
For the C++ examples the names of the source files are the same. However, the contents of the files are
slightly different. This mainly has to do with the different way in which specific libraries available in the
different programming environments handle string variables. Nevertheless, methods have been added in
each example, so that FluidProp can be used in the same way.
Matlab and Simulink Examples
Using FluidProp from Matlab is very easy. Look into the examples provided in:
<FluidProp folder>\Sample Clients\The MathWorks Matlab
Try running the Test_FluidProp.m procedure.
COM, the technology on which FluidProp is based, is (well enough) supported from Matlab Release 13
on.
Still some little discrepancies from the standard in the Matlab implementation of COM make the SetFluid
function a little different. The setting of the Model and the Fluid in Matlab is done with the SetFluid_M
function (the _M denote a different function from the standard FluidProp SetFluid). The Mathworks told
us that they will correct the bugs concerning the COM implementation in the next releases.
General syntax:
ErrorMsg = invoke(ObjID,'SetFluid_M', ModelName, nComp, Comp, Conc)
Arguments:
ObjID: Object variable as set by the actxserver Matlab function (e.g. FP = actxserver
('FluidProp.FluidProp');)
Comp(): String containing the comma separated list of the components (IMPORTANT: it
must match exactly the string returned by GetFluidNames but it is not case
dependent; both short and long names can be used.)
Conc(): Double Array. Dimensions: nComp rows X 2 columns. The second column is formed
by 0's. This is a bug in the Matlab implementation of COM: arrays can only be passed
if they are matrices and not vectors.
ErrorMsg: String (value returned)
Examples:
Model = 'GasMix';
nCmp = 5;
Cmp = 'AR,CO2,H2O,N2,O2';
Cnc = [0.0092,0; 0.0003,0; 0.0101,0; 0.7729,0; 0.2075,0];
ErrorMsg = invoke(FP,'SetFluid_M',Model,nCmp,Cmp,Cnc)
Model = 'RefProp';
nCmp = 1;
Cmp = 'Toluene';
Cnc = [1, 0];
ErrorMsg = invoke(FP,'SetFluid_M',Model,nCmp,Cmp,Cnc)
Any of the functions to compute a fluid property can be called with the same syntax, e.g.:
[Enthalpy,ErrorMsg] = invoke(FP,'Enthalpy','PT', P, T);
Browse your computer and select the file FluidProp.xla in the FluidProp folder:
Now a FluidProp category appears every time you use the Excel Function Wizard:
Excel Examples
Using FluidProp from Excel is very easy. Look into the examples provided in:
<FluidProp folder>\Sample Clients\Microsoft Excel
Excel Sample.xls shows examples of FluidProp functions for each available library.
The folder <FluidProp folder>\Sample Thermodynamic Diagrams contains T-s and PTx diagrams
realized with FluidProp as a demonstration of the FluidProp capabilities.
Example:
In one cell enter (e.g. A1), set the library and the fluid by inserting the SetFluid function:
=SetFluid(ModelName, FluidName)
e.g: =SetFluid("TPSI","Butane")
for a custom defined mixture: =SetFluid("RefProp",{"Butane","Propane"},{0.5,0.5})
To calculate properties, in another cell insert a function with the appropriate arguments:
=Enthalpy($A$1,"Tq",50,1)
The first argument is the address of the cell in which the SetFluid function was entered. All arguments
can be cell addresses.
The last argument is the address of the cell in which the SetUnits function was entered.
Remark: In this help file we assume the decimal symbol to be a period ("."), the digital grouping
symbol a space (e.g. 10 000) and the list separator a comma (e.g. "CH4","H2O", "N2"). The correct
symbol depends on your Regional and Language Options (see Control Panel of the MS-Windows
operating system) or your Excel settings (in Excel XP: Tools -> Options: International tab). You can also
open the file Excel Sample.xls in the folder Client samples\Microsoft Excel to check which symbols your
system is using.