Gasoline consumption Math


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2003
    Location
    Sao Paulo - Brazil
    Posts
    92

    Default Gasoline consumption Math

    Hello friends,

    after some time, I finally put the new version of my on-board computer on my Opel, and it is workng very fine.

    But (there´s always something to do...), I´m measuring just the Instant consumption.

    Now, I would like to measure the average consumption, just like on Opel Zafira or VW Golf.

    I know it´s easy to calculate : Average = Distance_Traveled (km) / Amount_of_Fuel_Used (liters)

    My injectors can bleed 17 ml / s (each one, there are 4 injectors)
    I read the time that one injector keep open in 500 ms.
    My digital odometer gives me the distance in 100 meters steps
    I would like to calculate the Average of consumption for each 100 meters

    For example : When my car is stopped, It waste around 1.9 Litters / Hour :
    Gasoline = 40 (or 0.004 s) * 17 ml/s (injector flow) * 4 (number of injectors) * 2 (1 second) Gasoline = 0.54 ml / s or 1.9 litters / hour

    When the car is in movement, the formula is a bit different and also takes the distance traveled do calculate the instant consumption.

    My problem is : How to work with big numbers when, for example, I´m stopped in the traffic for, let´s say 10 minutes (very common here in Sao Paulo, Brazil) and the calculation of the amount of gasoline used goes over the 65535 limit ?

    Is there another way of doing this math ?

    If I was not that clear, let me know and I will try to explain it better .

    Thanks guys !

    Sérgio

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Talking

    Hi, Sergio

    You really want to be frightened by your consumption results !!!

    There are no definite solutions for your problem ... cause you can take 2 hours or more to make 100 meters ... ( here some people stopped by the snow sometimes stay at the same place for ... 12 Hours, Engine idling, ... not to be frozen !!! )

    Note at this moment ... you do not really want to know the average gas per 100 m !!!

    so, just detect if your fuel volume is over the " Horror value " ( say 60 000 ...) as there was no odometer pulse ... and let the L/ km maths aside as they really do not mean anything !!!

    show L/h at this time , if you like Horror films !!!

    So, I think it will be simpler to show l/km ... only if your car runs ... Infinite is really difficult to write !!! ( yes : liters/ 0 m = infinite !!! )

    A problem well explained is half solved ... don't you think ???

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Nov 2003
    Location
    Sao Paulo - Brazil
    Posts
    92


    Did you find this post helpful? Yes | No

    Default

    Hi Alain,

    thanks for your Tips.

    Well, gas / etanol consumption is one of my, lets say, obsessions.

    I would like to measure the average during a trip, and after a very good sleepy night, I think I found a way of doing that using some auxiliary vars.

    Thanks again !

    Sérgio

  4. #4
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by srspinho View Post
    I read the time that one injector keep open in 500 ms.
    Hi Sérgio,

    The injection time will change depending on the load of the engine.
    The pressure of the fuel is constant, the supply of the fuel is
    controlled by the injection time.

    Best regards,

    Luciano

    EDIT:
    (See next post)

    I have cleaned my glasses now, but I'm not sure that was the problem!

    Sorry about that!

    Luciano
    Last edited by Luciano; - 9th November 2007 at 19:07.

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Wink

    Quote Originally Posted by Luciano View Post
    Hi Sérgio,

    The injection time will change depending on the load of the engine.
    The pressure of the fuel is constant, the supply of the fuel is
    controlled by the injection time.

    Best regards,

    Luciano
    Hi, Luciano

    500 ms: It's the time to make the consumption mesure ... let's say for an average consumption on a 500 ms period !

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  6. #6
    Join Date
    Nov 2003
    Location
    Sao Paulo - Brazil
    Posts
    92


    Did you find this post helpful? Yes | No

    Default Thank You !

    Hi Guys !

    I think my problem is almost fixed.

    I decided to implement the solution using some intermediate variables counting the amount of fuel used (milliliters and decilliters ) and making calculations for each 100 meters. If the division cannot be performed, the display shows "- -", like in some on-board computers I have seen.

    I just have to bootload the new software and run some kilometers in the traffic here in Sao Paulo.

    Well guys . . . Thank you for your advices ! ! !

    Regards

    Sérgio

Similar Threads

  1. Fuel consumption display
    By veijavi in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 27th December 2011, 06:05
  2. Reading curnt consumption with 16F877A
    By comwarrior in forum General
    Replies: 7
    Last Post: - 3rd October 2009, 19:06
  3. Line Graph, math problem...
    By TerdRatchett in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 6th May 2009, 04:20
  4. Pulsin Math question
    By ruijc in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 2nd April 2008, 16:15
  5. PBPL Math...new math takes more cycles...Always?
    By skimask in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th February 2008, 10:22

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

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