Use the Model Transformer and the Clone Detector to refactor a model to improve model componentization, readability and enable reuse.
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 dependency 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.
Use the Clone Detector to:
Identify clones and create a model with the clones replaced by links to the subsystem blocks in a library. Replacing clones with links to library blocks enables component reuse.
Identify and replace clones in a model with the subsystem references.
|Open Model Transformer|
|Identify eligible Interpolation Using Prelookup blocks to transform (Since R2021b)|
|Replace Interpolation Using Prelookup blocks (Since R2021b)|
|Open Clone Detector app|
|Find clones in a model (Since R2021a)|
|Replace clones in a model (Since R2021a)|
|Check equivalency of clone-replaced model and original model (Since R2021a)|
|Highlight clone in a Simulink model (Since R2021b)|
|Generate clone detection report (Since R2023b)|
|Results of search for eligible Interpolation Using Prelookup blocks (Since R2021b)|
|Refactored model results (Since R2021b)|
|Conditions for findClones function (Since R2021a)|
|Results of find clones (Since R2021a)|
|Conditions for clone replacement function (Since R2021a)|
|Results of replace clones (Since R2021a)|
|Results of equivalency check (Since R2021a)|
- 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.
- Improve Code Efficiency by Merging Multiple Interpolation Using Prelookup Blocks
Use the Model Transformer tool to transform a modeling pattern with multiple Interpolation Using Prelookup blocks into a single Interpolation Using Prelookup block.
- 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.
- Find Clones Across the Model
Use the Clone Detector to identify and replace clones across the model.