.

Lookup2D

Overview

Overview

The two-dimensional Lookup block is very similar to the one-dimensional version, except two inputs are mapped to the output instead of one. The mapping is either stepwise (type 0) or piecewise linear (types 1 and 2). Two dimensional 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 inputs to index into a two-dimensional lookup table. If an index is outside the bounds of the table the nearest output end value in the table is output.

For the Fixed form (Type 1) the input minimum values and point spacing are specified. The output values are interpolated over the a range determined by the size of the lookup table. If an 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.

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

Input Vector0

Input Vector1

Table

0

-200

0

1

2

3

4

5

100

-100

0.1

2

4

6

8

10

200

0

0.2

3

6

9

12

15

300

100

0.3

4

8

12

16

20

400

200

0.4

5

10

15

20

25

500

300

0.5

6

12

18

24

30

Lookup 2D Graph

The Lookup Block parameters are as follows:

LookupType

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

Lookup Table File

Name of a text (.txt) file that contains the interpolating vectors and table entries. See the Simulink documentation for the file formats.

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

Lookup 2D Simulink Block

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). See the Overview section for descriptions of the lookup types.

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 1 line per table row. The entry values must be a row of numbers at the beginning of the line. Each line may contain a comment following the table values as long as the comment does not begin with a numeric character and there is at least one space or tab character between the last value number and the comment. The following is an example of a Direct table file:

0.0 1 2 3 4 5   Comment may start here

0.1 2 4 6 8 10  Comment must not begin with a number

0.2 3 6 9 12 15  This table has 36 entries

0.3 4 8 12 16 20

0.4 5 10 15 20 25

0.5 6 12 18 24 30

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 line contain the minimum input values and table spacing values respectively. The following is an example of a Fixed table file:

0 100 -200 100 min0, delta0, min1, delta1

0.0 1 2 3 4 5   Comment may start here

0.1 2 4 6 8 10  Comment must not begin with a number

0.2 3 6 9 12 15  This table has 36 entries

0.3 4 8 12 16 20

0.4 5 10 15 20 25

0.5 6 12 18 24 30

For Vector (Type 2) lookup the file contains an two input vectors and a lookup table. The input vectors are in the first two rows and must be in ascending order. The following is an example of a Vector table file:

0 100 200 300 400 500 Input Vector 0

-200 -100 0 100 200 300 Input Vector 1

0.0 1 2 3 4 5   Comment may start here

0.1 2 4 6 8 10  Comment must not begin with a number

0.2 3 6 9 12 15  This table has 36 entries

0.3 4 8 12 16 20

0.4 5 10 15 20 25

0.5 6 12 18 24 30

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:

Lookup 2D Parameters Dialog Box


C++ API

LOOKUP2DBlock

Declaration

Public method

LOOKUP2DBlock&   LOOKUP2D();

Required Header: mechaware.h

Description

The LOOKUP2D block maps the an output to an input using a lookup table. The manner of lookup is controlled by the type which can be Direct indexing, Fixed spacing, or Vector specified spacing. See the Overview for details.

Parameters

long

LOOKUP2D().LookupType

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

long

LOOKUP2D().LookupTableCols

Number of columns (N) in the Lookup table (and input Vector 0 for type 2)

long

LOOKUP2D().LookupTableRows

Number of rows (M) in the Lookup table (and input Vector 1 for type 2)

std::vector<double>

LOOKUP2D().LookupTable[ ]

Type 0 (Direct): NxM array of output points for Direct (type 0) lookup.

N = LookupTableCols, M = LookupTableRows.

 

Type 1 (Fixed): Minimum Value 0, Delta 0, Minimum Value 1, Delta 1, then NxM array of output points.

 

Type 2 (Vector): Input Vector 0 (N values), Input Vector 1 (M values), then NxM array of output values.

 

Methods

Block Methods

See Also

Lookup | BiQuad Lookup

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