Help with computed attributes

José Germán4 years ago

I still do not fully understand the mechanics of the attributes.
I will do the tests and confirm results to help others. Thank you very much

José Germán4 years ago

hi again Anton!
Some results:
fuel=55-io65/8000 ---> it does not work, always throw 55
fuel=55-io65 x 0.000125 ---> if it Works!
With respect to possible negative results, the following happens:
alt text
alt text
but
if (fuel>0) {fuel=55- io65 x 0.000125} else {fuel=55}
for some reason it does not work. I think that it is my mistake to consider attributes as variables.
I imagine that the only solution, for the moment, is to assume a very large tank in the equation.
It is right?

Anton Tananaev4 years ago

Yes.

Vitor Reis4 years ago

Hi Anton, I am using a GPS103 protocol. I have seen here that there is a way to get the spent fuel in each trip using the average fuel consumption as an input but, I could not find a way to get the average fuel consumption from the device OBD data or from the calculated attributes. What do you recommend? Thank you

Anton Tananaev4 years ago

You should contact device vendor and ask them about data available in device messages.

Vitor Reis4 years ago

Thank you for your quick reply!
I would just like to see on traccar the average fuel consumption in L/km or km/L from TK306 data.
I have the user manual from the device and according to this documentation the available fuel data are:

  • FLI = remaining fuel
  • AF = Average fuel. According to the documentation the average fuel means the average fuel consumption of 100 km; it will be showed only after driving 10 km at least.
  • Oil = % of the fuel tank.
    All this information is obtained sending an sms code to the device.
    I can also set fuel tank volume using SMS to set the fuel tank volume in liters.
    See the link below for the picture with the detailed information obtained from the OBD port:

https://drive.google.com/file/d/1a4zj_wTCLHMuM8j9hsSaHHKjQxE1bGhU/view

Thank you

Anton Tananaev4 years ago

I would recommend to start a separate forum thread to discuss it. Please also provide message samples from your device.

Vitor Reis4 years ago

Ok. I have created a new forum thread with the information that you required:
(https://www.traccar.org/forums/topic/help-to-determine-average-fuel-consumption/)

João Cortes4 years ago

Hi Anton, could you please tell me where I can get some examples of calculator attributes of type RPM for example? I am with these doubts, how to put these expressions together!
Anyway thank you very much for the attention.

Raoula year ago

The last couple of days I am trying to work with Computed Attributes.
My device is a Mictrack MT600 Plus E.
Included in the MT600+is an SOS alarm: when pushing an SOS button an alarm is generated and this is received on my E-mail account. The same applies for ignition alarm (on/off). These two alarms work well and generate both E-mail notifications which are well received on my E-mail account.
For temperature alarm (Low/High) and door (open/close ) alarm I made computed attributes which are each individually working well and generate E-mail notifications.
But as soon as one of these last two alarms, or both, are added in the E-mail notification list the SOS alarm does not generate E-mail notifications anymore (the ignition alarm remains working). And only one of the three (SOS, door or temperature) alarm will generate an E-mail notification.

In the Status panel I can still see the changes of all the values like door status and or temperature value (except for ignition and SOS which are not shown in the Status panel).
I tried to split up the door alarm in Computed Attributes in two separate alarms . One for door open and one for door closed. In such a case only one of these will generate an E-mail notification. (In such a case I only receive "door lock" and never a "door unlock" E-mail).

Doing the same for the temperature alarm: splitting the alarms, in Computed Attributes, in a High temperature alarm and a Low temperature alarm, only one of two will generate an E-mail notification. (for instance only the "temperature High" E-mail is working the "temperature Low" alarm does never generate an E-mail in such a case)

I will shortly try to combine all these alarms under one Computed Attribute. (given by the fact that both alarms will give an E-mail notification in the case of Computed Attribute expression : door ? "lock" : "unlock" but only one E-mail only in case of two separate Computed Attributes: door: ? "lock" : null and the Computed Attribute : door ? null : "unlock")

My only question is: am I looking in the right direction to solve this problem ? Or should I concentrate on other solutions?