Main Content

FunctionApproximation.compressLookupTables

Compress all Lookup Table blocks in a system

Description

example

CompressionResult = FunctionApproximation.compressLookupTables(system) compresses all n-D Lookup Table blocks in the specified system. The compressed Lookup Table blocks output the same numerical results as the original Lookup Table blocks within the bounds of the breakpoints.

You can achieve additional memory savings by compressing each lookup table in the model individually and specifying tolerances for the compressed lookup table.

example

CompressionResult = FunctionApproximation.compressLookupTables(system, Name,Value) compresses all n-D Lookup Table blocks in the specified system with additional properties specified by name and value pair arguments.

Examples

collapse all

This example shows how to compress all Lookup Table blocks in a system.

Open the model containing the lookup tables that you want to compress.

system = 'sldemo_fuelsys';
open_system(system)

Use the FunctionApproximation.compressLookupTables function to compress all of the lookup tables in the model. The output specifies all blocks that are modified and the memory savings for each.

compressionResult = FunctionApproximation.compressLookupTables(system)
- Found 5 supported lookup tables
- Percent reduction in memory for compressed solution
	-  2.37% for sldemo_fuelsys/fuel_rate_control/airflow_calc/Pumping Constant
	-  2.37% for sldemo_fuelsys/fuel_rate_control/control_logic/Throttle.throttle_estimate/Throttle Estimation
	-  3.55% for sldemo_fuelsys/fuel_rate_control/control_logic/Speed.speed_estimate/Speed Estimation
	-  6.38% for sldemo_fuelsys/fuel_rate_control/control_logic/Pressure.map_estimate/Pressure Estimation
	-  9.38% for sldemo_fuelsys/fuel_rate_control/airflow_calc/Ramp Rate Ki

compressionResult = 

  LUTCompressionResult with properties:

                  MemoryUnits: bytes
             MemoryUsageTable: [5x5 table]
                 NumLUTsFound: 5
              NumImprovements: 5
              TotalMemoryUsed: 6024
           TotalMemoryUsedNew: 5796
           TotalMemorySavings: 228
    TotalMemorySavingsPercent: 3.7849
                          SUD: 'sldemo_fuelsys'
                  WordLengths: [8 16 32]
                  FindOptions: [1x1 Simulink.internal.FindOptions]
                      Display: 1

Use the replace function to replace each Lookup Table block with a block containing the original and compressed version of the lookup table.

replace(compressionResult);

You can revert the lookup tables back to their original state using the revert function.

revert(compressionResult);

Input Arguments

collapse all

Name of model or subsystem in which to compress all n-D Lookup Table blocks, specified as a character vector.

Example: compressionResult = FunctionApproximation.compressLookupTables('sldemo_fuelsys');

Data Types: char

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: CompressionResult = FunctionApproximation.compressLookupTables('sldemo_fuelsys', 'WordLengths', [8,16,32])

Whether to display details of each iteration of the optimization, specified as a logical. A value of 1 results in information in the command window at each iteration of the approximation process. A value of 0 does not display information until the approximation is complete.

Data Types: logical

Specify the word lengths, in bits, that can be used in the lookup table approximate based on your intended hardware. For example, if you intend to target an embedded processor, you can restrict the data types in your lookup table to native types, 8, 16, and 32. The word lengths must be between 1 and 128.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fi

Simulink.FindOptions object specifying options for finding lookup tables in the system.

Output Arguments

collapse all

Compression result object created during compression of the Lookup Table blocks in the model, returned as a LUTCompressionResult object.

See Also

Classes

Functions

Introduced in R2020a