Main Content

Assemble Variant Conditions Propagated from Variant Blocks

During simulation, Simulink® propagates the variant conditions specified on the variant blocks to the connecting blocks. The variant conditions propagated from multiple variant blocks are combined using the AND (&&) and OR (||) operators.

Cross-Coupling of Inputs and Outputs

In this model, the Variant Source block has two inputs with variant conditions Var == 1 and Var == 2, respectively. The first input to the Variant Source block branches into its second input before connecting to the block and are active when Var == 1 or Var == 2 evaluates to true.

During simulation, this model exhibits three modes of operation:

Variant ConditionActive Choice
Var == 1

First input of Variant Source

Var == 1 || Var == 2Second input of Variant Source and the branch of the first input
Var == 2Second input of Variant Source

Cascading Blocks and Compounding Conditions

In this model, Variant Source A and Variant Source B are two Variant Source blocks, each fed by two input ports and connected in a cascading manner. The inputs to Variant Source A are active when VarA == 1 or VarA == 2. The output of Variant Source A branches into one of the inputs of Variant Source B. The inputs to Variant Source B are active when VarB == 1 or VarB == 2 evaluates to true.

During simulation, this model exhibits eight modes of operation:

Variant ConditionActive Choice
VarA == 1 && VarB == 1

First inputs of Variant Source A and Variant Source B

VarA == 1 && VarB == 2First input of Variant Source A and the second input of Variant Source B
VarA == 2 && VarB == 1Second input of Variant Source A and the first input of Variant Source B
VarA == 2 && VarB == 2Second inputs of Variant Source A and Variant Source B
VarA == 1 && VarB != (1,2)First input of Variant Source A
VarA == 2 && VarB != (1,2)Second input of Variant Source B
VarA != (1,2) && VarB == 1None
VarA != (1,2) && VarB == 2Second input of Variant Source B
VarA != (1,2) && VarB != (1,2)None

Hierarchical Nesting of Blocks

In this model, multiple Variant Source blocks are used to create hierarchical nesting of variant choices and provide variations on sensor inputs. Multiple choices for sensors are first grouped by series: A Series, B Series, and C Series. The Variant Source block, Device Model, selects a sensor from one of the series. The Vendor block then chooses from the sensor choices provided by Device Model and X Sensor .

Simulink propagates complex variant control conditions to determine which model components are active during compilation.