This example shows how to control the torque in an interior permanent magnet synchronous motor (IPMSM) based drive. A high-voltage battery feeds the IPMSM through a controlled three-phase inverter. A ramp of torque request is provided to the motor controller. The load torque is quadratically dependent on the rotor speed. 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 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 rotor speed in the electric drive.