Contents - Index


$UnitSystem 

 

The unit system is needed only when the built-in thermophysical (e.g., enthalpy) or trigonometric (e.g., sine) functions are used.  Normally, the unit system is specified with the Unit System menu command.  However, the unit system can also be specified with the $UnitSystem directive which has the following format:

 

$UnitSystem SI[or ENG]  MASS[or MOLE]  DEG[or RAD]  KPA[or PA or MPA or BAR or PSIA or ATM] C[or F] K[or R] J[or KJ]

 

The unit specifications can be made in any order and only those which are to be changed need to be provided.

 

Note that it is not possible to specify a mixed unit system.  That is, if the unit system is SI, trying to specify F for the temperature will result in temperature units of C, not F.  Similarly specifying psia for pressure will result in pressure units of kPa.  The J and KJ specifications are only recognized for SI units.

 

Starting with version 9.777, it is possible to provide a separate $UnitSystem directive for Functions, Procedures, and Subprograms (but not Modules) so that the unit settings are different than those in the main program.  If a Function, Procedure, or Subprogram with specified unit settings calls another Function, Procedure, or Subprogram for which specific unit setting have not been specified, the unit system of the calling routine will remain in effect.  If a $UnitSystem directive appears in a Function, Procedure or Subprogram, the unit setting will be displayed in the Solution window tab corresponding to this program unit.  Unit consistency checking will be conducted using the specified unit settings in the program unit.   Note that the units of local variables in Functions, Procedures, and Subprograms must be set using the Variable Information dialog or with the $VarInfo directive.  Also note that specific enthalpy, internal energy, and entropy have values that are dependent on an arbitrary choice of reference state.  If the units set in a Function, Procedure or Subprogram differ from those set in the main program, the reference state may not be the same as that used in the main program or in other program units. The $Reference directive can only be used in the main program. Functions, Procedures and Subprograms that provide a $UnitSystem directive should be written to be independent of the choice of reference state by employing differences between property values.  

 

 

See also: $IF/IFNOT directive

 UnitSystem function

 Directives