Logger with different PID's

#1

I think I asked this before, but I couldn’t locate it.

How can I create a logger that uses two values from two different PID’s ? I have a case where voltage is from one PID and current from another … and I want to plot power.

Thanks,

Pete

1 Like
#2

As in, you want to combine two values in a calculation to log?
I think you need to make a custom code for that :frowning:

#3

Yea, I guess custom code can re-do the OBD queries, combine the values and return the results to the cloud.

It would be better if the logger calculations could access other loggers ( like torque pro allows ) or custom code could access the logger data ( to avoid a new request ).

1 Like
#4

How would you resolve the order of execution, though?
You’d need a dependency tree to know which loggers to go through first every cycle, in order to get the values other loggers depending on them need.

The only sensible solution i can see is multi-value loggers, that grab multiple values, use a formula on them, and log the result.

#5

Yep - presumably this is what torque pro already does.

From https://raw.githubusercontent.com/JejuSoul/OBD-PIDs-for-HKMC-EVs/master/Hyundai%20Kona%20EV%20%26%20Kia%20Niro%20EV/extendedpids/003_Kona%26Niro_EV_BMS.csv -

000_Battery Current,Batt Current,0x220101,((Signed(K)*256)+L)/10,-230,230,A,7E4
000_Battery DC Voltage,Batt Volts,0x220101,((m<8)+n)/10,268.8,403.2,V,7E4
000_Battery Power,Energy Draw,0x220101,val{000_Battery Current}*val{000_Battery DC Voltage}/1000,-90,90,kW,7E4

Power is calculated from voltage and current - ie voltage and current is only requested once. Also, since they happen to come from the same PID, I expect torque pro just does one OBD request to extract the 2 pieces of data.

What would be great is to go further and support the torque pro format directly - then we can just cut&paste existing PID definitions.

#6

I’m not so sure it won’t fire an additional request if they don’t come from the same PID. It likely just has a logger per PID, extracts the PIDs form the formulas and creates loggers for all of them, and then creates virtual loggers for the formulas.

I think it’s a bit different with Autopi, as it appears to treat loggers the way cron treats jobs, but who knows :slight_smile: