Lookup Table 2D block

The two-dimensional Lookup Table block performs a lookup in a user-defined table for the value of a single dependent variable (the block output) using two fields as indexes (the independent variables, block inputs).

Return to Overview of blocks

Lookup Table 2D block

Description

The block does a lookup using the values of two independent variables, selected during the configuration of the block, in a table specified by the user. The block uses the values of the independent fields to find the corresponding value of the dependent variable (block output).  If the value of either or both of the independent fields falls between two table entries, then the value of the dependent variable is calculated by a linear interpolation on the two-dimensional table.

diagram showing the lookup table 2-D block

Block Type

Data Transformation block

Input/Output ports

The block has one input port. The input port must contain at least two input fields, all input fields must be of type double. The output of the lookup table is supplied in the single output field in the output port of the block.

Functions performed on tags
  • On the values - The block contains only one output value.  If the row input value and the column input value is the same as the row and column entries of the table, the output value is the corresponding value of the output field in the table.  If either the row input value or the column input value lies between two row or column entries in the table respectively, then the output value is computed by doing a linear interpolation in the two dimensional lookup table. If the quality is set to bad, then the output value will not be changed.

  • On the timestamp - The output field takes the time stamp of the input field with the most recent time stamp.

  • On the quality - The two input field qualities will be read. If the quality of either of the two fields which were read, is bad, the output quality will be set to bad and the execution is complete (i.e. no lookup is performed).  The row input field will then be checked to see if it is less than the minimum row index, or more than the maximum row index.  If it is, the output quality is set to bad. The column input field will then be checked to see if it is less than the minimum column index, or more than the maximum column index. If it is, then the output quality is set to bad.  If the input qualities are good and the input fields within range, the output quality will be set to good.

Example

A 2-dimensional table is shown below.  In the example below we refer to a particular position in the table as (X;Y) where X is the row variable (Independent variable 1) and Y is the column variable (Independent variable 2).    

  • Case 1:  Assume that a good quality value of 2 enters for the row variable and a good quality value of 5 enters for the column variable.  The table has entries of 2 and 5 for these variables thus the block output will be 8.  

  • Case 2:  Assume that a good quality value of 3 enters for the row variable and a bad quality value of 8 enters for the column variable.  The block will not do a lookup, the block output will remain 8 (i.e. keep last principle) and be bad quality.

  • Case 3:  Assume that a good quality value of 5.5 enters for the row variable and a good quality value of 4 enters for the column variable.  The table has an entry of 4 for the column variable.  For the row variable the table only has entries of 5 and 6.  Thus the block will perform a linear interpolation on the 2-D table to determine the value of the output.  The output at (5;4) is 3 and at (6;4) is 9.  Since 6 lies halfway between 3 and 9, the output is 6.

  • Case 4:  Assume that a good quality value of 9 enters for independent variable 1 and a good quality value of 4 enters for independent variable 2.  The block will not do a lookup since the value for independent variable 1 lies outside the range of the table (too large), the value of the output will be  will be bad quality.

The diagram below shows the block input (I_Var_1 and I_Var_2) and output (Output) for the above cases.

 

Return to top


Related topics:

  

CSense 8.5 SP1- Last updated: November 17,2023