Main Content

Configurable Subsystem

Represent any block selected from user-specified library of blocks

Configurable Subsystem block will be removed in a future release. Use Variant Subsystem, Variant Model, Variant Assembly Subsystem instead. For more information on updating your model, see Version History.

  • Configurable Subsystem block

Libraries:
Simulink / Ports & Subsystems

Description

The Configurable Subsystem block represents one of a set of blocks contained in a specified library of blocks. The context menu of the Configurable Subsystem block lets you choose which block the configurable subsystem represents.

Configurable Subsystem blocks simplify creation of models that represent families of designs. For example, suppose that you want to model an automobile that offers a choice of engines. To model such a design, you would first create a library of models of the engine types available with the car. You would then use a Configurable Subsystem block in your car model to represent the choice of engines. To model a particular variant of the basic car design, a user need only choose the engine type, using the configurable engine block's dialog box.

To create a configurable subsystem in a model, you must first create a library containing a main configurable subsystem and the blocks that it represents. You can then create configurable instances of the main subsystem by dragging copies of the main subsystem from the library and dropping them into models.

You can add any type of block to a main configurable subsystem library. Simulink® derives the port names for the configurable subsystem by making a unique list from the port names of all the choices. However, Simulink uses default port names for non-subsystem block choices.

You cannot break library links in a configurable subsystem because Simulink uses those links to reconfigure the subsystem when you choose a new configuration. Breaking links would be useful only if you do not intend to reconfigure the subsystem. In this case, you can replace the configurable subsystem with a nonconfigurable subsystem that implements the permanent configuration.

Creating a Main Configurable Subsystem

To create a main configurable subsystem:

  1. Create a library of blocks representing the various configurations of the configurable subsystem.

  2. Save the library.

  3. Create an instance of the Configurable Subsystem block in the library.

    To do so, drag a copy of the Configurable Subsystem block from the Simulink Ports & Subsystems library into the library you created in the previous step.

  4. Display the Configurable Subsystem block dialog box by double-clicking it. The dialog box displays a list of the other blocks in the library.

  5. Under List of block choices in the dialog box, select the blocks that represent the various configurations of the configurable subsystems you are creating.

  6. To apply the changes and close the dialog box, click the OK button.

  7. Select Block Choice from the context menu of the Configurable Subsystem block.

    The context menu displays a submenu listing the blocks that the subsystem can represent.

  8. Select the block that you want the subsystem to represent by default.

  9. Save the library.

    Note

    If you add or remove blocks from a library, you must recreate any Configurable Subsystem blocks that use the library.

If you modify a library block that is the default block choice for a configurable subsystem, the change does not immediately propagate to the configurable subsystem. To propagate this change, do one of the following:

  • Change the default block choice to another block in the subsystem, then change the default block choice back to the original block.

  • Recreate the configurable subsystem block, including the selection of the updated block as the default block choice.

If a configurable subsystem in your model contains a broken link to a library block, editing the link and saving the model does not fix the broken link the next time you open the model. To fix a broken library link in your configurable subsystem, use one of the following approaches.

  • Convert the configurable subsystem to a variant subsystem. Right-click the configurable subsystem, and select Subsystem and Model Reference > Convert Subsystem to > Variant Subsystem.

  • Remove the library block from the main configurable subsystem library, add the library block back to the main configurable subsystem library, and then resave the main configurable subsystem library.

Creating an Instance of a Configurable Subsystem

To create an instance of a configurable subsystem in a model:

  1. Open the library containing the main configurable subsystem.

  2. Drag a copy of the main into the model.

  3. Select Block Choice from the context menu of that Configurable Subsystem instance.

  4. Select the block that you want the configurable subsystem to represent.

The instance of the configurable system displays the icon and parameter dialog box of the block that it represents.

Setting Instance Block Parameters

As with other blocks, you can use the parameter dialog box of a configurable subsystem instance to set its parameters interactively and the set_param command to set the parameters from the MATLAB® command line or in a MATLAB file. If you use set_param, you must specify the full path name of the configurable subsystem's current block choice as the first argument of set_param, for example:

