1. Attachments are working again! Check out this thread for more details and to report any other bugs.

Gen2 Prius: Custom PIDs for Torque (Android App) with formulas

Discussion in 'Gen 2 Prius Technical Discussion' started by usbseawolf2000, Jun 24, 2011.

  1. usbseawolf2000

    usbseawolf2000 HSD PhD

    Joined:
    Sep 22, 2004
    14,487
    2,994
    0
    Location:
    Fort Lee, NJ
    Vehicle:
    2012 Prius Plug-in
    Model:
    Plug-in Base
    Torque now supports OBDLink MX which is reported to get up to 60 PIDs per second! It is tiny too!

    If anyone can afford $199.95, please let us know how fast it works with Prius.

    [​IMG]
     
  2. FreydNot

    FreydNot Member

    Joined:
    Dec 16, 2010
    210
    37
    0
    Location:
    Seattle, WA USA
    Vehicle:
    2008 Prius
    Model:
    N/A
    I now have my kiwi bluetooth and have used Torque a few times. I'm still trying to get me bearings...

    Can someone who has Torque already set up let me know the initial vehicle values they use?
     
  3. ehybrid

    ehybrid Junior Member

    Joined:
    Nov 8, 2011
    17
    4
    0
    Location:
    Melbourne, Australia
    Vehicle:
    2009 Prius
    Model:
    N/A
    I find engine RPM is handy (~2k rpm is a nice sweet spot, under 3k ain't too horrible) .... HV SOC important for managing energy over the medium term -- if you know there's a nice downhill section, slightly more pressure to keep engine running to enable a longer coast is a big saving. Engine and catalyst temperature I also find useful for 'being gentle' on cold starts. And of course, HV current as the biggest dial meter, so you can clearly see current being used to make that light feathering of 0-15amp coasts easier to spot, feel and hold for longer durations. Best for last :p

    I had more, but I find torque kills my dial setup pretty regularly (once every few weeks) and I can't find a way of saving or restoring my dial setup. Does anyone know if it's possible (and if it's possible, is there a repository somewhere that we can share our "nice" setups with each other?)

    Ben.
     
  4. FreydNot

    FreydNot Member

    Joined:
    Dec 16, 2010
    210
    37
    0
    Location:
    Seattle, WA USA
    Vehicle:
    2008 Prius
    Model:
    N/A
    I did a full uninstall of the torque app (including clearing the userdata) and when I reinstalled fresh, my config and dials were still present. It seems like Torque stores it configuration files on the SD card in the ".torque" folder (the leading period is important). I would guess restoring a backup of the "torqueDial.dat" file might be enough to bring the gauages back. It wouldn't hurt to backup the "torqueConf.dat" file either.

    ehybrid, what do you use for your Volumetric Efficiency and Max RPM's? Do you have a Gen2 or Gen3 Prius?
     
  5. ehybrid

    ehybrid Junior Member

    Joined:
    Nov 8, 2011
    17
    4
    0
    Location:
    Melbourne, Australia
    Vehicle:
    2009 Prius
    Model:
    N/A
    I have my06.

    Volumentric efficiency I've thus far eyeballed off the BSFC chart toyota publish for the engine, and guestimate from RPM. Injector pulse width also seems like another useful proxy. As does engine load. I suspect we'd need more complex math than torque allows, to use something like a kahlman filter to combine, speed (kinetic energy), estimate of drag, height (potential energy), battery energy (including estimate or calculation of coulombic efficiency) to be able to get anything close to a realtime engine efficiency number. In reality, the prius' dynamic overdrive winds up taking most of the variables associated with fixed gear ratios away and making RPM a pretty good proxy in steady state conditions.
    Max RPM, the RPM graph thing has little dots that get left behind to show min/max ranges. Not sure what use it is though?

    Thanks for the tip re backing up files on the SD. Mine have definitely become corrupted a few times (guessing it's either "torque upgrade" that causes it, or loading torque after a reboot before the SD card has been mounted)

    Ben.
     
    1 person likes this.
  6. Flying White Dutchman

    Flying White Dutchman Senior Member

    Joined:
    Dec 29, 2007
    4,374
    313
    0
    Vehicle:
    Other Non-Hybrid
    Model:
    N/A
    i see with the app that you can also log pids
    and that the HV battery voltages can also be read out
    so can anyone tell me if that also works? and if so can i also log the HV battery voltages during driving and make a nice sheet from it in exel? graphs and stuff.
     
  7. usbseawolf2000

    usbseawolf2000 HSD PhD

    Joined:
    Sep 22, 2004
    14,487
    2,994
    0
    Location:
    Fort Lee, NJ
    Vehicle:
    2012 Prius Plug-in
    Model:
    Plug-in Base
    Yup, it can log and show the data in real-time. It can also graph in real-time!
     
  8. Flying White Dutchman

    Flying White Dutchman Senior Member

    Joined:
    Dec 29, 2007
    4,374
    313
    0
    Vehicle:
    Other Non-Hybrid
    Model:
    N/A
    nice
    but it can! or did you log HV battery voltages with it already? so a real life time user! ;-)

    so that way i can log the HB battery voltages during driving and see how they hold up.
    even log over time and see if its getting wors over time
     
  9. FreydNot

    FreydNot Member

    Joined:
    Dec 16, 2010
    210
    37
    0
    Location:
    Seattle, WA USA
    Vehicle:
    2008 Prius
    Model:
    N/A
    Logging the 14 block voltages and the 14 block resistances was one of the first things I did with Torque. My intention was to make graphs like these: http://priuschat.com/forums/gen-ii-...orque-android-app-formulas-2.html#post1372645

    However, logging 28 data points at 1 second intervals really slowed Torque down. I also found Excel is fairly lacking in creating histograms so I'm looking for a better solution.

    Based on this article Predictive battery failure analysis for the Prius Hybrid I decided to only log the min voltage and max voltage and try to make a similar graph. My first attempt showed some unexpected results (a single occurrence of a 1.5 volt difference). I'm hopeful it was a glitch (maybe both values were taken out of sync).

    I can verify you can log all of that and more to the SD card. It is also pretty easy to email the log files to yourself. There is also a built in automatic "upload to web site" feature that I haven't investigated yet.

    Well worth it.
     
  10. FreydNot

    FreydNot Member

    Joined:
    Dec 16, 2010
    210
    37
    0
    Location:
    Seattle, WA USA
    Vehicle:
    2008 Prius
    Model:
    N/A
    I think my Bluetooth connection to the car handsfree is interfering with the connection to the Kiwi. If I disconnect all other Bluetooth devices I seem to get more consistent updates in Torque.

    Has anyone has success using other Bluetooth devices simultaneously with Torque?

    Also, I am seeing a few instances where max voltage is actually lower than min voltage. Does this happen to anyone else? Does this indicate bad data capture in Torque or something in the car?
     
  11. usbseawolf2000

    usbseawolf2000 HSD PhD

    Joined:
    Sep 22, 2004
    14,487
    2,994
    0
    Location:
    Fort Lee, NJ
    Vehicle:
    2012 Prius Plug-in
    Model:
    Plug-in Base
    The min being higher than the max happened to me also.
     
    1 person likes this.
  12. FreydNot

    FreydNot Member

    Joined:
    Dec 16, 2010
    210
    37
    0
    Location:
    Seattle, WA USA
    Vehicle:
    2008 Prius
    Model:
    N/A
    I just reported a bug to the author of Torque where it forgets all imported custom PIDs after the first 101 entries. After importing "USBSeawolf2000 Gen2 Prius 11-8-11.csv", exiting Torque and restarting Torque again the last entry in the custom PID list I see is "Request Regenerative Brake Torque".

    Restarting the Torque app seems to be key in this bug.

    Is anyone else seeing this?
     
  13. FreydNot

    FreydNot Member

    Joined:
    Dec 16, 2010
    210
    37
    0
    Location:
    Seattle, WA USA
    Vehicle:
    2008 Prius
    Model:
    N/A
    Ian confirmed there was a 100 entry limit in version 1.5.30. The next release will have a 1000 entry limit.
     
    1 person likes this.
  14. Flying White Dutchman

    Flying White Dutchman Senior Member

    Joined:
    Dec 29, 2007
    4,374
    313
    0
    Vehicle:
    Other Non-Hybrid
    Model:
    N/A
    maybe you can delete some thing not relevant to us
    like turbo pressure and so on? or is that already taking out if that list?
     
  15. FreydNot

    FreydNot Member

    Joined:
    Dec 16, 2010
    210
    37
    0
    Location:
    Seattle, WA USA
    Vehicle:
    2008 Prius
    Model:
    N/A
    The limit only applies to the imported custom PIDs. I have trimmed usbseawolf2000's list down to under 100 which is a functional solution until the next version of Torque is released.
     
  16. FreydNot

    FreydNot Member

    Joined:
    Dec 16, 2010
    210
    37
    0
    Location:
    Seattle, WA USA
    Vehicle:
    2008 Prius
    Model:
    N/A
    Trying to find injector time

    I've been reading Hobbits Reflections on the sweet spot and trying to apply his theorys to my driving. He discusses using both a tachometer and the fuel injector pulse width as guides to keeping the engine working hard enough to be efficient. He likes them because they don't lag and update quickly.

    The Torque application gives us the tac very easily. However, the injector pulse seems to be more difficult. Hobbit gives the Xgauge information for injector pulse as:
    07E021F3 / 0306 8461 05F3 / 3808 / 000A 0008 0001 / inj​

    After reading Aberk's excellent instructions here I came up with the following Torque formula (min and max are guesses):
    Column 1
    0 Name ShortName ModeAndPID Equation Min Value Max Value Units Header
    1 Injector Time Inj 21F3 10 * A * ( 10 / 8 ) + 1 0 100 Ms 7E0

    I poked that into Torque but it didn't look right. The values were way too high. I did notice that as Hobbit described, when the ICE turns off, the injector time continues to report the last value before the ICE shut down. Because of this I am fairly sure we have the right information and the issue is just a matter of getting the adjustments in the formula correct. So I double checked...

    MTH = 000A 0008 0001
    The first 4 characters are the multiplier. Converted to decimal = 10.
    The middle 4 characters are the divisor. Converted to decimal = 8.
    The last 4 characters are either added or subtracted. The Two's Complement of "0001" in decimal = +1.

    RXF = 0306 8 46105F3
    The fifth character is an 8, so the data must be multiplied by 10.

    Maybe I'm missing something but that all looks correct to me.

    Hobbit states:
    The 2800 - 3000 RPM power burst corresponds to about 7 ms or slightly less. Watching injector time also helps at lower speeds, as it helps indicate full loading there as well. Just off the line up to about 25 MPH, low-RPM torque winds up using a slightly longer injection pulse like 6.7 and then starts shrinking as the driveability map starts to shift upward.

    I went for a drive and logged the ICE RPM, my calculated Injector Timing and the raw Injector Timing (stripping all equasions off and simply logging "A"). The results can be found on this Google spreadsheet. Nothing really jumped out at me as an obvious correction for the formula. From the spreadsheet it looks like the raw value doesn't have as much resolution as I was expecting.

    Am I making this too hard? Early on I ruled out using:
    Column 1
    0 Name ShortName ModeAndPID Equation Min Value Max Value Units Header
    1 ICE Power Request (hp) ICE Power 21C3 ((256 * K) + L) * 0.0134 0 76 hp 7E2
    Since it is the request and not an actual measure of work.

    Is there a PID that will reveal the HP (or kW) of the ICE? Ideally it would be something that didn't lag and updated quickly.
     
  17. vincent1449p

    vincent1449p Active Member

    Joined:
    May 24, 2004
    894
    331
    0
    Location:
    Singapore
    Vehicle:
    2012 Prius c
    Re: Trying to find injector time

    Hi FreydNot,

    To convert to Torque, you need to do the reverse, i.e. divide by 10 to undo the formatting by the fifth character. Your Equation should also use C instead of A. A and B are for Injector Volume. Pls check out my earlier post.

    Vincent
     
    1 person likes this.
  18. FreydNot

    FreydNot Member

    Joined:
    Dec 16, 2010
    210
    37
    0
    Location:
    Seattle, WA USA
    Vehicle:
    2008 Prius
    Model:
    N/A
    Thanks for the pointer up the thread. Not sure how I missed that.

    Is there something in the Xgauge data that would have pointed me to the third byte of 7E0/21F3 and not the first? I would really like to learn how to accurately convert them over to Torque. Would you say it is generally best to throw out the Xgauge equations, look up min and max values in a repair manual and then calculate my own?

    I'll poke that into my custom PID list and see how it corresponds. Have you already had a chance to test it to your satisfaction? If this is already vetted, perhaps usbseawolf2000 could add it to the list.

    Thanks again!
     
  19. vincent1449p

    vincent1449p Active Member

    Joined:
    May 24, 2004
    894
    331
    0
    Location:
    Singapore
    Vehicle:
    2012 Prius c
    RXD would tell you the offset from the first bit of the response. However, there are some complications because some of the response are Single Frame, some are First Frame and some are Consecutive Frame. Each of these have different calculation of offset:

    Column 1 Column 2 Column 3 Column 4 Column 5 Column 6 Column 7 Column 8 Column 9 Column 10 Column 11
    0 Bit offset 0 8 10 18 20 28 30 38 40 48
    1 Byte no. 1 2 3 4 5 6 7 8 9 10
    2 Single 07 E8 06 61 F3 A B C D E
    3 First 07 E8 10 13 61 F3 A B C D
    4 Consecutive 07 E8 21 E F G H I J K
    5 Consecutive 07 E8 22 L M N O P Q R


    Byte no. 3 would tell you what type of Frame msg. For this case, Hobbit found it to be 06 (can be any no. that is 7 or less) so it is a SF msg. The RXD is 3808 so it should be C.

    There are not many Scangauge PIDs. Somebody already did the PIDs reverse engineering as posted by usbseawolf2000 here.

    Most of the PIDs in the spreadsheet are correct but a few of them have the equations wrong. So it is advisable to double check with the RM. For e.g. WIN HV Batt to Converter and Discharge Request to Adjust SOC are wrong.

    No, mine is a Gen1.

    Vincent
     
    SFO and FreydNot like this.
  20. FreydNot

    FreydNot Member

    Joined:
    Dec 16, 2010
    210
    37
    0
    Location:
    Seattle, WA USA
    Vehicle:
    2008 Prius
    Model:
    N/A
    That is some good data. I will take some time and digest it.

    I'm not looking to reinvent the wheel. I just seems like there are still some "missing" PIDs from usbseawolf2000 Google spreadsheet. Injector Time was the most obvious to me.

    Torque has the ability to create a "push button" which will send a "RAW" OBD command. This is often used to initiate a reset of a trip counter. I thought this would be an interesting way to create a virtual EV mode button.

    Does anyone happen to know if there is an OBD command which will trigger EV mode?