Configurable Subsystem - Represent any block selected from user-specified library of blocks

Library

Ports & Subsystems

Description

The Configurable Subsystem block represents one of a set of blocks contained in a specified library of blocks. The block's context menu 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.

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

You can add any type of block to a master configurable subsystem library. Simulink software derives the port names for the configurable subsystem by making a unique list from the port names of all the choices. Note that Simulink software uses default port names for non-subsystem block choices.

Note that Simulink software does not allow you to break library links in a configurable subsystem because Simulink software needs the links to reconfigure the subsystem when you choose a new configuration. Breaking links would be useful only if you never intended to reconfigure the subsystem, in which case you could simply replace the configurable subsystem with a nonconfigurable subsystem that implements the permanent configuration.

Creating a Master Configurable Subsystem

To create a master 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 this, drag a copy of the Configurable Subsystem block from the Simulink Ports & Subsystems library into the library you created in the preceding step.

  4. Display the Configurable Subsystem block's dialog by double-clicking it. The dialog 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. Click the OK button to apply the changes and close the dialog box.

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

    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.

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:

Creating an Instance of a Configurable Subsystem

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

  1. Open the library containing the master configurable subsystem.

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

  3. Select Block Choice from the copy's context menu.

  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 the instance's parameters interactively and the set_param command to set the parameters from the MATLAB command line or in an M-file program. 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, e.g.,

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 software uses the following rules to map library ports to Configurable Subsystem block ports:

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, respectively, as illustrated in the following figure.

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. On the other hand, port c on the Configurable Subsystem block functions only if library block A is selected. Otherwise, it simply terminates.

Data Type Support

The Configurable Subsystem block accepts and outputs signals of the same types as are accepted or output by the block that it currently represents. The data types may be any supported by Simulink software, including fixed-point data types.

Parameters and Dialog Box

List of block choices

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

Port information

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

Characteristics

A Configurable Subsystem block has the characteristics of the block that it currently represents. Double-clicking the block opens the dialog box for the block that it currently represents.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS