Imperial gallons?
#1
I noticed the top car on the mileage chart is located in the UK. A gallon in the UK is an imperial gallon, about 1.2x a US gallon. Using an online calculator I found at http://hemsidor.torget.se/users/b/bohjohan...ert/conv2_e.htm his mean mileage comes to about 83 US mpg. Perhaps the database should have some way of adjusting for this, or did I miss mention of this somewhere else?
#2
Yes. The database compensates for this. When you enter data, you can select "Imperial Gallons". The value is mathematically calculated and inserted in US gal in the database.
There's some computer code for you. Basically says that if they select "liter", multiply by 3.785. If "imperial gallon", by 1.201.
Code:
if ($_POST['mileage_unit2'] == 'liter') { $mileage = $mileage*3.785; } elseif ($_POST['mileage_unit2'] == 'imperialgallon') { $mileage = $mileage*1.201; }
#5
I'm changing it to the following. I'll change his data so that I'm assuming he used kilometers and Imperial gallons. Is that a good assumption?
To interpret, ignore the $ and $_POST. Between {}s means "Do this". = is to define. == is to see if it's true.
To interpret, ignore the $ and $_POST. Between {}s means "Do this". = is to define. == is to see if it's true.
Code:
$mileage = $_POST['mileage_integers'].'.'.$_POST['mileage_tenths']; if ($_POST['mileage_unit1'] == 'km') { $mileage = $mileage*1.609; } if ($_POST['mileage_unit2'] == 'liter') { $mileage = $mileage*3.785; } elseif ($_POST['mileage_unit2'] == 'imperialgallon') { $mileage = $mileage/1.201; } $mileage = round($mileage,1); if ($_POST['distance_unit'] == 'km') { $distance = round($_POST['distance']*1.609); } else { $distance = $_POST['distance']; }
#6
Okay. He's back in his rightful place. I didn't change the distances, as I really don't know if he used miles or kilometers. There isn't a significant difference.
I'll need to double check my code for future use. Thank you very much for pointing it out!
I'll need to double check my code for future use. Thank you very much for pointing it out!
#7
On second thought, I'll probably change it as if he initially put KM because using 7 gallons on a tank isn't normal. The average for insights seems to be about 11.
Ooh! I need to do some heavy thinking tomorrow The data is all wrong for him, and I don't want to just delete it.
Ooh! I need to do some heavy thinking tomorrow The data is all wrong for him, and I don't want to just delete it.
#8
Just noticed these issues for myself; passed it on to Jason and he put up the notice to use miles and US Gallons.
For the benefit of those of us using metric:
1.0 litres = 0.264172051 US gallons
1.0 kilometer = 0.621371192 miles
Gotta love Google's built-in calculator!
Andrew.
For the benefit of those of us using metric:
1.0 litres = 0.264172051 US gallons
1.0 kilometer = 0.621371192 miles
Gotta love Google's built-in calculator!
Andrew.
#10
...and of course as an added wrinkle we don't actually measure fuel consumption performance in km/L. It's "L/100km"; on Google you can enter in something like:
50 miles per gallon in L/100km
...and get back...
50 miles per gallon = 4.70429169 L/100km
Or in my case as an example, my best ever trip I averaged 4.0L/100km on a 600km summer trip (from Ottawa to Kingston and back), average speed of 80km/h:
4.0 L/100km in miles per US gallon
...gives me...
4.0 L/100km = 58.8036461 miles per US gallon
So, all that is my long-winded way of saying, until Jason has the time iron out the bugs, those of us using other units can do the calculations via Google.
Great place you have here, Jason!
Andrew.
50 miles per gallon in L/100km
...and get back...
50 miles per gallon = 4.70429169 L/100km
Or in my case as an example, my best ever trip I averaged 4.0L/100km on a 600km summer trip (from Ottawa to Kingston and back), average speed of 80km/h:
4.0 L/100km in miles per US gallon
...gives me...
4.0 L/100km = 58.8036461 miles per US gallon
So, all that is my long-winded way of saying, until Jason has the time iron out the bugs, those of us using other units can do the calculations via Google.
Great place you have here, Jason!
Andrew.