batpred icon indicating copy to clipboard operation
batpred copied to clipboard

Clipping Buffer (hybrid inverter)

Open rholligan opened this issue 1 year ago • 118 comments

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.

rholligan avatar Jun 11 '24 20:06 rholligan

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

gcoan avatar Jun 11 '24 22:06 gcoan

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).

rholligan avatar Jun 12 '24 07:06 rholligan

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

PatrickJanssens avatar Jun 14 '24 19:06 PatrickJanssens

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

springfall2008 avatar Jun 22 '24 19:06 springfall2008

Sounds good to me!

rholligan avatar Jun 22 '24 19:06 rholligan

Hi Trefor, clipping prevention is working well in the background now based on forecast PV and inverter limits - thanks for the efforts on that.

Is there any appetite to add further user control around this feature? In an ideal world I'd be able to adjust clipping prevention, especially during the Scottish summers where there can be rather unpredictable bouts of cloud and sun which may not prevent clipping when relying on forecast generation alone.

rholligan avatar Aug 20 '24 14:08 rholligan

Hi Trefor, clipping prevention is working well in the background now based on forecast PV and inverter limits - thanks for the efforts on that.

For me I'm unfortunately not seeing any sign of clipping prevention happening in my plan. Predbat pretty much always tries to charge the battery to 100% overnight (depending on rates of course), and never leaves any spare capacity for solar charging that would otherwise be clipped.

I think the problem is that whilst I can define my two inverter limits in apps.yaml, Predbat only has a total solar forecast. It could retrieve the individual sites from Solcast but would then need a sites to inverter mapping (I have Solcast sites for East and West arrays but the panels are spread over the two inverters). I don't think without an awful lot more configuration options this is solvable in a fully automatic way in Predbat.

What I have been doing in the summer is setting Predbat to read only part way through the night to stop the batteries charging fully and then setting the inverter charge rates to a much lower value so the batteries trickle fill through the day rather than charge at max rate. Automating this is I think more viable

gcoan avatar Aug 20 '24 14:08 gcoan

I don't feel clipping is captured well by PredBat. The solar forecast are not accurate enough to capture actual peak loads, especially on day with scattered clouds. I presume solcast averages out the peaks so have frequently experienced the battery to be full when "unpredicted" sunshine appears. For me personally I have implemented an automation that discharges the battery in the morning to ensure there is sufficient battery capacity available for clipping. My target is to discharge to close to 15% of my battery capacity, so I still have some battery charge available for sudden loss of PV or sudden high loads. This automation is triggered by the overal solar production forecast for the day, meaning if the solar forecast is low I keep the battery charged, Towards the end of the day I stop discharging the battery, triggered by the remaining solar production forecast for the day to ensure I have sufficient battery charge to cover the evening. This has worked quite well for me. I have been playing around with the settings for these two values. Right now I have set the values to 25 kWh for the full day forecast and 12 kWh for the remaining PV forecast. That works quite well for me and I have managed to capture most of the excess clipping since I implemented this. Some examples below:

A perfect sunny day: image (Note I recovered some 65% battery charge from excess solar)

Scattered clouds day: image

Cloudy day: image

Note that I am on the Octopus Intelligent Go tarrif, so I do not worry about the price paid for my solar production, and I want to maximise the use of the cheap overnight tarriff. But I'm sure there room to optimise this further, especially for those on other tarriffs. Key for me would be to base the required buffer capacity for clipping on more conservative (in this case high) peak solar predictions.

PatrickJanssens avatar Aug 20 '24 16:08 PatrickJanssens

The solar forecast are not accurate enough to capture actual peak loads, especially on day with scattered clouds. I presume solcast averages out the peaks so have frequently experienced the battery to be full when "unpredicted" sunshine appears.

This is exactly the issue I face as well.

What I have been doing in the summer is setting Predbat to read only part way through the night to stop the batteries charging fully and then setting the inverter charge rates to a much lower value so the batteries trickle fill through the day rather than charge at max rate. Automating this is I think more viable

While I don't have a dual inverter setup, I appreciate the sentiment to avoid an overly complex solutionby mapping sites to inverters. It sounds like addition of a "clipping buffer" could help to simplify things for you here as well. It sounds like having some degree of control over this clipping prevention would be important to you, to help tackle the more complex dual inverter setup.

