Fleetrun
Hecterra
NimBus
Other apps
Wialon for Android/iOS
Logistics
Wialon Local
Wialon Hosting
WiaTag
Configurator
LeaseControl
en
Contents
Expression Parameters
  • sensors
  • sensor_parameters

The sensor parameter can be a compound expression. Due to such parameters, you can create a wide variety of sensors which meet any needs and purposes. In the expression, you can use:

  • parameters from the last message (adc1, in1, and so on);
  • parameters from the previous message (they should be preceded by the sign #, for example, #adc1);
  • bitwise control of a parameter (param199:3, and so on);
  • sensor names (they should be indicated in square brackets, for example, [Fuel level]);
  • constant parameters (const10, const-4.54, and so on);
  • mathematical operation signs listed below.

SignOperation

addition

− 

subtraction

∗ 

multiplication

division

^

exponentiation (for example, ^const2 denotes squaring, ^const0.5 denotes square rooting)

( )

parentheses of priority (for example, in the expression const1.5*(param1−#param1), the parentheses indicate that subtraction should be performed before multiplication)

|

value availability check

parameter conversion

The parameters from the previous message are not available:

  • for the Private mode sensor and its validator,
  • for sensors in notifications,
  • in tooltips for charts,
  • during the retransmission of sensors.
If one of the parameters included in the expression is invalid, the total value of the expression is also invalid. 

Sensor values are calculated in the following order:

  1. calculating the expression in the Parameter field,
  2. conversion of the value according to the calculation table (if configured),
  3. validation (if configured).

Parameter of the sensor determining speed by coordinates

This section describes how to prepare a formula for the sensor parameter that allows you to determine the speed of a unit from its coordinates. A sensor with this parameter can be useful if the tracker does not send the speed value, but only the coordinates.

The ready formula is specified in the Parameter field of the sensor to be created. The sensor type should be Custom.

This sensor can only be used in reports (not online notifications), as it requires the parameters from the previous message.

Below is an example of the ready formula for Vilnius, as well as the steps to apply the formula. The formula is based on the calculation of speed as distance divided by time.

(((lat-#lat)*const111.1365)^const2+((lon-#lon)*const64.3541)^const2)^const0.5/((time-#time)/const3600)

The steps to calculate the speed using this formula can be divided into 3 steps:

  1. Calculation of coefficients to convert latitude and longitude values into kilometers, taking into account the location of the unit. 
  2. Calculation of distance using the Pythagoras’ theorem.
  3. Final calculation of speed using the data obtained in step 2.

Calculating coefficients for lat and lon values

Latitude (lat) and longitude (lon) values need to be converted from degrees to kilometers. To do this, you need to calculate the coefficients. The coefficient for the longitude value depends on the location. 

  • Latitude (lat). The distance covered by 1 degree of latitude differs slightly from north to south pole: from 110.579 kilometers at the equator to 111.694 kilometers at the poles. To simplify calculations we can use the average value: 110.579+111.694)/2=111.1365.
  • Longitude (lon). The distance covered by 1 degree of longitude varies considerably from north to south pole: from 0 kilometers at the poles to 111.321 kilometers at the equator. This distance is calculated by the formula 111.321*cos(lat). Vilnius is located at latitude 54.6833 degrees (in decimal format), so we get: 111.321*cos(54.6833)=64.3541.

If you want to calculate the coefficient for another location, substitute its latitude into the formula without changing the other values. You can also create a calculation table that automatically calculates the cosine value for different latitudes.

In this case, the following formula will be used:

(((lat-#lat)const111.1365)^const2+((lon-#lon)*const111.321[Sensor for calculating the cosine of latitude])^const2)^const0.5/((time-#time)/const3600)

Calculating distance by Pythagoras' theorem

When calculating distance by Pythagoras' theorem, the following steps are performed:

  1. Calculating the difference between the latitude values from the current and previous message in kilometers, squaring it.
  2. Calculating the difference between the latitude values from the current message and the previous message in kilometers, squaring.
  3. Adding the two values together.
  4. Taking the square root of the sum to get the distance in kilometers.

Final speed calculation

To calculate the speed using the resulting distance value, the following steps are performed:  

  1. Converting the time difference between the current message and the previous message from seconds to hours. To do this, it is necessary to divide the number of seconds by a coefficient of 3600.
  2. Dividing the distance by the obtained value.

Adding an ignition sensor to a formula (optional)

If an ignition sensor is configured for a unit, you can add a zero condition to the formula when the ignition is switched off. This will prevent taking into account the erroneous change of coordinates during parking. For this purpose, the expression can be specified in the following form:

(((lat-#lat)const111.1365)^const2+((lon-#lon)*const64.3541)^const2)^const0.5/((time-#time)/const3600)[Ignition sensor name]

Result

The resulting speed is expressed in kilometers per hour. This method shows the average speed required to travel from one point to another in the time between two messages, rather than the instantaneous speed as trackers do.

Parameter for determining relative engine hours

To obtain data on real engine hours, you should create two sensors:

  • sensor of the coefficient of engine hours (determines the intensity of the equipment operation depending on engine revolutions);
  • sensor of relative engine hours.

To create a sensor of the coefficient of engine hours, follow these steps:

  1. Click New.
  2. Enter the sensor name.
  3. Select the Custom sensor type.
  4. As the sensor parameter, specify the expression (param1+#param1)/const2, where param1 stands for the parameter which sends the value of engine revolutions. The parameter of the coefficient sensor is the arithmetic average of engine revolutions within the interval between two successive messages.


  5. In the calculation table, enable the XY pairs option and configure them as follows:

    XYExplanation

    500

    0.33

    One minute of operation at 500 rpm corresponds to 20 seconds of engine operation, which means that the coefficient is 0.33.

    1000

    0.67

    One minute of operation at 1000 rpm corresponds to 40 seconds of engine operation, which means that the coefficient is 0.67.

    1500

    1

    One minute of operation at 1500 rpm corresponds to 60 seconds of engine operation, which means that the coefficient is 1.

    2000

    1.5

    One minute of operation at 2000 rpm corresponds to 90 seconds of engine operation, which means that the coefficient is 1.5.

  6. Click Generate.
  7. Click ОК.

Next, create a sensor of the Relative engine hours type and specify the following parameter for it:

(time-#time)*[Coefficient sensor name]/const3600

This parameter is the time difference between two successive messages which is multiplied by the coefficient of operation intensity and divided by 3600. Division by 3600 is required to convert seconds to hours.

You can use such sensors in reports and counters, but not in online notifications, because they require parameters from the previous message.

Value availability check

The value availability check is used to avoid data loss when the equipment is replaced. To apply this operation, specify the required parameters in the Parameter field, separating them by a vertical bar (|). The system takes into account the first valid value from the specified parameters.

Example. The equipment installed on the unit during the first month sent data in the param1 parameter, and the equipment used since the second month sends the same data in the param2 parameter. To exclude the loss of data, when executing a report for two months you should specify param1|param2 in the Parameter field of the sensor properties. In this case, the system takes the value from the param1 parameter, and if it is invalid, from param2.

The values of other sensors can also be used in the format [Sensor name1]|[Sensor name2] instead of the parameter.

The value availability check doesn't work with digital input parameters, as well as with the sensors created on their base. For example, the function doesn’t work if in1|in2 is specified in the Parameter field.

If you find a mistake in the text, please select it and press Ctrl+Enter.
Thank you for your feedback!
Report a mistake
Text with the mistake Comment
Maximum 500 characters