Page 2 of 2 FirstFirst 12
Results 21 to 27 of 27

Thread: MPG Gauge

  1. #21
    Potential Tuner
    Join Date
    Jan 2017
    Posts
    9
    Quote Originally Posted by TownDrunk View Post
    Try: (400-6*10)*[50020.114]/[6210.72]/[50151.248.avg(700)]/[50070.56]

    You may have to tweak the 400 to make it more accurate.
    Ah ha, got it, it took that formula, thank you sir.

  2. #22
    If you wanted to make it accurate for E85 and E10, you could tweak the 6 slightly, maybe a by slight changes, but still keeping it close to 6.

    If you don't care about flex fuel, just change the 400 to whatever makes it accurate.

  3. #23
    Potential Tuner
    Join Date
    Nov 2020
    Posts
    1
    I tried a bunch of the formulas above with no luck. it's a 2011 escalade with the virtual ethanol sensor.

    Here is the formula you'll need. You have to adjust for the weight of fuel, that is what is lacking in all of the other formulas. There is something just a little off and needed tweaking. Just adjust the number 1 at the start of the formula to make it accurate. I ended up with 0.998. It may be due to fuel temp or something.

    to use this formula just enter the fuel weight. It's bolded in this example. Then then tweak that number one to match the instant gas senor in your car.

    1* 6.16 * 15 * [50020.114] / [6210.72] /[50151.248.avg(700)] / [50070.56]

    Gas weight 100% = 6.16 lbs
    10% ethanol = 6.191
    E85 = 6.59 lbs /gallon
    100% Ethanol = 6.567

    This formula should have worked to adjust the weight automatically, but you can't use it for math in the virtual ethanol sensor for some reason
    0.85 * (( 1-.149 ] * 6.16 ) + (0.149 * 6.567) * 120 * [50020.114] / [6210.72] / [50151.248.avg(700)] / [50070.56]
    Last edited by Doc Sean; 12-04-2020 at 09:41 AM.

  4. #24
    Tuner in Training
    Join Date
    Jan 2007
    Posts
    34
    any thoughts on how one would calculate the average mpg for an entire log scan ?

  5. #25
    Potential Tuner
    Join Date
    May 2020
    Posts
    1
    Quote Originally Posted by shanekennedy View Post
    any thoughts on how one would calculate the average mpg for an entire log scan ?
    Easy, add a Graph. Parameter is your instant MPG that you made and then set it to average, add decimals for more precision, I made it go from 0 to 100 with appropriate colors. You don't even need a row and column axis (I found that out later).

  6. #26
    Tuner in Training
    Join Date
    Feb 2017
    Posts
    18

    Lightbulb

    I dredged this up via search as I was looking for a math equation to calculate MPG, and I started really digging into the previously mentioned calculations and was bothered by having a constant that you may have to manipulate to make your output more accurate. Just seemed wrong to me. Doc Sean posted a good equation that is pretty spot on with static input for fuel weight, but I really felt the need to verify it and also account for those with Flex Fuel capabilities so decided to do some math surrounding just the units of the logged data. If anyone has done this in chemistry, physics or other classes, they know it sucks. Anyways, here's what I came up with. I used the resulting calculation to do a quick spot check logging a drive around town and it seems to be pretty accurate as compared to my truck's output on the dash..

    FYI, it does take into account the weights (as posted previously in this thread) of gasoline/ethanol at the varying percentages reported by a flex fuel sensor, but does NOT account for variations in fuel temperature that may affect final true weight per volume. If you don't have a flex fuel sensor, you can just put a constant in the equation for the lb/gal of your fuel.
    Gasoline 100% = 6.16 lb/gal
    Ethanol 100% = 6.567 lb/gal

    Start by taking injector flow rate and pulse width, including a multiplier to reach common units of time and simplify units to just 'lb'
    (flow rate(lb/hr) * (pulse width(s) / 3600(s/hr))) = lb

    Next, add in number of injector pulses per engine revolution. Assuming a V8 here.
    (flow rate(lb/hr) * (pulse width(s) / 3600(s/hr)) * 4(pulse/rev) = lb/rev

    Now we bring in the Engine Speed and simplify units.
    (flow rate(lb/hr) * (pulse width(s) / 3600(s/hr)) * 4(pulse/rev) * Engine Speed(rev/min)) = lb/min

    This adds in the weight per volume calculation of fuel and further simplifies units
    (flow rate(lb/hr) * (pulse width(s) / 3600(s/hr)) * 4(pulse/rev) * Engine Speed(rev/min)) / (6.16(lb/gal)-6.16(lb/gal)*Percent Alcohol+6.567(lb/gal)*Percent Alcohol) = gal/min

    Now we add a multiplier to covert units to gal/hr so it can align with the vehicle speed sensor units in the next step
    (60(min/hr) * (flow rate(lb/hr) * (pulse width(s) / 3600(s/hr)) * 4(pulse/rev) * Engine Speed(rev/min)) / (6.16(lb/gal)-6.16(lb/gal)*Percent Alcohol+6.567(lb/gal)*Percent Alcohol) = gal/hr

    Adding in vehicle speed to the equation and simplifying units to the final desired of mile/gal : MPG
    Vehicle Speed(mile/hr) / (60(min/hr) * (flow rate(lb/hr) * (pulse width(s) / 3600(s/hr)) * 4(pulse/rev) * Engine Speed(rev/min)) / (6.16(lb/gal)-6.16(lb/gal)*Pct Alc+6.567(lb/gal)*Pct Alc)) = mile/gal

    Here I pulled the various multipliers out of the various locations of the equation so we can combine them in the final step
    Vehicle Speed(mile/hr) / (60(min/hr)*4(pulse/rev)/3600(s/hr) * (flow rate(lb/hr) * pulse width(s) * Engine Speed(rev/min)) / (6.16(lb/gal)-6.16(lb/gal)*Pct Alc+6.567(lb/gal)*Pct Alc)) = mile/gal

    Combined multipliers. This is where my professors would say that your multipliers (constants) may have some really funky units... I know you can simplify them further, but for the sake of this exercise, it's good enough...
    Vehicle Speed(mile/hr) / (240(min*pulse/hr*rev)/3600(s/hr) * (flow rate(lb/hr) * pulse width(s) * Engine Speed(rev/min)) / (6.16(lb/gal)-6.16(lb/gal)*Pct Alc+6.567(lb/gal)*Pct Alc)) = mile/gal


    So at the end, for a V8, your HP Tuners user math expression could be:
    [50020.114]/(((240/3600)*[6210.72]*[50151.248.avg(700)]*[50070.56])/(6.16-(6.16*[82.155])+(6.567*[82.155])))

    Further manipulation of the equation structure can get it to:
    (15*[50020.114]*(6.16-(6.16*[82.155])+(6.567*[82.155])))/([6210.72]*[50151.248.avg(700)]*[50070.56])

    Removing parentheses and allowing order of operations to take place normally:
    15*[50020.114]*(6.16-(6.16*[82.155])+(6.567*[82.155]))/[6210.72]/[50151.248.avg(700)]/[50070.56]

    The '15' constant is for a V8. I believe a V6 should use '20', and a 4 cyl should use '30'

    Considering that I was able to replicate Doc Sean's calc makes me feel confident that his is accurate. I could go further and simplify the fuel mixture calculations, but doing so would lose the ability to modify the weights of 100% gas vs. 100% ethanol should you choose to do so (based off better or different weight data that may account for thermal expansion).

    Anyways, I hope this helps someone out there. Cheers!

  7. #27
    Potential Tuner
    Join Date
    May 2022
    Posts
    2
    Quote Originally Posted by mbaskett View Post
    I dredged this up via search as I was looking for a math equation to calculate MPG, and I started really digging into the previously mentioned calculations and was bothered by having a constant that you may have to manipulate to make your output more accurate. Just seemed wrong to me. Doc Sean posted a good equation that is pretty spot on with static input for fuel weight, but I really felt the need to verify it and also account for those with Flex Fuel capabilities so decided to do some math surrounding just the units of the logged data. If anyone has done this in chemistry, physics or other classes, they know it sucks. Anyways, here's what I came up with. I used the resulting calculation to do a quick spot check logging a drive around town and it seems to be pretty accurate as compared to my truck's output on the dash..

    FYI, it does take into account the weights (as posted previously in this thread) of gasoline/ethanol at the varying percentages reported by a flex fuel sensor, but does NOT account for variations in fuel temperature that may affect final true weight per volume. If you don't have a flex fuel sensor, you can just put a constant in the equation for the lb/gal of your fuel.
    Gasoline 100% = 6.16 lb/gal
    Ethanol 100% = 6.567 lb/gal

    Start by taking injector flow rate and pulse width, including a multiplier to reach common units of time and simplify units to just 'lb'
    (flow rate(lb/hr) * (pulse width(s) / 3600(s/hr))) = lb

    Next, add in number of injector pulses per engine revolution. Assuming a V8 here.
    (flow rate(lb/hr) * (pulse width(s) / 3600(s/hr)) * 4(pulse/rev) = lb/rev

    Now we bring in the Engine Speed and simplify units.
    (flow rate(lb/hr) * (pulse width(s) / 3600(s/hr)) * 4(pulse/rev) * Engine Speed(rev/min)) = lb/min

    This adds in the weight per volume calculation of fuel and further simplifies units
    (flow rate(lb/hr) * (pulse width(s) / 3600(s/hr)) * 4(pulse/rev) * Engine Speed(rev/min)) / (6.16(lb/gal)-6.16(lb/gal)*Percent Alcohol+6.567(lb/gal)*Percent Alcohol) = gal/min

    Now we add a multiplier to covert units to gal/hr so it can align with the vehicle speed sensor units in the next step
    (60(min/hr) * (flow rate(lb/hr) * (pulse width(s) / 3600(s/hr)) * 4(pulse/rev) * Engine Speed(rev/min)) / (6.16(lb/gal)-6.16(lb/gal)*Percent Alcohol+6.567(lb/gal)*Percent Alcohol) = gal/hr

    Adding in vehicle speed to the equation and simplifying units to the final desired of mile/gal : MPG
    Vehicle Speed(mile/hr) / (60(min/hr) * (flow rate(lb/hr) * (pulse width(s) / 3600(s/hr)) * 4(pulse/rev) * Engine Speed(rev/min)) / (6.16(lb/gal)-6.16(lb/gal)*Pct Alc+6.567(lb/gal)*Pct Alc)) = mile/gal

    Here I pulled the various multipliers out of the various locations of the equation so we can combine them in the final step
    Vehicle Speed(mile/hr) / (60(min/hr)*4(pulse/rev)/3600(s/hr) * (flow rate(lb/hr) * pulse width(s) * Engine Speed(rev/min)) / (6.16(lb/gal)-6.16(lb/gal)*Pct Alc+6.567(lb/gal)*Pct Alc)) = mile/gal

    Combined multipliers. This is where my professors would say that your multipliers (constants) may have some really funky units... I know you can simplify them further, but for the sake of this exercise, it's good enough...
    Vehicle Speed(mile/hr) / (240(min*pulse/hr*rev)/3600(s/hr) * (flow rate(lb/hr) * pulse width(s) * Engine Speed(rev/min)) / (6.16(lb/gal)-6.16(lb/gal)*Pct Alc+6.567(lb/gal)*Pct Alc)) = mile/gal


    So at the end, for a V8, your HP Tuners user math expression could be:
    [50020.114]/(((240/3600)*[6210.72]*[50151.248.avg(700)]*[50070.56])/(6.16-(6.16*[82.155])+(6.567*[82.155])))

    Further manipulation of the equation structure can get it to:
    (15*[50020.114]*(6.16-(6.16*[82.155])+(6.567*[82.155])))/([6210.72]*[50151.248.avg(700)]*[50070.56])

    Removing parentheses and allowing order of operations to take place normally:
    15*[50020.114]*(6.16-(6.16*[82.155])+(6.567*[82.155]))/[6210.72]/[50151.248.avg(700)]/[50070.56]

    The '15' constant is for a V8. I believe a V6 should use '20', and a 4 cyl should use '30'

    Considering that I was able to replicate Doc Sean's calc makes me feel confident that his is accurate. I could go further and simplify the fuel mixture calculations, but doing so would lose the ability to modify the weights of 100% gas vs. 100% ethanol should you choose to do so (based off better or different weight data that may account for thermal expansion).

    Anyways, I hope this helps someone out there. Cheers!
    Having a read through this and trying to do the math to figure it out for a diesel engine is this something that you have come across, unfortunately for me it gives flow rate in mm3 not lb/hr