MultiSwitch

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

    MultiSwitch

Library

Modelica/Blocks/MathInteger

Description

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 isset to expr[i], if i is the first element in the input vector u that is true. If all input signals arefalse, 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 inputvector is enlarged by one and the connection is automaticallyconnected to this new free index (thanks to theconnectorSizing annotation).

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

Parameters

MultiSwitch_0

NameLabelDescriptionData TypeValid Values

mo_expr

expr

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

Vector

mo_y_default

y_default

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

Scalar

mo_use_pre_as_default

use_pre_as_default

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

Scalar

true
false

mo_nu

nu

Number of input connections

Scalar

MultiSwitch_1

NameLabelDescriptionData TypeValid 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'
'fixed'

mo__modifiers/value

Value

Ports

NameTypeDescriptionIO TypeNumber

u

implicit

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

input

1

y

implicit

Output depending on expression

output

1

See Also