dalathegreat / Battery-Emulator

This software enables EV battery packs to be used for stationary storage in combination with solar inverters.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tesla battery power wrong value on the webpage

MarkoBolt opened this issue · comments

Battery power has the wrong value shown on the webpage.

Screenshot 2024-01-02 at 17 41 30

Could the following line cause an overflow?

https://github.com/dalathegreat/BYD-Battery-Emulator-For-Gen24/blob/430da0e0bd7f35e1cdde4469e814cecd5ef30641/Software/src/battery/TESLA-MODEL-3-BATTERY.cpp#L205C3-L205C68

Suggestion:

stat_batt_power = ( (volts/10) * amps);

Nice find @MarkoBolt , I pushed an attempted fix to this branch: main...bugfix/tesla-power

Wanna test it? :)

Tested it, not working ok yet. Value is too large for the variable power, causing an overflow in the variable power. Next to that, the power value should be 10 times less, so the divide by 10 helps in both cases in my setup. Scaled ok and no overflow.

Tested with the following line and then it seems to be ok in my setup and tested with 8415W.

power = ((volts/10) * amps);

Line: https://github.com/dalathegreat/BYD-Battery-Emulator-For-Gen24/blob/6d6cca179a9a61dbc4dad2288b9583e88c2eaf8b/Software/src/battery/TESLA-MODEL-3-BATTERY.cpp#L206

Test results:
Screenshot 2024-01-02 at 20 39 11

@MarkoBolt Thanks! Fixed in 6b06132