





It is possible to annotate parameters or parameter types in order that it's possible to make a selection from a set of values from a pull down menu. For example, setting a parameter true or false can be made by selecting on or off as shown below.
![]()
The needed declarations for this appearance is:
type OnOff = Boolean annotation (choices(choice=false "off", choice=true "on"));The following examples show similar choices from a set of predefined vectors representing different common directional axes or commonly used colors. In the example to the right, a selection has been among a set of strings.
parameter OnOff animation=false "Enable/disable animation";
![]()
![]()
![]()
The corresponding declarations are:type Axis = Real[3] annotation (choices(
choice={1,0,0} "{1,0,0} - x axis",
choice={0,1,0} "{0,1,0} - y axis",
choice={0,0,1} "{0,0,1} - z axis",
choice={0,0,0} "any axis"));
parameter Axis n={1,0,0} "Axis of rotation";type Color = Real[3] annotation (choices(
choice={1,0,0} "red",
choice={0,1,0} "green",
choice={0,0,1} "blue"));
parameter Color color={1,0,0} "Object color";type Shape = String annotation (choices(It should be noted that, it's possible to enter any value without using the pull downmenu. This enables the use of expressions, for example.
choice="" "none",
choice="box" "box",
choice="cylinder" "cylinder"));
parameter Shape shape="" "Animation shape";
model M
CompType *pattern*;
end M;
model M
extends *pattern*;
*pattern* comp_name;
CompType c1(redeclare *pattern* c2);
end M;
annotation (
defaultComponentName="world",
defaultAttributes="inner",
missingInnerMessage="No \"world\" component is defined. A default world
component with the default gravity field will be used
(g=9.81 in negative y-axis). If this is not desired,
drag MultiBody.World into the top level of your model.",
import Modelica.Math.*
= true
sin(1)
= 0.841470984807897
a=1:10
Declaring variable: Integer a [10];
a=1:20
Redeclaring variable: Integer a [20];