How to charge and discharge energy storage charging piles