Some devices allow transferring user data. In Wialon, this data is registered as unsigned integers by default, regardless of the form in which it is sent from the device. In order for the reports and messages in Wialon to display "clear values", that is, the values as they are sent from the device, you can use the bitwise parameter control method. This guide describes three examples of using this method to work with source data.
Consider the case when a unit sends data, for example, in the user_d1 parameter as two double-byte unsigned integers. In Wialon, this data is registered as user_d1=2646793773.
Convert the received number in Wialon to the binary system: 2646793773 → 10011101110000101101111000101101.
In Wialon, bits are calculated from one.
- Divide the resulting number by two (according to the double-byte number count): 1101111000101101 and 1001110111000010.
Create a custom sensor numeral_1 in the unit properties in Wialon. In the Parameter field, specify the following formula:
Create a custom sensor numeral_2. In the Parameter field, specify the following formula:
As a result, the reports and messages in Wialon display the values of two double-byte sensors (numeral_1=56877 and numeral_2=40386) instead of user_d1=2646793773.
In this example, consider the case when a unit sends data as a number with floating point (float). In Wialon, the data is registered as user_d3=1017282565.
- Convert the received number in Wialon to the binary system: 1017282565 → 111100101000101000000000000101.
Create a custom sensor float in the unit properties in Wialon. In the Parameter field, specify the following formula:
The formula for the sensor parameter is created on the basis of the formula for converting to the 32-bit IEEE 754 format: F=(-1)S2(E-127)(1+M/223).
As a result, Wialon displays the values of the float sensor instead of user_d3=1017282565.
Consider the case of the Teltonika FMT100 device when the io_258 parameter registers the values of the accelerometer on three axes when exceeding the values specified in the device. The data of this parameter is useful when working with the Eco Driving application. In Wialon, the data is registered as io_258=932034904003. The values should be converted into g.
The image below shows the parameter structure.
The values on the axes are signed. In Eco Driving, only the values on the X and Y axes are used. On the X-axis, depending on the sign, the acceleration and braking are determined. On the Y-axis, the transverse acceleration is determined which will be used as an absolute value (module) because the sign (left/right) is not taken into account in Eco Driving.
Create a custom sensor Accel_MAX in the unit properties in Wialon. In the Parameter field, specify the following formula :
Create a custom sensor Brk_MAX. In the Parameter field, specify the following formula :
Create a custom sensor Crn_MAX. In the Parameter field, specify the following formula:
Two bytes are provided for the Y-axis. The bit numbers in Wialon are from 17 to 32. Since the module (absolute) values are taken into account, the formula is a little longer than the previous ones.
The given examples show that the application area of the bitwise control is not limited to the control of a specific bit. This is a comprehensive tool which allows creating custom sensors in Wialon. You can formulate the logic and calculation of such sensors on your own to fulfil the most challenging tasks.