Control Design For A Microgrid In Normal And Resiliency Modes Of A Distribution System