主要内容

重构模型

识别建模克隆件和模式以变换模型

使用模型变换器和克隆件检测器来重构模型,以改善模型组件化、可读性并支持重用。

使用模型变换器可以:

  • 确定可转换为 Variant Source 或 Variant Subsystem 模块的建模模式。使用 Variant SubsystemVariant Source 模块有助于提高模型在不同条件表达式(称为变体选择项)中的重用率。活动模型是根据所选的变体选择项而激活的固定结构和可变组件的组合。

  • 标识符合消除条件的数据存储模块。消除数据存储模块可明确表现数据依赖关系,从而提高模型的可读性。

  • 识别哪些 n-D Lookup Table 模块可转换为共享 Prelookup 模块和多个 Interpolation 模块。这种转换可提高仿真效率。

  • 识别在建模模式中可变换为单一 Interpolation Using Prelookup 模块的多个 Interpolation Using Prelookup 模块。这种变换可提高生成代码的效率。

使用克隆检测器可以:

  • 识别克隆件并创建模型,用指向库中子系统模块的链接替换克隆件。用指向库模块的链接替换克隆件可以实现组件重用。

  • 识别模型中的克隆并用子系统引用替换。

函数

全部展开

mdltransformer打开模型变换器
Simulink.ModelTransform.BusTransformation.identify识别需要变换的 Bus Selector 和 Bus Creator 模块 (自 R2022b 起)
Simulink.ModelTransform.BusTransformation.refactor将 Bus Selector 和 Bus Creator 模块替换为 In Bus Element 和 Out Bus Element 模块 (自 R2022b 起)
Simulink.ModelTransform.CommonSourceInterpolation.identifyCandidatesIdentify eligible Interpolation Using Prelookup blocks to transform (自 R2021b 起)
Simulink.ModelTransform.CommonSourceInterpolation.refactorModelReplace Interpolation Using Prelookup blocks (自 R2021b 起)
clonedetection打开克隆检测器
Simulink.CloneDetection.findClones查找模型中的克隆 (自 R2021a 起)
Simulink.CloneDetection.replaceClones替换模型中的克隆 (自 R2021a 起)
Simulink.CloneDetection.checkEquivalency检查克隆被替换后的模型与原始模型的等效性 (自 R2021a 起)
Simulink.CloneDetection.highlightClone突出显示 Simulink 模型中的克隆 (自 R2021b 起)
Simulink.CloneDetection.generateReportGenerate clone detection report (自 R2023b 起)
Simulink.CloneDetection.addExclusionsExclude component from clone detection (自 R2025a 起)
Simulink.CloneDetection.getExclusionsGet list of components excluded from clone detection (自 R2025a 起)
Simulink.CloneDetection.deleteExclusionsRemove component from clone detection exclusion list (自 R2025a 起)

全部展开

Simulink.ModelTransform.BusTransformation.ResultResults of identified Bus Selector and Bus Creator blocks (自 R2022b 起)
Simulink.ModelTransform.CommonSourceInterpolation.ResultsResults of search for eligible Interpolation Using Prelookup blocks (自 R2021b 起)
Simulink.ModelTransform.CommonSourceInterpolation.RefactorResultsRefactored model results (自 R2021b 起)
Simulink.CloneDetection.Settings Conditions for findClones function (自 R2021a 起)
Simulink.CloneDetection.ResultsResults of find clones (自 R2021a 起)
Simulink.CloneDetection.ReplacementConfig用于克隆替换函数的条件 (自 R2021a 起)
Simulink.CloneDetection.ReplacementResults替换克隆的结果 (自 R2021a 起)
Simulink.CloneDetection.EquivalencyCheckResults等效性检查的结果 (自 R2021a 起)

App

模型变换器通过识别和重构建模模式来实现模型变换,从而优化模型
克隆检测器通过标识和替换克隆,在模型中实现模型重构和子系统重用

主题

模型变换器

克隆件检测器

精选示例