Main Content

Convert Configurable Subsystem to Variant Subsystem

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 do not need to create a library to create an instance of the variant subsystem.

  • You can specify variants that have different numbers of input and output ports.

  • You can control variant blocks through label modes and other modes.

  • You can generate code with the advanced code generation capabilities of variant subsystems.

You can convert Configurable Subsystem block to a Variant Subsystem block in one of the four ways:

Convert Configurable Subsystem Blocks to Variant Subsystem Blocks Using Upgrade Advisor Programmatically

Configurable Subsystem blocks in a model can be converted to Variant Subsystem blocks programmatically using upgradeadvisor.

Perform these steps to convert Configurable Subsystem blocks in a model to Variant Subsystem blocks:

  1. Open a model containing Configurable Subsystem block.

  2. Convert the library template blocks to Variant Subsystem blocks using upgradeadvisor. Create an object for upgradeadvisor, and run the method upgrade with the upgrader object output.

    upgrader = upgradeadvisor(bdroot);
    upgrader.upgrade
    

    For information on using this method, see upgradeadvisor. A report with the status of the block conversion is generated.

Convert Configurable Subsystem Blocks to Variant Subsystem Blocks Using Upgrade Advisor

Convert Configurable Subsystem blocks in a model to Variant Subsystem blocks using Upgrade Advisor.

When you compile 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.

  1. Consider a model with Configurable Subsystem block. When you compile 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.

  2. In the Diagnostic Viewer, click Open in the Suggested Actions section.

  3. 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 recommended action to be performed is displayed.

    Note

    To upgrade Configurable Subsystem instances created by Model discretizer in the model or subsystem level, perform the Recommended Action. The recommended action ensures that the information regarding discretization is retained.

    To convert to Variant Subsystem, right click on each of the Configurable Subsystem instances provided in the list and select Subsystem and Model Reference >Convert to>Variant Subsystem.

  4. In the model, perform the Recommended Action of running the Analyze model hierarchy and continue upgrade sequence to convert the configurable subsystem template blocks to update the listed configurable subsystem blocks. Upgrade Advisor guides you through the recommended sequence of steps to upgrade your models. Click Continue Upgrade Sequence to open the libraries in a sequence.

  5. In the library, run the Identify configurable subsystem blocks for converting to variant subsystem blocks again. Click the Convert All button to convert all the configurable subsystem blocks in the libraries in the sequence. You must run the Identify configurable subsystem blocks for converting to variant subsystem blocks check as many times as the number of libraries.

Convert Configurable Subsystem Blocks to Variant Subsystem Blocks Programmatically Using convertToVariant

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:

  1. Open a model containing Configurable Subsystem block.

  2. 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'}
  3. 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'
    
  4. Convert the library template blocks to Variant Subsystem blocks using convertToVariant.

    Simulink.VariantManager.convertToVariant('mconfiglib/nested config')
    
    Simulink.VariantManager.convertToVariant('mconfiglib/Subsystem/config_sub')
  5. Save the libraries. You can use save_system command to save the libraries.

  6. Close and open the model again. The Configurable Subsystem blocks in the model will be converted to Variant Subsystem blocks.

Convert Configurable Subsystem Blocks to Variant Subsystem Blocks Through the Dialog

  1. Open a model containing Configurable Subsystem block.

  2. Right-click the Configurable Subsystem block and in the context menu, select Subsystem & Model Reference > Convert to > Variant Subsystem.

  3. 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.

  4. 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.

  5. Manually replace the Configurable Subsystem block with the converted Variant Subsystem block in the original model.

Changing Active Variant

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.

See Also

Related Topics