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.
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's 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 like case 2 with an additional layer of Subsystem in the model. Here, the Variant Subsystem block is wrapped in a double layer of masked Subsystem block.