How microgrids function as an intelligent system that promote the optimization of energy use