springfall2008 / batpred

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

Clipping #1152

Open rholligan opened 1 month ago

rholligan commented 1 month ago

Describe the bug Referring to Friday plan (not Thursday, where the plan starts): During the period from 11:00 to 16:00, there is 31.24 kWh forecast generation. This is 6.24 kWh above the inverter generation capacity (due to AC limit). 6.24 kWh exceeds spare capacity in the battery, and therefore clipping will occur.

5 kW export (from solar generation) will be possible during this time, but no battery discharge / export from battery is possible, because the inverter DC to AC capacity is already fully utilised by solar generation.

Also, this is the median forecast for the day, so there may be periods of even higher generation which the Predbat plan cannot absorb.

Expected behavior Ideally, Predbat would target a lower battery SOC prior to this period, allowing hybrid inverter to export to AC and also fill battery, minimising clipping.

Predbat version v7.20.6

Environment details 6.38 kWp panels (15 x 425 W) 5 kW Givenergy Gen 3 hybrid inverter 9.5 kWh Givenergy Gen 2 battery Location: Edinburgh, UK Home Assistant Green

Screenshots If applicable, add screenshots to help explain your problem. The most useful ones can be your battery chart, the Predbat HTML plan and your current settings in HA.

image homeassistant local_8123_robins-dash_plan

Log file Can you capture a log file from the time of the issue, debug mode is not normally required. If you are not keeping the full logs then please enable this in appdaemon.yaml (see the installation instruction in the Predbat docs area for details on how to do this)

predbat.log

springfall2008 commented 1 month ago

I've released a fix that's worth testing when you get time.

Abn8mTGsijbJ commented 1 month ago

This feels like a different issue but it's related to clipping so posting here, let me know if you want me to raise a separate issue.......

On Sunday morning at 8:28 Batpred set the battery charge power 0 which made sense sense to maximise export (although I prefer to do it by disabling Eco mode which gets around the 280W leakage that still trickles into the battery when charge power is set to 0)

image

However at 9AM my Hybrid Gen 3 inverter started clipping when the battery still had sufficient capacity to absorb the excess solar:

image

This continued until I manually intervened to set the charge power back to 3600 and disable eco mode:

image

Looks like there's a fair chance of clipping again tomorrow so will report back with what happens with the recent changes.

springfall2008 commented 1 month ago

This feels like a different issue but it's related to clipping so posting here, let me know if you want me to raise a separate issue.......

On Sunday morning at 8:28 Batpred set the battery charge power 0 which made sense sense to maximise export (although I prefer to do it by disabling Eco mode which gets around the 280W leakage that still trickles into the battery when charge power is set to 0) image

However at 9AM my Hybrid Gen 3 inverter started clipping when the battery still had sufficient capacity to absorb the excess solar: image

This continued until I manually intervened to set the charge power back to 3600 and disable eco mode: image

Looks like there's a fair chance of clipping again tomorrow so will report back with what happens with the recent changes.

This feels like a different issue but it's related to clipping so posting here, let me know if you want me to raise a separate issue.......

On Sunday morning at 8:28 Batpred set the battery charge power 0 which made sense sense to maximise export (although I prefer to do it by disabling Eco mode which gets around the 280W leakage that still trickles into the battery when charge power is set to 0) image

However at 9AM my Hybrid Gen 3 inverter started clipping when the battery still had sufficient capacity to absorb the excess solar: image

This continued until I manually intervened to set the charge power back to 3600 and disable eco mode: image

Looks like there's a fair chance of clipping again tomorrow so will report back with what happens with the recent changes.

Are you letting predbat model clipping, as in did you avoid setting an the AC limit too low in Solcast?

Abn8mTGsijbJ commented 1 month ago

Are you letting predbat model clipping, as in did you avoid setting an the AC limit too low in Solcast?

