主要内容

重构模型

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

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

使用模型变换器可以:

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

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

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

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

  • 识别哪些 Bus Creator 和 Bus Selector 模块可转换为 In Bus Element 和 Out Bus Element 模块。此转换可简化总线处理,减少模型中的模块数量并改善可读性。

使用克隆检测器可以:

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

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

函数

全部展开

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
Simulink.ModelTransform.CommonSourceInterpolation.refactorModelReplace Interpolation Using Prelookup blocks
clonedetection打开克隆检测器
Simulink.CloneDetection.findClones查找模型中的克隆
Simulink.CloneDetection.replaceClones替换模型中的克隆
Simulink.CloneDetection.checkEquivalency检查克隆被替换后的模型与原始模型的等效性
Simulink.CloneDetection.highlightClone突出显示 Simulink 模型中的克隆
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
Simulink.ModelTransform.CommonSourceInterpolation.RefactorResultsRefactored model results
Simulink.CloneDetection.Settings Conditions for findClones function
Simulink.CloneDetection.ResultsResults of find clones
Simulink.CloneDetection.ReplacementConfig用于克隆替换函数的条件
Simulink.CloneDetection.ReplacementResults替换克隆的结果
Simulink.CloneDetection.EquivalencyCheckResults等效性检查的结果

主题

模型变换器

克隆件检测器

精选示例