The calculation table is very important in sensor configuration (see sensor properties). According to the calculation table adjusted, raw data coming in a parameter is transformed into sensor values, for instance, some abstract 86 is interpreted as 10.5 liters of fuel.

The calculation table is not always necessary. For example, if the sensor is digital and sends only 1 or 0, which correspond to the **On/Off** states, there is no need in the value calculation table for such a sensor.

The completed calculation table is essential for the analog engine ignition sensor since it is necessary to determine how all available analog values are transformed into two available states — On/Off.

Calculation table recalculates data according to the equation of the straight line **Y = a×X + b**, where

**X**is the input value that comes from the device;**Y**is the output value that is included in the reports, charts, tooltips, etc.;**a**is the coefficient that determines the slope or gradient of the line (tangent of the angle, or relation of the opposite cathetus to the adjoining one);**b**is the displacement of a straight line along the Y-axis.

Upon the arrival of the value (i.e. **X**), it is substituted into the calculation table, **a** and **b** are calculated automatically, and the output receives a final value, i.e. **Y** (it gets into reports, graphs, tooltips, etc.).

Each row of the table operates only within its segment that is to the **X** value of the next row. That is why **X** values cannot be repeated.

It is possible to get the tangent of the angle (that is needed to be substituted for the **a** coefficient) using mathematics. To do it, find on the **X** and **Y** axes the segments of values operation (deltas). Then divide the values **∆y/∆x**. The result value is the tangent of the angle.

## Working with the table

To add a new line to the table, click** Add line** (). To delete a line, click on the icon next to it. To delete all lines at once, click on the icon in the table heading and confirm the action in the window that opens.

In the **Lower bound** and **Upper bound** fields, you can specify the range of sensor values. The specified lower bound is included in the range of valid values while the upper one is not. All received values which go beyond the specified range are considered invalid. The **Apply after calculation** option allows applying the specified bounds to the raw **X** values (option disabled) or to the processed **Y** values (option enabled).

You can fill in the calculation table in one of the following ways:

- Fill in all available fields (
**X**,**b**, and**a**) manually. This method is useful if you want to configure the table on your own. - Fill in only the
**X**and**b**values, and**a**set as zero. This method is useful if you want to convert an analog signal to a digital one. - Fill in only the
**X**and**a**values. In this case,**b**is calculated automatically. This method is useful if you want to get a curve knowing the angles, but without recalculating the**Y**offset. - Fill in all fields automatically using the
**X**and**Y**values. To do this, you should enable and configure the XY pairs.

## Working with the chart

To open the calculation chart, click on the icon above the table.

Using the icons above the chart, you can perform the following actions:

Icon | Action |
---|---|

Zoom in the selected area of the chart. To do this, click on the icon and select the required area while holding the left mouse button. | |

Show the default scale of the chart. | |

Zoom in/Zoom out the chart. You can also change the scale using the scroll wheel. | |

Save the visible area of the chart to a PNG file. |

## Example 1: Temperature sensor

As an example, let us create a calculation table for the temperature sensor. Suppose that the data is coming in complement code, i.e. the positive values are from 0 to 127, and negative from 128 (which corresponds to -128 degrees) to 255 (which corresponds to -1 degree).

You can see the resulting calculation in the chart.

The calculation chart always has a somewhat extended view — along the X axis it stretches to the right and to the left. This is due to the fact that on the first interval the function also works in the opposite direction — up to minus infinity, and on the last interval — up to plus infinity.

## Example 2: Engine ignition sensor

It is possible to configure a non-digital ignition sensor based on the parameter sending voltage. For instance, the voltage up to 0.5 V would mean **ignition off**, and over 0.5 V — **ignition on**. For such a sensor, we should create a calculation table as shown below:

The calculation chart looks as follows:

## Generate from XY pairs

The **Generate from XY pairs** tool is designed to fill in the calculation table automatically. You can use this tool when calibrating sensor values experimentally. For example, you can pour different volumes of fuel into the tank and take the readings of the fuel level sensor corresponding to these volumes. See more information on how to make the calibration of a fuel tank in the guide.

To add the XY pairs and fill in the calculation table automatically, follow the steps below.

- Activate the
**Generate from XY pairs**tool. - In the
**X**line, specify the input value (for example, the fuel level sensor value), and in the**Y**line, the output value which corresponds to it (for example, the fuel volume at which this value was received). Add the required number of lines. - Click on the
**Generate**button.

On the left, the calculation table is generated automatically in accordance with the specified values. The table shows one line less than added in the XY pairs. All changes made in the calculation table manually don't influence the values specified in the XY pairs.

In the calculation table, the **a** and **b** values are calculated by the system in the following way:

