GreenHybrid Interactive Hybrid Car Resource
Home Discuss Articles Compare Share Shop
GreenHybrid.com   Hybrid Car Forums   Tech Information   Mileage & Specs   Photo Gallery   Buying Guide  
GreenHybrid Mileage Database - Click here to track your MPG! Join Hybrid car discussions today - Create a FREE GreenHybrid Account

Go Back   GreenHybrid - Hybrid Cars > Miscellaneous Forums > Website Questions & Input

Website Questions & Input Suggestions and inquiries about GreenHybrid are welcome here.

Reply
 
Thread Tools
  #1 (permalink)  
Old 08-07-2005, 11:42 PM
GreenHybrid Founder
 
Real Name: Jason Siegel
Location: Houston, TX
Hybrids: 2004 Toyota Prius
Posts: 4,593
Default Quick Math Help

For the mileage database, a small display bug was pointed out. To rectify it, I need to calculate the MPG for the tanks that are logged. It's late and my brain is fried. Can anyone else figure out the equation?

Known: Lifetime MPG, Lifetime Miles, Starting MPG, Starting Miles, Tank Miles
Need: Tank MPG

This may be really easy, but at 1:45 after all I've been doing on this thing... can't think! Thanks.

.

Read my new biweekly column, The Western Street 7.
Visit my political debate forum, Volconvo.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 08-08-2005, 12:06 AM
tbaleno's Avatar
Plodding along
 
Real Name: Tom Baleno
Location: Leominster, MA
Hybrids: 2003 - Honda Civic Hybrid CVT
Posts: 2,130
Default Re: Quick Math Help

can it be done? how can you ever know tank mpg without knowing tank gallons

You can maybe take a guess at it and assume all tanks had equal gallons. But this tank could be the exception to the rule.

I think you need tank gallons to do this equasion.

.



My hydroponics experiment

You ever notice how hard it is to lip read cartoon characters?
"Crazy is what the sane call Delta Flyer"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-08-2005, 12:15 AM
GreenHybrid Founder
 
Real Name: Jason Siegel
Location: Houston, TX
Hybrids: 2004 Toyota Prius
Posts: 4,593
Default Re: Quick Math Help

Haha. I think not! I'll figure it out tomorrow when I get some more sleep Trust me, it's possible.

BTW how do you think I calculate lifetime mileage when I never know how many gallons anyone ever uses?

.

Read my new biweekly column, The Western Street 7.
Visit my political debate forum, Volconvo.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 08-08-2005, 02:40 PM
Conservative Republican
 
Real Name: Bob Barlow
Location: near Fredericksburg, Virginia
Hybrids: 2004 Honda Civic w/Manual Trans
Posts: 178
Default Re: Quick Math Help

Jason,

If I could to real math.... Never mind. Math was not my subject. I have not had a math class since 10th grade geometry in 1975. I never had Algebra II, or Trig, or Calc, but...

I think what you are talking about can be figured by taking miles for a given tank, divided by total miles, to get a percentage that tank represents of the total miles. Multiply that number by the mpg for that tank, and you get X. Do the equation again for another tank and you get X1, and again for another tank and you get X2, and again for another tank and you get X3.... Add X, X1, X2, X3, etc together, and you get an mpg for the total number of miles entered.

Am I making any sense? It frightens me to think I might be. Don't ask me how I came up with this. I don't know.

Bob

Quote:
Originally Posted by Jason
For the mileage database, a small display bug was pointed out. To rectify it, I need to calculate the MPG for the tanks that are logged. It's late and my brain is fried. Can anyone else figure out the equation?

Known: Lifetime MPG, Lifetime Miles, Starting MPG, Starting Miles, Tank Miles
Need: Tank MPG

This may be really easy, but at 1:45 after all I've been doing on this thing... can't think! Thanks.

.


Last edited by rjbarlow; 08-08-2005 at 02:46 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 08-08-2005, 02:45 PM
Conservative Republican
 
Real Name: Bob Barlow
Location: near Fredericksburg, Virginia
Hybrids: 2004 Honda Civic w/Manual Trans
Posts: 178
Default Re: Quick Math Help

