== Lookup Tables == Lookup tables provide a method to compute an approximate value of a function based on indexes into arrays of values with interpolation between values. The indexing is normally simpler and faster than the equivalent mathematical formula. Lookup tables can save processing time, while being faster to setup for complex non-linear equations, and easy to calibrate on the fly. ==== OpenECU lookup tables ==== OpenECU provides support for 1d and 2d lookup tables, with linear interpolation between data points, and no extrapolation. OpenECU also supports 1d and 2d non-volatile adaptive lookup tables. OpenECU lookup blocks provide full support for ASAP2 MAP entries in the generated A2L file for all Simulink coders (i.e. RSIM, RTMODEL, and ERT based), including the active interpolation point (if available). ==== Simulink native lookup tables ==== Simulink provides similar functionality, but allows for greater configurability for the lookup table dimensions, data types, index search, and interpolation method (with extrapolation available). Considerations when using native Simulink lookup tables: * The tables do not support non-volatile adaptive table data. * The tables have limited support for ASAP2 integration features, which provide the ability to view the map in a graphical representation in a calibration tool. * The tables support ASAP2 MAP entries with some limitations based on the configuration of the model. * When a model is configured to use the RSIM coder, Simulink lookup tables must follow the map naming convention, and do not support the active interpolation point, or a common axis. * When a model is configured to use the RTMODEL or ERT coder, Simulink lookup tables must either follow the naming convention, or the model must be setup to use Simulink based ASAP2 generation, which may require a certain version of MATLAB/Simulink depending on the block required. ==== Naming considerations ==== In order to support a common axis in either OpenECU or Simulink lookup table blocks, either the naming convention must be disabled using Simulink Data Dictionaries in R2015a or later, or Simulink based ASAP2 generation must be enabled, see table below for details. ||<-2> |||||||| OpenECU blocks |||||||| Simulink blocks || ||<-2> Feature || [[doc_user/openecu_user_guide_simulink_chunk/put_calmap1d.html|put_Calmap1d]] || [[doc_user/openecu_user_guide_simulink_chunk/put_calmap2d.html|put_Calmap2d]] || [[doc_user/openecu_user_guide_simulink_chunk/pnv_adaptive_map1d.html|pnv_AdaptiveMap1d]] || [[doc_user/openecu_user_guide_simulink_chunk/pnv_adaptive_map2d.html|pnv_AdaptiveMap2d]] || Lookup Table || Lookup (2-D) || Lookup (n-D) || Interpolation Using Prelookup || ||<-2> Data types || float || float || float || float || float || float || Any numeric (incl. fixed pt) || Any numeric (incl. fixed pt) || ||<-2> Table dimensions || 1 || 2 || 1 || 2 || 1 || 2 || 1-30 || 1-30 || ||<-2> Configurable index search || No || No || No || No || No || No || Yes || Yes || ||<-2> Configurable interpolation method || No || No || No || No || Yes || Yes || Yes || Yes || ||<-2> Nonvolatile data || No || No || Yes || Yes || No || No || No || No || ||<|3> ASAP2 MAP entry || RSIM || Yes || Yes || Yes || Yes || Yes <> || Yes <> || Yes <> || Yes <> || || RTMODEL || Yes || Yes || Yes || Yes || Yes <> ^or^ <> || Yes <> ^or^ <> || Yes <> ^or^ <> || Yes <> ^or^ <> || || ERT || Yes || Yes || Yes || Yes || Yes <> ^or^ <> || Yes <> ^or^ <> || Yes <> ^or^ <> || Yes <> ^or^ <> || ||<|3> Active interpolation point || RSIM || Yes || Yes || Yes || Yes || No || No || No || No || || RTMODEL || Yes || Yes || Yes || Yes || Yes <> || Yes <> || Yes <> || Yes <> || || ERT || Yes || Yes || Yes || Yes || Yes <> || Yes <> || Yes <> || Yes <> || ||<|3> Common axis || RSIM || Yes <> || Yes <> || Yes <> || Yes <> || No || No || No || No || || RTMODEL || Yes <> ^or^ <> || Yes <> ^or^ <> || Yes <> ^or^ <> || Yes <> ^or^ <> || Yes <> || Yes <> || Yes <> || Yes <> || || ERT || Yes <> ^or^ <> || Yes <> ^or^ <> || Yes <> ^or^ <> || Yes <> ^or^ <> || Yes <> || Yes <> || Yes <> || Yes <> || <> For more description of Lookup tables, see [[https://en.wikipedia.org/wiki/Lookup_table|Wikipedia's Lookup table Article]]. For more description of Linear interpolation, see [[https://en.wikipedia.org/wiki/Linear_interpolation|Wikipedia's Linear interpolation Article]].