Unit objects are the only kind of objects that can be created in Schema Definitions. They are derived from the Unit intrinsic class, defining a conversion table of measuring units. Each unit object represents a dimension of measurement, such as mass, length, temperature, force, or any unit that you need to incorporate in your simulator.
For an introduction to unit handling in SansGUI, please see the User Extensible Unit Conversion section in the SansGUI User's Guide. Here we discuss unit objects in Schema Definitions from the simulation developer's point of view.
Each unit object contains a unit table with the number of entries decided by the simulation developer. The table can be locked during the Object Library generation, or opened (default) for users to add their own favorite units. Locked unit objects can be modified only in service sessions, entered through the password set in the simulator identification. Indexed to the unit table, three unit entries are more significant:
Base Unit: the first unit entry with the conversion multiplier always set to 1.
Spec Unit: the unit specified in an attribute of a class for use by the simulator internally. It is a good idea to use the Base unit as the Spec unit because this will eliminate the need of a conversion. However, this is not a requirement. The simulator can use any appropriate unit entries in different situations. All the values in the model will be converted to Spec units in the manipulation layer before being sent to the simulator.
User Unit: the unit to be used in an attribute for presentation purposes. It is selected by the user when entering data or viewing simulation results. Until the user makes a selection, the default User unit is the same as the Spec unit.
From the above definition, a unit table contains unit entries with a Base unit. The Spec and User units are stored on a per attribute basis. If the user changes a User unit, all data values associated with such attribute in the objects, parts, or links will be converted accordingly.
Except for temperature, all the units are linearly scaled. That is, the data of the source unit is divided by the source unit multiplier and then multiplied by the target unit multiplier.
TargetValue = (SourceValue / SourceUnitMultiplier) × TargetUnitMultiplier
The temperature units are handled specially for its "offset in addition to scaling" nature. For example, to convert 100 degree Celsius to Fahrenheit, we multiply 1.8 and then add 32 to the result:
100 degree Celsius = 100 × 1.8 + 32 degree Fahrenheit = 212 degree Fahrenheit
SansGUI Modeling and Simulation Environment Version 1.2
Copyright © 2000-2003 ProtoDesign, Inc. All rights reserved.