Adding Attributes to Classes


Because SansGUI supports hierarchical levels of classes, an attribute entered in a super class is inherited by all its subclasses. Therefore, the attribute list of a class is defined as a collection of attributes from all of the classes in the path, root down to the actual class.

Creating Attributes

To add attributes to a class, you need to access the Attribute Grid View of the class. The Attribute Grid View of the class can be obtained in the right pane by selecting the class in the Tree View in the left pane. The Attribute Grid View contains a list of all of the class attributes either inherited from its ancestor classes in the class path or created locally in the class. At the class level, you can only modify locally created attributes. All the inherited attributes are protected, as shown by the background color similar to that of the tool tips registered in the Windows environment. Each row in the Attribute Grid View represents an attribute definition in the class.

If an attribute can be added to a class, the first column of the last row of the Attribute Grid View contains a New>> cursor. In order to create a new attribute, merely enter the attribute code. Once the code is entered, a sequence number is automatically assigned and the New>> cursor is move down to a newly appended row. You need to enter the attribute label and change the default attribute definitions to fit your requirements. The following are a couple notes that may help before going into the details of Attribute Definitions:

Attribute Definitions

The following describes the groups of columns used for class attributes:

Code

The attribute code is an internal key for the attribute. It is used by SansGUI to find a matching attribute during class schema version evolution. The code should be unique in the entire class path, including those inherited from the ancestor classes. The attribute code is used as the variable name during source code generation. Taking all of that into consideration, you should apply the variable identifier rules and conventions to select the attribute code. For example, a variable must start with a letter or an underscore in the C programming language. SansGUI will turn all non-alphanumeric characters into underscores and prefix an underscore to the variable name if the first character is a digit.

Attribute

The attribute field contains the name of the attribute to be displayed in the user interface. It is a short description of the attribute and can be any arbitrary string.

Scope

All the attributes in a class will be turned into variables local to the class. Programmatically, a class function has read and write privileges for all the data members in any instance of the class. The class function can also access any data object that is passed to it through the SansGUI application programming interface (API). For example, the simulation control object is passed to all the class functions; therefore, the data members in it become globally accessible. Certainly, a good programming practice is to treat global variables with extreme care, especially when there are synchronization concerns.

In addition to local and global visibility of attributes, SansGUI has a set of copy rules for synchronizing the values in the GUI controls and the internal object data. For a cell attribute, which occupies a single cell in a data input sheet, the copy rules are applicable because the GUI control and the object data have different data storage. The copy rules are not applicable to any array attribute because the same data storage is used for both the GUI control and the internal object data in order to save memory space.

The above scopes are mutually exclusive, meaning that only one scope can be selected at a time. One is suppressed when the other is turned on.

Logistic

Logistic definitions of an attribute indicates how the attribute is managed in the SansGUI environment and in the textual Model File. The available definitions are:

Literal

String literals in this group differ from those string types listed in the Special Types group in the sense that these types can coexist with other type definitions, such as a numerical quantity. Because SansGUI is dynamically typed during model configuration, you can specify more than one type in the attribute definition. For example, a numerical field can be specified to allow an input file name so that the data can be obtained by fetching the contents of the file during the simulation run. See the GUI Control Data Representation section in the SansGUI Reference Manual for more details.

Quantity

The definitions in the quantity group specify the attribute with a numerical type, limits, and its unit of measurement. A cell attribute may also contain a vector or a matrix. See the GUI Control Data Representation section in the SansGUI Reference Manual for details on the syntax and semantics of quantity definitions. It should be noted that the Integer, Real-Single Float, and Real-Double Float definitions are mutually exclusive.

For quantity attributes, the following can be specified:

Quality

The definition of a qualitative attribute contains an adjective and a noun phrase for three critical points: 1) a low threshold, 2) a neutral point, and 3) a high threshold. With these three points, four additional ranks can be defined, which are: 1) below low threshold, 2) somewhat low, 3) somewhat high, and 4) beyond high threshold. The adjectives and the noun phrases are used to construct a linguistic expression for a qualitative value. For example, in the seven selectable ranks in the Quality Input Assistant, the adjective and the noun phrase for a critical point can be in the format of "as <Adjective> as <Noun Phrase>." A sample qualitative value for a temperature attribute is "as hot as the boiling point."

Quantity/Quality Map

When a mapping between the quantity and quality space is desired, you need to specify a Certainty Level and an Allowance Factor for each defined critical point. When they are properly specified, each point in the quantity space will have an associated qualitative rank and a confidence factor, ranged between 0.0 and 1.0. The certainty level determines the hedge, or how wide the confidence factor distribution curve should be around the critical point. SansGUI uses certainty level 1 for normal blending between two ranks. For each increasing certainty level, SansGUI simply condenses the curve of the previous level by taking the square value of each point in the curve. The certainty level can be from 1 to 7, as depicted in the following figure. The horizontal axis U represents a normalized quantity space.

 

Generate/adding_attributes_to_cla.gif

 

The allowance factor determines a cut-off line from 1.0. When the user enters a confidence factor that is beyond (1.0 - AllowanceFactor), the (1.0 - AllowanceFactor) will be used to calculate the selection range in the quantity space. If the confidence factor is on or below (1.0 - AllowanceFactor), the confidence factor is used directly to obtain the selection range. You can use this factor to set a minimum selection range of a rank.

 

Generate/adding_attributes_to_cla1.gif

 

The fields for Quantity/Quality Map definitions are:

Special Types

Except Object Reference, the following special types are static, meaning that the types cannot coexist with other types when it is defined. They use special GUI controls; therefore, the type is fixed. The Object Reference type can coexist, however, with the a URL/File type and/or a quantity type. The actual type of such an attribute is determined when the user actually enters its value in the GUI control, which becomes fixed during simulation run-time. See the GUI Control Data Representation section in the SansGUI Reference Manual for more details.

It is much easier to enter enumerated items and object reference classes in the Attribute Properties dialog, which is discussed in more detail below.

Using Attribute Properties Dialog

The Attribute Grid View shows a class attribute in each row. The advantage is that you can see all the class attributes in one sheet. However, it is hard to edit the definitions of a particular attribute by scrolling this sheet horizontally. For this purpose, you can use the Attribute Properties dialog to examine and modify a single attribute. To invoke the Attribute Properties dialog:

When you double click on the Code or Attribute field, make sure that the pointer is not on top of any character; otherwise, it will lead you to a field editing mode. Most of the fields are the same as in the Attribute Grid View. The major input enhancements are with the Enumerated Items and Reference Classes.

Enumerated Items

To add new enumerated items:

You can arrange the sequence of the items by selecting an item and using the Move Up and Move Down buttons to move it. The Delete button is for deleting a selected item.

Object Reference

To enter a compatible reference class for an object reference field:

 



C:\FH_Suite\htmlgifs\home.gif Operating on Class Tree View Operating on Attribute Grid View

SansGUI Modeling and Simulation Environment Version 1.2

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

http://protodesign-inc.com