Microgrid can be applied in different locations, relative to traditional power technology. It can improve the reliability of users of electricity and power system operation. Distributed power in microgrid needs real-time and multi-objective optimization management. This paper discusses functions and structure of microgrid energy management system(MGEMS) when connected with the main grid. Problems in long-term and short-term energy management of microgrid are discussed. From the point of view of the software platform, the system structure of MGEMS software are proposed. On this basis, this paper discusses the way to construct modules of MGEMS and their functions.