The relationship between energy storage charging and discharging and the power grid