Jason,

Isn't this the same formula you use to figure out cumulative mpg for each member? All you need to do for me is use the formula you use now to calculate mpg, but subtract the "at start" numbers from your formula.

Does this make sense?

Bob

.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 08-08-2005, 02:45 PM
GreenHybrid Founder
 
Real Name: Jason Siegel
Location: Houston, TX
Hybrids: 2004 Toyota Prius
Posts: 4,593
Default Re: Quick Math Help

Hmm. That requires a loop... a bit code intensive. I'm telling you... there IS a better way! I'll figure it out soon.

.

Read my new biweekly column, The Western Street 7.
Visit my political debate forum, Volconvo.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 08-08-2005, 02:47 PM
GreenHybrid Founder
 
Real Name: Jason Siegel
Location: Houston, TX
Hybrids: 2004 Toyota Prius
Posts: 4,593
Default Re: Quick Math Help

If any of you know PHP, maybe this could help. It's the code to calculate lifetime MPG.

Code:
$carQUERY=mysql_query("SELECT tanks, mi_start, mpg_start FROM cars WHERE cid=$cid");
$car=mysql_fetch_array($carQUERY);

// Grab tanks data
$tanks=0;
$tankQUERY=mysql_query("SELECT mi, mpg FROM tanks WHERE cid=$cid AND deleted=0");
while($tank=mysql_fetch_array($tankQUERY)) {
	$tanks_bit=$tanks_bit + ($tank['mi']/$tank['mpg']);
	$mi_tanks=$mi_tanks + $tank['mi'];
	$tanks++;
}

// Define car data
$mi=$car['mi_start']+$mi_tanks;
if($car['mpg_start']>0) {
	$mpg=$mi / ($tanks_bit + ($car['mi_start']/$car['mpg_start']));
} elseif ($mi_tanks>0) {
	$mpg=$mi_tanks / $tanks_bit;
} else {
	$mpg=0;
}

.

Read my new biweekly column, The Western Street 7.
Visit my political debate forum, Volconvo.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 08-08-2005, 02:49 PM
Conservative Republican
 
Real Name: Bob Barlow
Location: near Fredericksburg, Virginia
Hybrids: 2004 Honda Civic w/Manual Trans
Posts: 178
Default Re: Quick Math Help

Well, I don't know anything about computer programming either. You are on your own!

.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 08-08-2005, 02:54 PM
Conservative Republican
 
Real Name: Bob Barlow
Location: near Fredericksburg, Virginia
Hybrids: 2004 Honda Civic w/Manual Trans
Posts: 178
Talking Re: Quick Math Help

Jason,

Now I am really treading into the unknown, I know NOTHING about computer language or programming. But what if in the third line of the partial quote below you changed ">0" to "=0" as the formula just to calculate the progress since adding tanks? Isn't that the code entry that tells the calculator that the mpg start may be something above 0, as in 23,151 miles in my case?

Bob

Quote:
Originally Posted by Jason
If any of you know PHP, maybe this could help. It's the code to calculate lifetime MPG.

[// Define car data
$mi=$car['mi_start']+$mi_tanks;
if($car['mpg_start']>0) {
$mpg=$mi / ($tanks_bit + ($car['mi_start']/$car['mpg_start']));
} elseif ($mi_tanks>0) {
$mpg=$mi_tanks / $tanks_bit;
} else {
$mpg=0;
}[/code]

.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Topic Starter Forum Replies Last Post
Math & Decimal Accuracy Jason Fuel Economy & Emissions 23 05-09-2005 07:07 PM
Quick Jump go Bye Bye? Jason Website Questions & Input 8 03-27-2005 08:34 PM


All times are GMT -7. The time now is 11:36 AM.


Home | Hybrid Discussion Forums | Hybrid Articles Archive | Mileage Database | Hybrid Photo Galleries | Compare Vehicles
Terms of Service - Privacy Policy - Advertising
GreenHybrid.com, Copyright 2008
InternetBrands.com Automotive Network

SEO by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52