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

Scangauge or Torque App?

Discussion in 'Generation 1 Prius Discussion' started by FinsUp99, Dec 29, 2012.

  1. vincent1449p

    vincent1449p Active Member

    Joined:
    May 24, 2004
    894
    331
    0
    Location:
    Singapore
    Vehicle:
    2012 Prius c
    Thanks, after thinking over, I finally understand now.

    Vincent
     
  2. ChapmanF

    ChapmanF Senior Member

    Joined:
    Mar 30, 2008
    24,906
    16,213
    0
    Location:
    Indiana, USA
    Vehicle:
    2010 Prius
    Model:
    IV
    On the VehicleDatabases SourceForge page you'll now find a link to a very preliminary Torque CSV exporter. I don't have Torque installed myself to test it on, so I'm counting on reports. :)

    The comments in the exporter show how to run it, after downloading Java and Saxon if necessary. Run it on the NHW11.xml file and it will make a CSV file you can try importing into Torque.

    Things I know won't work or might not work yet:

    For now it leaves MinValue and MaxValue blank. I have no idea whether Torque will accept that, or requires those to be specified. Short of adding hand-selected mins and maxes into the database, a reasonable default would be for the exporter to determine the min and max raw values for the bit width, apply the calc arithmetic to them, and call those the min and max possible result values. That wouldn't be hard, but I didn't know if Torque would accept having those limits unspecified, which is even less hard.

    I assume Torque's arithmetic operators have the usual precedence so I can count on * before + without adding even more parentheses. If you know the answer, let me know.

    Vincent posted that syntax like {A:7} can be used for a single-bit field. Is there some syntax like {A:6-0} for a multibit field? I don't know, so for right now the exporter just skips any such field.

    There currently aren't any Torque-specific labels defined in the database. This exporter will fill in descriptions and labels from what's already in the database (mostly Vincent's XGAUGE labels).

    Some of those have some non-ASCII characters. Right now I'm producing the CSV file in iso-8859-1 encoding. No idea whether that's what Torque expects.

    Wherever there isn't a torque:unit specified, the Units column will be filled in using the ucum attribute. This does tell you precisely what you've got but might be a little obscure to people unfamiliar with ucum notation (for example, circ/min instead of RPM, [mi_i]/h (international statute mile per hour) instead of mph, Cel for
    Celsius but [degF] for Fahrenheit, 500.[fur_us]/wk for kilofurlongs/fortnight, etc.).

    Happy testing....

    -Chap
     
  3. Jeff F

    Jeff F Member

    Joined:
    Oct 10, 2012
    111
    37
    0
    Location:
    London, Ontario
    Vehicle:
    2001 Prius
    Model:
    N/A
    Thanks, Chap. I will try this, but not until later this week. I can say that I tried building the CSV file with missing values for Min and Max and it didn't load. Also my experience is that the arithmetic order of operations is followed.
     
    LeeD likes this.
  4. Florian_steiper

    Florian_steiper Junior Member

    Joined:
    Nov 12, 2007
    16
    14
    0
    Hello everybody,

    I also made it to this discussion.. Hello Bob and Jeff :)
    already having the miniscanner I just couldnt resist getting the bluetooth OBDII adapter for almost no money, plus the torque app from the market.

    As of a few minutes ago I also succesfully managed to get my SOC displayed on my phone :) As they allow nice and round displays I think it will make a nice add-on for the classic.

    What I would like most would be an imitation of the bar gauge that the 3rd gen has, which shows the area of regen, electric, normal and boost operation... maybe something like this could be possible :)

    Best regards

    Florian
     
    bwilson4web likes this.
  5. vincent1449p

    vincent1449p Active Member

    Joined:
    May 24, 2004
    894
    331
    0
    Location:
    Singapore
    Vehicle:
    2012 Prius c
  6. seckwielen

    seckwielen Member

    Joined:
    Aug 31, 2012
    112
    26
    0
    Location:
    Florida
    Vehicle:
    2010 Prius
    Model:
    III
    Just curious. What type of PID uses a multibit field like {A:6-0}? I've have been writing a WinCE app for the OttoNavi and haven't seen that equation in any PID yet. Development is going quiet well.

    Have you tried? {A:6}{A:5}{A:4}{A:3}{A:2}{A:1}{A:0}
     
  7. ChapmanF

    ChapmanF Senior Member

    Joined:
    Mar 30, 2008
    24,906
    16,213
    0
    Location:
    Indiana, USA
    Vehicle:
    2010 Prius
    Model:
    IV
    The first example you run into in NHW11.xml is "No. of Engine DTCs"
    (/iso14230/ecu[@address='10']/p[@id='01']/field[2]).

    No... I wouldn't guess that'd work (though of course I could be wrong). I could see trying 64*{A:6}+32*{A:5}+16*{A:4}+8*{A:3}+4*{A:2}+2*{A:1}+{A:0} and of course if no better syntax exists I could make the exporter generate that with no problem. It's just ugly to look at.

    If the & operator that Vincent mentioned above really is a bitwise AND then of course A&127 would work. I'd be much happier if Torque documented the set of operators available. It's great that Vincent can look up postings in the software's user forums where people talk about how they think it works, but even those posts don't quite come out and say that the operation you get with & is a bitwise AND, and it's a discussion between posters who don't all seem to share the same idea of whether the n in {A:n} is a bit index or a bit mask, so really, an actual complete operator list on the wiki from the author would be a big improvement.

    -Chap
     
  8. Florian_steiper

    Florian_steiper Junior Member

    Joined:
    Nov 12, 2007
    16
    14
    0
    Hello,

    I don't have an exporter, but I relied on manual work :) It is just a few PIDs and the scaling isn't correct on all of them, but it is working.. somehow :)

    Code:
    "Name","ShortName","ModeAndPID","Equation","Min Value","Max Value","Units","Header"
    "State-of-Charge","soc","0191","A/2","0","100","%","D5F1"
    "Battery Block 1 Voltage","V01","01A4","a*256+b","0","20","V","D5F1"
    "Battery Block 2 Voltage","V02","01A4","c*256+d","0","20","V","D5F1"
    "Battery Block 3 Voltage","V03","01A5","a*256+b","0","20","V","D5F1"
    "Battery Block 4 Voltage","V04","01A5","c*256+d","0","20","V","D5F1"
    "Battery Block 5 Voltage","V05","01A6","a*256+b","0","20","V","D5F1"
    "Battery Block 6 Voltage","V06","01A6","c*256+d","0","20","V","D5F1"
    "Battery Block 7 Voltage","V07","01A7","a*256+b","0","20","V","D5F1"
    "Battery Block 8 Voltage","V08","01A7","c*256+d","0","20","V","D5F1"
    "Battery Block 9 Voltage","V09","01A8","a*256+b","0","20","V","D5F1"
    "Battery Block 10 Voltage","V10","01A8","c*256+d","0","20","V","D5F1"
    "Battery Block 11 Voltage","V11","01A9","a*256+b","0","20","V","D5F1"
    "Battery Block 12 Voltage","V12","01A9","c*256+d","0","20","V","D5F1"
    "Battery Block 13 Voltage","V13","01AA","a*256+b","0","20","V","D5F1"
    "Battery Block 14 Voltage","V14","01AA","c*256+d","0","20","V","D5F1"
    "Battery Block 15 Voltage","V15","01AB","a*256+b","0","20","V","D5F1"
    "Battery Block 16 Voltage","V16","01AB","c*256+d","0","20","V","D5F1"
    "Battery Block 17 Voltage","V17","01AC","a*256+b","0","20","V","D5F1"
    "Battery Block 18 Voltage","V18","01AC","c*256+d","0","20","V","D5F1"
    "Battery Block 19 Voltage","V19","01AD","a*256+b","0","20","V","D5F1"
    "Lowest Battery Block Voltage","Vlo","01AE","a*256+b","0","20","V","D5F1"
    "Highest Battery Block Voltage","Vhi","01AF","a*256+b","0","20","V","D5F1"
    "Lowest Battery Block Number","blo","01AE","c","1","19","#","D5F1"
    "Highest Battery Block Number","bhi","01AF","c","1","19","#","D5F1"
    "Battery Block 1 Resistance","R01","01CA","a","0","256","mOhm","D5F1"
    "Battery Block 2 Resistance","R02","01CA","b","0","256","mOhm","D5F1"
    "Battery Block 3 Resistance","R03","01CA","c","0","256","mOhm","D5F1"
    "Battery Block 4 Resistance","R04","01CA","d","0","256","mOhm","D5F1"
    "Battery Block 5 Resistance","R05","01CB","a","0","256","mOhm","D5F1"
    "Battery Block 6 Resistance","R06","01CB","b","0","256","mOhm","D5F1"
    "Battery Block 7 Resistance","R07","01CB","c","0","256","mOhm","D5F1"
    "Battery Block 8 Resistance","R08","01CB","d","0","256","mOhm","D5F1"
    "Battery Block 9 Resistance","R09","01CC","a","0","256","mOhm","D5F1"
    "Battery Block 10 Resistance","R10","01CC","b","0","256","mOhm","D5F1"
    "Battery Block 11 Resistance","R11","01CC","c","0","256","mOhm","D5F1"
    "Battery Block 12 Resistance","R12","01CC","d","0","256","mOhm","D5F1"
    "Battery Block 13 Resistance","R13","01CD","a","0","256","mOhm","D5F1"
    "Battery Block 14 Resistance","R14","01CD","b","0","256","mOhm","D5F1"
    "Battery Block 15 Resistance","R15","01CD","c","0","256","mOhm","D5F1"
    "Battery Block 16 Resistance","R16","01CD","d","0","256","mOhm","D5F1"
    "Battery Block 17 Resistance","R17","01CE","a","0","256","mOhm","D5F1"
    "Battery Block 18 Resistance","R18","01CE","b","0","256","mOhm","D5F1"
    "Battery Block 19 Resistance","R19","01CE","c","0","256","mOhm","D5F1"
    "Battery Inhaling Air Temperature ","TBi","01B2","A-40","-40","216","°C","D5F1"
    "Battery Inhaling Air Temperature ","TBi","01B2","(A-40)*9/5+32","-40","216","°F","D5F1"
    "Battery Temperature, Sensor 1 ","TS1","01D0","A-40","-40","216","°C","D5F1"
    "Battery Temperature, Sensor 1 ","TS1","01D0","(A-40)*9/5+32","-40","216","°F","D5F1"
    "Battery Temperature, Sensor 2 ","TS2","01D0","B-40","-40","216","°C","D5F1"
    "Battery Temperature, Sensor 2 ","TS2","01D0","(B-40)*9/5+32","-40","216","°F","D5F1"
    "Battery Temperature, Sensor 3 ","TS3","01D0","C-40","-40","216","°C","D5F1"
    "Battery Temperature, Sensor 3 ","TS3","01D0","(C-40)*9/5+32","-40","216","°F","D5F1"
    "Battery Temperature, Sensor 4 ","TS4","01D1","A-40","-40","216","°C","D5F1"
    "Battery Temperature, Sensor 4 ","TS4","01D1","(A-40)*9/5+32","-40","216","°F","D5F1"
    "HV Battery Current","btA","01A3","(a*256+b)/100-128","-40","216","°C","D5F1"
    "MG1 Inverter Temperature","Ti1","01CD","a-50","-40","216","°C","16F1"
    "MG1 Inverter Temperature","Ti1","01CD","(a-50)*9/5+32","-40","216","°F","16F1"
    "MG2 Inverter Temperature","Ti2","01CD","b-50","-40","216","°C","16F1"
    "MG2 Inverter Temperature","Ti2","01CD","(b-50)*9/5+32","-40","216","°F","16F1"
    "MG1 Temperature","TM1","01CE","a-50","-40","216","°C","16F1"
    "MG1 Temperature","TM1","01CE","(a-50)*9/5+32","-40","216","°F","16F1"
    "MG2 Temperature","TM2","01CE","b-50","-40","216","°C","16F1"
    "MG2 Temperature","TM2","01CE","(b-50)*9/5+32","-40","216","°F","16F1"
    "HV Battery Voltage","btV","01D1","A*2","0","512","V","16F1"
    "MG1 RPM","M1R","01C4","signed(a*256)+b","-10000","10000","u/min","16F1"
    "MG2 RPM","M2R","01C2","signed(a*256)+b","-10000","10000","u/min","16F1"
    Some of the battery voltages seem to be off by a factor of 10. I need to sit down and test each PID individually to see which ones are a little funny.

    Best regards

    Florian
     
  9. Florian_steiper

    Florian_steiper Junior Member

    Joined:
    Nov 12, 2007
    16
    14
    0
    Hello Chap,

    It looks like the source is the documentation :) If it was well documented the app would probably be not available yet because of documentation and verification of the added features.. I agree however, that there should be at least some kind of decent documentation what you can put into the formula field. Hopefully the author will bring the wiki back up.

    Best regards

    Florian
     
  10. vincent1449p

    vincent1449p Active Member

    Joined:
    May 24, 2004
    894
    331
    0
    Location:
    Singapore
    Vehicle:
    2012 Prius c
    How about a shorter ver., A - 128 * {A:7}?

    Vincent
     
  11. vincent1449p

    vincent1449p Active Member

    Joined:
    May 24, 2004
    894
    331
    0
    Location:
    Singapore
    Vehicle:
    2012 Prius c
    Hi Florian ,

    Most of them are correct except those I highlighted in blue.

    For battery voltages, there is a 100X factor in RXF, 03D5444105A4, so you need to divide your results by 100. If it is an 8, you need to divide by 10.

    Both the MG1 & MG2 RPM are not signed. The signed one are MG1 & MG2 Torque, MG1 & MG2 Current V & Current W.

    Vincent
     
    Florian_steiper and usnavystgc like this.
  12. ChapmanF

    ChapmanF Senior Member

    Joined:
    Mar 30, 2008
    24,906
    16,213
    0
    Location:
    Indiana, USA
    Vehicle:
    2010 Prius
    Model:
    IV
    It's shorter, but it isn't any simpler to generate automatically. (An exporter could be written so that for fields wider than 4 bits it subtracts the excluded ones instead of adding the included ones, but as long as Torque doesn't mind loading the CSV file with a longish expression in it, then there's no need to add complexity to the exporter.)

    Bitwise AND with shift would be shorter anyway....

    -Chap
     
  13. Jeff F

    Jeff F Member

    Joined:
    Oct 10, 2012
    111
    37
    0
    Location:
    London, Ontario
    Vehicle:
    2001 Prius
    Model:
    N/A
    Florian, are you getting the MG temperatures OK? I have also largely been successful, except where there are more than one ecu that responds to the PID - for example 01CE gets responses from both 10 and 16, and the app picks up the first one. Vincent explained the headers, and I have read up on them since, but I can't seem to get the ecu addressing right... I read somewhere on the Torque forum that the developer used the broadcast header by default - it seems I'm stuck there...
     
  14. bwilson4web

    bwilson4web BMW i3 and Model 3

    Joined:
    Nov 25, 2005
    27,665
    15,664
    0
    Location:
    Huntsville AL
    Vehicle:
    2018 Tesla Model 3
    Model:
    Prime Plus
    Some quick questions:
    1. Can we record these values with time-stamp for later analysis?
    2. Can we do math with two PID results (i.e., torque * rpm * k)?
    3. Can both double PID return values be handled together or must each be accessed separately?
    Thanks,
    Bob Wilson

    ps. You guys are really tempting me ...
     
    usnavystgc likes this.
  15. Jeff F

    Jeff F Member

    Joined:
    Oct 10, 2012
    111
    37
    0
    Location:
    London, Ontario
    Vehicle:
    2001 Prius
    Model:
    N/A
    Take the plunge Bob :) If you have a reasonably new Android phone or tablet the investment in an adaptor and the app is minimal. And I'm sure we would benefit from your hands-on involvement.
     
  16. vincent1449p

    vincent1449p Active Member

    Joined:
    May 24, 2004
    894
    331
    0
    Location:
    Singapore
    Vehicle:
    2012 Prius c
    1. Not only time-stamp, you can also logged with GPS coordinates, map or videos with PIDs overlay, etc.
    2. Supposedly possible according to the author.
    Forums — » Torque OBD ECU Scanner » Torque Discussion / Ideas » PID math summaryTorque
    3. Same as above.

    Vincent
     
    bwilson4web and usbseawolf2000 like this.
  17. usbseawolf2000

    usbseawolf2000 HSD PhD

    Joined:
    Sep 22, 2004
    14,487
    3,000
    0
    Location:
    Fort Lee, NJ
    Vehicle:
    2012 Prius Plug-in
    Model:
    Plug-in Base
    Thanks, Vincent. Virtual PIDs would open so many doors! I wasn't aware it was added.
     
  18. Florian_steiper

    Florian_steiper Junior Member

    Joined:
    Nov 12, 2007
    16
    14
    0
    Hello Vincent,

    thanks a lot for your feedback. This is a pretty international discussion by now, I am sitting in Germany and we have abour 20cm of fresh snow outside... I won't be spending much time in the car and trying out codes those days :)

    I added the division by 100 to the battery voltages. I had some misunderstanding that I would have to multiply by 100, but dividing by 100 makes more sense.

    What puzzles me a little bit.. I am pretty sure that both MG1 and MG2 work in all four quadrants.

    MG2s rotational speed is always proportional to the cars speed. As the car can also go backwards it must also be able to rotate backwards.

    Then there is the "overdrive" mode of the THS, which reverses the direction of MG1, allowing the engine to turn slower.. so MG1 must also allow positive and negative rpms.. at least this is what I get displayed on the miniscanner. As soon as I can go out on a longer drive, I will try to see if the rpms of both electric motors makes sense.

    Best regards

    Florian
     
  19. Florian_steiper

    Florian_steiper Junior Member

    Joined:
    Nov 12, 2007
    16
    14
    0
    Hello Jeff,

    the temperatures were screwed.. like -40°C or something while it was "only" -3 or -4°C outside... I will wait for warmer weather to play around in the car.. right now it more feels like sitting in a fridge.. and I usually take the bike to work :)

    Best regards

    Florian
     
  20. Florian_steiper

    Florian_steiper Junior Member

    Joined:
    Nov 12, 2007
    16
    14
    0
    Hello Bob,

    I didn't do any recording, but from what I can see you can simply use all the values which are inside one command to do all the math with those.

    The rpm and torque of MG1 and MG2 seem to live in the very same command.

    This would mean that it is possible to calculate MG1 power very directly (taking the correct scaling) :) Maybe a simple way of cabibrating could be to drive constant speed in EV mode and then somehow calibrate using battery power is somewhat equal to MG power :) something like that.

    lets see what other fun stuff we can get out of our little NHW11 :)

    Best regards

    Florian