springfall2008 / batpred

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

Not calculating best plan after 8.1.0 #1284

Open Philhews opened 1 week ago

Philhews commented 1 week ago

Describe the bug Tomorrows agile rates are negative in the afternoon, and the solar forecast is not enough to max out my inverter so freeze discharging before and using some negative grid to charge later is the best cost. This is the plan that is selected on 8.1.0

However when upgrading past that version (anything up to latest) the plan no longer utilises the AC negative rates and just does solar charge with a demonstrably worse 'best' cost value.

Expected behavior Best plan should be selected on newer versions

Predbat version 8.1.0

Environment details

Hybrid 3.6 Gen2, 9.5kWh battery RPI4 with HAOS and standalone predbat

Screenshots Plan on 8.1.0 image Cost on 8.1.0 image Battery graph on 8.1.0 image

Plan on 8.1.1 image Cost on 8.1.1 image Battery graph on 8.1.1 image

Log file Update from 8.1.0 to 8.1.1 happened at 20:53 so log from before then is working as I would expect, and immediately after is the problem predbat.log

springfall2008 commented 1 week ago

You might find that an inverter loss of 7% is too high as this means 7% + 3% battery loss on charge and then 7% + 3% on discharge which is overall 20%.

You also have combine_discharge_slots set to True which may prevent discharge if you have a fixed rate export

Please try inverter loss of 4% and combine discharge as False.

set_discharge_during_charge(True) combine_charge_slots(False) combine_discharge_slots(True) combine_rate_threshold(0.0) best_soc_min(0.0 kWh) best_soc_max(0.0 kWh) best_soc_keep(1.3 kWh) inverter_loss(7 %) battery_loss(3 %) battery_loss_discharge (3 %) inverter_hybrid(True) metric_min_improvement(-0.2 p) metric_min_improvement_discharge(0.3 p)

Philhews commented 1 week ago

I'll see how that affects the current plans, obviously the rates are different now so it's not a direct comparison.

Did something change between the two versions mentioned that would make these settings more/less important in the calculation to result in the differences I was seeing?

Philhews commented 1 week ago

8.1.1 still tending towards less charging, requires more solar to refill the battery rather than using grid at 7 or 9p

8.1.0 plan Screenshot_2024-07-06-23-01-25-73_c3a231c25ed346e59462e84656a70e50

8.1.1 plan Screenshot_2024-07-06-23-05-14-50_c3a231c25ed346e59462e84656a70e50

Log file, update to .1 at 23.02 predbat.log

springfall2008 commented 6 days ago

I'll see how that affects the current plans, obviously the rates are different now so it's not a direct comparison.

Did something change between the two versions mentioned that would make these settings more/less important in the calculation to result in the differences I was seeing?

Yes, there were bugs in the code which mean it wasn't always applying losses correctly.