Adding Unit Objects


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.

Creating Unit Objects

To create a unit object:

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.

Unit Conversion Table

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:

The Data sheet contains the actual unit conversion table, with two columns:

Temperature Unit Object

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.

Dynamic Conversion Table

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:

 



C:\FH_Suite\htmlgifs\home.gif Defining Simulation Control Classes Adding Classes

SansGUI Modeling and Simulation Environment Version 1.2

Copyright 2000-2003 ProtoDesign, Inc. All rights reserved.

http://protodesign-inc.com