.

Lookup

Overview

Overview

The Lookup block performs a step (type 0) or piecewise linear (types 1 and 2) mapping of the input. Lookup blocks have three forms Direct (direct indexing into table), Fixed (table spacing is fixed), and Vector (table spacing is specified by a vector).

The Direct form (Type 0) uses the input to index into a lookup table. If the index is outside the bounds of the table the nearest output end value in the table is output. The following is an example of a Direct Lookup Block:

Table
0
1
1
3
5
10
10
8
5
lookup_overview1

For the Fixed form (Type 1) the input minimum value and point spacing are specified. The output values are interpolated over the a range determined by the size of the lookup table. The input is outside the range of the table (below the input minimum or above the minimum + number of points * spacing) the output value is extrapolated from the nearest two end points in the table. The following is an example of a Fixed Lookup block:

Table
Comment
100
// Input Minimum Value
200

// Input Step Size

100

// Table Entry 0

300
 
500
 
500
 
500
 
-100
 
-300
 
-300
 
-100
 
0
 
lookup_overview2


For the Vector form (Type 2) an input vector is used to determine the interpolation value used for the output. The input vector must be ordered (ascending values). The input value is used to search the input vector for points that bracket the input (i. e. vector[n] <= input <= vector[n+1]). The output is then calculated by interpolating the corresponding values in the lookup table. The following example shows a Vector Lookup block:

Input Vector
Table
200
100

250

300

500

500
700
500
725
500
1100
-100
1450
-300
1500
-300
1700
-100
1750
0
lookup_overview3

The Lookup Block parameters are as follows:

LookupType

Lookup Table Type (0 = Direct, 1 = Fixed, 2 = Vector)

LookupTableSize

Number of points in the Lookup table (and input vector for type 2) .

LookupTable[ ]

Nx1 vector of output points for Direct (type 1) lookup.
N = LookupTableSize.

1xN+2 vector for Fixed (type 1) lookup.
The first two points are the Input Minimum and Spacing, and the remaining N points are the output points.

2xN vector for Vector (type 2) lookup.
The first column is the input vector and the second column is the table of output points.

Subsample Code A code which determines the schedule for updating this block (every sample, even samples only, etc.) See Subsampling.
User Data 0 Application-specific data. See User Data Storage.
User Data 1 Application-specific data. See User Data Storage.

Matlab/Simulink

Simulink Interface

bin_img1

The Lookup Input may be connected to any block output except FTOI. The Output will be generated from the input using a lookup table. The table may be indexed directly (Lookup Type = 0 (default)) or interpolated (Type = 1, Fixed and Type = 2, Vector).

The Lookup Table File field should have the name of a text file that contains the lookup table data appropriate for the Lookup Type.

For Direct (Type 0) lookup the file contains one line per table entry. The entry value must be a number at the beginning of the line. Each line may contain a comment following the table value as long as the comment does not begin with a numeric character and there is at least one space or tab character between the value number and the comment. The following is an example of a Direct table file:

100.0    Comment can start here, but must not start with a number
300.0    This table has 10 entries
500.0
500.0
200.0
-100.0
-300.0
-15.0
-200.0
15.0

The format for the text file containing data for Fixed (Type 1) lookup table blocks is the same as that for Direct types except the first two lines contain the minimum input value and table spacing value respectively. The following is an example of a Fixed table file:

100.0    // Input Minimum Value
200.0    // Input Step Size
100.0    // Table Entry 0
300.0
500.0
500.0
500.0
-100.0
-300.0
-300.0
-100.0
0.0

For Vector (Type 2) lookup the file contains an input vector value and a lookup table value on each line (separated by at least one space or tab character). The input vector values must be in ascending order. The following is an example of a Vector table file:

200    100
250    300
500    500
700    500
725    500
1100   -100
1450   -300
1500   -300
1700   -100
1750   0

The block has two user data fields (User Data 0, User Data 1) to store application-specific data for convenient storage and retrieval. See User Data Storage for details.

The block's update schedule is determined by the Subsample Code (See Subsampling). The following Parameter Dialog Box can be opened by double-clicking on the block in a Simulink Model:

bin_img2

 

C++ API

LOOKUPBlock

Declaration

Public Method

LOOKUPBlock&   LOOKUP();
Required Header: mechaware.h

Description

The Lookup block maps the an output to an input using a lookup table and is controlled by the type which can be Direct indexing, Fixed spacing, or Vector specified spacing.

Parameters

long
LOOKUP().LookupType

Lookup Table Type (0 = Direct, 1 = Fixed, 2 = Vector)

long LOOKUP().LookupTableSize

Number of points in the Lookup table (and input vector for type 2)

std::vector<double> LOOKUP().LookupTable[ ]

Nx1 vector of output points for Direct (type 0) lookup.
N = LookupTableSize.

1xN+2 vector for Fixed (type 1) lookup.
The .first two points are the Input Minimum and Spacing, and the remaining N points are the output points.

2xN vector for Vector (type 2) lookup.
The first column is the input vector and the second column is the table of output points.

Methods

Block Methods

Remarks

The number of lookup points is currently limited to 700 for Types 0 and 1, and 350 for Type 2.

See Also

LOOKUP2D

 

       Legal Notice  |  Tech Email  |  Feedback
      
Copyright ©
2001-2012 Motion Engineering