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:
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)
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:
(Y(i+1) — Y(i)) / (X(i+1) — X(i))
Y — a × X
(10 — 0) / (86 — 0)
0 — a×0
(20 — 10) / (173 — 86)
10 — a×86
(30 — 20) / (252 — 173)
20 — a×173
(40 — 30) / (330 — 252)
30 — a×252
(50 — 40) / (405 — 330)
40 — a×330
(60 — 50) / (477 — 405)
50 — a×405
(70 — 60) / (546 — 477)
60 — a×477
(80 — 70) / (618 — 546)
70 — a×546
(90 — 80) / (686 — 618)
80 — a×618
(100 — 90) / (749 — 686)
90 — a×686
(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)
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.
|(Y(i+1) — Y(i)) / (X(i+1) — X(i))|
Y — a × X
(90 — 100) / (0,6 — 0,32)
100 — a×0,32
(80 — 90) / (0,96 — 0,6)
90 — a×0.6
(70 — 80) / (1,1 — 0,96)
80 — a×0.96
(60 — 70) / (1,25 — 1,1)
70 — a×1.1
(50 — 60) / (1,3 — 1,25)
60 — a×1.25
(40 — 50) / (1,65 — 1,3)
50 — a×1.3
(30 — 40) / (2,0 — 1,65)
40 — a×1.65
(20 — 30) / (2,18 — 2,0)
30 — a×2
(10 — 20) / (2,58 — 2,18)
20 — a×2.18
(0 — 10) / (2,8 — 2,58)
10 — a×2.58