子系统
将模块分组为功能子系统,创建模型层次结构
随着模型的大小和复杂度的增加,您可以通过将模块组合为子系统来简化它。子系统是组合为一个 Subsystem 模块的一组模块。
使用子系统,您可以:
建立一个分层模块图,其中的 Subsystem 模块位于一个层中,而构成子系统的模块位于另一个层中。
将功能相关的模块放在一起。
帮助减少您的模型窗口中显示的模块数目。
建立一个带输入和输出的界面。
当您创建子系统的副本时,该副本将独立于源子系统。要在一个模型范围内或跨多个模型重用子系统的内容,请考虑引用子系统、引用模型或链接到自定义库中某个模块的子系统。有关详细信息,请参阅 Explore Types of Model Components。
子系统可以是虚拟的,也可以是非虚拟的。虚拟子系统提供模型中的图形层次结构。非虚拟子系统提供模型的图形层次结构并作为单个单元来执行。
模块
Subsystem | 对各模块进行分组以创建模型层次结构 |
函数
工具
主题
子系统
- Explore Types of Subsystems
Decide among virtual and nonvirtual subsystems, including conditionally executed subsystems. - 将模块组合为子系统
使用子系统组织大型模型。 - Expand Subsystem Contents
Flatten a model hierarchy by bringing the contents of a subsystem up one level. - Connect Subsystems
Add ports to subsystems and configure port labels. - Navigate Model Hierarchy
Navigate model hierarchy using the Explorer Bar and Model Browser. - 预览模型组件的内容
在模块的表面显示模块内容的表示。
子系统引用
- Subsystem Reference
Save a subsystem in a separate file and reference it in a model. - Reference a Subsystem File in a Model
Use subsystem reference in a model. - Change Subsystem Reference Component Dynamically Using InitFcn
This example shows how to dynamically change the subsystem reference component using the Initialization Function. - Validate Subsystem Reference Use and Build Model Using Component Codes
This example shows how to check the valid use of subsystem reference instances in a model and reuse generated subsystem component codes to build the model using unit testing.