Contents - Index


$DefineUnits

 

The $DefineUnits directive allows a new unit specification to be defined or an existing unit specification to be modified.  The format of this directive is:

 

$DefineUnits  UnitName=UnitSpecification

 

UnitName is the name of the unit specification.  It must begin with a letter.  It should not include any mathematical operators nor should it end with a number.  The unit name is case-insensitive.  If the unit name has already been defined, e.g., mW, it will be redefined as indicated with this directive and a warning will be issued. UnitName can be assigned as the units for a variable and it can be used in the Convert command.

 

UnitSpecification is the units that will be assigned to the unit name.  It can consist of any combination of previously defined units.  Previously defined units can be seen in the Unit Conversion Information dialog.  The unit specification can also use any unit name previously defined with a $DefineUnits directive.  The unit specification can include a numerical constant.  In this case, the numerical constant must appear directly after the = sign and be separated from the first unit with a space.  See the 3rd example.

 

Examples:

 

$DefineUnits lb=lbf  {rename an existing unit specification}

F= 55 [lb]

 

$DefineUnits BHFF=Btu/hr-ft^2-F {allows a short way to enter a long unit specification}

 

$DefineUnits mW=0.001 W  {note that mW is the same as MW and MW was previously defined to be megawatts.  It will be overwritten}

g=1 [W]*Convert(W,mW)

 

 

See also: Entering Units

               Directives