Fuel consumption

Discussion in 'Ideas and Suggestions' started by Jujudemetz, Nov 9, 2018.

  1. Jujudemetz

    Jujudemetz
    Expand Collapse

    Joined:
    Nov 19, 2016
    Messages:
    61
    Hello!

    Is there any way to have an average fuel consumption Ui app? To work with the cruise control?

    Thanks
     
  2. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    Trip meter app, click numbers on it few times and you get average fuel consumption. It can also show distance you drove, average speed etc. Click arrowthing to reset it, sometimes you need to reset right after you start driving to get it to show sensible reading.
    --- Post updated ---
    upload_2018-11-9_20-38-36.png
    Trip Computer was the exact name.
     
    • Agree Agree x 3
  3. Jujudemetz

    Jujudemetz
    Expand Collapse

    Joined:
    Nov 19, 2016
    Messages:
    61
    Thank you so much, I didn't know that is it possible to click on an UI app.

    I think nothing is missing now (maybe add possibility to set 2 times the same UI app?^^)
     
    • Agree Agree x 1
  4. Jujudemetz

    Jujudemetz
    Expand Collapse

    Joined:
    Nov 19, 2016
    Messages:
    61
    On the other side, when the vehicle is stopping and at idle, the consumption is again calculated.

    For example, after many runs, it's at 40L/100 and it takes 150, 350, 500 and so... in few seconds when I stop the car. (in MPG: 6, 1.6, 0.7, 0.4...)
     
  5. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    Yes, I think that it is not really calculating per driven distance, but more in terms of per frame updates, or then it is just bugged out., but it is very easy to get 1500l/100km in two seconds, which then does not change to normal unless resetting the trip counter, which indeed is bit annoying.
     
  6. Jujudemetz

    Jujudemetz
    Expand Collapse

    Joined:
    Nov 19, 2016
    Messages:
    61
    Ok, I'd see that all stats (temps and so) are calculated per frame updates. I think it was a little bit difficult to fix that, maybe in ignore fuel consumption under 1km/h, but in frame update that wasn't so easy..

    And a majority of cars (even the less 150hp) had a big fuel consumption. Less than 10L/100 by running at 80-110 km/h was nearly impossible.

    Therefore there are a minority people that careful at this spec
     
  7. iheartmods

    iheartmods
    Expand Collapse

    Joined:
    Aug 8, 2012
    Messages:
    1,482
    If this: "Yes, I think that it is not really calculating per driven distance, but more in terms of per frame updates" is true, that's really annoying and unfairly hacky. You would think with the fuel and distance systems in place they could do the simple calculations of fuel/distance without issue; perhaps they do and the issue is that it is fuel/time.

    To say differently, I'm extremely annoyed that the avg MPG reading goes to 0 if you stop. They figured this out in the gauge cluster for the ETK800, it should make it to the app. Maybe some upper limit of calculation to go in place when the vehicle is <1m/s? Thinking out loud (ranting)
     
    • Agree Agree x 2
  8. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    Average fuel consumption should be fuel consumed / driven distance * 100 for l/100km, to get fuel consumed is to save spawn/reset fuel amount - current fuel amount, that gives you true average fuel consumption, there is own formula for MPG and conversion exists too, then in trip computers you need to press reset button to reset average fuel consumption, which button there is and it does work.

    To get smoothed fuel consumption, there one can use smoothed per number of frames or something.

    However there are always reasons, not sure what they could be, but there might be something why it has been decided to use something else for the app, maybe it is actual distance calculation that is going berserk, however it is not shown up in distance travelled though.


    Also for example there could be a bug that takes mm as a meter when stopped and instead of distance driven (which does not get reset when you press R) they use some other variable to calculate driven distance.

    That is possibility instead of average fuel consumption based on frametime, would need to examine a lot of code which I understand barely 10% to be able to tell :D

    But I posted a video to bug thread so they probably fix that.
     
  9. PriusRepellent

    PriusRepellent
    Expand Collapse

    Joined:
    Mar 19, 2018
    Messages:
    353
    @fufsgfen I will look at the code for that app because I'm curious now. Its probably some typo in there or something like with the unit conversion bug I found quite a while back (which was fixed sooner because I found what caused the bug).
     
    • Like Like x 2
  10. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    That is cool :)

    I spam this video here too which shows behavior that would match to theory of distance unit error, at least in my eyes:
     
    • Like Like x 1
  11. PriusRepellent

    PriusRepellent
    Expand Collapse

    Joined:
    Mar 19, 2018
    Messages:
    353
    I looked at the code and it is calculated in a rather weird way involving dividing by a counter on a timer. Why doesn't it just do based on a fuel consumed vs distance driven?
     
    • Agree Agree x 2
  12. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    Usually dt is there to stabilize effect of framerate to calculations, but I'm not sure why they need to do that for average fuel consumption and I'm not exactly sure if it is dt there.

    Maybe it can have something to do with changing of vehicle / changing fuel amount, but I can only guess here.
     
  13. PriusRepellent

    PriusRepellent
    Expand Collapse

    Joined:
    Mar 19, 2018
    Messages:
    353
    Maybe. I'll see what I can do with experimenting with my own fuel economy app later on.
     
    • Like Like x 1
  14. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    I did play with the JS a little today, sadly my understanding of JS is bit limited and from some reason I could not get to reading from streams to work.

    Now I realized that I used electrics.streams.fuelVolume instead of electrics.values.fuelVolume not sure if there would of been need to enable reading from values with some way first too.

    Anyway I think it should work by reading fuelVolume from init/reset then substracting current fuel volume and dividing by totalDistance, but I'm not sure about unit of totalDistance.

    That I did run out of time to test and with limited skill it is bit random struggle :p

    Well after one gets that to work, then lot of testing shows if there are any of surprises I guess.
     
  15. iheartmods

    iheartmods
    Expand Collapse

    Joined:
    Aug 8, 2012
    Messages:
    1,482
    • Like Like x 1
  16. Cutlass

    Cutlass
    Expand Collapse

    Joined:
    Apr 30, 2017
    Messages:
    3,125
    #16 Cutlass, Mar 25, 2019
    Last edited: Mar 25, 2019
    • Agree Agree x 2
  17. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    I think what is needed is (meters):
    local M = {}

    local totalDrivenm = 0

    local function updateGFX(dt)
    totalDrivenm = totalDrivenm + electrics.values.wheelspeed * dt

    Then just needs to figure out fuel consumed, which would be fuel at start - fuel at now, I think there was values for both in electrics, just can't be bothered to look for them right now, maybe even trip computer app has references to those?

    Now as we can get known distance, known fuel consumed, we can get perfectly correct average fuel consumption, even correct behavior with idling as average fuel consumption is calculated from total fuel consumed and total distance traveled, any errors would be down to sensor accuracy like IRL.

    Obviously there is reason why it is not done this way in current app, but I have no idea why it is calculated so odd way.

    I think I did same workaround as you did, it did work, but indeed has same issues as your app. I would need to stop being lazy and actually do what I proposed, but I don't want fame and glory, especially not riches and stuff, so I try my best at being lazy :)
     
    • Agree Agree x 1
  18. iheartmods

    iheartmods
    Expand Collapse

    Joined:
    Aug 8, 2012
    Messages:
    1,482
    Good stuff. I'm going to focus on my current coding class then see if I can't do some redesign after that.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice