A conditional subsystem (also known as a conditionally executed subsystem) is a type of subsystem where you can control the execution using an external signal.
Enabled, Triggered, and Function-Call Subsystems are examples of conditional subsystems. The signal that controls a conditional subsystem is called the control signal and the port from which the signal enters the block is called the control port. For more information on conditional subsystems, see Conditionally Executed Subsystems Overview.
You can use a variant block to control the execution of a conditional subsystem blocks.
Consider this model.
Variant Source1 is a single-input/single-output Variant Source block with variant condition as
V==1. When you simulate this model, the variant condition from the
Variant Source1 block propagates to the control port of the
Subsystem block and then to the blocks connected to its inports and outports.
For example, when
Variant Source1 is active and the Variant condition propagates to the control port of the
Subsystem block. Therefore, the
Subsystem block is also active and the variant condition propagates to the blocks connected to the input and output ports of the
Function-Call Subsystem block is a subsystem that another block can invoke directly during simulation. The
Function-Call Subsystem block is analogous to a function in procedural programming language. For more information, see Using Function-Call Subsystems.
You can use a single-input/single-output variant block to make the
Function-Call Subsystem block conditional.
Variant Source block has condition
V is a
When you simulate this model, the variant condition from the Variant Source block propagates to the control port of the
SubA subsystem block and further propagates to the blocks connected to its inports and outports.
For example, when
SubA block is active and the variant condition propagates backward and forward to the blocks connected to the input (
In1) and output (
V~=1 (for example,
SubA becomes inactive, making
Out1 to be inactive.
In2 remains active as it is connected to
SubB, which is active.
In2 is not connected to
In2 becomes inactive when
Note: If the
Function-Call Subsystem is placed inside a virtual grouped subsystem, the variant condition triggering the
Function-Call Subsystem must match the corresponding condition on the input of the higher level subsystem block.