This shows you the differences between two versions of the page.

Both sides previous revision Previous revision | |||

cms:units:sensors:calc [11/09/2019 08:47] alse |
cms:units:sensors:calc [24/07/2020 19:29] (current) mary |
||
---|---|---|---|

Line 4: | Line 4: | ||

The calculation table is very important in sensors configuration (see [[props|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 very important in sensors configuration (see [[props|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 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. |

- | :!: //Attention!//\\ 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. | + | :!: 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 to the equation of the straight line **Y = a×X + b**, where | Calculation table recalculates data according to to the equation of the straight line **Y = a×X + b**, where | ||

Line 17: | Line 17: | ||

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.). | 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. | + | 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. | + | 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. |

- | **Lower and upper bounds** are used to set the limits for input values. Note that the bounds correspond to the half-open interval. In other words, the lower bound is included in the interval of valid values while the upper one is not. In case of receiving values beyond the indicated interval, these values are considered to be invalid. Moreover, depending on the enabling/disabling of the //Apply after calculation// checkbox, the indicated limits are applied to the raw values X (disabled checkbox), or to the processed values Y (enabled checkbox). | + | **Lower and upper bounds** are used to set the limits for input values. Note that the bounds correspond to the half-open interval. In other words, the lower bound is included in the interval of valid values while the upper one is not. In case of receiving values beyond the indicated interval, these values are considered to be invalid. Moreover, depending on the enabling/disabling of the **Apply after calculation** checkbox, the indicated limits are applied to the raw values X (disabled checkbox), or to the processed values Y (enabled checkbox). |

Incorrect pairs of values can be removed with the button {{:icons:del.png?nolink}}. To remove all pairs at once, click on the delete button in the header of the table. | Incorrect pairs of values can be removed with the button {{:icons:del.png?nolink}}. To remove all pairs at once, click on the delete button in the header of the table. | ||

- | A graphic for the created calculation table can be viewed by clicking the //Show chart// icon at the top of the table header. | + | A graphic for the created calculation table can be viewed by clicking the **Show chart** icon at the top of the table header. |

===== Methods of filling the table ===== | ===== Methods of filling the table ===== | ||

- | - Fill in //all// available fields (//X//, //b//, and //a//). Use this method to get the calculation table under your complete control. \\ | + | - Fill in **all** available fields (**X**, **b**, and **a**). Use this method to get the calculation table under your complete control. \\ |

- | - Fill in only //X// and //b// values, and //a// set as zero. This method is convenient if you need to convert an analog signal to a digital one. \\ | + | - Fill in only **X** and **b** values, and **a** set as zero. This method is convenient if you need to convert an analog signal to a digital one. \\ |

- | - Fill in only //X// and //a// values. In this case, //b// is calculated automatically. This method is convenient if you need to get a curve knowing the angles, but without recalculating the Y offset. \\ | + | - Fill in only **X** and **a** values. In this case, **b** is calculated automatically. This method is convenient if you need to get a curve knowing the angles, but without recalculating the Y offset. \\ |

- | - In some cases it is possible to adjust the calculation table knowing the //X// and //Y// values. In such cases use the [[cms/units/sensors/calc?&#calculation_table_wizard|calculation table wizard]] (right part of the dialog box). | + | - In some cases it is possible to adjust the calculation table knowing the **X** and **Y** values. In such cases use the [[cms/units/sensors/calc?&#calculation_table_wizard|calculation table wizard]] (right part of the dialog box). |

Line 49: | Line 49: | ||

{{ :units:calc1.png?nolink }} | {{ :units:calc1.png?nolink }} | ||

- | On the basis of the values indicated in the table, a chart is made. To view the chart, click the //Show chart// icon. | + | On the basis of the values indicated in the table, a chart is made. To view the chart, click the **Show chart** icon. |

{{ :units:calc2.png?nolink }} | {{ :units:calc2.png?nolink }} | ||

- | :!: //Note//.\\ | + | :!: The calculation graph 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. |

- | The calculation graph 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 ===== | ===== 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 above: | + | 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 above: |

{{ :units:calc3.png?nolink }} | {{ :units:calc3.png?nolink }} | ||

- | Move to the //Calculation Chart// and see if the result meets your expectations. | + | Move to the **Calculation Chart** and see if the result meets your expectations. |

{{ :units:calc4.png?nolink }} | {{ :units:calc4.png?nolink }} | ||

Line 68: | Line 67: | ||

====== Calculation Table Wizard ====== | ====== Calculation Table Wizard ====== | ||

- | The Calculation Table Wizard is a tool that simplifies the process of creating a calculation table. It is sufficient to indicate input //X// values and corresponding output //Y// values. You can use the calculation table wizard to calibrate a sensor experimentally. For instance, you fill in different volumes of fuel into the tank and each time you take the readings from the sensor. The Calculation Table Wizard is located on the right side of the dialog window. It is disabled by default. To use a wizard, indicate the //Generate from XY pairs// flag. | + | The Calculation Table Wizard is a tool that simplifies the process of creating a calculation table. It is sufficient to indicate input **X** values and corresponding output **Y** values. You can use the calculation table wizard to calibrate a sensor experimentally. For instance, you fill in different volumes of fuel into the tank and each time you take the readings from the sensor. The Calculation Table Wizard is located on the right side of the dialog window. It is disabled by default. To use a wizard, indicate the **Generate from XY pairs** flag. |

- | Enter the pairs and click //Generate// in order for them to be processed by the system. On the basis of values indicated in the wizard, a calculation table will be created. | + | Enter the pairs and click **Generate** in order for them to be processed by the system. On the basis of values indicated in the wizard, a calculation table will be created. |

- | The program calculates //a// and //b// using the following algorithm: | + | The program calculates **a** and **b** using the following algorithm: |

- | * **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//. | + | * **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**. | * **b** is calculated by the formula **b = Y — a × X**. | ||

- | :!: //Note.//\\ In the upper right corner of the table wizard there are buttons for exporting the introduced XY pairs into a CSV file and importing values from CSV or TXT files. | + | :!: In the upper right corner of the table wizard there are buttons for exporting the introduced XY pairs into a CSV file and importing values from CSV or TXT files. |

===== Example 1: Fuel Level Sensor ===== | ===== Example 1: Fuel Level Sensor ===== | ||

Line 94: | Line 93: | ||

| 749 | 100 | | | 749 | 100 | | ||

- | Enter these pairs into the wizard and click //Generate//. Based on the entered values, a calculation table (on the left) is generated. | + | Enter these pairs into the wizard and click **Generate**. Based on the entered values, a calculation table (on the left) is generated. |

{{ :units:wizard1.png?nolink }} | {{ :units:wizard1.png?nolink }} | ||

- | In order to view a chart, click the //Show chart// icon. | + | In order to view a chart, click the **Show chart** icon. |

{{ :units:wizard2.png?nolink }} | {{ :units:wizard2.png?nolink }} | ||

- | :!: //Note//.\\ All the data entered and saved on this tab is available when you open the dialog. Any changes in the calculation table do not affect the Wizard. In other words, the Wizard only shows the entered values but does not reflect the current situation. | + | :!: All the data entered and saved on this tab is available when you open the dialog. Any changes in the calculation table do not affect the Wizard. In other words, the Wizard only shows the entered values but does not reflect the current situation. |

- | Now let us see how //a// and //b// 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 //a// coefficient can be calculated: **a** = **∆Y/∆X** = 10 / 86 = 0,11627906976744186. | + | Now let us see how **a** and **b** 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 **a** coefficient can be calculated: **a** = **∆Y/∆X** = 10 / 86 = 0,11627906976744186. |

For other intervals, we apply the same calculation scheme (there will be one interval less than there are rows in the Calculation Wizard): | For other intervals, we apply the same calculation scheme (there will be one interval less than there are rows in the Calculation Wizard): | ||

Line 122: | Line 121: | ||

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

- | The information on how to make calibration of a fuel tank can be found in the //[[faq/hw/hw1|Calibrating a fuel tank]]// section. | + | The information on how to make calibration of a fuel tank can be found in the **[[faq/hw/hw1|Calibrating a fuel tank]]** section. |

===== Example 2: Fuel Level Sensor ===== | ===== Example 2: Fuel Level Sensor ===== | ||

- | In this example, input //X// values decline while output //Y// values grow. Insert the pairs into the Wizard in any order — they will be rearranged automatically. | + | In this example, input **X** values decline while output **Y** values grow. Insert the pairs into the Wizard in any order — they will be rearranged automatically. |

Initial data: | Initial data: | ||

Line 163: | Line 162: | ||

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

- | The information on how to make calibration of a fuel tank can be found in the //[[faq/hw/hw1|Calibrating a fuel tank]]// section. | + | The information on how to make calibration of a fuel tank can be found in the **[[faq/hw/hw1|Calibrating a fuel tank]]** section. |

Was this helpful?

Thank you!