Main Content

Prelookup

Compute index and fraction for a Curve Using Prelookup or Map Using Prelookup block

  • Prelookup block

Libraries:
AUTOSAR Blockset / Classic Platform / Library Routines / Interpolation

Description

The Prelookup block computes the index and fraction that specify how its input value u relates to the breakpoint dataset. The Prelookup block feeds the resulting output index and fraction values as a bus into a Curve Using Prelookup block to interpolate a one-dimensional table or a Map Using Prelookup block to interpolate a two-dimensional table. When a Prelookup block is used with either a Curve Using Prelookup or Map Using Prelookup block, they perform the same algorithm operation as the Curve or Map blocks. The use of the two blocks together offers greater flexibility and more efficient simulation and code generation.

If you select the AUTOSAR 4.x code replacement library (CRL) for your AUTOSAR model, code generated from this block is replaced with the AUTOSAR library routine that you configure in the block parameters dialog box.

Ports

Input

expand all

The Prelookup block accepts real-valued signals of these data types: single, int8, uint8, int16, uint16, int32, uint32, and specifically for signals and breakpoint data, fixed-point data types.

Data Types: single | int8 | uint8 | int16 | uint16 | int32 | uint32 | fixed point

Output

expand all

Outputs the index and fraction as a bus, which specifies the interval containing the input and the normalized position of the input on the interval. The bus type is defined automatically based on if the Targeted Routine Library is set to fixed-point (IFX) or floating-point (IFL) code replacement.

Data Types: bus

Parameters

expand all

If you select the AUTOSAR 4.x code replacement library (CRL) for your model, code generated from this block is replaced from the selected AUTOSAR routine library. This parameter enables you to choose either fixed-point (IFX) or floating-point (IFL) code replacement and validation checks.

This parameter reflects the name of the AUTOSAR code replacement library (CRL) routine used to replace the code generated by this block. The naming convention includes the targeted routine library, interpolation method, and block type. This parameter is reference-only and must not be edited.

When the Targeted Routine Library is set to IFX (fixed-point) the value defaults to Ifx_DPSearch.

When the Targeted Routine Library is set to IFL (floating-point) the value defaults to Ifl_DPSearch.

Table Specification

If you set this parameter to:

  • Explicit values, the Breakpoints parameter becomes visible in the dialog box.

  • Breakpoint object, the Name parameter is visible in the dialog box.

Programmatic Use

Block Parameter: BPSpecification
Type: character vector | string
Values: "Explicit values" | "Breakpoint object"
Default: "Explicit values"

Explicitly specify the breakpoint data. Each breakpoint data set must be a strictly monotonically increasing vector that contains two or more elements.

Dependencies

To enable this parameter, set Breakpoints Specification to Explicit values.

Programmatic Use

Block Parameter: BreakpointsData
Type: character vector
Values: 1-by-n or n-by-1 vector of monotonically increasing values
Default: '[1 2 3]'

Specify the name of a Simulink.Breakpoint object. If a Simulink.Breakpoint object does not exist, click the action button and select Create. The corresponding parameters of the new breakpoint object are populated with the block information.

Dependencies

To enable this parameter, set Breakpoints Specification to Breakpoint object.

Programmatic Use

Block Parameter: BreakpointObject
Type: character vector
Values: Simulink.Breakpoint object
Default: '[]'

Algorithms

Each search method has speed advantages in different situations:

  • If input values for u do not vary significantly between time steps, selecting Linear search with Begin index search using previous index result produces the best performance.

  • If input values for u jump more than one or two table intervals per time step, selecting Binary search produces the best performance.

A suboptimal choice of index search method can lead to slow performance of models that rely heavily on lookup tables.

Programmatic Use

Block Parameter: IndexSearchMode
Type: character vector | string
Values:"Linear search" | "Binary search"
Default: "Linear search"

For input values of u that change slowly with respect to the interval size, enabling this option can improve performance. Otherwise, the linear search and binary search methods can take longer, especially for large breakpoint sets.

Programmatic Use

Block Parameter: BeginIndexSearchusingPreviousIndexResult
Type: character vector | string
Values: "off" | "on"
Default: "off"

Specify the rounding mode for fixed-point or floating-point lookup table calculations that occur during simulation or execution of code generated from the model.

This option does not affect rounding of block parameter values. Simulink™ rounds such values to the nearest representable integer value.

Dependencies

This parameter is visible only if you set it to Round. Integer rounding is not supported for AUTOSAR 4.x and host libraries for SIL testing and is hidden by default. To enable SIL workflows, change this setting to Zero.

Programmatic Use

Block Parameter: RndMode
Type: character vector | string
Values: "Round" | "Zero"
Default: "Zero"

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2019a

expand all