MultiSwitch
Set Boolean expression that is associated with the first active input signal
Library
Modelica/Blocks/MathBoolean
Description
The block has a vector of Boolean input signals u[nu] and a vector of(time varying) Boolean expressions expr[:]. The output signal y isset 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 theprevious 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 exampleModelica.Blocks.Examples.BooleanNetwork1.
Parameters
Name | Label | Description | Data Type | Valid Values |
---|---|---|---|---|
mo_expr | expr | Sets y = if u[i] then expr[i] else y_default (time varying) | Vector | true |
mo_use_pre_as_default | use_pre_as_default | Set true to hold last value as default (y_default = pre(y)) | Scalar | true |
mo_y_default | y_default | Default value of output y if all u[i] = false | Scalar | true |
mo_nu | nu | Number of input connections | Scalar |
Name | Label | Description | Data Type | Valid Values |
---|---|---|---|---|
mo__nmodifiers | Number of Modifiers | Specifies the number of modifiers | Number | |
mo__modifiers | Modifiers | Add new modifier | Structure | |
mo__modifiers/varname | Variable name | Cell of strings | 'firstActiveIndex' | |
mo__modifiers/attribute | Attribute | Cell of strings | 'start' | |
mo__modifiers/value | Value |
Ports
Name | Type | Description | IO Type | Number |
---|---|---|---|---|
u | implicit | Set y = expr[i], if u[i] = true | input | 1 |
y | implicit | Output depending on expression | output | 1 |