{"action":"created","issue":{"url":"https://api.github.com/repos/pires/android-obd-reader/issues/120","labels_url":"https://api.github.com/repos/pires/android-obd-reader/issues/120/labels{/name}","comments_url":"https://api.github.com/repos/pires/android-obd-reader/issues/120/comments","events_url":"https://api.github.com/repos/pires/android-obd-reader/issues/120/events","html_url":"https://github.com/pires/android-obd-reader/issues/120","id":96089488,"number":120,"title":"Better fuel consumption","user":{"login":"Pho3niX90","id":7858187,"avatar_url":"https://avatars.githubusercontent.com/u/7858187?v=3","gravatar_id":"","url":"https://api.github.com/users/Pho3niX90","html_url":"https://github.com/Pho3niX90","followers_url":"https://api.github.com/users/Pho3niX90/followers","following_url":"https://api.github.com/users/Pho3niX90/following{/other_user}","gists_url":"https://api.github.com/users/Pho3niX90/gists{/gist_id}","starred_url":"https://api.github.com/users/Pho3niX90/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pho3niX90/subscriptions","organizations_url":"https://api.github.com/users/Pho3niX90/orgs","repos_url":"https://api.github.com/users/Pho3niX90/repos","events_url":"https://api.github.com/users/Pho3niX90/events{/privacy}","received_events_url":"https://api.github.com/users/Pho3niX90/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pires/android-obd-reader/labels/feature","name":"feature","color":"009800"},{"url":"https://api.github.com/repos/pires/android-obd-reader/labels/improvement","name":"improvement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-07-20T15:30:27Z","updated_at":"2015-07-24T14:27:58Z","closed_at":null,"body":"Hi.\r\n\r\nIn my car (bmw m6) the app can't get the fuel consumption via obd. I have found a website that gives a proper calculation for this use. \r\n\r\nThis is the same method most of the OBD2 apps use on the playstore. \r\n\r\n\r\nSource: http://www.lightner.net/obd2guru/IMAP_AFcalc.html\r\nMaking use of the Ideal Gas Law, a synthetic variable called IMAP can be used to estimate the mass air-flow (MAF) of an internal combustion vehicle, much like a MAF sensor. However, in order to make this work, the engine displacement and volumetric efficiency of the engine must be provided.\r\n\r\nIMAP is integrated by the firmware using the following formula:\r\n\r\n        IMAP = RPM * MAP / IAT / 2\r\nwhere RPM is engine speed in revolutions per minute, MAP (manifold absolute pressure) is measured in KPa, and IAT (intake air temperature) is measured in degrees Kelvin. This integrated value can be converted into total air flow (grams) using the following formula:\r\n        (grams of air) = (IMAP/60)*(Vol Eff/100)*(Eng Disp)*(MM Air)/(R)\r\nwhere R is 8.314 J/°K/mole and the average molecular mass of air is 28.97 g/mole. Note that in the above formula the volumetric efficiency of the engine is measured in percent and the displacement is in liters.\r\nOnce we have MAF integrated over time, we can calculate fuel flow using a specific air/fuel mixing ratio (A/F). A/F can range from 6 to 22. The total mass of air which flows through the engine (as measured by the MAF sensor or calculated using MAP, RPM and IAT) is divided by the A/F ratio (e.g., 14.7) to derive the total mass of fuel that has been burned.\r\n\r\nIf the air mass is measured in grams, then the calculated amount of fuel will also be in grams. Using an average density of gasoline of 6.17 pounds per gallon and knowing that there are 454 grams per pound, then dividing the total fuel mass in grams by (454 * 6.17) yields the total number of gallons of fuel burned for a given amount of air (as measured by the MAF sensor).\r\n\r\nFuel consumed can be estimated from integrated MAF using the following formula:\r\n\r\n        (gallons of fuel) = (grams of air) / (air/fuel ratio) / 6.17 / 454\r\nKnowing the total fuel consumed and the distance traveled, the fuel consumption rate in MPG (miles per gallon) then can be calculated."},"comment":{"url":"https://api.github.com/repos/pires/android-obd-reader/issues/comments/124541076","html_url":"https://github.com/pires/android-obd-reader/issues/120#issuecomment-124541076","issue_url":"https://api.github.com/repos/pires/android-obd-reader/issues/120","id":124541076,"user":{"login":"pires","id":1752631,"avatar_url":"https://avatars.githubusercontent.com/u/1752631?v=3","gravatar_id":"","url":"https://api.github.com/users/pires","html_url":"https://github.com/pires","followers_url":"https://api.github.com/users/pires/followers","following_url":"https://api.github.com/users/pires/following{/other_user}","gists_url":"https://api.github.com/users/pires/gists{/gist_id}","starred_url":"https://api.github.com/users/pires/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pires/subscriptions","organizations_url":"https://api.github.com/users/pires/orgs","repos_url":"https://api.github.com/users/pires/repos","events_url":"https://api.github.com/users/pires/events{/privacy}","received_events_url":"https://api.github.com/users/pires/received_events","type":"User","site_admin":false},"created_at":"2015-07-24T14:27:58Z","updated_at":"2015-07-24T14:27:58Z","body":"@Pho3niX90 unit-tests. Check `obd-java-api/src/test/java`."}}