blockMultiSwitch
Set Boolean expression that is associated with the first active input signal
Information
The block has a vector of Boolean input signals u[nu] and a vector of (time varying) Boolean expressions expr[:]. 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 previous value of y is kept if parameter 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 usage is demonstrated, e.g., in example Modelica.Blocks.Examples.BooleanNetwork1.
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Boolean | use_pre_as_default | true | Set true to hold last value as default (y_default = pre(y)) |
| Boolean | y_default | false | Default value of output y if all u[i] = false |
| Integer | nu | 0 | Number of input connections |
Connectors
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica.Blocks.Interfaces.BooleanVectorInput[nu] | u | Set y = expr[i], if u[i] = true | |
| Modelica.Blocks.Interfaces.BooleanOutput | y | Output depending on expression |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| Boolean[nu] | expr | fill(false, nu) | Sets y = if u[i] then expr[i] else y_default (time varying) |