WOLFRAM SYSTEM MODELER

MultiSwitch

Set Integer expression that is associated with the first active input signal

Wolfram Language

In[1]:=
SystemModel["Modelica.Blocks.MathInteger.MultiSwitch"]
Out[1]:=

Information

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

This block has a vector of Boolean input signals u[nu] and a vector of (time varying) Integer expressions expr[nu]. The output signal y is set to expr[i], if i is the first element in the input vector u that is true. If all input signals are false, y is set to parameter "y_default" or the last value is kept, if use_pre_as_default = true.

// Conceptual equation (not valid Modelica)
i = 'first element of u[:] that is true';
y = if i==0 then (if use_pre_as_default then pre(y)
                                        else y_default)
    else expr[i];

The input connector is a vector of Boolean input signals. When a connection line is drawn, the dimension of the input vector is enlarged by one and the connection is automatically connected to this new free index (thanks to the connectorSizing annotation).

The usage is demonstrated, e.g., in example Modelica.Blocks.Examples.IntegerNetwork1.

Parameters (3)

y_default

Value: 0

Type: Integer

Description: Default value of output y if use_pre_as_default=false, as well as pre(y) at initial time

use_pre_as_default

Value: true

Type: Boolean

Description: = true, y holds its last value if all u[i]=false, otherwise y=y_default

nu

Value: 0

Type: Integer

Description: Number of input connections

Inputs (1)

expr

Default Value: fill(0, nu)

Type: Integer[nu]

Description: y = if u[i] then expr[i] elseif use_pre_as_default then pre(y) else y_default

Connectors (2)

u

Type: BooleanVectorInput[nu]

Description: Set y = expr[i], if u[i] = true

y

Type: IntegerOutput

Description: Output depending on expression

Used in Examples (1)

IntegerNetwork1

Modelica.Blocks.Examples

Demonstrates the usage of blocks from Modelica.Blocks.MathInteger