springfall2008 / batpred

Home battery prediction and charging automation for Home Assistant, supporting many inverter types
https://springfall2008.github.io/batpred/
115 stars 40 forks source link

Agile import w/loss calculation incorrect with plung pricing #1190

Closed Surb109 closed 3 months ago

Surb109 commented 3 months ago

Describe the bug With Octopuse during price plunging the Import rate with loss caluclulation seem to be incorrect.

e.g. when Import rate is -2.03 with a 5% battery loss charge, the value is showing as -2.14

Expected behavior With Import rate -2.03 with a 5% loss expect Import rate to be -1.93. The import rate after losses should be higher not lower.

When Import rates are negative need to subtract the 5% loss instead of adding the 5% loss when prices are positive.

Predbat version

v7.22.3

Environment details

Screenshots 2024-06-07_18-25-17

Log file

gcoan commented 3 months ago

I raised the same problem a couple of months ago, see https://github.com/springfall2008/batpred/issues/881

In short, the calculation is correct

Surb109 commented 3 months ago

Thanks for the pointer, I did try and search for similar issues before posting, but didn't find anything.

I've taken alook at #881 and I'm still trying to understand the logic. If the maths has been proven to be correct, I'll leave it at that.

gcoan commented 3 months ago

If it's any consolation, I thought it was wrong as well!