Engee documentation

1-D Lookup Table

Approximate one-dimensional function.

blockType: LookupTableND

Path in the library:

/Basic/Lookup Tables/1-D Lookup Table

Description

Block 1-D Lookup Table calculates the approximate value of some function:

,

where the function can be empirical.

Block icon 1-D Lookup Table displays the graph of the function defined in the block.

The block maps the input data to a table of output values using interpolation and extrapolation methods.

The block supports the following interpolation methods: Flat, Linear point-slope, Linear Lagrange, Nearest, Cubic spline and Akima spline.

You can read more about interpolation methods here: Methods for approximating function values

Setting reference points and output value table

These block parameters set the values for the datums and the output table.

Block parameter Purpose

Breakpoints 1

Sets the vector of reference points.

Table data

Defines the corresponding set of output values.

How the block generates output data

Block 1-D Lookup Table generates output data by searching the table or by evaluating values based on input values.

Block input data Block behaviour 1-D Lookup Table

Match the values in the datasets of the reference points

Outputs tabular value

Does not match the values in the datasets of the anchor points, but is within the range.

Interpolates the corresponding table values using the selected value Interpolation method

Do not match the values in the datasets of the reference points and are out of range

Extrapolates the output value using the selected Extrapolation method

Ports

Input

# IN_1 — input signal
scalar | vector | matrix

Details

An input signal , matched to an output value by searching or interpolating from a table of values.

Data types

Float16, Float32, Float64, Int8, Int16, Int32, Int64, Int128, UInt8, UInt16, UInt32, UInt64, UInt128, Fixed-point, Bool.

Complex numbers support

Yes

Output

# OUT_1 — output signal calculated by searching or evaluating table values
scalar | vector | matrix

Details

An output calculated by finding or evaluating table values based on input values.

When the input data of a block is…​ Then the block 1-D Lookup Table…​

Match the values in the datasets of the reference points

Outputs a tabular value

Do not match the values in the datasets of the anchor points, but are within range

Interpolates the corresponding table values using the selected value. Interpolation method

Do not match the values in the anchor point datasets and are out of range

Extrapolates the output value using the selected Extrapolation method

Data types

Float16, Float32, Float64, Int8, Int16, Int32, Int64, Int128, UInt8, UInt16, UInt32, UInt64, UInt128, Fixed-point, Bool.

Complex numbers support

Yes

Parameters

Main

# Table data — table of output values
Array of real and/or complex numbers

Details

Table of output values.

Default value

tanh.(collect(-5:5))

Program usage name

Table

Tunable

Yes

Evaluatable

Yes

# Breakpoints 1 — the values of the reference points for the first measurement
Array of real numbers

Details

Reference points for the first measurement.

Default value

collect(-5:5)

Program usage name

BreakpointsForDimension1

Tunable

Yes

Evaluatable

Yes

Lookup method

# Interpolation method — the method of interpolation between the values of the reference points
Flat | Nearest | Linear point-slope | Linear Lagrange | Cubic spline | Akima spline

Details

When the input signal falls between the values of the reference points, the block interpolates the output value using adjacent points.

You can read more about the interpolation methods here.: Methods for approximating function values

Dependencies

  • If you choose Cubic spline, then the block will only support scalar signals. Other interpolation methods support non-scalar signals.

  • If you choose Akima spline, then the extrapolation method can only be Akima spline.

Values

Flat | Nearest | Linear point-slope | Linear Lagrange | Cubic spline | Akima spline

Default value

Linear point-slope

Program usage name

InterpMethod

Tunable

No

Evaluatable

No

# Extrapolation method — a method for processing input values that fall outside the range of the data set of reference points
Clip | Linear | Cubic spline | Akima spline

Details

The choice of the extrapolation method.

You can read more about extrapolation methods here.: Methods for approximating function values

Dependencies

  • To select Cubic spline for the Extrapolation method, you must also select Cubic spline for the Interpolation method.

  • To select Akima spline for the Extrapolation method, you must also select Akima spline for the Interpolation method.

Values

Clip | Linear | Cubic spline | Akima spline

Default value

Linear

Program usage name

ExtrapMethod

Tunable

No

Evaluatable

No

Data type

# Table data — the data type of the table values
Inherit: auto | Same as output | Float64 | Float32 | Float16 | Int8 | UInt8 | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 | Int128 | UInt128 | Fixed-point

Details

Specify the data type of the table values.

Values

Inherit: auto | Same as output | Float64 | Float32 | Float16 | Int8 | UInt8 | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 | Int128 | UInt128 | Fixed-point

Default value

Same as output

Program usage name

TableDataTypeStr

Tunable

No

Evaluatable

No

# Table fixed-point type — the fixed-point data type for the table
Data type

Details

Specify the fixed-point data type for the table.

Dependencies

To use this parameter, set for the parameter Table data meaning Fixed-point.

Default value

fixdt(1, 16, 0)

Program usage name

TableDataTypeStrFixed

Tunable

No

Evaluatable

Yes

