Graphical Annotations

1 Graphical Representation of Resistor

The example below shows the use of graphical attributes in the form of annotations to define the different parts of the Resistor icon.


1.1 Electrical units


1.2 Electrical Connectors


1.3 Resistor


2 Graphical Annotation Attributes

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.


2.1 Basic Attributes

The basic attribute classes are Point, Extent, and Style with the corresponding attributes point, extent, and style.





2.2 Built-in Attributes to Classes, Instances and Connections


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.





2.3 Definitions of Graphical Elements

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.









2.4 Choices Annotations for Variables and Enumerations Types

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:



2.5 Choices Annotations for Replaceable Model Elements

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:


2.6 Resistor


2.7 MyResistor


2.8 MyCircuit

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:




2.9 Additional Examples of Replaceable Class Declarations

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.