Main Content

Electric Vehicle Configured for HIL

This example shows an electric vehicle model suitable for Hardware-In-the-Loop (HIL) deployment. Energy-based modeling is used to avoid high-frequency switching, and solvers set for fixed-step simulation.

The test run shows the vehicle accelerating to a steady speed up an incline followed by a period of descent during which electrical power is returned to the battery.

Model

PMSM Drive Subsystem

Cooling System Subsystem

Electric and Thermal Model Subsystem

Vehicle Control Subsystem

Simulation Results from Simscape Logging

The plot below shows the behavior of an electric vehicle subject to driver inputs and environmental conditions. The vehicle accelerates until the driver enables cruise control. The vehicle maintains speed even as the grade of the road changes. As the driver applies the brakes, the vehicle slows down to zero speed.

The plots below shows the torque produced by the PMSM motor in the electric vehicle and its temperature. During the first half of the simulation the motor is accelerating the vehicle to the commanded speed and then continuing to apply torque to push the vehicle up a hill. During the second half of the simulation, the motor acts as a generator as shown by the change in sign of motor torque.

Results from Real-Time Simulation

This example has been tested on a Speedgoat Performance real–time target machine with an Intel® 3.5 GHz i7 multi–core CPU. This model can run in real time with a step size of 400 microseconds.