In certain cases, the battery Soc approached the charging curve boundary without being able to surpass it (floating point arithmetic).
Changed: take next interval if SoC is already close to next boundary, stop charging if SoC is close to target (in both cases compare with EPS instead of 0).
Added assertion that energy delta is greater than 0 (something happens in the battery, no infinite loop)
In certain cases, the battery Soc approached the charging curve boundary without being able to surpass it (floating point arithmetic). Changed: take next interval if SoC is already close to next boundary, stop charging if SoC is close to target (in both cases compare with EPS instead of 0). Added assertion that energy delta is greater than 0 (something happens in the battery, no infinite loop)