Consensus-Based Active and Reactive Power Control and Management of Microgrids