This example shows how to control the rotor position in a PMSM based electrical drive. An ideal torque source provides the load. The Control subsystem uses a cascade control structure with two control loops, an outer loop for position and speed control and an inner loop for current control. An optimal state-feedback linear quadratic regulator controls the position and speed. A Luenberger observer estimates the load. The inner current-control loop is implemented using PI controllers. The PMSM is fed by a controlled three-phase inverter. The simulation uses step references. The Scopes subsystem contains scopes that allow you to see the simulation results.
The plot below shows the requested and measured angle for the test and the rotor speed in the electric drive.