Digital Formation, Inc.     Technical Document #1006


Subject: Editing the Units Conversion Dictionary

Product: RIS-View & RIS-Info

Last Updated: February 22, 1999


Overview

This document describes how the Units Conversion Dictionary (UCD) is laid out, and how to edit it to add your own units. The basic configuration of the conversion file is a Windows INI file, where there are sections with various keys. Each section relates to a dimension (for example, length or time), and each key relates to a unit within that dimension (for example, feet or seconds). The UCD is by default stored in the product Bin directory, in the file Units.INI (e.g. C:\Program Files\product\Bin\Units.INI).


Details

The Units Conversion Dictionary is laid out in a standard Windows INI format, similar to the SYSTEM.INI or WIN.INI from Windows for Workgroups. This open format allows the flexibility needed to do mappings between different unit systems, while making the format accessible to non-programmers. The file can be edited using any plain text editor, like NotePad.

The first section in the UCD is called [Dimensions]. Each item in this section is the name of a dimension section to be listed later in the file. This way, new dimensions can be added by simply adding a key to the [Dimensions] section, and adding the section and unit conversions within the file for that dimension. Each of the other sections of the UCD specifies the unit conversions for a particular dimension. For example, for the length dimension, there can be conversions for feet, meters, inches, millimeters, etc. Each unit conversion specifies a multiplier (or factor) and additive (or offset) portion for converting a unit to another unit within the same dimension:

value_in_dest_units = value_in_src_units * multiplier + offset

So for a destination units of inches and a source of centimeters (cm), where there are 2.54 cm per inch, the multiplier is 2.54, and the offset is 0:

value_in_inches = value_in_cm * 2.54 (cm/inch) + 0 (offset)

A short description of each unit type can also be entered. Converting (or transforming) a unit from one dimension to another (like inversions of the form: OHMM = 1 / CONDUCTIVITY) is not currently supported.

The list of dimensions in the [Dimensions] section, and the dimension sections themselves, are usually kept in alphabetical order. This makes it easier to find a section for editing. However, the software does not depend on this ordering.

The first item in each dimension section is the "default" units for that dimension, and is therefore the key value that all other units within that dimension try to revert to. As long as each unit listed in the dimension's section can be converted back to the key value units, conversions between any of the units for that dimension are possible. The key value units are only used to have a base units to work with for doing conversions. For example, for the length dimension [LENG], the key units are inches (IN). The key units do not need any additional information to map back to themselves, so the multiplier is 1, and the offset is 0. For a units of centimeters to convert to inches properly, using a conversion of 2.54 cm/inch, the multiplier would be 2.54, and the offset would be 0. This stub section shows this relationship:

[LENG]
IN=1, 0, Inches
CM=2.54, 0, Centimeters

Any real number can be used for the multiplier or offset, and for numbers that become excessively large or small, proper scientific notation may be used. For example, for the number 0.0000543, the scientific notation would be 5.43e-05, and for 543000 the scientific notation would be 5.43e+05.


Conclusions

By editing the Units Conversion Dictionary, users can add any units that we may have overlooked, or to accommodate unit names seldom seen. Even units from different languages can be incorporated.


Copyright © 1999 Digital Formation, Inc.
Contact information on the Technical Document Index page.