blockMultiSwitch

Set Integer 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) Integer 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 to pre(y) depending on the parameter use_pre_as_default:

  // 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];

Parameters

TypeNameDefaultDescription
Integery_default0Default value of output y if use_pre_as_default=false, as well as pre(y) at initial time
Booleanuse_pre_as_defaulttrue= true, y holds its last value if all u[i]=false, otherwise y=y_default
Integernu0Number of input connections

Connectors

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

Components

TypeNameDefaultDescription
Integer[nu]exprfill(0, nu)y = if u[i] then expr[i] elseif use_pre_as_default then pre(y) else y_default