Note
Configurable Subsystem will be removed in a future release. The Configurable Subsystem blocks in existing models must be converted to Variant Subsystem blocks.
Variant Subsystems offer more capabilities than Configurable Subsystems, with these advantages:
You can mix Model blocks and Subsystem blocks as variant choices.
You can specify variants that have different numbers of input and output ports.
Perform these steps to convert Configurable Subsystem block to a Variant Subsystem block:
Open a model containing Configurable Subsystem block.
Right-click the Configurable Subsystem block and in the context menu, select Subsystem & Model Reference > Convert to > Variant Subsystem.
By default, the Copy without creating links to the configurable subsystem library check box is selected. This creates Variant choices without creating links to library.
Click OK. The Configurable Subsystem block is converted to Variant Subsystem block and is displayed in a new window.
Note
When Configurable Subsystem block is converted to a
Variant Subsystem block, the Block choice of
Configurable Subsystem block is changed to
LabelModeActiveChoice
in Variant Subsystem
block.
Manually replace the Configurable Subsystem block with the converted Variant Subsystem block in the original model.
When you load a model containing Configurable Subsystem blocks, a warning is displayed which will instruct you to convert the Configurable Subsystem block to a Variant Subsystem block.
Consider a model with Configurable Subsystem block. When you load this model, a warning is displayed in the Diagnostic Viewer.
Note
When you create a new Configurable Subsystem block, an upgrade advisor alert is displayed to convert the Configurable Subsystem block to Variant Subsystem block.
In the Diagnostic Viewer, click Open in the Suggested Actions section.
In the Upgrade Advisor, select Identify configurable subsystem blocks for converting to variant subsystem blocks and then click Run This Check. A list of all the Configurable Subsystem blocks in the model and recommend action to be performed is displayed.
Also, when you simulate the model containing Configurable Subsystem blocks, Upgrade Advisor warning is displayed in the editor. A sample screenshot is as shown below.
When Configurable Subsystem block is converted to a Variant Subsystem block, the Block Choice of Configurable Subsystem block is changed to Label mode active choice in Variant Subsystem block.
To change the active variant, perform one of these steps:
Right-click the badge on the Variant Subsystem block
and select Block Parameters (Subsystem). In the
block parameters dialog box, select the active variant from
Label mode active choice
drop-down
list.
Right-click the badge on the Variant Subsystem block and select Label Mode Active Choice.
Note
When a Configurable Subsystem block with a mask is
converted to Variant Subsystem block, the Label
mode active choice
option and all other parameters in
block parameters dialog box is disabled. To change the active variant,
right-click the badge on the Variant Subsystem block and
select Label Mode Active Choice.
Configurable Subsystem blocks in a model can be converted to
Variant Subsystem blocks programmatically using
convertToVariant
method.
When a Configurable Subsystem is converted to a Variant
Subsystem block, the Block choice of Configurable
Subsystem block is changed to LabelModeActiveChoice
in the Variant Subsystem block.
If the Block choice of the Configurable Subsystem template block is linked, then the block is copied to the Variant Subsystem graph and the copied blocks will have its links retained. If the Block choice of the Configurable Subsystem template block is not linked, then the block is copied to the Variant Subsystem graph and the block in the Configurable Subsystem library is linked to it.
Perform these steps to convert Configurable Subsystem blocks in a model to Variant Subsystem blocks:
Open a model containing Configurable Subsystem block.
In the command-line, enter the find_system
command to
find all the Configurable Subsystem blocks in the
model:
find_system(bdroot, 'Regexp', 'on', 'LookUnderMasks', 'on','FollowLinks', 'on', 'Variants', 'AllVariants', 'TemplateBlock', '.')
The Configurable Subsystem blocks present in the model are listed:
{'mconfigsub/config_sub'} {'mconfigsub/nested config'}
Find the library template blocks from the list using
get_param
command.
get_param('mconfigsub/nested config','TemplateBlock') ans = 'mconfiglib/nested config' get_param('mconfigsub/config_sub','TemplateBlock') ans = 'mconfiglib/Subsystem/config_sub'
Convert the library template blocks to Variant Subsystem blocks using
convertToVariant
method:
Simulink.VariantManager.convertToVariant('mconfiglib/nested config') Simulink.VariantManager.convertToVariant('mconfiglib/Subsystem/config_sub')
For information on using this method, see convertToVariant
.
Save the libraries. You can use save_system
command to
save the libraries.
Close and open the model again. The Configurable Subsystem blocks in the model will be converted to Variant Subsystem blocks.