Main Content

本页翻译不是最新的。点击此处可查看最新英文版本。

子系统

将模块分组为功能子系统,创建模型层次结构

随着模型的大小和复杂度的增加,您可以通过将模块组合为子系统来简化它。子系统是组合为一个 Subsystem 模块的一组模块。

使用子系统,您可以:

  • 建立一个分层模块图,其中的 Subsystem 模块位于一个层中,而构成子系统的模块位于另一个层中。

  • 将功能相关的模块放在一起。

  • 帮助减少您的模型窗口中显示的模块数目。

  • 建立一个带输入和输出的界面。

当您创建子系统的副本时,该副本将独立于源子系统。要在一个模型范围内或跨多个模型重用子系统的内容,请考虑引用子系统、引用模型或链接到自定义库中某个模块的子系统。有关详细信息,请参阅 Explore Types of Model Components

子系统可以是虚拟的,也可以是非虚拟的。虚拟子系统提供模型中的图形层次结构。非虚拟子系统提供模型的图形层次结构并作为单个单元来执行。

模块

Subsystem对各模块进行分组以创建模型层次结构

函数

全部展开

Simulink.BlockDiagram.createSubsystem创建包含指定模块集的子系统
Simulink.BlockDiagram.copyContentsToSubsystem将图形内容从系统复制到空子系统
Simulink.BlockDiagram.expandSubsystemReplace subsystem with subsystem contents
Simulink.SubSystem.convertToModelReference将子系统转换为模型引用
Simulink.SubSystem.copyContentsToBlockDiagram将图形内容从子系统复制到另一个模型
Simulink.SubSystem.deleteContents删除子系统的内容
convertAllSubsystemReferenceBlockToSubsystemConverts all subsystem reference blocks to regular Subsystem blocks (自 R2022a 起)
convertSubsystemReferenceBlockToSubsystemConverts a subsystem reference block to a regular Subsystem block (自 R2022a 起)
convertSubsystemToSubsystemReferenceConverts a Subsystem block to subsystem reference (自 R2022a 起)
getActiveInstancesReturns all the active instances of subsystem references (自 R2022a 起)
getAllDirtyInstancesReturns child Subsystem block diagrams that are referred in the given block diagram and are also being edited (自 R2022a 起)
getAllInstances Returns all subsystem reference blocks inside a block diagram (自 R2022a 起)
getAllReferencedSubsystemBlockDiagrams Returns all the child Subsystem block diagrams for a given block diagram (自 R2022a 起)
getNearestParentSubsystemReferenceBlock Returns the nearest parent subsystem reference for a block (自 R2022a 起)
getSystemOwningTheLockReturns the system that has acquired the lock for editing (自 R2022a 起)
isSystemLocked Checks if the system is locked due to an edit or update to the subsystem reference (自 R2022a 起)
Simulink.SubsystemReference.generateSignaturesGenerate unit test signatures of subsystem file (自 R2023a 起)
Simulink.SubsystemReference.getUnitTestNamesReturn names of unit tests of subsystem file (自 R2023a 起)
Simulink.SubsystemReference.removeSignaturesRemove previously generated unit test signatures of subsystem file (自 R2023a 起)
Simulink.SubsystemReference.showSignatureDiffDialogForSSOpen dialog to show difference in signatures of two subsystem blocks (自 R2023a 起)
Simulink.SubsystemReference.showSignatureDiffDialogForUnitTestsDisplay differences in signatures of Subsystem Reference block in model with unit test signatures of subsystem file (自 R2023a 起)

工具

模型引用转换顾问Convert subsystems to referenced models
引用的文件窗格View, save, and close referenced subsystems and models (自 R2020b 起)

主题

子系统

子系统引用