Main Content

Curve Using Prelookup

Use previously calculated index and fraction values to accelerate approximation of one-dimensional function

  • Curve Using Prelookup block

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

Description

The Curve Using Prelookup block is intended for use with the Prelookup block. This block enables a prelookup result to drive multiple interpolation results.

The Prelookup block computes the index and interval fraction that specify how its input value u relates to the breakpoint data set and feeds the resulting index and fraction values into the Curve Using Prelookup block to interpolate a one-dimensional table.

The Prelookup and Curve Using Prelookup blocks have distributed algorithms that, when used together, perform the same algorithm operation as the Curve block. By using the Prelookup and Curve Using Prelookup blocks together you have greater flexibility and more efficient simulation and code generation than when just using the Curve block.

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

Inputs to the kf1 port contain index k and fraction f, specified as either Ifx_DPResultU16_Type or Ifl_DPResultF32_Type.

When Targeted Routine Library is set to IFX (fixed-point) then the port is set to data type Ifx_DPResultU16_Type.

When Targeted Routine Library is set to IFL (floating-point) then the port is set to data type Ifl_DPResultF32_Type.

Output

expand all

Approximation of the one-dimensional function computed by interpolating table data that uses values from the input index, k, and the fraction, f.

When Targeted Routine Library is set to IFL (floating-point) then the only valid data type is single.

When Targeted Routine Library is set to IFX (fixed-point)then you can the values of the Port 1 can be one of these data types: int8, uint8, int16, uint16, int32, uint32, and fixed-point data types.

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

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

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

Table Specification

Specify whether to enter table data directly or use a lookup table object. If you set this parameter to:

  • Explicit values, the Table Data parameter and Data Types tab are visible in the dialog box.

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

Programmatic Use

Block Parameter: TableSpecification
Type: character vector | string
Values: "Explicit values" | "Lookup table object"
Default: "Explicit values"

Specify the name of a Simulink.LookupTable object. A lookup table object references Simulink® breakpoint objects. If a Simulink.LookupTable object does not exist, click the action button and select Create. The corresponding parameters of the new lookup table object are populated with the block information.

Dependencies

To enable this parameter, set Data Specification to Lookup table object.

Programmatic Use

Block Parameter: LookupTableObject
Type: character vector
Value: Simulink.LookupTable object
Default: '[]'

Enter the table of output values.

During simulation, the matrix size must be one-dimensional. However, during block diagram editing, you can enter an empty matrix (specified as []) or an undefined workspace variable. This technique lets you postpone specifying a correctly dimensioned matrix for the table data and continue editing the block diagram.

Dependencies

To enable this parameter, set Data specification to Explicit values.

Programmatic Use

Block Parameter: Table
Type: character vector
Values: matrix of table values
Default: '[1 2 4]'

Click this button to open the Lookup Table Editor.

Clicking this button for a lookup table object lets you edit the object and save the new values for the object.

Algorithm

Specify the method that the block uses to interpolate table data. You can select Linear point-slope or Flat. For more information, see Interpolation Methods.

Programmatic Use

Block Parameter: InterpMode
Type: character vector | string
Values: "Flat" | "Linear point-slope"
Default: "Linear point-slope"

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"

Data Types

To enable this tab, on the Table Specification tab, set Data Specification to Explicit values.

Specify the table data type. The block validates that the selected types are compatible with the specification of the targeted routine.

When Targeted Routine Library is set to IFL (floating-point) then the only valid data type is single.

When Targeted Routine Library is set to IFX (fixed-point)then you can set the data type to:

  • Rules that inherit a data type: Inherit: Same as output, Inherit: Inherit from 'Table data'.

  • One of these built-in data types: int8, uint8, int16, uint16, int32, and uint32.

  • The name of a data type object, for example, a Simulink.NumericType object.

  • An expression that evaluates to a data type. For example, the software provides these common fixed-point data type expressions: fixdt(1,16), fixdt(1,16,0), or fixdt(1,16,2^0,0).

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the data type attributes. For more information, see Specify Data Types Using Data Type Assistant.

Tip

Specify a table data type different from the output data type for these cases:

  • Lower memory requirement for storing table data that uses a smaller type than the output signal

  • Sharing of prescaled table data between two Curve blocks with different output data types

  • Sharing of custom storage table data in the generated code for blocks with different output data types

Programmatic Use

Block Parameter: TableDataTypeStr
Type: character vector | string
Values: "Inherit: Inherit from 'Table data'" | "Inherit: Same as output" | "single" | "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32" | "fixdt(1,16)" | "fixdt(1,16,0)" | "fixdt(1,16,2^0,0)" | "<data type expression>"
Default: "Inherit: Same as output"

Extended Capabilities

expand all

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

Version History

Introduced in R2019a

expand all