SLUUDM5 March 2026 MSPM0G1507 , MSPM0G1519 , MSPM0G3507 , MSPM0G3519
FOC algorithm has two PI controllers, one each for Id and Iq to control flux and torque separately. Kp and Ki coefficients are the same for both PI controllers and are configured in Table 7-5. The outputs of the current control loops are used to generate voltage signals Vd and Vq to be applied to the motor. The outputs of the current loops are clamped to supply voltage VM. Id current PI loop is executed first and output of Id current PI loop Vd is checked for saturation. When the output of the current loop saturates, the integration is disabled to prevent integral wind-up.
| Variable | Description |
|---|---|
| pUserInputRegs->systemParams.currLoopKp | Proportional gain users set for the closed loop torque control in float |
| pUserInputRegs->systemParams.currLoopKi | Integral gain users set for the closed loop torque control in float |
The FOC application supports automatically calculating the current loop PI parameters based on the motor parameters (resistance and inductance). By default, the current loop bandwidth is set as 0.03 times the FOC loop frequency in the algorithm. For example, if users set FOC loop as 10kHz, then the default current loop bandwidth is 300Hz.
Set the variables described in Table 7-5 as 0 to enable the PI parameters auto calculation. Users can then get the computed PI parameters in Table 7-6.
| Variable | Description |
|---|---|
| pUserStatusRegs->currentPI.Kp | Read Only. Proportional / Integral gain for current loop. The value is passed from variable: pUserInputRegs->systemParams.currLoopKp / currLoopKp (if either has non-zero value). The value is generated by FOC algorithm if is pUserInputRegs->systemParams. currLoopKp / currLoopKp are both zero. |
| pUserStatusRegs->currentPI.Ki |
After getting auto calculated PI parameters shown in Table 7-6, users can set the calculated parameters value as the initial value of the PI parameters shown in Table 7-5. Users can then do manual parameters tuning based on the actual control performance.
There is a scaling factor relationship between the current loop PI parameters set by the user in pUserInputRegs and the actual PI parameters used in the PI controller calculations, as the motor speed and current are based on PU values.