This example shows how to control the torque in an interior permanent magnet synchronous machine (IPMSM) based automotive electrical-traction drive. A high-voltage battery feeds the IPMSM through a controlled three- phase converter. The IPMSM operates in both motoring and generating modes according to the load. An ideal angular velocity source provides the load. The Control subsystem uses an open-loop approach to control the IPMSM torque and a closed-loop approach to control the current. At each sample instant, the torque request is converted to relevant current references. The current control is PI-based and uses a sample rate that is faster than the rate that is used for torque control. The simulation uses several torque steps in both motor and generator modes. The task scheduling is designed in Stateflow®. The Scopes subsystem contains scopes that allow you to see the simulation results.
The plot below shows the requested and measured torque for the test, as well as the phase currents in the electric drive.