WOLFRAM SYSTEM MODELER

DynamicSelect

DynamicSelect

Wolfram Language

In[1]:=
SystemModel["ModelicaReference.Annotations.DynamicSelect"]
Out[1]:=

Information

This information is part of the Modelica Standard Library maintained by the Modelica Association.

Define schematic animation of diagram layer

Examples

The level of a tank is animated by a rectangle expanding in vertical direction and its color depending on a variable overflow:

annotation(
  Icon(graphics={Rectangle(
    extent=DynamicSelect({{0,0},{20,20}},{{0,0},{20,level}}),
    fillColor=DynamicSelect({0,0,255},
                            if overflow then {255,0,0} else {0,0,255}))}
);

Description

Any value (coordinates, color, text, etc.) in graphical annotations can be dependent on class variables using the DynamicSelect expression. DynamicSelect has the syntax of a function call with two arguments, where the first argument specifies the value of the editing state and the second argument the value of the non-editing state. The first argument must be a literal expression and this value is used for the annotation when editing and/or browsing the diagram layer. The second argument may contain references to variables to enable a dynamic behavior and the actual value is used for the annotation for schematic animation of the diagram layer, e.g., after a simulation.