A Unit Object defines a dimension of measuring units. One very common example of a dimension is length. Some measuring units associated with length are meter, centimeter, millimeter, inch, foot, yard, etc. A Unit Object is referred to by attributes in all the classes that use the set of units in the same unit dimension. Quantities with different magnitudes but measured in the same unit dimension can still share the same unit object. For example, the lengths of lumbers are measured in feet and the lengths of nails are in inches. They may share the same Length unit object, which contains both foot and inch in the unit table. The preferences of unit entries (indices to the unit table) are stored on a per-attribute basis. Internal to a simulator, the simulation developer specifies what unit entry is expected in an attribute, so that SansGUI can convert associated values in the data objects to use the specified unit. At the user interface layer external to the simulator, the simulation user specifies what measuring unit is used to enter the data in an attribute so that SansGUI can store and present the data accordingly. For an introductory text on Unit Objects, see Chapter 1 of this manual.
To create a unit object:
Right click on the Unit class in the Tree View under the Simulator tab.
Select Add Unit Object menu item from the context menu.
An Object Properties dialog will be displayed for you to enter the name of the unit dimension, such as Length, Mass, Force, Pressure, Currency, etc., in the Object Name field.
Do not use this method to create a Temperature unit object. Use a separate menu item Add Temperature Object to do it because the Temperature object is handled as a special case, which is described in further detail.
Each unit object contains a unit conversion table. The unit conversion table has two sheets, a Specification sheet and a Data sheet. In the Specification Sheet, there are two fields:
Number of Entries: this integer number specifies the number of unit entries in the unit conversion table in the Data sheet. It must be at least 1, which is for the base unit entry.
Locked Entries: this is a protected field in which the value will be filled during the Object Library generation process. At that time, the Locked Entries value will be the same as the Number of Entries. This distinguishes the entries created by the simulation developer from those entered by the simulation user.
The Data sheet contains the actual unit conversion table, with two columns:
Multiplier: the multiplier column is used to specify the unit entry in accordance with the base unit. For example, if the base unit is 1 meter, the multiplier for centimeter is 100. One can treat them as equality. For example, one meter is equal to 100 centimeters. Conversely, if centimeter is the base unit with multiplier 1, the multiplier for meter is 0.01. Meaning, one centimeter is equal to 0.01 meter.
Unit Name: the name string of the unit, to be displayed in the unit selection list.
Because of the offset nature in converting values between Centigrade (Celsius) and Fahrenheit temperature units, the unit object for temperature is handled specially. To create the special Temperature unit object, right click on the Unit class and select Add Temperature Object, instead of Add Unit Object as described above. The base unit is always set to K (Kelvin) and two entries for degC and degF are automatically created with the Multiplier fields marked as {SpecialHandler}. You can add an entry degR for Rankine, for example, with 1.8 being the multiplier. Meaning, there are 1.8 degrees Rankine for every Kelvin.
Almost all the relationships among units in a unit dimension are constant, meaning that they are represented by constant multipliers. However, there are some useful conversion tables that may require dynamic multipliers. One example is the currency exchange rate table. SansGUI can support dynamic currency conversion in the following manner:
The simulation developer determines the currency to be used for calculations in the simulator. Enter it as the base unit with the multiplier set to default 1. Do not enter any other currency entries.
The simulation user extends the unit table by entering the name of the currency and the multiplier of the day for each currency of interest. Once the currencies are entered, the user can select the currency of their preference in the presentation layer.
SansGUI Modeling and Simulation Environment Version 1.2
Copyright © 2000-2003 ProtoDesign, Inc. All rights reserved.