This paper presents the analysis, design and simulation of a Photovoltaic energy management system. The proposed system is capable of both grid connected and islanded operation. An operation protocol is proposed to ensure the quality of the energy supply and to minimize the energy losses. A battery bank is connected to the DC-link as an energy storage for islanded operation mode.