SetUnits

It defines the units to be used for the calculation of thermophysical properties in FluidProp. The use of this method in Excel is slightly different from its use in other client programs or programming environments.

 

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

FluidObj:

An object variable created at runtime.

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:

 

SetUnits( "SI", " ", "P,T", "bar,°C")

 

To specify that all units of the specified unit set must be per mole instead of per mass, enter:

 

SetUnits( "SI", "PerMole", "P,T", "bar,°C")

 

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:

 

SetUnits("Anglo-Saxon", "PerMole", " ", " ")