blockMultiSwitch

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

Information

This block has a vector of Boolean input signals u[nu] and a vector of (time varying) Real 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".

// Conceptual equation (not valid Modelica)
i = 'first element of u[:] that is true';
y = if i==0 then 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.RealNetwork1.

Parameters

TypeNameDefaultDescription
Realy_default0.0Default value of output y if all u[i] = false
Integernu0Number of input connections
Advanced
Integerprecision3Number of significant digits to be shown in dynamic diagram layer for y

Connectors

TypeNameDefaultDescription
Modelica.Blocks.Interfaces.BooleanVectorInput[nu]uSet y = expr[i], if u[i] = true
Modelica.Blocks.Interfaces.RealOutputyOutput depending on expression

Components

TypeNameDefaultDescription
Real[nu]exprfill(0.0, nu)y = if u[i] then expr[i] else y_default (time varying)