Contents - Index


UNITSYSTEM

 

The UNITSYSTEM function provides information relating to the current settings in the Unit System dialog window.  The function takes one character-string argument that must be surrounded by single quote marks.  Legal arguments are 'SI', 'Eng', 'Mass', 'Molar', 'Deg', 'Rad', 'Pa', 'kPa', 'bar', 'MPa',  'psia', 'atm', 'C', 'K', 'F', 'R', 'J', and 'kJ'.  The function will return 1 (for true) or 0 (for false).

 

The function is particularly important if you are writing your own internal library routines.  For example, suppose you have established a correlation for specific heat that requires temperature to be in R.  You can convert the temperature supplied to the function depending on the unit system settings made in the EES program, as illustrated in the following function for the specific heat of ethylene glycol.

 

Function CPEG(T,MF)

{$CPEG

CPEG returns the specific heat of an ethylene-glycol solution in Btu/lbm-F, given a temperature in degrees R and a mass fraction of ethylene-glycol in the solution.}

 

if (UnitSystem('F')=1)  then T:=T+459.6

if (UnitSystem('K')=1) then T:=T*1.8

if (UnitSystem('C')=1) then T:=(T+273.15)*1.8

 

{Following correlation requires T in degrees R}

 

CPEG=0.8972266+1.6125E-04*T+1.8963E-08*T^2-2.0722E-11*T^3-7.2303E-01*MF-8.5445E-02*MF^2+0.00560529*MF^3+7.1584E-04*T*MF-7.4079E-05*T*MF^2+1.4842E-08*T^2*MF+8.9292E-09*T^2*MF^2

 

End

  

 

Also see: 

 UNITSYSTEM$

 $UNITSYSTEM

 Mathematical functions