Main Content

Control Torque of IPMSM Inside Axle-Drive EV in DQ Frame

Since R2025a

This example models an interior permanent magnet synchronous machine (IPMSM) propelling a simplified axle-drive electric vehicle. The example controls and simulates the torque in the rotor direct-quadrature (DQ) reference frame. The IPMSM operates in both motoring and generating modes. A fixed-ratio gear-reduction model implements the vehicle transmission and differential. The Vehicle Controller subsystem converts the driver inputs into a relevant torque command. The Drive Controller subsystem controls the torque of the IPMSM. The control algorithm is implemented in continuous time. To simulate this model faster, this example uses a variable-step solver. The Scopes subsystem contains scopes that allow you to see the simulation results.

Open Model

Open Electric Drive Subsystem

View Simulation Results from Simscape Logging

This plot shows the requested and estimated torque for the test as well as the DQ currents in the electric drive.

simlog_handles = 

  1×2 Axes array:

    Axes    Axes

Results from Real-Time Simulation

This example has been tested on these platforms:

  • Speedgoat™ Performance real-time target machine with an Intel® 3.5 GHz i7 multi-core CPU and 4 GB RAM.

  • dSPACE® SCALEXIO LabBox with Intel® Core XEON E3-1275v3 at 3.5GHz and 4 GB RAM.

You can run this model in real time with a step size of 50 microseconds by using the Simscape local solver. For small sample rates, a task overrun might occur during the initial task execution due to a cold cache. To avoid this overrun, if the selected platform supports these options, relax the start-up behavior by specifying a limited number of task overruns or increasing the sample time of periodic tasks during the start-up phase of the real-time application.

See Also

Topics