Vehicle-to-Grid Based Microgrid Modeling and Control