These examples demonstrate that the current functionality of predbat could be greatly enhanced with the additional of a "clipping buffer" (delibreately reserving spare battery capacity in predbat plan) during the periods where generation may exceed inverter capacity. This would give the flexibility to accommodate peak loads, while optimising the overall plan in the normal way based on generation, usage, rates etc.

rholligan avatar Aug 20 '24 16:08 rholligan

It sounds like addition of a "clipping buffer" could help to simplify things for you here as well. It sounds like having some degree of control over this clipping prevention would be important to you, to help tackle the more complex dual inverter setup.

Yes it would be useful, in effect I am creating my own "clipping buffer" in the battery by only letting the batteries charge partially overnight.

I think to be a complete solution there's several additional components I'd like to see within Predbat:

  1. A configurable "clipping buffer" per inverter with the size of the buffer being user defined either as a fixed number or as a helper entity that I could control via an automation depending on solar forecast

  2. Ability to vary the charging rate dynamically per inverter. At the moment (apart from overnight slow charging when switch.predbat_set_charge_low_power is turned on) Predbat uses either the inverter max rate, or an over-ride figure in apps.yaml, but you can't set a helper entity name in apps.yaml. If you could then programmatically you could set whether Predbat is to charge at max rate or trickle charge during the day.

  3. Linked to 2, when the charging rate is set to zero, the battery pause mode is set to PauseCharging. This is needed to get around inverters/firmwares that continue to charge at a slow rate when the charge rate is set to zero.

What I would anticipate is something like:

Overnight, charge rate is set to maximum so normal grid charging & discharging. Clipping buffer set to (say) 2kWh so Predbat leaves 2kWh spare capacity in the battery. Normal predbat optimisation of charge and discharge periods so that the battery gets charged overnight at the cheapest rates.

Sunrise, my automation sets the charge rate helper entity to zero. Predbat sets inverter charge rate to zero and enables PauseCharge mode on the battery.

From sunrise to say 10am, all solar is exported.

At 10am, my automation sets the charge rate helper entity to 900W. Predbat sets the inverter charge rate to 900W and disables PauseCharge mode. The battery starts charging at 900W, this slow charge reduces the chance of clipping occurring through the solar peak.

At 3pm, my automation sets the charge rate helper entity to the inverter max rate, Predbat mirrors that on the inverter.

I have two inverters one of which is East facing and one of which is East and West facing so I would follow the above timings for inverter 1, but for inverter 2 I wouldn't start the trickle charging until about 1pm as the peak for that array is later.

If you are using the Solcast integration, the latest versions includes the site (array) specific breakdown of peak solar times in the peak time Solcast sensor so these can be easily used in an automation. Taking account of either the estimate or estimate10 times if you wish to: image

gcoan avatar Aug 20 '24 18:08 gcoan

Hi Trefor, any thoughts on adding capabilities to adjust handling of clipping?

It's a sunny day with clouds here today meaning I'm often generating higher peak power than forecast, and with a lot of negative slots early this morning, my plan has resulted in battery being full over mid day / peak generation period resulting in clipping.

It would have been great to have some control over this, to avoid the clipping.

rholligan avatar Sep 27 '24 12:09 rholligan

The cloud model should handle this, it just depends on your skew between the 10% and average scenario.

As this ticket is old I'm going to close it, please re-open if the issue is there on latest.

springfall2008 avatar Jan 01 '25 19:01 springfall2008

Hi Trefor, appreciate you're likely trying to tidy up the queue a bit here.

This request is not a current issue per se, rather it's a feature request (still relevant to latest version); the current cloud model does not allow for any manual weighting or adjustment of the skew between 10% and average scenario (unless I missed something in the docs).

This request is to add some additional control over how clipping is handled (over and above the existing functionality - which for me does work as intended).

Edit: I can't see a way to re-open this

rholligan avatar Jan 04 '25 20:01 rholligan

Just seen this following the recent comments. I agree now an enhancement idea for the coming summer. I think the part missing from the current clipping model is the charge low power aspect.

