-
-
Save MrPoofy/8450b725ec45988c27e5e59bb99be383 to your computer and use it in GitHub Desktop.
| var command = [ | |
| "ATZ", | |
| "ATD", | |
| "ATE0", | |
| "ATS0", | |
| "ATAL", | |
| "ATH0", | |
| "ATSP7", | |
| "ATCP18" | |
| ]; | |
| var command = [ | |
| "ATSHDA44F1", | |
| "ATFCSH18DA44F1", | |
| "ATCRA18DAF144", | |
| "22A029", | |
| "22A010", | |
| "22A009", | |
| "22A011", | |
| "22A00A", | |
| "22A042", | |
| "ATSHDA40F1", | |
| "ATFCSH18DA40F1", | |
| "ATCRA18DAF140", | |
| "22013C" | |
| ]; | |
| // SOH calc | |
| // > 22A029 | |
| // 00A | |
| // 0:62A029F9FFOO | |
| // 1:04B00493000000 | |
| // ahrTotRead = [1][0-3] | |
| // ahrResRead = [1][4-7] | |
| var ahrTotRead = parseInt("04B0", 16)/10; | |
| var ahrResRead = parseInt("0493", 16)/10; | |
| var REAL_SOH = Math.round((ahrResRead/ahrTotRead)*1000)/10; | |
| console.log("REAL_SOH: ", REAL_SOH); | |
| // SOC | |
| // > 22A010 | |
| // 009 | |
| // 0:62A0106D6D6C | |
| // 1:6E6C6B00000000 | |
| // SOC [0][10-11] | |
| var SOC = (parseInt("6C", 16)/255)*100; | |
| console.log("SOC: ", SOC); | |
| // VOLT MIN & MAX | |
| // > 22A009 | |
| // OOF | |
| // 0:62A009390F0E | |
| // 1:350E3101108013 | |
| // 2:80120000000000 | |
| // voltMax [0][10-11] [1][0-1] | |
| // voltMax [1][2-5] | |
| var voltMax = parseInt("0E35", 16)/1000; | |
| var voltMin = parseInt("0E31", 16)/1000; | |
| var voltDelta = voltMax - voltMin; | |
| console.log("voltMax: ", voltMax); | |
| console.log("voltMin: ", voltMin); | |
| console.log("voltDelta: ", voltDelta); | |
| // BATERY TEMP | |
| // > 22A009 | |
| // 00F | |
| // 0:624009390F0E | |
| // 1:360E3101108013 | |
| // 2:80120000000000 | |
| // baterytempRead [1][12-13] | |
| var baterytempRead = parseInt("13", 16); | |
| if(baterytempRead >= 128 ){ | |
| baterytempRead = baterytempRead - 256; | |
| } | |
| var bateryTemp = baterytempRead; | |
| console.log("bateryTemp Celsius: ", bateryTemp); | |
| // VOLT | |
| // > 22A011 | |
| // 022 | |
| // 0:62A0110DA20D | |
| // 1:A10DA0125FOCDA | |
| // 2:0CC60B8F0CCBOC | |
| // 3:C60CC50CC70D9F | |
| // 4:04125F0B8F125E | |
| // VOLT [1][2-5] | |
| var VOLT = parseInt("0DA0", 16)/10 | |
| console.log("VOLT: ", VOLT); | |
| // AMPERE | |
| // > 22A00A | |
| // 62A00A80108039 | |
| // AMPERE [6-9] | |
| var AMPERE = ((parseInt("8010", 16)-32768)/20); | |
| console.log("AMPERE: ", AMPERE); | |
| // OBD VOLT | |
| // > 22A042 | |
| // 62A0423723 | |
| // obdVolt [6-9] | |
| var obdVolt = parseInt("3723", 16)/1000; | |
| console.log("obdVolt: ", obdVolt); | |
| // AMBIENT TEMP | |
| // > 22013C | |
| // 62013C70 | |
| // ambientTemp [6-7] | |
| var ambientTemp = (parseInt("70", 16)/2)-40; | |
| console.log("ambientTemp Celsius: ", ambientTemp); | |
| KW = Math.round((VOLT*AMPERE)/100)/10; | |
| console.log("KW: ", KW); |
@MrPoofy for wrong SoC we have more values we can try:
// SOC // > 22A010 // 009 // 0:62A0106D6D6C // 1:6E6C6B00000000 // SOC [0][10-11]In that sequence we have 6D, 6C, 6E, 6B which are all pretty close together and would translate to 6B->107 = 41,96% 6C->108 = 42,35% 6D->109 6E->110 = 45,08%
As the values below 50% should be a bit higher than what the BMS shows (in this case
6C), one of the other values could actually be display soc. I think the best way to find out is to go as low as possible (5-10%) and compare all these values to display, and do the same for 90-100%But doing it in the low range should actually already provide a good insight on which one is the correct one.
Hi @SamuelBrucksch!
Sorry about the delay but i was able to create a list with the displayed SOC and the calculated SOC retrieved from the OBD2 port.
I checked the other values from the response and none seem to be the display SOC but you can see here https://docs.google.com/spreadsheets/d/10EZMmmperrv-VWa_TjmzG5to68-SZ6KpvF6UFSXJ0Ck/edit?usp=sharing the deltas between the 2 values.
Nice, thanks for the comparison, i'll use your values then to calculate a proper offset.

Hi @SamuelBrucksch!
I took a look at the list of PIDs that i had previously and "ATCP18" was there, i would say that we can add it as well to the list.
From the old list:
var init_command = [ "ATWS", "ATWS", "ATWS", "ATE0", "ATI", "AT@1", "ATAT1", "ATH1", "ATL0", "ATS0", "ATAL", "ATSP7", "ATCP18", "ATSHDA40F1", "ATFCSH18DA40F1", "ATFCSD300000", "ATFCSM1", "ATCFC1", "ATCAF1", "ATCRA18DAF140" ];Do you see anything that could also help us?