Optimal control of plug-in vehicles fleets in microgrids