Algorithm for energy storage charging pile capacity