Control Variant Condition Propagation
During variant condition propagation, Simulink® automatically assigns conditions to blocks. The conditionality of a block depends on the presence of variant conditions and the behavior of its inputs. If a block is connected to at least one unconditional input, it is considered unconditional. However, the presence of certain blocks, such as the Scope block or Terminator block, can influence the propagation of variant conditions and the conditionality of connected blocks.
Consider the slexVariantStopCondProp
model.
model = "slexVariantStopCondProp";
open_system(model);
In Simulink, click Simulation > Run to view the variant condition propagation and observe the propagated variant conditions.
sim(model);
The
Variant Source1
block has the variant conditionA == 1
, which propagates both backward and forward to the connected blocks. The variant condition affects the behavior of connected blocks.
The
Sine Wave1
block is connected to a Scope block that is not influenced by variant conditions. The Scope block always displays the signal it receives fromSine Wave1
, regardless of the active variant choice. This makes theSine Wave1
block unconditional. Only if you remove the Scope block, the variant condition propagates to theSine Wave1
block, making it conditional.
If you replace the Scope block with a Terminator block, the
Sine Wave1
block remains unconditional. The Terminator block ends the signal flow without any conditional logic, so it does not affect the conditionality of theSine Wave1
block.
The input of the Sum block is connected to the
Gain5
(conditional) block and theSine Wave2
(unconditional) block. Since theSine Wave2
block is unconditional, its output is always available to the Sum block. Therefore, the Sum block is considered unconditional because it can perform the summation using the unconditional input from theSine Wave2
block.
Stop Propagation of Variant Conditions Upstream and Downstream
Consider the section of the model that is connected to the Variant Source2
and Variant Source3
blocks. When you simulate the model, the variant conditions from the Variant Source2
block and the Variant Source3
blocks propagate upstream and downstream.
The Stop on both sides
block between the Gain6
and Gain7
blocks prevent the variant conditions from propagating upstream or downstream. Double-click the Stop on both sides
block to view its components.
The Stop on both sides
block uses a Terminator block to stop variant condition propagation upstream to the Subsystem block. To stop variant condition propagation downstream to the Subsystem block, one of the inports is connected to a Ground block, which is unconditional. Therefore, this arrangement stops the variant condition propagation both upstream and downstream. Similarly, you can selectively stop the propagation of variant conditions upstream or downstream for a model. For example, if you remove the Terminator block, the variant condition propagates upstream but is stopped downstream.
Stop Propagation of Variant Condition Downstream
Here, one input port of the Subsystem block is unconditional since it received input from the unconditional Ground block. This makes the Subsystem block unconditional, stopping the propagation of the variant condition downstream.
More About
Propagate Variant Conditions to Define Variant Regions with Variant Blocks