A single discharge ahead of the peak window and then a low power charge through it would be a more elegant, efficient and cost effective solution.

Limiting the charge rate is what I started doing with automations before going fully predbat. Having the decision on when that happens calculated taking into account all the variables that predbat uses would be maximally effective.

I think it is the charge low power logic but applied between demand/idle/eco and freeze export across multiple slots.

johnwb87 avatar Jan 07 '25 08:01 johnwb87

Just seen this following the recent comments. I agree now an enhancement idea for the coming summer. I think the part missing from the current clipping model is the charge low power aspect.

A single discharge ahead of the peak window and then a low power charge through it would be a more elegant, efficient and cost effective solution.

Limiting the charge rate is what I started doing with automations before going fully predbat. Having the decision on when that happens calculated taking into account all the variables that predbat uses would be maximally effective.

I think it is the charge low power logic but applied between demand/idle/eco and freeze export across multiple slots.

Glad to hear there are others in a similar position.

I actually prefer to avoid limiting the charge rate, because in the case of higher than predicted generation, this can also cause clipping in itself (e.g. I have 6.4 kWp panels, and inverter with 5 kW AC + 3 kW DC capacity - if the DC capacity was limited to e.g. 1 kW, clipping could occur at peak generation).

rholligan avatar Jan 07 '25 09:01 rholligan

An uninformed limit of 1 kW would be bad but solar peak minus inverter limit could be used as a lowest bound for the charge rate.

predbat already knows the inverter limit but currently only takes max solar from the forecast. In this potential enhancement if we told predbat in apps.yaml the peak solar then when the clipping model comes in it would reference that in then setting a reduced charge rate.

johnwb87 avatar Jan 07 '25 10:01 johnwb87

I'm personally not in favour of limiting the charge rate. I don't think it solves the issue and adds another risk of clipping as rholligan pointed out. For me key is to discharge the battery sufficiently before clipping occurs. Any strategy should be focusing on that. I did explain my approach earlier in this forum, so won't repeat here.

PatrickJanssens avatar Jan 07 '25 14:01 PatrickJanssens

I'm personally not in favour of limiting the charge rate. I don't think it solves the issue and adds another risk of clipping as rholligan pointed out. For me key is to discharge the battery sufficiently before clipping occurs. Any strategy should be focusing on that. I did explain my approach earlier in this forum, so won't repeat here.

Sorry I disagree, I think being able to limit the charge rate absolutely has to be part of the solution and it's what I do outside of predbat to limit clipping in summer. It's not going to be the single answer for everyone and there may not be a unified solution as predbat can't know our individual inverter and solar setups, but rather a number of different options that can be used.

I made some suggestions of components earlier in this thread https://github.com/springfall2008/batpred/issues/1206#issuecomment-2299470573

Personally I'm against force discharging the battery to provide room for more solar charging. It adds extra battery cycles and wastes circa 15% power if you charge and then discharge the battery. But if that's a solution for some then let's include it in the set of options that predbat can use

gcoan avatar Jan 07 '25 14:01 gcoan

Personally I'm against force discharging the battery to provide room for more solar charging. It adds extra battery cycles and wastes circa 15% power if you charge and then discharge the battery. But if that's a solution for some then let's include it in the set of options that predbat can use

I agree with this based on my observations of predbat actions during clipping events last summer. What I saw was multiple, short full power discharges followed by full power charge from solar. This is incurring avoidable battery losses and also makes our export to the grid more spikey then it needs to be, both sub-optimal things.

My view is that a reduced charge rate is indeed part of the solution and a useful potential addition to the current solution. A reduced charge rate only has no impact if max solar would saturate both the AC and DC limits. If that happens then the inverter has likely been mis-sized or there are some strict export limits imposed by the DNO

A reduced charge rate is anything less than 100%. In the thread we've had examples of 6.4kWp and what looks like around 7.5kWp. So with 5kW of AC + 3kW of DC capacity both systems would benefit from a reduced charge rate, with no additional clipping risk, in addition to forced export.

johnwb87 avatar Jan 07 '25 16:01 johnwb87

I think a lot of people have very different requirements for the clipping solutions and it is going to be very difficult to satisfy everyone!.

