Propagate Variant Conditions to Define Variant Regions Using Variant Source and Variant Sink Blocks - MATLAB & Simulink (original) (raw)

Main Content

Simulink® automatically propagates the variant conditions from the Variant Source and Variant Sink blocks to their connecting blocks. The propagation of variant conditions enables Simulink to determine which components of the model remain active during simulation. Simulink then deactivates the model components associated with the inactive choices and highlights the active connections.

Variant Source and Variant Sink Blocks

Consider the slexVariantSourceAndSink model containing two Variant Source blocks Variant Source1 and Variant Source2, and a Variant Sink block. The variant conditions at the inports and the outports of the Variant Source and the Variant Sink blocks determine the activation and deactivation of the blocks connected to them. V and W are the variant control variables and are defined in the PostLoadFcn callback of the model.

open_system("slexVariantSourceAndSink");

When you simulate the model, the variant conditions are propagated as follows:

If you set Allow zero active variant controls of the Variant Sink block to on, Simulink® also propagates the variant conditions to the unconditional blocks Sine5 and Gain4 of the variant region also. The variant conditions on Sine5 and Gain4 are the logical OR of the variant conditions, W == 1 and W == 2 of the Variant Sink block. When W == 1 and W == 2 evaluate to false, the condition W == 1 OR W == 2 evaluates to false, thus making Sine5 and Gain4 inactive. This ensures that Sine5 and Gain4 are removed from simulation and are not left unused when the Variant Sink block is inactive.

See Also

Propagate Variant Conditions to Define Variant Regions with Variant Blocks

Topics