The example below shows the use of graphical attributes in the form of annotations to define the different parts of the Resistor icon.
There are a number of predefined graphical annotation attributes, which can be divided into basic attributes; built-in attributes to classes, instances, and connections; and attributes that are graphical elements to specify the appearance of class icons.
The basic attribute classes are Point, Extent, and Style with the corresponding attributes point, extent, and style.
The annotation elements CoordinateSystem, Placement, and Route below are by default associated with classes, instances, and connection equations respectively. This means that these elements including their attributes exist even if they are not mentioned explicitly in the annotations of these entities. The Route annotation element also has alternative names such as Line and Polygon defined in the next section.
The following predefined graphical elements are used as graphical annotation elements including annotation attributes when defining the appearance of class icons. The Line graphical element can also be used for connection lines.
The choices annotation is applicable to both replaceable and nonreplaceable elements. For example, consider the following Integer type called KindOfController used to represent a choice of controller in the modeling process. This choice is made from the following enumeration of three recommended alternatives:
Assume that KindOfController is used in a model A as below:
If you interactively choose the third alternative from the menu this corresponds to giving the default value 3 for the instantiated variable x in the following code for an instance a2 of the model A:
The choices annotation can also be used to generate menus with redeclaration alternatives for replaceable models. For example, consider the following replaceable model with a choices annotation:
If the user would choose the first alternative, the following code might be produced if MyResistor is part of the class MyCircuit and the chosen name of the instantiated component is x:
Additional examples of replaceable class declarations with redeclaration choices are shown below. In the first example you can choose between a resistor and a capacitor as choices of components with two pins, and in the second example a friction function is implemented as a constant, a table, or defined as an exponentiation function depending on your choice.