Virtual energy storage for frequency and voltage control