# Breakpoints 1 — the data type for the reference point values for the first measurement
Inherit: auto | Same as input | Float64 | Float32 | Float16 | Int8 | UInt8 | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 | Int128 | UInt128 | Fixed-point

Details

Specify the data type for the reference point values for the first measurement

Values

Inherit: auto | Same as input | Float64 | Float32 | Float16 | Int8 | UInt8 | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 | Int128 | UInt128 | Fixed-point

Default value

Same as input

Program usage name

BreakpointsForDimension1DataTypeStr

Tunable

No

Evaluatable

No

# Breakpoints 1 fixed-point type — fixed point data type for the reference point values for the first measurement
Data type

Details

Specify the fixed-point data type for the reference point values for the first measurement.

Dependencies

To use this parameter, set for the parameter Breakpoints 1 meaning Fixed-point.

Default value

fixdt(1, 16, 0)

Program usage name

BreakpointsForDimension1DataTypeStrFixed

Tunable

No

Evaluatable

Yes

# Fraction — fraction data type
Inherit: auto | Float64 | Float32 | Fixed-point

Details

Specify the fraction data type.

Values

Inherit: auto | Float64 | Float32 | Fixed-point

Default value

Inherit: auto

Program usage name

FractionDataTypeStr

Tunable

No

Evaluatable

No

# Fraction fixed-point type — fixed-point fraction data type
Data type

Details

Specify the data type with a fixed fraction point.

Dependencies

To use this parameter, set for the parameter Fraction meaning Fixed-point.

Default value

fixdt(1, 16, 0)

Program usage name

FractionDataTypeStrFixed

Tunable

No

Evaluatable

Yes

# Intermediate results — the data type of the intermediate results
Inherit: auto | Same as output | Float64 | Float32 | Int8 | UInt8 | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 | Int128 | UInt128 | Fixed-point

Details

Specify the data type of the intermediate results.

Values

Inherit: auto | Same as output | Float64 | Float32 | Int8 | UInt8 | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 | Int128 | UInt128 | Fixed-point

Default value

Same as output

Program usage name

IntermediateResultsDataTypeStr

Tunable

No

Evaluatable

No

# Intermediate results fixed-point type — a fixed-point data type of intermediate results
Data type

Details

Specify the fixed-point data type of the intermediate results.

Dependencies

To use this parameter, set for the parameter Intermediate results meaning Fixed-point.

Default value

fixdt(1, 16, 0)

Program usage name

IntermediateResultsDataTypeStrFixed

Tunable

No

Evaluatable

Yes

# Output — type of output data
Inherit from `Table data` | Same as input | Float64 | Float32 | Float16 | Int8 | UInt8 | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 | Int128 | UInt128 | Fixed-point

Details

Specify the type of output data.

Values

Inherit from `Table data` | Same as input | Float64 | Float32 | Float16 | Int8 | UInt8 | Int16 | UInt16 | Int32 | UInt32 | Int64 | UInt64 | Int128 | UInt128 | Fixed-point

Default value

Same as input

Program usage name

OutDataTypeStr

Tunable

No

Evaluatable

No

# Output fixed-point type — the type of fixed-point output
Data type

Details

Specify the type of fixed-point output.

Dependencies

To use this parameter, set for the parameter Output meaning Fixed-point.

Default value

fixdt(1, 16, 0)

Program usage name

OutDataTypeStrFixed

Tunable

No

Evaluatable

Yes

# Integer rounding mode — rounding mode for fixed point operations
Ceiling | Convergent | Floor | Nearest | Round | Zero

Details

Select the rounding mode for fixed-point operations. You can choose:

  • Floor — rounds down both positive and negative numbers (towards negative infinity).

  • Ceiling — rounds up both positive and negative numbers (towards positive infinity).

  • Convergent — rounds the number to the nearest representable value. If the fractional part of the number ends in 5, the number is rounded to the nearest even integer.

  • Nearest — rounds the number to the nearest representable value. If the fractional part of the number ends in 5, the number is rounded up (towards positive infinity).

  • Round — rounds the number to the nearest integer.

  • Zero — rounds the number towards zero.

The block parameters are always rounded to the nearest representable value.

Values

Ceiling | Convergent | Floor | Nearest | Round | Zero

Default value

Floor

Program usage name

RndMeth

Tunable

No

Evaluatable

No

# Saturate on integer overflow — method of action in case of overflow
Logical

Details

When this option is selected, saturation is applied to all internal block operations, not just the output or result.

Action Reasons for making this decision What happens when there is an overflow Example

Check this box.

Overflow is possible in your model, and you need explicit protection against saturation in the generated code.

Overflows are saturated to the minimum or maximum value that a given data type can represent.

Overflow associated with a signed 8-bit integer can saturate to -128 or `127'.

Do not check this box.

You want to optimize the efficiency of the generated code.
You want to avoid over-clarifying how the block handles signals that are out of range.

Overflows are wrapped into an appropriate value, which can be represented by a data type.

The number 130 does not fit into a signed 8-bit integer and collapses into -126

Default value

false (switched off)

Program usage name

SaturateOnIntegerOverflow

Tunable

No

Evaluatable

No

Additional options

C code generation: Yes