Main Content

Variant Function-Call Signals on Variant Subsystem Outport

This example shows how the Variant Subsystem block allows function-call signals to be merged on its outports.

Explore the Model

Open the model slexVariantSubsystemFunctionCall.slx. The model contains a Variant Subsystem block with the conditions A==1 and A==2. choices. A is the variant control variable defined in the PostLoadFcn in File > ModelProperties > Callbacks. A Pulse Generator block is connected to the Variant Subsystem block and all its choices.

open_system('slexVariantSubsystemFunctionCall.slx')

Chart1 and Chart2 are configured with port names that match the corresponding port names of the Variant Subsystem block.

open_system('slexVariantSubsystemFunctionCall/Variant Subsystem')

Simulate the Model

1 Enable the Output function call option on the outport Block Parameters dialog box on which the function-call is passed. To enable this option programmatically, use this command:

set_param(variantsubsytem_outport_path,'OutputFunctionCall','On')

2 Simulate the model by executing Simulation > Update Diagram.The variant condition propagation determines active and inactive variant choices.

  • When A==1, Chart1 is active.

  • When A==2, Chart2 is active.

The outport activate() gets function-call signal from the choices Chart1 and Chart2. When the Function-Call Subsystem block is triggered, there is a sine wave output at Out2.

sim('slexVariantSubsystemFunctionCall.slx')
load_system('slexVariantSubsystemFunctionCall/Variant Subsystem')