Main Content

Mask a Variant Subsystem

This example shows how to use a masked Variant Subsystem block in a Simulink model. Click the Open Model button located on the top right corner to view the related example model. This example model references masked library blocks.

When you mask a Variant Subsystem block, you can specify the variant choice from the mask dialog box. The variant choice that you specify on the mask dialog box is applied on the underneath Variant Subsystem block.

To pass the variant choice from the mask to the Variant Subsystem block, you can either use the set_param command or the parameter promotion option.

Let us consider the cases described in the example model.

  • Case 1: The mask parameter promotion option is used to promote the Variant Subsystem block parameter to the mask. The Variant Subsystem block is wrapped within a masked Subsystem block. Initialization code (set_param) is used in the Variant Subsystem block to define the variant choice which is further passed on to the mask on the Subsystem block using parameter promotion. This promoted parameter records the variant choice specified from the masked Subsystem block.

  • Case 2: The Popup mask parameter is used to create the choice option on the top level masked Subsystem block. This masked Subsystem block contains a Variant Subsystem block. Initialization code (set_param) is used in the Variant Subsystem block to define the variant choice. The value that you specify as a variant choice from the mask dialog box (Popup parameter) is transferred to the underneath Variant Subsystem block to set it choices.

  • Case 3: This case is similar to Case 2 with an additional layer of Variant Subsystem block in the model. Initialization code (set_param) in the Subsystem block is used to define the variant choice.

  • Case 4: Parameter promotion is used to record the choice from the parent block on the masked Subsystem block. The masked Subsystem block contains a masked Variant Subsystem block within. Initialization code (set_param) in the Variant Subsystem block mask sets the parameter value that is passed from the Subsystem block (MaskedSubsystem1).