So it was set in Solcast as follows: Site 1: 5.67 kW DC SE facing array with the inverter capacity set to 5kW (I've updated the inverter to 6kW now) Site 2: 2.43 kW DC SW facing array with the inverter capacity set to 5kW I feel this should have enabled it to model the majority of the clipping as at most 670W out.

Looking at the plan at 06:45 this morning it was going to clip all afternoon as the SoC was predicted to be 100% by 12:00:

Plan

This is what the forecast showed in the energy dashboard (didn't have the Predbat chart configured)

Screenshot 2024-06-07 220928

The plan also didn't seem to make optimal use of the cheap charge slots between 13:30 & 15:00 so I set Predbat to monitor mode, did a quick manual discharge, turned off Eco mode and timed a charge for the afternoon. This is what ended up happening.

Screenshot 2024-06-07 221604

Will continue to monitor what happens with the extra 670W now captured by Solcast.

gcoan commented 1 month ago

The plan also didn't seem to make optimal use of the cheap charge slots between 13:30 & 15:00 so I set Predbat to monitor mode, did a quick manual discharge, turned off Eco mode and timed a charge for the afternoon

You could have set Predbat to read only instead of Monitor mode, but either works.

I think you'll find that its not worthwhile making use of cheap charge slots when the battery is full by forcing a discharge and then a recharge:

If the battery remains at 100% then all solar you generate will be exported at your 15p export rate minus the DC to AC inverter conversion loss (say 5%) giving 14.25p income.

If you discharge the battery then you will incur the battery discharge loss (5%) AND the DC to AC inverter conversion loss (5%), giving you the effective export rate of 13.27p you see in the plan. If you then subsequently recharge the battery at say 4.2p cheap rate, you'll incur the AC to DC inverter conversion loss and the battery charge loss, giving you an effective import price of 5.21p

Thus you will have gained 13.27-5.21p = 8.06p from the battery discharge and recharge vs 14.25p if you'd just exported the excess solar.

(these figures assume no recharging of the battery from solar and it entirely being grid imported, but any solar you consumed like that that doesn't get exported has effectively "cost" 14.25p as missed export opportunity so the principle of holding the battery full still holds)

rholligan commented 1 month ago

Clipping 09-Jun

I experienced quite a lot of clipping again on 09-Jun. Unfortunately I didn't manage to download the logs. This coincided with low / negative energy rates, and it felt like the plan was over optimised to make gains from this, at the cost of low / no flexibility to accommodate generation above inverter AC limit. Unfortunately in my case, charging ~1 kWh at -£0.01/kWh would not outweigh the ~5 kWh potential export at £0.15/kWh which was lost to clipping.

I've attached a chart which highlights what happened.

Part A: Looks like clipping is caused by limit to battery charge rate.

Part B: Caused by full battery

Abn8mTGsijbJ commented 1 month ago

You could have set Predbat to read only instead of Monitor mode, but either works. Yep, either works. As I use the vertical stack card rather than the entity one for me selecting monitor mode from the drop down is faster than digging into control -> switches -> and scrolling past many similar looking toggle switches to find read only.

I think you'll find that its not worthwhile making use of cheap charge slots when the battery is full by forcing a discharge and then a recharge:

If the battery remains at 100% then all solar you generate will be exported at your 15p export rate minus the DC to AC inverter conversion loss (say 5%) giving 14.25p income.

If you discharge the battery then you will incur the battery discharge loss (5%) AND the DC to AC inverter conversion loss (5%), giving you the effective export rate of 13.27p you see in the plan. If you then subsequently recharge the battery at say 4.2p cheap rate, you'll incur the AC to DC inverter conversion loss and the battery charge loss, giving you an effective import price of 5.21p

Thus you will have gained 13.27-5.21p = 8.06p from the battery discharge and recharge vs 14.25p if you'd just exported the excess solar.

(these figures assume no recharging of the battery from solar and it entirely being grid imported, but any solar you consumed like that that doesn't get exported has effectively "cost" 14.25p as missed export opportunity so the principle of holding the battery full still holds)

Maybe shouldn't have stated it didn't seem to make sense as I was only glancing at the rates in plan rather than doing the calculation. Given the actual solar generation at the time and the house load it probably worked out at a negligible difference.

Back to the clipping issue it looks like my current plan will result in a full battery from 9am so will very likely clip if there is any amount of sun between 09:00 - 15:00 if I let it run: image

Batpred should be able to model the clipping as looking at the solar forecasts vs actual production I'm consistently a fair amount under the Solcast predictions: image

rholligan commented 3 weeks ago

Some decent generation forecast tomorrow, predbat plan does not seem to be attempting to avoid clipping between 11:30 and 14:30. Attached predbat.log here too.

predbat (1).log

image

Abn8mTGsijbJ commented 3 weeks ago

I had some clipping today IMG_8553

The plan for tomorrow looks very similar, a full battery by around 8am and no capacity to prevent clipping. Rather than let it run tomorrow I'll likely turn off eco mode on the inverter and set Predbat to monitor mode when I wake up around 6am Image

rholligan commented 2 days ago

predbat (3).log

Lots of clipping today (v8.2.4) At around 08:00 this morning I noticed that my plan had battery SOC at 100% all day (not really any discharge periods etc), not leaving any room to mitigate clipping. At around 10:15 the plan drastically changed, mapping discharge across the full day to try and avoid clipping. Unfortunately this has little effect since generation was already reaching the inverter limit, so discharge was not feasible. I can't work out why the plan only adjusted once it was too late, since it had been working well over the last week or so (admittedly not much generation in this time to properly test). Any ideas?

image

springfall2008 commented 1 day ago

What I can see is the forecast for the 10% scenario gets less pessimistic by 10:30

2024-07-12 09:57:38.990790: PV Forecast 54.6 kWh and 10% Forecast 17.3 kWh pv cloud factor 0.3

2024-07-12 10:31:41.341671: PV Forecast 55.3 kWh and 10% Forecast 20.5 kWh pv cloud factor 0.3

I suspect too much discharge would have meant you run out battery in the 10% case, but then once it got better then this wasn't true anymore.

It maybe your PV 10 weighting could be tweaked if you want to be more optimistic?