More and more often governments around the world drive their efforts on displacing their actual electricity production models which consist on large power plants based on fossil fuels, towards other ones based on renewable energy source, usually smaller and geographically distributed. Two main reasons justify this movement: 1-the increasingly environmental problem derived from the use of fossil fuels and 2-the long distances they must be overcome to transport the electricity from the production point to consumption area. In this paper authors propose a distributed power generation system with interconnected loads (microgrid), made up by solar panels (PV), wind turbines (WT), a batteries bank (BAT) and a modular fuel cell system. In addition, an electrolyzer (load) will convert the electrical energy into chemical energy with the use of hydrogen like energy vector. To put in work this microgrid, it is needed a proper energy management strategy which takes into account both technical and economical parameters (smart grid). This paper analyses the hierarchical structure of the proposed smart grid, starting from primary sources, and finishing with the whole plant. Furthermore it is proposed and tested an energy management strategy which satisfies smart grid requirements at time that accomplishes the fixed targets.