SansGUI uses an innovative mechanism to deal with units of measure and unit conversion. The idea is to separate unit conversions into data presentation and manipulation layers. Simulation users can specify the units used for data presentation in object, part and link properties dialogs, in data grid views, in simulation result logs, and in plotting specifications. At the programming side, all the calculation routines in the simulator, the user overriding routines, the routines to import or export data, and the textual model file generation routines, use the units specified by the simulation developer. Therefore, the units specified by the simulation developer are needed when the simulation user starts to write plug-in routines. In most cases, however, the simulation user is dealing with the presentation layer only.
In the SansGUI Object System, each dimension of quantity, such as length, mass, temperature, time, etc. is represented by a unit object. A unit object contains the number of unit entries and a unit conversion table. The minimum number of unit entries in the table is 1, the base unit, which is decided by the simulation developer. There may be more unit entries defined in the table. The table may be extended by the simulation user, if the unit object is unlocked or a service session is entered.
The unit conversion table in a unit object always has the first entry as Base Unit, with a constant conversion multiplier 1.0. An example of the length unit looks like:
|
Multiplier |
Unit Name |
1 |
1 |
m |
2 |
100 |
cm |
3 |
1000 |
mm |
4 |
39.37 |
inch |
The table can be interpreted as one meter is equal to 100 centimeters and is equal to 1000 millimeters and is equal to 39.37 inches. In this example, the first entry, meter, is the base unit. Although recommended, the base unit may not be the same as the unit specified for a certain attribute by the simulation developer. The user can select a presentation unit on an attribute-by-attribute basis.
There are unit objects that require special handling:
Temperature measurements involving Celsius and Fahrenheit are not in ratio scales; therefore, SansGUI provides a special handler for the two unit entries in the table.
Dynamic unit tables are possible when the simulation developer supplies only the base unit entry and leave the table open for the user to enter all the additional entries. An example is a table for currency exchange. Because the exchange rates vary day by day, the user can modify the conversion multiplier according to the daily rates obtained.
An Object Library or a Project Model contains pre-defined unit objects for the simulator. Before a shared class can be imported from another Object Library, the units used in the shared class should exist in the current Object Library or Project Model; otherwise, drag-and-drop the unit objects, referred to by the shared class, from the source to the target is necessary. It is very important that the imported classes use the same unit table, if existing, to specify required units for data manipulation.
SansGUI Modeling and Simulation Environment Version 1.2
Copyright © 2000-2003 ProtoDesign, Inc. All rights reserved.