Gain Calculation and Tuning
Motor Control Blockset helps you to select and adjusting the controller gains (PI gains) for the current, speed, and position loops. The gains are initially calculated from the motor’s electrical parameters (resistance, inductance, inertia) and the desired bandwidth or response time of each control loop. In FOC, the current loops (d‑ and q‑axis) are tuned first because they must be fast and well‑damped to ensure proper torque and flux control. The speed loop gains are then tuned to be slower than the current loops, ensuring stable cascaded control. Proper gain calculation and tuning are critical to avoid oscillations, excessive torque ripple, slow response, or even instability in the drive.
Functions
mcb.getPIControllerParameters | Compute gains for PI controller in field-oriented control |
mcb.calcFOCGains | Compute gains and transfer functions for PI controller in field-oriented control of PMSM (Since R2025a) |
Blocks
Topics
- Estimate Control Gains and Tune Control Parameters
Perform control parameter tuning for speed and torque control subsystems.
- Obtain Controller Gains to Run Motor Using Field-Oriented Control
This example shows how to obtain PI controller gains using Optimum theory for the current control loop and speed control loop in Field Oriented Control (FOC) of a Permanent Magnet Synchronous Motor (PMSM).


