Hardware in the Loop Simulation of an Electric Vehicle Powertrain