I have a Hybrid system so there's no clipping issue as such on the charging because the inverter is not involved.

However, I have a 3.68kW export limit but a split E/W system that is capable of peak generation of 8kW so any charge/discharge cycling or charge rate limits would be no use in my situation - my issue is that the battery ends up full early in the day and so the clipped power is lost because I am not allowed to export it.

So, me a clipping solution would be a case of Predbat deciding how much power during the day will be generated above the amount I can use (3.68kW export + House Usage) and then reduce the battery charge by that amount in the overnight off-peak period, so I start the day with a somewhat empty battery then then export + fill the battery during the daytime.

cyberkryten avatar Jan 07 '25 17:01 cyberkryten

Large array and low export limit is a thinker. Is 8kW your installed capacity so you don’t actually see that peak?

In that scenario you want to be getting as close to max export at all times outside the off-peak window using both the battery and solar and achieve that with no clipping.

So depending on export rates could still discharge as soon as off-peak finishes assuming that still gets you to an SOC that limits clipping as much as possible. Likely also benefits from a longer plan forecast period so predbat can see if another high solar day is forecast.

Interesting problems to solve with this one.

johnwb87 avatar Jan 07 '25 18:01 johnwb87

My scenario is large array (actually 3 arrays) but they match my inverter sizing (so no inverter DC clipping) and no DNO export limit.

But practically I do have an export "limit" in that if I do nothing, the batteries are full by 10am and then I could be generating 8-12kW across the 3 arrays. Together that power output pushes the grid voltage up above the allowable limits and one or two of the inverters shut down as a result of the high voltage. Voltage drops, inverters start up again, whole cycle repeats.

So basically I get a lot of peak rate throttling of my inverter output.

If instead of charging the batteries up at full rate on solar in the morning I leave them empty/part empty (e.g. with a slow rate charge or export all solar generation), and then during the solar peak I stop limiting the battery charge rate, I can divert 4.8kW of solar power into the batteries instead of the grid and this stops pushing the grid voltage out of tolerance.

So a different set of circumstances than @cyberkryten but a similar set of requirements for Predbat

gcoan avatar Jan 07 '25 20:01 gcoan

I had a lot of issues due to the batteries so also had G100 limit triggers and voltages over 255v causing the Active Power Limit to drop to zero, which complicated the peak summer period a lot on the data side.

I have 10.5kW of panels installed and saw a peak generation of around 8kW in the summer into the batteries - as it is DC coupled and I have three batteries (5kW charge into each) they can take the full charge without issue. It's hard to tell the actual generation as the SE portal reported 15kW (clearly wrong).

On the sunny days, I pretty much need to not charge overnight at all IF it was going to be sunny. I had many days where I clipped to 4.5kW production for 8-10 hours though the peak of summer so don't really know how much power I 'lost'.

The good news is there's several months before this is going to be a problem again ;)

cyberkryten avatar Jan 08 '25 23:01 cyberkryten

I think what @gcoan and I are saying is that in the first hours of generation, when the batteries are presumably charging, a better solution would be to export upto your export limit even discharging the batteries in this window and only put the potential clipping into the battery once an excess of solar occurs. Maximising the export at all times is the solution and so depending on inverter arrangements (I’m thinking in terms of my GE Hybrid) reducing the charge rate is part of achieving that. That reduction could scale as the solar forecast increases and have an additional headroom added to it to avoid passing clouds clipping. The main constraint for all of us is Grid Export whether because of the inverter itself or DNO limits so we have to maximise getting the most kWh down whatever kW size export pipe we have.

johnwb87 avatar Jan 09 '25 08:01 johnwb87

