Control and operation of a microgrid can be operated at grid connected or islanded modes. In this paper, the microgrid consists of a Diesel, PV modules with a distributed energy storage system, loads, and inverter. The purpose of power management is to control the stability of the system to cope with changes in load and interconnection with other networks. The stability of the microgrid is also obtained by setting the load connected to the system. Power management is also controls the operation of each plant based on the condition of the energy sources used as a source of generation. In islanded mode, the main goal of power management is to stabilize the system, in terms of frequency and voltage. In grid connected mode, typical objectives are to minimize the price of energy import at the point of common coupling (PCC).