Fuel Consumption Formula

Joystick5 years ago

Hi Anton,

My device report analogue input from fuel sensor (millivolts) so I have configured the fuel attribute to convert millivolts to show fuel level as per below. Please assist with a formula to calculate FUEL CONSUMPTION, litres per hour, based on the info I have.

Tank Capacity = 400 l
5000 mv = Empty tank
0 mv = Full tank
Analogue input from fuel sensor = adc1

My Attribute is:
Fuel
adc1? 0.08*(5000-adc1) : null
Number

Fuel level formula is

(Sensor input range/Tank capacity)*(Sensor input range-Sensor input value)
(5000/400)*(5000-adc1)