I'm not sure I entirely understand how reducing the charge rate helps? What matters is how much energy is stored in the battery and so reducing the rate of charge and adding it over a longer period doesn't change that. My guess is that you actually mean the system should be starting to export early and by doing so this will reduce how fast the batteries fill up (because some power is being sent to the grid) - is that correct? Again, we may be struggling for terminology/implementation between different inverter/battery types (I'm thinking of this in terms of SolarEdge) as maybe you can force-exporting by saying only allow X kW DC to be stored?

I guess there are a couple of values that will need to be set/calculated to allow a clipping calculation to be accurate and the requirements are probably also different for AC and DC coupled batteries - in a Hybrid system, the DC batteries can fill at the full rate of solar generation whilst there is capacity. In a system with an AC coupled battery, you are limited by the Inverter for how fast the batteries can be charged.

Of course the absolute key for the calculations is the absolute maximum output. This will again vary because of Inverter Size, DNO Limit and house consumption and I'm sure it will need a lot of tweaking, to avoid a mistake where we don't have enough battery and end up paying peak prices for electricity!

cyberkryten avatar Jan 10 '25 14:01 cyberkryten

I'm not sure I entirely understand how reducing the charge rate helps? What matters is how much energy is stored in the battery and so reducing the rate of charge and adding it over a longer period doesn't change that. My guess is that you actually mean the system should be starting to export early and by doing so this will reduce how fast the batteries fill up (because some power is being sent to the grid) - is that correct?

By reducing the charge rate (or even setting it to zero), you are storing less solar energy in the batteries earlier in the day, so leaving space for later in the day, and as you say, will start exporting solar energy earlier.

To try to give an example, simplifying my own setup.

Inverter max AC throughput 5kW Battery max charge rate 2.6kW

Nice sunny summer's day, generation starts at 5am, peaks at 12 with 7kW of peak power

If I don't intervene Predbat will let the batteries charge from solar from 5am, they will be full by say 10am, and then solar will converted to AC, exported, but only up to the 5kW inverter limit.

If instead I don't let the batteries charge at all until 10am, or charge them at a reduced rate, any solar above the battery charge rate will be exported, and at 12am when I am generating 7kW peak then 2.6 of that will be going into the battery and 7-2.6=4.4kW will be exported.

Overall by delaying the charge I will export more and not lose the solar power that would have been clipped during the peak

gcoan avatar Jan 10 '25 14:01 gcoan

Ah, OK, this is definitely going to get complicated. I have three DC coupled batteries so can't set a max charging rate in the same way to end up with excess being exported because there's no equivalent mode on the SolarEdge inverter that will do that. The one mode that looks like it should work "Charge from Clipped Solar Power" mode will not discharge the battery at all, so if house consumption is greater than solar generation it will pull from the grid so it can only be used during low-rate periods.

cyberkryten avatar Jan 10 '25 16:01 cyberkryten

Different behaviours for different inverter types.

Comes back for me to there not being a single way Predbat can handle clipping for us all, not least of which it won't know enough about our different setups. For your inverters it sounds like a periodic force discharge is a solution, for my hybrid inverters, that has less use because of the over-arching 5kW AC inverter limit. So if generating 4kW of solar I can only discharge the battery at 1kWh, and above 5kW I am back to clipping the solar generation.

gcoan avatar Jan 10 '25 19:01 gcoan

My set up and preferred solution is very similar to @gcoan. I’m pretty sure we both have GE Hybrid inverters so that would be why we are coming at it with the same inverter capabilities in mind.

johnwb87 avatar Jan 11 '25 08:01 johnwb87

Well, it is sunny this morning and the panels were generating nearly 3kW so I decided to have a play around with the various settings on the Inverter. I set the solaredgemodbus_i1_storage_charge_limit figure to 500 with the mode left as "Maximize Self Consumption".

As it is DC coupled batteries I assumed it was the Grid AC charge limit and I didn't think this would do anything but it does actually restrict the charge power in the same way you have described on the GE Hybrid system.

The batteries went from charging at 2000W to 497W and at the same time, the export rate went from nothing up to 1.4kW so it did exactly as would be needed if the clipping calculations were accurate in predicting charge/export to avoid being left with excess.

However, shortly after, Predbat for some reason changed the discharge rate to 500W to match the charge rate (I tried again with 2000 and it did the same). That's NOT what I wanted as it will limit self-usage - I'm not sure why they are tied together so I'll have a look through the code and if I can't figure either out I'll open a separate ticket for that (I was actually expecting Predbat to notice the reduced charge_rate value and change it back to the normal figure!)

cyberkryten avatar Jan 11 '25 11:01 cyberkryten