Page 12 of 13 FirstFirst ... 2345678910111213 LastLast
Results 111 to 120 of 122

Thread: Calculating MPG from VSS and MAF from OBD2

  1. #111
    Newbie
    Join Date
    Jun 2011
    Posts
    7
    Sorry, I'm not able to use "Fuel injection timing" pid, it's unable to my car.
    And I haven't found solution on the 1st page. Please, give the link
    Any other ways?

  2. #112
    Raw Wave
    Join Date
    Nov 2009
    Posts
    2,119
    jiggersplat in post/reply #10.


    If you don't have the readings available, you sample them. How many samplers depends on your pedanticness and whether its batch or sequential, or if each injector is independent (which is unlikely unless using ionic sensing or similar).


    Any other ways? Other than what has already been posted?
    I'd only use injector pulse width. I'd only consider the others herein if they were essentially plug and play (with manual calibration of course - unless self learning) and I couldn't read else (easily) sample/measure the pulse width.

  3. #113
    Newbie
    Join Date
    Jun 2011
    Posts
    7
    Hi to all.
    Yeah, you are right. How can I sample/measure the pulse width?

  4. #114
    Raw Wave
    Join Date
    Nov 2009
    Posts
    2,119
    A sampling circuit - something that measures the injector(s) signal.
    EG - when the injector signal swings from +ve to gnd, time how long that is for.

    (With spike protection and probably a bit of filtering to remove any injector inductive/voltage ringing. Injectors are usually ground switched.)

  5. #115
    Newbie lightner's Avatar
    Join Date
    Sep 2007
    Location
    La Jolla, CA
    Posts
    8

    OBD-II Scan Tool Detection Schemes

    One issue with rolling your own MPG gauge and possibly "hard-wiring" it onto your vehicle's OBD-II bus is the issue of coexisting with any factory scan tools that might be plugged into your vehicle's OBD port---for example at your local automotive repair shop.

    A while ago I put together a short treatise on the subject of detecting and reacting to such events. A Web page with that information is titled "OBD-II Scan Tool Detection Schemes" and can be found here...

    http://www.lightner.net/obd2guru/ScanToolDetect.html

    The various options for detecting scan tools is discussed, and a novel method for detecting the insertion of a scan tool's "ground pin" is presented---a method I developed and prototyped several years ago, in several forms, using a little "microsurgery" on "stock" OEM OBD-II connectors/pins. Usually a bit of epoxy was required as well. :-)

    The method described is based on replacing the "vehicle-side" OBD-II female "ground" connector pin with a dual-contact assembly---more or less within the the same volume as the original stock single-contact assembly. One of the two contacts supplies ground to the factory scan tool pin while the other senses the presence of the (grounded) scan tool pin (e.g., using a pull-up resistor). The scan tool pin shorts the two contacts together when inserted. The two contacts are isolated when the scan tool ground pin is not inserted. (See the above URL for some "pictures".)

    BTW: It seems that this thread---which I somehow precipitated---just won't die! :-)

    Best regards,

    Bruce D. Lightner
    Lightner Engineering
    La Jolla, Calfornia
    [email protected]
    http://www.lightner.net/bruce/

  6. #116
    Maximum Bitrate
    Auto Apps:loading...
    VegasGuy's Avatar
    Join Date
    May 2009
    Location
    Las Vegas
    Posts
    590
    While there's still .000001% of accuracy to be argued over, there's still life in the old girl!

    Sincere thanks for sharing your knowledge and insights!

    VegasGuy

  7. #117
    Newbie
    Join Date
    May 2011
    Location
    Minot, ND
    Posts
    6
    Thread back from the dead...oh well...

    Built my own OBD scanner, ST1110, PIC18F27J13, color/touch LCD, Wifi, GPS, SD card, datalogging, camera, accelerometer, NTSC TV output, Speech chip, etc.etc...youtube video to come eventually.

    Saw the formula for calculating a MAF reading without a physical MAF being installed. I was doing it another way entirely, but the method/formula presented here was much cleaner (from a numerical standpoint), even though the end result was the same between the two.

    My '01 Dodge pickup doesn't have MAF, so I use the calculated MAF method. The MPG numbers seem to fit according to tank fillups and the overhead MPG indicator. It's not dead on, but it's close enough for me.

    My '98 Nissan Sentra has both a MAF as well as MAP/IAT/RPM/etc. I calculate MPG using the direct MAF method, and using the calculated MAF, and from that, I derive a V(e) solution which seems to fit...i.e. hovers around 80%, lower at low throttle, higher at greater loads, etc.

    I just bought an '05 Pontiac Vibe. Has a MAF, but no MAP! What? No MAP sensor installed, No MAP PID supported. Ok...whatever. Well, there goes trying to derive a V(e) solution.
    So, any thoughts on how to regenerate a MAP value without a physical MAP sensor installed?
    Why would a guy want to do that? Why not?
    Sure, a continuous vacuum leak would likely show up in the short term/long term trims, as well as low MAF readings, etc...if a guy knew what the baseline values were in the first place.
    Short of a mathematical solution, shouldn't be that much more difficult to T-off a vacuum port somewhere and install an absolute pressure sensor hooked up to an A/D input on the PIC.

  8. #118
    Newbie
    Join Date
    Sep 2012
    Posts
    1
    Quote Originally Posted by lightner View Post
    For the record, the first "one-line" MPG formula above, taken from my Circuit Cellar article, is off by 100! The "4.54" should in fact be "454". The correct formula is:


    MPG = (14.7 * 6.17 * 454 * VSS * 0.621371) / (3600 * MAF / 100)
    MPG = 710.7 * VSS / MAF


    Note that OBD-II VSS reading is in kilometers/hour and MAF reading is grams/sec times 100.
    Quote Originally Posted by JML View Post
    A note on Diesel engines:
    A Diesel engine does not use stoichiometric combustion.
    So, a reasonable approach of the fuel mass can only be achieved with the Lambda correction and the value of 14.5 for the Stoichiometric Ratio.
    The density of Diesel fuel is 7.03 lbs/gal.

    JML


    To calculate the MPG in the most accurate way, I found out from this thread posts that there could be several ways and levels of accuracy.

    If we take in consideration the Fuel Type obtained from PID $51, and the Lambda equivalence ratio from PID $44 (See also PID $4F for possible scaling).

    Case 1: Lambda equivalence ratio is available: (and we could consider using the gasoline density if it's a gasoline vehicle or no details about fuel type are available (defaults calculation that won't be so accurate))

    Then the formula would become:

    MPG = (14.7 * Lambda * 6.17 * 454 * VSS * 0.621371) / (3600 * MAF / 100)



    Case 2: Lambda equivalence ratio is available and Fuel Type is known (as well as the density of the given fuel type):

    Then the formula would become:

    MPG = (14.7 * Lambda * Fuel Density * 454 * VSS * 0.621371) / (3600 * MAF / 100)


    One of the question I have is to know if the Lambda Equivalence Ratio take in account the Fuel Type, so if I know my car runs on Diesel and offer the Lambda Equiv. Ratio value, should I use both of those information, or just the Lambda Equiv. Ratio and the fuel density of the gasoline ?

    If no fuel type can be determined, the gasoline density could be used as default, but if the fuel type can be determined, it is better to use this fuel type density, is that right ?

    Am I understanding the point correctly with the lambda ratio and the fuel density ?

    Thank you in advance for your feedback !

  9. #119
    Newbie
    Join Date
    Oct 2012
    Posts
    1
    Quote Originally Posted by lightner View Post
    For the record, the first "one-line" MPG formula above, taken from my Circuit Cellar article, is off by 100! The "4.54" should in fact be "454". The correct formula is:

    MPG = (14.7 * 6.17 * 454 * VSS * 0.621371) / (3600 * MAF / 100)
    MPG = 710.7 * VSS / MAF


    Note that OBD-II VSS reading is in kilometers/hour and MAF reading is grams/sec times 100.

    This formula works very well in a modern automobile because the engine computer spends almost 100% of its time managing the fuel-air-ratio to 14.7, which it can do very well because of the "closed loop" feedback from the O2 sensor(s).

    In fact, the accuracy of this method has been proven in literally tens of thousands of gasoline-powered vehicles. Accuracy within a few percent is typical, often limited by the accuracy of the vehicle speed reading (i.e., VSS).

    As for other ways of doing this, especially if you don't have a MAF sensor, by knowing the displacement of the engine, and after a simple "calibration" using fuel tank "fill-up" data to find the only unknown, namely the "volumetric efficiency" (VE) of the engine, MAF can be calculated from RPM, MAP and IAT. With VE, one can use the following formulas to calculate a synthetic "mass air-flow" (MAF) in grams per second, all without a MAF sensor, using the "Ideal Gas Law", as follows:

    IMAP = RPM * MAP / IAT
    MAF = (IMAP/120)*(VE/100)*(ED)*(MM)/(R)


    where manifold absolute pressure (MAP) is in kPa, intake air temp (IAT) is in degrees Kelvin, R is 8.314 J/K/mole and the average molecular mass of air (MM) is 28.97 g/mole. Note that, in the above formula, the volumetric efficiency of the (4-cycle!) engine is measured in percent and the engine displacement (ED) is in liters.

    The VE of my 1999 7.4L Chevy Suburban is about 65%. Smaller, higher performance engines can have VE's of 85% or higher.

    Best regards,

    Bruce D. Lightner
    [email protected]
    http://www.lightner.net/lightner/bruce/


    I've worked on this for two days now, and I've gotten to the point that I'm going to post my questions.

    My situation is unusual. I am working with the ODB1 Honda ECU that is chipped and has a data port installed. From this I can poll for information that the ECU is using to manage the engine.

    I am getting IAT in Fahrenheit , MAP in PSI, RPM and VSS in MPH.

    Here's an example of the numbers

    IAT = 88.39
    MAP = -16.97
    RPM = 3094
    VSS = 60.89


    IAT F to K = 304.3
    MAP PSI to kPa = -117.06
    RPM = 3094
    VSS = 60.89

    I plug that into the first formula to get IMAP:

    IMAP = RPM * MAP / IAT
    1190.218994413408 = 3094 * -117.06 / 304.3

    Then I plug that into the MAF formula:
    MAF = (IMAP/120)*(VE/100)*(ED)*(MM)/(R)
    MAF = (1190.218994413408/120)*(80/100)*(2.056)*(28.97)/8.314
    MAF = 9.918491620111732 * .8 * 2.056 * 28.97 / 8.314
    MAF = 56.84564559003256

    Then I plug that into the MPG formula with adjustments because I'm in MPH and not KPH:
    MPG = (14.7 * 6.17 * 454 * VSS) / (3600 * MAF / 100)
    MPG = (14.7 * 6.17 * 454 * 60.89) / (3600 * 56.84564559003256 / 100)
    MPG = 2507288.59794 / 2046.443241241172
    MPG = 1225.19332440382

    Now, as much as I'd like this to be true... it sadly isn't. I'm getting around 30 - 31.5 MPG on a tank of gas. I've checked my conversions several times and I'm sure they are correct.

    Can someone please put a second set of eyes on these equations to help me figure out what's wrong here. Unfortunately, I don't have an ODBII car to compare numbers with.

    Thank you in advance.

  10. #120
    Newbie
    Join Date
    May 2011
    Location
    Minot, ND
    Posts
    6
    Quote Originally Posted by lude-de View Post
    IAT = 88.39 = 304.48K
    MAP = -16.97 (assume 29.92 baro) = 12.95 ambient pressure (not VACUUM!)
    RPM = 3094
    VSS = 60.89

    IAT F to K = 304.3
    MAP PSI to kPa = -117.06 = 43.85
    RPM = 3094
    VSS = 60.89

    I plug that into the first formula to get IMAP:

    IMAP = RPM * MAP / IAT
    445.59 = 3094 * 43.85 / 304.48

    Then I plug that into the MAF formula:
    MAF = (IMAP/120)*(VE/100)*(ED)*(MM)/(R)
    MAF = ( 445.59 /120) * (80/100) * (2.056) * (28.97) / 8.314
    MAF = 21.28

    Then I plug that into the MPG formula with adjustments because I'm in MPH and not KPH:
    MPG = (14.7 * 6.17 * 454 * VSS) / (3600 * MAF / 100)
    MPG = (14.7 * 6.17 * 454 * 60.89) / (3600 * 21.28 )
    MPG = 32.73

    Now, as much as I'd like this to be true... it sadly isn't. I'm getting around 30 - 31.5 MPG on a tank of gas. I've checked my conversions several times and I'm sure they are correct.
    Your MAP was calculated wrong (biggest factor), an extra /100 in the final formula not required because it's already taken care of in the IMAP conversion (2nd biggest factor, probably would've seen that in an "off by a factor of 100" error), and the F to K conversion wasn't quite accurate.

Bookmarks

Posting Permissions

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