curr_choice = get_param('mymod/myconfigsys', 'BlockChoice');
curr_choice = ['mymod/myconfigsys/' curr_choice];
set_param(curr_choice, 'MaskValues', ...);

Mapping I/O Ports

A configurable subsystem displays a set of input and output ports corresponding to input and output ports in the selected library. Simulink uses the following rules to map library ports to Configurable Subsystem block ports:

  • Map each uniquely named input/output port in the library to a separate input/output port of the same name on the Configurable Subsystem block.

  • Map all identically named input/output ports in the library to the same input/output ports on the Configurable Subsystem block.

  • Terminate any input/output port not used by the currently selected library block with a Terminator/Ground block.

This mapping allows a user to change the library block represented by a Configurable Subsystem block without having to rewire connections to the Configurable Subsystem block.

For example, suppose that a library contains two blocks A and B and that block A has input ports labeled a, b, and c and an output port labeled d and that block B has input ports labeled a and b and an output port labeled e.

A Configurable Subsystem block based on this library would have three input ports labeled a, b, and c, respectively, and two output ports labeled d and e.

In this example, port a on the Configurable Subsystem block connects to port a of the selected library block no matter which block is selected. Port c on the Configurable Subsystem block functions only if library block A is selected. Otherwise, it simply terminates.

Note

A Configurable Subsystem block does not provide ports that correspond to non-I/O ports, such as the trigger and enable ports on triggered and enabled subsystems. Thus, you cannot use a Configurable Subsystem block directly to represent blocks that have such ports. You can do so indirectly, however, by wrapping such blocks in subsystem blocks that have input or output ports connected to the non-I/O ports.

Convert to Variant Subsystem

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

  • Using Upgrade Advisor interactively

  • Using Upgrade Advisor programmatically

  • Using the convertToVariantSubsystem method

  • Using the context menu of the Configurable Subsystem block

For more information see, Convert Configurable Subsystem to Variant Subsystem.

During conversion, Simulink performs the following operations:

  • Replaces the Subsystem block with a Variant Subsystem block, preserving ports and connections.

  • Adds the original subsystem as a variant choice in the Variant Subsystem block.

  • Overrides the Variant Subsystem block to use the subsystem that was originally the active choice.

  • Preserves links to libraries. For linked subsystems, Simulink adds the linked subsystem as a variant choice.

    Simulink also preserves the subsystem block masks, and it copies the masks to the variant choice.

See Variant Subsystem for more information on variant choices.

Ports

Input

expand all

Input signal to the Configurable Subsystem. The block that the Configurable Subsystem represents determines the supported data types and dimensions of the input signal.

Dependencies

The number of input ports depends on the blocks in the library that the Configurable Subsystem represents. For more information, see Mapping I/O Ports.

Data Types: half | single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | Boolean | fixed point | enumerated | bus

Output

expand all

Output signal from the Configurable Subsystem. The block that the Configurable Subsystem represents determines the output data types and dimensions.

Dependencies

The number of output ports depends on the blocks in the library that the Configurable Subsystem represents. For more information, see Mapping I/O Ports.

Data Types: half | single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | Boolean | fixed point | enumerated | bus

Parameters

expand all

Select the blocks you want to include as members of the configurable subsystem. You can include user-defined subsystems as blocks.

Programmatic Use

Block Parameter: MemberBlocks
Type: cell array of character vectors
Values: cell array of block names as character vectors
Default: {''}

Lists of input and output ports of member blocks. In the case of multiple input and output ports, you can rearrange selected port positions by clicking the Up and Down buttons.

Block Characteristics

Data Types

Booleana | busa | doublea | enumerateda | fixed pointa | halfa | integera | singlea | stringa

Direct Feedthrough

no

Multidimensional Signals

yesa

Variable-Size Signals

yesa

Zero-Crossing Detection

no

a Actual data type or capability support depends on block implementation.

Extended Capabilities

Version History

Introduced before R2006a

expand all