Improve the efficiency of your model simulation by using the Model Transformer tool to identify n-D Lookup Table blocks that qualify for transformation and replacing them with Interpolation blocks and shared Prelookup blocks. Eliminating the redundant Prelookup blocks improves the performance of simulation for linear interpolations. The Model Transformer creates a model with these replacements blocks. This new model has the same functionality as the original model.
The Model Transformer can replace Lookup Table blocks if:
The same source drives the Lookup Table blocks.
The Lookup Table blocks share the same breakpoint specification, values, and data types.
The Lookup Table blocks share the same algorithm parameters in the block parameters dialog box.
The Lookup Table blocks share the same data type for fractions parameters in the block parameters dialog box.
The data type of the Lookup Table block fractions and breakpoint are double, single, int8, uint8, int16, uint16, int32, or uint32.
The Model Transformer tool works only if all the Lookup Table blocks share all the preceding conditions.
mLutOptim contains three Lookup Table
The blocks are driven from the same input sources
Identify n-D Lookup Table blocks that qualify for transformation and replace them with a single shared Prelookup block and multiple Interpolation blocks.
Open the model
mLutOptim. At the MATLAB® command line,
Save the model to your working folder.
In the Simulink Editor, from the Analysis menu, select Refactor Model > Model Transformer.
In the Transformations folder, select the Transform table lookup into prelookup and interpolation check.
Select the Skip Lookup Table (n-D) blocks in the libraries from this transformation option to avoid replacing Lookup Table blocks that are linked to a library.
In the Prefix of refactored model field, specify a prefix for the new refactored model.
Click the Run This Check button. The top Result table contains hyperlinks to the Lookup Table blocks and the corresponding input port indices.
Clear the Candidate Groups that you do not want to transform.
Click the Refactor Model button. The
Result table contains a hyperlink to the new model. The
table also contains hyperlinks to the shared Prelookup block and
corresponding Interpolation blocks. Those blocks replaced the
original Lookup Table blocks. The tool creates an
m2m_mLUTOptim folder. This folder contains the new
The Lookup Table blocks
gen_mLutOptim.slx have two shared Prelookup table
for each data source. There are also three Interpolation blocks
LUT3_InterpND that replace the Lookup Table
The Model Transformer cannot replace Lookup Table blocks if:
A Rate Transition block drives the Lookup Table blocks.
The Lookup Table blocks are commented-out regions and inactive variants.
The Lookup Table blocks are masked.
The Output block's data type is set to
Inherit:Same as first input.
The Lookup Table block Interpolation
method and Extrapolation method on the
Algorithm pane of the block parameters dialog box
is set to
The Lookup Table block Input settings on the Algorithm pane of the block parameters dialog box has Use one input port for all input data selected.
The Lookup Table block Code generation on the Algorithm pane of the block parameters dialog box has Support tunable table size in code generation selected.
The Model Transformer tool does not replace Lookup Table blocks across the boundaries of Atomic subsystems, Referenced Models, and library-linked blocks.