springfall2008 / batpred

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

Clipping Buffer (hybrid inverter) #1206

Open rholligan opened 2 weeks ago

rholligan commented 2 weeks ago

Is your feature request related to a problem? Please describe. I currently experience clipping when solar generation exceeds inverter AC capacity, and there is no or limited battery capacity to make use of inverter DC capacity.

Describe the solution you'd like It would be great to see additional features designed around preventing clipping. Predbat does already attempt to accommodate clipping within the plan, however is closely optimised according to solar forecast and low / negative import rates (as intended!), which can come at the cost of reduced flexibility when e.g. battery is charged, and solar generation exceeds forecast rates. This is particularly evident in summer since the solar forecast looks at average generation across each hour, but in reality there could be peak generation for 10 minutes while there is a break in clouds, then 10 minutes of cloud cover etc.

The feature could work by allocating some overhead / buffer in the battery to accommodate clipping, especially during summer / peak generation months. The buffer should be active during period where generation is set to exceed inverter capacity. Once risk of clipping is over, the battery should revert to regular target SOC (e.g. 100%). The start / end time and amount of spare capacity could be determined based on e.g.: 1) Manual user setting 2) Ratio of import to export rate (e.g. allocate a higher buffer when export rate is significantly greater than import) 3) Sunset / sunrise times, plus an offset

Additionally, battery charge power should be set to maximum throughout this period, and priority given to exporting generation (battery is only charged at the minimum rate which avoids clipping).

Describe alternatives you've considered I currently run an automation which triggers manual discharge earlier in the day to create this buffer capacity within the battery.

Additional context Add any other context or screenshots about the feature request here.

gcoan commented 2 weeks ago

As an alternative solution to reduce clipping, could either make the battery charge rate an externally controllable entity (so could manage via an automation), or (preferable), predbat plans the charging at a rate such that solar charging is spread out over a much longer period rather than always charging at max rate.

Tomorrow being a good example (ignoring the zero rate import period mid day), there is loads of solar forecast and so the batteries (drained down overnight) will be fully charged by 11:00. Thereafter solar will be exported, but risks clipping.

If the battery was charged lower and slower over a longer period of the day it would reduce the risk of clipping as its charging and exporting for longer image

rholligan commented 2 weeks ago

As an alternative solution to reduce clipping, could either make the battery charge rate an externally controllable entity (so could manage via an automation), or (preferable), predbat plans the charging at a rate such that solar charging is spread out over a much longer period rather than always charging at max rate.

Tomorrow being a good example (ignoring the zero rate import period mid day), there is loads of solar forecast and so the batteries (drained down overnight) will be fully charged by 11:00. Thereafter solar will be exported, but risks clipping.

If the battery was charged lower and slower over a longer period of the day it would reduce the risk of clipping as its charging and exporting for longer image

I would actually avoid using charge / power limits during periods where clipping is likely, since these can inadvertently result in clipping also. However, the same effect could be achieved by setting lower SOC targets (solving for clipping buffer), and prioritising all generation to export (battery is only charged at the minimum rate which avoids clipping).

PatrickJanssens commented 2 weeks ago

I think the key is to have the battery SOC as low as possible prior to the time clipping is expected (I set it to 10%). As soon as clipping is happening I set an automation to switch off the Eco mode and set the system to Timed Discharge, still with a low battery discharge SOC (this can be done either based on the Solcast forecast, or based on the actual PV production). This way the Excess PV is sent to the battery, but when PV production drops below the inverter capacity the battery is discharging again to increase the buffer for more excess PV. I don't think there is a need to adjust the battery charge rate, as long as it can be configured to only send the excess PV to the battery (seems to work fine on my GivEnergy hybrid inverter using timed discharge). The limiting factor is really the battery capacity, so key is to start with an as low as possible battery SOC, and ensure it can discharge to the grid when no clipping is occuring to make space for more excess PV. In order to ensure I have a full battery when the sun sets I set my system to revert back to eco mode and disable the discharge schedule once the remaining PV foreceast drops below a certain value (I presently set it to 12 to 15 kWh). This way I'm sure to have a full battery when the sun sets.

Looks something like this (though set charge level to 75% to cover evening loads and set an intermediate timed discharge SOC at 50%): image

springfall2008 commented 1 week ago

I've been trying to fix this by fixing the model for clipping, a new version is being tested on main

rholligan commented 1 week ago

Sounds good to me!