How is fuelConsumption calculated?

Ólavur7 years ago

I am trying to understand the attribute fuelConsumption which gives a value of 4313.1336 l/h in my example.

What does this mean or how is this calculated? How can I use this for something uesful?

"id": 5440983,
        "attributes": {
            "hdop": 118,
            "ignition": false,
            "status": 0,
            "odometer": 5460919,
            "power": 11.7529296875,
            "temp1": 14.521484375,
            "battery": 4.15283203125,
            "geofenceIn": 0,
            "geofenceAlarm": 0,
            "event": 1,
            "distance": 5.66,
            "totalDistance": 3926460.33,
            "motion": false,
            "coolantTemperature": 89,
            "rpm": 755,
            "obdSpeed": 0,
            "fuel": 19,
            "clearedDistance": 4532,
            "fuelConsumption": 4313.1336,
            "eventMask": 512
        },
Anton Tananaev7 years ago

What protocol are you using? The value is reported by your device. Possibly it's decoded incorrectly, but need HEX sample and documentation to check.

Ólavur7 years ago

I am using the Ulbotech protocol. Here is a screenshot from the protocol description:

Fuel consumption

Also attached is an HEX example:

Fuel consumption example

Anton Tananaev7 years ago

Please provide sample from your device, expected value and fuel type.

Ólavur7 years ago

Ok, here is an example from a live car:

2017-10-10 12:21:31 DEBUG: [4B427A3C: 5072 < 185.74.208.107] HEX: f801010868323026528734a16f69ba010e03b4df71ff98359100530137006a0304024200000404016b259f0506035118fa221706080000000000000000070e310582410c177a310d534131bc540804812e41000f040015f661100101d1bcf8
2017-10-10 12:21:31 DEBUG: [4B427A3C: 5072 > 185.74.208.107] HEX: f801fef80104aef8
2017-10-10 12:21:31  INFO: [4B427A3C] id: 868323026528734, time: 2017-10-10 12:21:30, lat: 62.18533, lon: -6.80203, speed: 44.8, course: 311.0

From the data:

f801010868323026528734a16f69ba010e03b4df71ff98359100530137006a0304024200000404016b259f0506035118fa221706080000000000000000070e310582410c177a310d534131bc540804812e41000f040015f661100101d1bcf8

This part is the fuelconsumption: 0804812e4100

08: data ID
04: data length
812e4100: in decimal 2167292160

The web interface shows FuelConsumption: 216729.22 l/h

But according to the Ulbotech protocol in the attached picture above this should be:

Real fuel consumption (unit liter) = 2167292160/10000/2.364 = 91679.03 l

Is this a bug? Or maybe this could be fixed using computed attributes?

Anton Tananaev7 years ago

Yes, it can be fixed with computed attributes.

Ólavur7 years ago

Ok, I managed to fix it with fuelConsupmtion / 10000 / 2.364

But is it possible to change the unit from l/h to l only?

Anton Tananaev7 years ago

It means that it's not really consumption. It's total fuel used.

Ólavur7 years ago

Yes, i know. That is why I would like to change the unit from l/h to l. That is not possible?

Anton Tananaev7 years ago

There is no standard attribute for that. You can try fuel level, but it's not really the same.

Ólavur7 years ago

Ok, thanks. Maybe I can figure out using some CSS or jQuery trick

Thanks.