MotoHawk:Lookup Tables Overview
Contents
MotoHawk Lookup Table Blocks
MotoHawk provides a library of lookup table blocks that provide functionality similar to the native Simulink lookup table blocks, but also allow for calibration in MotoTune. The blockset provides 1D and 2D maps, as well as adaptive tables. Pre-lookup and Interpolation tables can be used to split up the breakpoints and table data separately. Reference tables can be used to access a table defined by a data store (Data Storage Blockset) somewhere else in the model. Data for the lookup tables can be stored in Volatile or Non-Volatile storage.
The use of tables in the application is a means to save on CPU throughput. The results of complex equations are pre-computed and made available to the application through a fast lookup mechanism. Characterization of sensors is another common use of tables.
The Breakpoint Data is the "axis" of the table. 2D tables have a row axis and a column axis.
The Table Data is the calculation given the axis point(s) as the input.
Valid Matlab expressions such as Ones(1,5), or [1:.5:25] can be used for the breakpoints or the table data.
In a simple example, if the row breakpoint has two points [1,2] and the column breakpoint has two points [3,4]. Table Data is [10 10; 30 40]. Then, given row and column inputs of 1 and 4 as shown below, the output of the table is 20.
Similarly, inputing r=1.7 and c=3.4 interpolates between the breakpoints to give an output of 27.99 as shown.
1D and 2D Lookup Table Blocks
MotoHawk 1D Lookup Table
This MotoHawk™ block behaves similarly to the native Simulink Look-Up Table (1-D) block. This block performs 1-D linear interpolation of input values using the Breakpoint (x-axis) and Table Data (y-axis). End values of Table Data is used for input outside of the Breakpoint Data.
MotoHawk 2D Lookup Table
This block performs 2-D linear interpolation of input values using the Breakpoint (x) and 2-D matrix of Table data values to be searched.
Prelookup and Interpolation Blocks
The MotoHawk 1D and 2D Lookup Tables are comprised under the mask of Prelookup and Interpolation table as shown below:
Using the Prelookup and Interpolation blocks separately allows for one Pre-lookup to be connected to multiple Interplation Tables (one pre-lookup into different table data sets).
The prelookup provides the interpolation between two points on the axis. This is then connected to the 1D or 2D interpolation table. The output of a prelookup can only be connected to the input port of an interplation block.
MotoHawk Prelookup Table (Prelookup Index Search)
This block is used to generate an index and interpolation fraction for use with a MotoHawk Lookup Table block.
MotoHawk Interpolation 1D
This MotoHawk™ block behaves similarly to the native Simulink Interpolation (1-D) using Prelookup block, with n=1.
This block performs a linear interpolation on an 1-D matrix, "Table Data," using precalculated indices and distance fractions provided by the PrelookUp block. End values of Table Data is used for input outside of the Breakpoint Data. This block is used with the MotoHawk Prelookup or MotoHawk Prelookup Reference block.
MotoHawk Interpolation 2D
This MotoHawk™ block behaves similarly to the native Simulink Interpolation (2-D) using Prelookup block, with n=2.
This block performs a linear interpolation on an 2-D matrix, "Table Data," using precalculated indices and distance fractions provided by the PrelookUp block. End values of Table Data is used for input outside of the Breakpoint Data. This block is used with the MotoHawk Prelookup or MotoHawk Prelookup Reference block.
Lookup Reference Blocks
The same look-up table can be used in several functions by using the Lookup Table Reference blocks (1D or 2D). Datastorage created by any other MotoHawk Data Definition may be referenced.
The reference blocks perform the same function as 'Non-reference' blocks, except they don't define any data, or create variables that can be viewed in MotoTune.
The MotoHawk Data Definition block under MotoHawk Data Storage can be used to define the referenced data. The storage class can then be selected of the data - ex. Non-Volatile can be selected for the Data, and the table would reference NV data. Breakpoints can similarly be referenced to the table Breakpoints using the Prelookup (1D/2D) Reference blocks. The table values are referenced to the data storage through the MotoHawk Interpolation (1D/2D) Reference block.
Note: Care needs to be taken to ensure the breakpoint and table dimensions match with the reference data definitions. The reference blocks don’t have a check to prevent a dimension overrun.
MotoHawk Prelookup Reference Block
This block has the same operation as a MotoHawk Prelookup Block, except it doesn't define any data or create anything visible from MotoTune.
MotoHawk Interpolation 1D Reference
This MotoHawk™ block performs the same operation as a MotoHawk Interpolation (1-D) block, but does not define any data or create any VarDecs visible from MotoTune.
MotoHawk Interpolation 2D Reference
This MotoHawk™ block performs the same operation as a MotoHawk Interpolation (2-D) block, but does not define any data or create any VarDecs visible from MotoTune.
Adapt Table
The MotoHawk Adapt Table block modifies the values of the 1D or 2D table at runtime. The table name references a 1-D or 2-D table defined elsewhere in the module. The "Storage and Accessibility" option of that table must be set to 'Adaptive-Volatile' or 'Adaptive-NonVolatile'.
The user can then set parameters for:
Adapt Quantity: The value to be added to the Table Data of the Lookup Table surrounding the breakpoint as it is executed. If the current index is within 1/4 fraction distance between two breakpoints, then the Adapt Quantity value will be added to the closer corresponding point in table data.
Adapt Min/Max: Adapt Min and Adapt Max are the saturation values of Table Data. This is to set the limit of Table Data in case of continuous accumulation of the Adapt Quantity. Note that the Min and Max Values in the MotoHawk Lookup Table or Interpolation do not apply here since the adaptation occurs during runtime, while the Min and Max Values apply for MotoTune only
Convert Prelookup Index Type (Index_T) to Double
This MotoHawk™ block converts the custom index_T data type, which is output from a MotoHawk Prelookup block, into a double. The output can be connected to a probe for measurement or debugging.