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.


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.

Was this topic helpful?