Hi again,
I know this has come up before but I'm afraid I cannot find the appropriate topic to reply to!
Anyway I wanted to note that when the target charge level is set to 100% (i.e. very low solar forecast), the charge level only ever reaches around 94%. I am certain that this is because - even in normal operation - the charge rate gets throttled by the BMS as it approaches 100%. I believe this is screwing up your calculations which are surely based on a linear interpretation of the "battery charge rate" setting.
Can I suggest you add a simple buffer of some sort to the calculation? While having the battery charge at as low a rate as possible is a great idea, I'm sure nobody would mind if it played it a bit safer. i.e. keep the same total battery target calculation but increase the charge rate a bit.