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.0 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 any numeric data type that Simulink™ supports, except Boolean. The Prelookup block supports fixed-point data types for signals and breakpoint data.

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

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.0 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.

Table Specification

If you set this parameter to:

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

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

Programmatic Use

Block Parameter: BreakpointsSpecification
Type: character vector
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 2 3]'
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.

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: IndexSearchMethod
Values: 'Binary search' | 'Linear search'
Type: character vector
Default: 'Binary search'

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. To control the rounding of a block parameter, enter an expression using a MATLAB™ rounding function into the edit field on the block dialog box.

Programmatic Use

Block Parameter: RndMeth
Type: character vector
Values: 'Round' | 'Zero'
Default: 'Round'

Extended Capabilities

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

Version History

Introduced in R2019a