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).
The general syntax is:
SetFluid( ModelName, nComp, Comp(), Conc(), ErrorMsg)
The syntax for Excel is:
SetFluid( ModelName, nComp, Comp(), Conc(), UnitObj)
Arguments:
ModelName: |
String (possible values: TPSI, RefProp, StanMix, GasMix, IF97) |
nComp: |
Long Integer, number of components |
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.) |
Conc(): |
Double Array, concentrations of components |
ErrorMsg: |
String |
UnitObj: |
In Excel it is the variable returned by SetUnits. It is optional: leave it blank (" ") for default units. |
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:
For pure fluids or predefined mixtures:
SetFluid("TPSI", 1, "methane", 1, ErrorMsg)
SetFluid("StanMix", 1, "methane", 1, ErrorMsg)
SetFluid("IF97", 1, "", "", ErrorMsg)
Note: in this case also the Comp argument is ignored because the IF97 model applies only to water.
SetFluid("StanMix", 1, "benzene/toluene", { 0,5\0,5 }, ErrorMsg)
Note: the Conc() argument is not ignored, even though it is a predefined mixture(in this case benzene (0.5) / toluene (0.5) ). For predefined mixtures SetFluid still needs to be called with an array specifying the concentrations of the fluids. The concentration can also be explicitly specified with Conc() as in the following examples about custom defined mixtures:
Comp(1) = "N2"
Conc(1) = 0.7729
Comp(2) = "O2"
Conc(2) = 0.2075
Comp(3) = "H2O"
Conc(3) = 0.0101
Comp(4) = "AR"
Conc(4) = 0.0092
Comp(5) = "CO2"
Conc(5) = 0.0003
SetFluid("GasMix", 5, Comp, Conc, ErrorMsg)
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.