# Thread: Calculate LPK from OBD2

1. ## Calculate LPK from OBD2

Hi to all.
I'm trying to create correct formula for calculating average litres per 100 kilometers.
I've read this topic and parsed formula for getting MAF, KPL (kilometers per liters), LPK (liters per kilometers moment) and LPS (liters per second). But I'm still unable to create formula for average LP100K.
I'm hard to create formula because I don't understand how to adjust average LP100K when I'm standing in traffic.

Thanks beforehand for all yours help

2. If you know kilometers/litre then it is easy to get litres/kilometer and if you then multiply this by the kilometers travelled you will know the litres used.
Then I expect it is as easy as adding the litres/sec at each second standing still in traffic to the number of litres used and redivide by the number of kilometers/100 to get your average litres/100km.
Does this make sense ?

3. Yeah, it does. But litres/kilometer changes every second 1st second it can be 0,067 liter/kilometer and next second it can be 0,357 liter/kilometer
But, the main idea I received, today I'll work on this data and try to create some formulas and test them. So, today evening I'll write the result of my work

4. I found another solution.
I just calculate sum of all LPS and devided them by distance that I travelled and multiply it by 100 That's shows me the average litres/100km. Now this formula is in testing. I hope it will work as I need...

5. Readings like that almost always need filtering.
You need to decide what "resolution" you want, and be aware that the only accurate figure is that over the entire period (ie, fuel & distance for 3 readings, 3 seconds, 3 hours, the whole trip, since trip start etc).

Most in-car economy meters have the "total" since trip start or tank refill, get a "moving" average (eg, last 500k etc) as well as the "instantaneous" reading - which is usually an average when sub-second samples are involved - eg, 10 MAF readings per second but displayed only every 1 or 3 seconds).

Analogs simply use an RC filter, and produce accurate tracking.
Digital require copious sampling and filtering algorithms to do the same, but are perfect for total displays (ie,long term, not real time; but that's the advantage on analog computing isn't it?)

6. LPS/100km is missing a time constant (sec) in the equation to mean anything. So what you have is Litres/sec/100km

Like oldspark says, you need to define what period of time you want your readings to represent.
If it is per second then your figures are correct, but if it is a minute then you need to add 60 readings together and divide the sum by 60. If it is an hour then you need to add 3600 readings together and divide by 3600...
There is also the running average but this is still time period dependant, needing a running sum of 60 or 3600 samples.

7. Though litres per (100)km & km/L etc require no time constants.

And L/s/km etc makes no sense... (other than "for the last x-km, you got y L/sec" etc).

To paraphrase the issue I was getting at - instantaneous "digital" readings such as AFMs, injector volumes, etc, vary wildly with compared to the actual average over a few sample periods.

Usually injector pulses are used to measure quantity - they should be more accurate than AFM, MAPs etc (even without pintle opening/closing compensation).

8. I'll try to explain my solution.
I'm using sum of ALL LPS + Trip (a whole trip).
For now I'm receiving correct values of LPK average. I just calc sum of LPS and devide it by trip. time of measure is 1 sec. So, i can remove it from my formula.

9. Than you have to multiply out LPS by S to get L.
Then divide by total distance.

Not as accurate as a raw L count, but if that's all there is.....
(That's why I'd try to tap the L counter source, but that could be from an injector algorithm.)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•