Main Content

本页的翻译已过时。点击此处可查看最新英文版本。

重构模型

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

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

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

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

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

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

函数

mdltransformerOpen Model Transformer
clonedetectionOpen Clone Detector app
Simulink.CloneDetection.findClonesFind clones in a model
Simulink.CloneDetection.replaceClonesReplace clones in a model
Simulink.CloneDetection.checkEquivalencyCheck equivalency of clone-replaced model and original model

Simulink.CloneDetection.Settings Conditions for findClones function
Simulink.CloneDetection.ResultsResults of find clones
Simulink.CloneDetection.ReplacementConfigConditions for clone replacement function
Simulink.CloneDetection.ReplacementResultsResults of replace clones
Simulink.CloneDetection.EquivalencyCheckResultsResults of equivalency check

App

Clone DetectorEnable model refactorization and subsystem reuse in models by identifying and replacing clones with library links or subsystem references

主题

模型变换器

Transform Model to Variant System

Use the Model Transformer tool to transform a model into a variant system.

Improve Model Readability by Eliminating Local Data Store Blocks

Use the Model Transformer tool to make data dependency explicit in a model by replacing data store blocks with either a direct signal line, a Delay block or a Merge block.

Improve Efficiency of Simulation by Optimizing Prelookup Operation of Lookup Table Blocks

Use the Model Transformer tool to convert multiple n-D Lookup Table blocks into shared Prelookup blocks and multiple Interpolation blocks.

克隆件检测器

Enable Component Reuse by Using Clone Detection

Use the Clone Detector app to replace subsystem clones with library blocks.

Replace Exact Clones with Subsystem Reference

Use the Clone Detector app to replace exact clones with subsystem reference blocks.

Detect and Replace Subsystem Clones Programmatically

Use the Clone Detection APIs to identify and replace subsystem clones in a model.

特色示例