Design and simulation of a vehicle-To-grid system