主要内容

可配置的子系统

表示从用户指定的块库中选择的块

  • Library:
  • 金宝appSimulink / Ports&Subsystems

  • 可配置的子系统块

描述

Note

可配置的子系统块will be removed in a future release. It is recommended to use Variant Subsystem instead of Configurable Subsystem. Variant Subsystems offer more capabilities than Configurable Subsystems with these advantages:

  • 你可以混合模型块和子系统blocks as variant choices.

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

For more information on converting可配置的子系统block to a变体子系统block, see将可配置子系统转换为变体子系统

For more information on Variant Subsystem, see变体子系统, Variant Model

The可配置的子系统block represents one of a set of blocks contained in a specified library of blocks. The context menu of the可配置的子系统block lets you choose which block the configurable subsystem represents.

可配置的子系统阻止简化了代表设计系列的模型的创建。例如,假设您想要建模一个提供提供发动机的汽车。要为更模拟此类设计,您将首先创建电车可用的发动机类型的模型库。然后你会用一个可配置的子系统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.

要在模型中创建可配置的子系统,您必须首先创建包含主可配置子系统的库和所代表的块。然后,您可以通过从库中拖动主子系统的副本并将其丢弃到模型中来创建主子系统的可配置实例。

您可以将任何类型的块添加到主配置子系统库中。金宝appsimulink.®通过从所有选项的端口名称中列表唯一列表,通过从所有选项的端口名称派生列表来派生可配置子系统的端口名称。但是,Simuli金宝appnk使用非子系统块选择的默认端口名称。

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.

创建主配置子系统

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. 创建一个实例可配置的子系统块在图书馆。

    为此,拖动副本可配置的子系统从Simulink端口和子系统金宝app库中的块将库库到您在上一步中创建的库中。

  4. Display the可配置的子系统通过双击它来阻止对话框。该对话框显示库中其他块的列表。

  5. Under块选择列表在对话框中,选择表示您正在创建的可配置子系统的各种配置的块。

  6. 要应用更改并关闭对话框,请单击好的按钮。

  7. SelectBlock Choicefrom the context menu of the可配置的子系统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

    如果您添加或从库中删除块,则必须重新创建任何可配置的子系统blocks that use the library.

如果修改了一个可配置子系统的默认块选择的库块,则更改不会立即传播到可配置的子系统。要传播此更改,请执行以下操作之一:

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

  • 重新创建可配置的子系统块,包括将更新块的选择作为默认块选择。

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子系统和模型Reference>转换子系统到>变体子系统

  • 从主配置子系统库中删除库块,将库块添加回主配置子系统库,然后重新定位主配置子系统库。

创建可配置子系统的实例

创建一个实例的一个可配置的子系统in a model:

  1. Open the library containing the master configurable subsystem.

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

  3. SelectBlock Choicefrom the context menu of that可配置的子系统实例。

  4. 选择要配置的子系统表示的块。

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

设置实例块参数

与其他块一样,您可以使用可配置子系统实例的参数对话框以交互方式设置其参数set_param.命令从MATLAB设置参数®命令行或matlab文件。如果你使用set_param.,您必须将可配置子系统的当前块选择的完整路径名指定为第一个参数set_param., 例如:

curr_choice = get_param('mymod / myconfigsys','blockchoice');curr_choice = ['mymod / myconfigsys /'curr_choice];set_param(curr_choice,'maskvalues',......);

映射I / O端口

可配置的子系统显示一组对应于所选库中的输入和输出端口的输入和输出端口。金宝appSimulink使用以下规则将库端口映射到可配置的子系统块端口:

  • 将库中的每个唯一命名的输入/输出端口映射到可配置子系统块上同名的单独输入/输出端口。

  • 将库中的所有相同名为的输入/输出端口映射到可配置子系统块上的相同输入/输出端口。

  • Terminate any input/output port not used by the currently selected library block with aTerminator/Groundblock.

此映射允许用户更改由a表示的库块可配置的子系统块而无需重新绕地连接到可配置的子系统block.

For example, suppose that a library contains two blocksAB那个块Ahas input ports labeleda,b, 和c和标有输出端口d那个块Bhas input ports labeledab和标有输出端口e

A可配置的子系统基于此库的块将有三个输入端口标记为a,b, 和c分别标有两个输出端口de

在这个例子中,端口a在这一点可配置的子系统块连接到端口a无论选择哪个块,所选库块的内容块。港口c在这一点可配置的子系统block functions only if library block A is selected. Otherwise, it simply terminates.

Note

A可配置的子系统块不提供对应于非I / O端口的端口,例如触发器和启用触发和启用子系统的端口。因此,你不能使用可配置的子系统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.

转换为变体子系统

右键单击可配置的子系统并选择子系统和模型参考>转换子系统到>变体子系统

在转换期间,Simulink执行以下操金宝app作:

  • 取代子系统块与A.变体子系统块,保留端口和连接。

  • 将原始子系统添加为一个变体选择变体子系统block.

  • 覆盖变体子系统块使用最初是活动选择的子系统。

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

    金宝appSimulink还保留子系统块掩码,并将掩码复制到变体选择。

See变体子系统有关变体选择的更多信息。

港口

输入

展开全部

输入signal to the可配置的子系统。那个块可配置的子系统represents determines the supported data types and dimensions of the input signal.

Dependencies

输入端口的数量取决于库中的块可配置的子系统代表。有关更多信息,请参阅映射I / O端口

数据类型:half|single|双倍的|int8|int16|INT32.|INT64.|uint8|uint16|uint32|uint64|布尔基|固定点|枚举|bus

Output

展开全部

来自的输出信号可配置的子系统。那个块可配置的子系统表示确定输出数据类型和维度。

Dependencies

输出端口的数量取决于库中的块可配置的子系统代表。有关更多信息,请参阅映射I / O端口

数据类型:half|single|双倍的|int8|int16|INT32.|INT64.|uint8|uint16|uint32|uint64|布尔基|固定点|枚举|bus

Parameters

展开全部

选择要包含为可配置子系统成员的块。您可以将用户定义的子系统包含为块。

Programmatic Use

块参数:成员博克斯
类型:字符向量的单元格阵列
Values:块名称的单元格数组作为字符向量
Default:{''}

Lists of input and output ports of member blocks. In the case of multiports, you can rearrange selected port positions by clicking theUp纽扣。

块特征

Data Types

布尔基[a]|bus[a]|双倍的[a]|枚举[a]|固定点[a]|half[a]|整数[a]|single[a]|string[a]

直接喂养

多维信号

有限的[a]

Variable-Size Signals

有限的[a]

零交叉检测

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

Extended Capabilities

HDL代码生成
使用HDL Coder™生成FPGA和ASIC设计的Verilog和VHDL代码。

在R2006A之前介绍