Jump to content

Math function for fuel consumption and Distance to Empty?


koracing

Recommended Posts

So I have been thinking about this for a while:  I would love to be able to output to a CAN gauge instantaneous MPG as well as some averaging of such, as well as possibly with inputing a tank size variable provide a calculated value of distance to empty.  It is these little things that make new cars feel new and adding something like this to an old car would be fantastic.  

Given:
Driven wheel speed in MPH
Inst. Fuel consumption in cc/min
1 gallon = 3785.41 cc
1 Hour = 60 min

(Driven wheel speed/Inst. Fuel cons.)*(3785.41/60)= mile/gallon = mpg

or

image.png.83cb63f41f1d350e0e51bf2d205eba40.png

 

It would be nice to provide some accumulated average MPG as well, but I'm not sure the averaging function would work well for that.  Any thoughts?  

Also distance to empty once you know miles per gallon seems fairly straight forward or even instantaneous fuel consumption given a know fixed volume of fuel.  Perhaps fuel level sensor input would automate this value....

Link to comment
Share on other sites

  • 3 years later...
On 12/9/2020 at 9:33 AM, koracing said:

So I have been thinking about this for a while:  I would love to be able to output to a CAN gauge instantaneous MPG as well as some averaging of such, as well as possibly with inputing a tank size variable provide a calculated value of distance to empty.  It is these little things that make new cars feel new and adding something like this to an old car would be fantastic.  

Given:
Driven wheel speed in MPH
Inst. Fuel consumption in cc/min
1 gallon = 3785.41 cc
1 Hour = 60 min

(Driven wheel speed/Inst. Fuel cons.)*(3785.41/60)= mile/gallon = mpg

or

image.png.83cb63f41f1d350e0e51bf2d205eba40.png

 

It would be nice to provide some accumulated average MPG as well, but I'm not sure the averaging function would work well for that.  Any thoughts?  

Also distance to empty once you know miles per gallon seems fairly straight forward or even instantaneous fuel consumption given a know fixed volume of fuel.  Perhaps fuel level sensor input would automate this value....

How did you get on with this, im wanting to do something with the virtual fuel tank and distance to empty that i can stream to a powertune digital display

Link to comment
Share on other sites

iimage.thumb.jpeg.c5e105234c41c16b7c5e720fc7a29d5d.jpeg

I managed to get the fuel tank level in litres from virtual tank into the display. I reset it via direct input 3 which is connected to ignition on button ( power hold system) and when tps is over 98 percent.

Effectively hold pedal down and turn it on. which resets the fuel to full tank.

 

Any pointers to get the distance to empty to work in power tune display?

i have speed in the lf wheel speed,  a custom math block?  

 

 

 

Link to comment
Share on other sites

If you are wanting to do the distance to empty maths yourself it would be something like the below:

Note that it will be distance in km unless you change the 0.01 to 0.0062 to get miles.

 

Capture.PNG

Link to comment
Share on other sites

@Vaughan,

In a Real Wheel Drive application with a single speed sensor, the Helpfile indicates to configure - at least for a Front Wheel Drive with single input - the following:
image.png.6b35459c384da49a3a29945574525cf8.png

 

To calculate the Accumulated Fuel/Distance above, the Helpfile indicates a Driven Wheel Speed input is required:
image.png.23ce9c65e47e2cd3e8de6885fe5d11b8.png

 

Can I configure Driven Wheel Speed to the same GP Input as Driving Wheel Speed..? or no..
With the above Math Block the ECU is currently calculating 'INF' due to the Accum Fuel/Distance calculating 0L/100km

image.thumb.png.7c7c47b37f59e8bf4e55c83043afde62.png


Thanks

Link to comment
Share on other sites

On 6/10/2024 at 8:30 PM, HarryBeron said:

@jdniss did you get it to work? 
 

hey @HarryBeron, it looks to have worked, yes - thanks @koracing.

I forgot to enable the ECU log parameter and I only verified the Math value output on the Dash - however there was no value output at all prior to enabling Driven Speed - so the change looks to have worked as intended.

Still unsure whether the setting change will cause any adverse effects elsewhere as its not mentioned in the Helpfiles - but no issues so far.

Link to comment
Share on other sites

20 minutes ago, jdniss said:

Still unsure whether the setting change will cause any adverse effects elsewhere as its not mentioned in the Helpfiles - but no issues so far.

no issue with having driven and driving set to same speed input unless you are using features like traction control which require the two to be differentiated

Link to comment
Share on other sites

On 6/11/2024 at 10:33 AM, jdniss said:

hey @HarryBeron, it looks to have worked, yes - thanks @koracing.

I forgot to enable the ECU log parameter and I only verified the Math value output on the Dash - however there was no value output at all prior to enabling Driven Speed - so the change looks to have worked as intended.

Hey, just to follow this up @Vaughan, @HarryBeron - Distance to Empty isn't really working as expected - I suspect I have a calculation error somewhere.

The ECU is still reporting a calculated '0' value after 2-3 days (just to rule out the "Math Blocks only show historic data" question), despite the other parameters being populated.
 

On 6/6/2024 at 2:10 PM, Vaughan said:

If you are wanting to do the distance to empty maths yourself it would be something like the below:

Note that it will be distance in km unless you change the 0.01 to 0.0062 to get miles.

Capture.PNG


 

image.png.e95b46ab8a6cf22d660a7c3bf1cc2ddf.png


Oddly the Dash is showing a fixed '75' value for Math Block 8 regardless of the Fuel Left and Accum Fuel/Distance values - so suspecting this is also a divider or multiplier issue on my CAN stream.
~ Though with the Math Block 8 reporting a '0' value at least in the Log, I'm not entirely sure what RealDash thinks is being transmitted..

image.png

Link to comment
Share on other sites

Is it possibly a resolution issue where you're commanding only 1 decimal place, but multiplying by .01 in your equation?  Anything resulting in a/b being less than 1 would be 3 decimal places out.

Link to comment
Share on other sites

All working here now - both in PCLink and output to RealDash via Math Block 8 - thanks @Vaughan @koracing.

The updated math calculation sorted the Distance to Empty value,
and I'd stuffed up the CAN Stream output which was why Math Block 8 was reporting a weird parameter in RealDash last week.

I'd upload a picture, but I'm out of Storage Space on the account :lol:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...