Resilient Microgrids Using A State Controller