Energy storage grid connection control strategy