Hauptinhalt

Refactor Models

Identify modeling clones and patterns to transform model

Use the Model Transformer and the Clone Detector apps to refactor a model to improve model componentization, readability and reusability.

Use the Model Transformer to:

  • Identify modeling patterns that qualify for transformation into Variant Source or Variant Subsystem blocks. Using Variant Subsystem and Variant Source blocks helps in the reusability of a model for different conditional expressions called variant choices. The active model is a combination of a fixed structure and variable components that you activate depending on the variant choice that you select.

  • Identify data store blocks that qualify for elimination. Eliminating data store blocks improves model readability by making data dependencies explicit.

  • Identify n-D Lookup Table blocks that qualify for transformation into shared Prelookup blocks and multiple Interpolation blocks. This transformation improves the simulation efficiency.

  • Identify multiple Interpolation Using Prelookup blocks that qualify for transformation into a single Interpolation Using Prelookup block in a modeling pattern. This transformation improves the generated code efficiency.

  • Identify Bus Creator and Bus Selector blocks that qualify for transformation into In Bus Element and Out Bus Element blocks. This transformation simplifies bus handling, reduces the number of blocks in the model, and improves readability.

Use the Clone Detector to:

  • Identify clones and create a model with the clones replaced by links to subsystem blocks in a library. Replacing clones with links to library blocks enables component reuse and ensures consistency across models.

  • Identify and replace clones in a model with the subsystem references.

Functions

expand all

mdltransformerOpen Model Transformer
Simulink.ModelTransform.BusTransformation.identifyIdentify Bus Selector and Bus Creator blocks to transform (Since R2022b)
Simulink.ModelTransform.BusTransformation.refactorReplace Bus Selector and Bus Creator blocks with In Bus Element and Out Bus Element blocks (Since R2022b)
Simulink.ModelTransform.CommonSourceInterpolation.identifyCandidatesIdentify eligible Interpolation Using Prelookup blocks to transform (Since R2021b)
Simulink.ModelTransform.CommonSourceInterpolation.refactorModelReplace Interpolation Using Prelookup blocks (Since R2021b)
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.highlightCloneHighlight clone in a Simulink model (Since R2021b)
Simulink.CloneDetection.generateReportGenerate clone detection report (Since R2023b)
Simulink.CloneDetection.addExclusionsExclude component from clone detection (Since R2025a)
Simulink.CloneDetection.getExclusionsGet list of components excluded from clone detection (Since R2025a)
Simulink.CloneDetection.deleteExclusionsRemove component from clone detection exclusion list (Since R2025a)

Classes

expand all

Simulink.ModelTransform.BusTransformation.ResultResults of identified Bus Selector and Bus Creator blocks (Since R2022b)
Simulink.ModelTransform.CommonSourceInterpolation.ResultsResults of search for eligible Interpolation Using Prelookup blocks (Since R2021b)
Simulink.ModelTransform.CommonSourceInterpolation.RefactorResultsRefactored model results (Since R2021b)
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

Topics

Model Transformer

Clone Detector

Featured Examples