Contents - Index


CONVERT

 

The Convert function provides unit conversions.  The format of the Convert function is

 

Convert('From', 'To') 

 

where From and To are unit designations provided either as string constants or string variables.  If string constants are used, the single quote marks are optional. String variables are identified with a $ as the final character in the variable name.  The unit designations can be optionally enclosed in square brackets.

 

NOTE:  The CONVERT function will convert temperature differences but it does NOT convert temperatures from one scale to another.  Use the CONVERTTEMP function for this purpose.

 

(Note:  use a semicolon instead of a comma as the list separator when using the European numerical format)

 

The Convert function returns the value X which satisfies the following relation:

 

1.0 * From = X * To  

 

As a specific example, 

 

FI=Convert(ft^2, in^2) 

 

will set FI to a value of 144 because 1 square foot is 144 square inches. 

 

Combination of units and multiple unit terms may be entered.  In a combination of units, such as Btu/hr-ft^2-R, the individual units are separated with a space, a hyphen (i.e., -), a dot (·) alt-250, or division signs.   Only one division symbol may be used in any one term.  All units to the right of the division symbol are assumed to be in the denominator (i.e., raised to a negative power).  See Entering Units for detailed information.  

 

The ^ symbol is optional so ft2 and ft^2 are equivalent.  The following example converts 5 Btu/hr-ft^2-R into W/m2-K and sets H equal to this number:

 

H=5*Convert('Btu/hr-ft^2-R','W/m2-K)

 

The Convert function will accept multiple unit terms.  Each term is enclosed within parentheses.  Terms are separated with an optional * symbol or with a / symbol, as in the example below.

 

P =15* Convert((lbm/ft3)*(ft)/(s^2/ft), kPa)

 

Groups of units contained in parentheses can be raised to a power as in the following conversion.

 

Energy=KE*convert((m/s)^2,kJ/kg)

 

The defined unit symbols can be displayed with the Unit Conversion Info in the Options menu.

 

If you find that a unit you need is not defined, you can enter it by editing the UNITS.TXT file in the EES directory.   Instructions for entering new units are provided in the UNITS.TXT  file.

 

The Convert function should be used in preference to constants that have inherent dimensions (e.g., 144 in^2/ft^2) in order to avoid false error reports from the Check Units command.

 

Special characters:

To enter µ as in µm, hold the Alt-Key down and type 230 on the  numeric keypad.  Let the Alt key up and the µ should appear.   Other useful characters are Alt-248 which displays the degree symbol   and Alt-250 which appears as a dot (·) and is used as a unit separator.  The Convert routine will accept a hyphen (-), a  space or character 250 (·) as a separator for units.  For example,  W-hr, W hr and W·hr will all be accepted in the Convert command for Watt-hours.  Shown below are some additional examples.

_____________________________________________________________________________________________

"This simple problem illustrates a variety of equivalent ways for entering the units of a variable"

A=2 [Btu/hr-ft^2-F] "all units to the right of the / sign are assumed to be in the denominator"

B=2 [Btu hr-1 ft-2 F-1] "spaces separate each dimension"

C=2 [Btu hr^-1 ft^-2 F-1] "the ^ is usually optional, but recommended"

D=2 [Btu/(hr-ft^2-F)] "use parentheses sparingly"

E=2 [Btu·hr-1·ft^-2·F-1] "the dot character is entered as alt-250"

F=2 [(Btu/hr)*(ft^-2*F-1)] "use * to multiply groups of units enclosed in parentheses"

_____________________________________________________________________________________________

 

Comments in Units

A comment can be embedded within a unit string by surrounding the comment with either { } or \ characters.  The comment will be displayed with the unit but it will be ignored by the Convert function when doing unit conversions.  A possible use for these comments is to identify the substance, e.g, h= 1500 [kJ/kg{dry air}].  The length of the unit string, including the comment, is limited to 30 characters.

 

 

See also: CONVERTTEMP, Mathematical Functions

 Check Units

 Entering Units