**a**is calculated by the formula**∆Y/∆X**. X- and Y-axial displacement is calculated separately for each interval, and then Y-axial displacement is divided by X-axial displacement, that is**∆Y/∆X**.**b**is calculated by the formula**b = Y — a × X**.

To see the calculation result in the chart, click on the icon above the table.

To the right of the **Generate from XY pairs** tool, the following icons are available:

- . Allows you to export the values of the added XY pairs to a CSV file.
- . Allows you to import values from CSV or TXT files.

Below you can see examples of filling in the calculation table by configuring the XY pairs for the fuel level sensor.

## Example 1: Fuel level sensor

Consider the case when 10 liters of fuel are poured into the tank and the fuel level sensor shows the value 86. Then another 10 liters are poured into the tank and the sensor shows 173, etc. Thus, you can get the following table in which the **X** values correspond to the sensor readings, and the **Y** values, to the fuel volumes:

Input values (X) | Output values (Y) |
---|---|

0 | 0 |

86 | 10 |

173 | 20 |

252 | 30 |

330 | 40 |

405 | 50 |

477 | 60 |

546 | 70 |

618 | 80 |

686 | 90 |

749 | 100 |

Based on the values from the table, the XY pairs are added (see steps 1-3 from the guide above).

The calculation chart looks as follows:

You can see how the **a** and **b** values were calculated. The first interval starts with 0 and lasts until 86. At that, at the last point the output is 10. So, **X** displacement is **∆Х** = 86 — 0 = 86, and **Y** displacement is **∆Y** = 10 — 0 = 10. Now the **a** coefficient can be calculated: **a** = **∆Y/∆X** = 10 / 86 = 0,11627906976744186.

For other intervals, the same calculation scheme is applied:

Interval | X | Y | a | b |
---|---|---|---|---|

N | X | Y | (Y | Y — a × X |

1 | 0 | 0 | (10 — 0) / (86 — 0) | 0 — a×0 |

2 | 86 | 10 | (20 — 10) / (173 — 86) | 10 — a×86 |

3 | 173 | 20 | (30 — 20) / (252 — 173) | 20 — a×173 |

4 | 252 | 30 | (40 — 30) / (330 — 252) | 30 — a×252 |

5 | 330 | 40 | (50 — 40) / (405 — 330) | 40 — a×330 |

6 | 405 | 50 | (60 — 50) / (477 — 405) | 50 — a×405 |

7 | 477 | 60 | (70 — 60) / (546 — 477) | 60 — a×477 |

8 | 546 | 70 | (80 — 70) / (618 — 546) | 70 — a×546 |

9 | 618 | 80 | (90 — 80) / (686 — 618) | 80 — a×618 |

10 | 686 | 90 | (100 — 90) / (749 — 686) | 90 — a×686 |

11 | 749 | 100 | (110 — 100) / (812 — 749) | 100 — a×749 |

## Example 2: Fuel level sensor

In this example, the input **X** values are indicated in descending order, and the output **Y** values, in ascending order. Initial data:

Input values (X) | Output values (Y) |
---|---|

2.8 | 0 |

2.58 | 10 |

2.18 | 20 |

2.0 | 30 |

1.65 | 40 |

1.3 | 50 |

1.25 | 60 |

1.1 | 70 |

0.96 | 80 |

0.6 | 90 |

0.32 | 100 |

Based on the initial data, the XY pairs are added (see steps 1-3 from the guide above). After clicking on the **Generate** button, the specified **Y** values are shown in descending order automatically.

In this example, the calculation chart looks as follows:

Below is the table for calculating intervals.

Interval | X | Y | a | b |
---|---|---|---|---|

N | X | Y | (Y_{(i+1)} — Y_{(i)}) / (X_{(i+1)} — X_{(i)}) | Y — a × X |

1 | 0,32 | 100 | (90 — 100) / (0,6 — 0,32) | 100 — a×0,32 |

2 | 0,6 | 90 | (80 — 90) / (0,96 — 0,6) | 90 — a×0.6 |

3 | 0,96 | 80 | (70 — 80) / (1,1 — 0,96) | 80 — a×0.96 |

4 | 1,1 | 70 | (60 — 70) / (1,25 — 1,1) | 70 — a×1.1 |

5 | 1,25 | 60 | (50 — 60) / (1,3 — 1,25) | 60 — a×1.25 |

6 | 1,3 | 50 | (40 — 50) / (1,65 — 1,3) | 50 — a×1.3 |

7 | 1,65 | 40 | (30 — 40) / (2,0 — 1,65) | 40 — a×1.65 |

8 | 2,0 | 30 | (20 — 30) / (2,18 — 2,0) | 30 — a×2 |

9 | 2,18 | 20 | (10 — 20) / (2,58 — 2,18) | 20 — a×2.18 |

10 | 2,58 | 10 | (0 — 10) / (2,8 — 2,58) | 10 — a×2.58 |