Limit to formula length

From a discussion https://github.com/JejuSoul/OBD-PIDs-for-HKMC-EVs/issues/36#issuecomment-484176153 it looks like there is a better way to detect when the Kona is charging than we are currently using.

However, I found I can’t use this - with a longer formula the PID can’t be saved in the library dialog box./

So I presume there is a limit to the formula length.

I don’t see a way around this - so we’ll either need a longer formula or some shorter way to represent the calculation.

Which one’s too long? The energy draw one?

Breaking down the single battery power into separate charging power and driving power.

For example, I think charging power ( positive when charging, zero otherwise ) should be -

((bytes_to_int(message.data[12:13])&1)-(((bytes_to_int(message.data[53:54]))&4)/4))*-((twos_comp(bytes_to_int(message.data[13:14])*256+bytes_to_int(message.data[14:15]),16)/10.0)*((bytes_to_int(message.data[15:16])*256+bytes_to_int(message.data[16:17]))/10.0)/1000.0)

Which is too long.

I think I mentioned it before, but I prefer the Torque Pro way of expressing formulas - its much shorted and more maintainable.

I think i’m missing something here…
Why do you need a unified energy flow (+/-) to detect if it’s charging or not?
Or, why do you need it at all?

On my console I want to see two plots - one driving power and the second charging power. I don’t want to see a combined plot. Thats it really.

If we just have one plot of power ( battery voltage * battery current ) then its a bit confusing - its negative when charging. We also have negative power when driving and using regen so its less obvious when the car is really charging.

Original post here BTW Hyundai Kona / Ionic EV

Beyond this I would really like to track charges, costs etc.

But anyways, regardless of the reasons why, looks like we’ve got a limit to the formula length. No doubt this will impact other plots.

1 Like

Gotcha.

Original post mentioned detecting charging, so i misunderstood what the intent was.
And yeah, definitely needs a way to either reference other PIDs in formulas, or longer formulas, or both.

Hi guys

I will look into this :slight_smile:

Best regards
/Malte

1 Like

Any progress on this?