# FOC current control autotuning PI Controller for BLDC Motors

I try to understand, how the guys from odrive tuned the current control PI parameters for Field Oriented Control:

https://github.com/madcowswe/ODrive/blob/master/Firmware/MotorControl/low_level.c

In the Function "motor_calibration", K_i and K_p are choosen as:

// Calculate current control gains
float current_control_bandwidth = 1000.0f;  // [rad/s]
motor->current_control.p_gain = current_control_bandwidth * motor->phase_inductance;
float plant_pole = motor->phase_resistance / motor->phase_inductance;
motor->current_control.i_gain = plant_pole * motor->current_control.p_gain;


How they came up with this dependecies of K_i and K_p from L and R? They somehow must place the poles the right way with this, but I don't see how they guarantee to shift the poles to the negative half plane.

The State Space Model of a BLDC motor looks like this, but from here we cannot simply assume, that the input u is F*x, such that we come up with a closed loop system, because the back EMF voltages we cannot control directly:

Edit: Is it possible, that the following simple model was used? So the closed loop system has the transfer function:

$$G(s)= \frac{K_p s + K_i}{s^2 L + s(R+K_p) + K_i}$$

• A quick method is just Pole-Zero Cancellation. An R-L load has a certain placement so tune the controller to cancel them – JonRB Mar 26 '18 at 12:23
• Ok, and that's done here? How is this R-L placement in this case here? – HansPeterLoft Mar 26 '18 at 12:48
• The PI controller places a zero in the left half plane. Its value can be adjusted to drag a right half plane open-loop pole into the left half plane, thereby giving a stable closed loop. E.g. the open loop TF: $G(s)=\frac{1+as}{s(s-b)}$, with a>b. – Chu Mar 26 '18 at 23:53
• the method used in the controller by Odrive is well explained here by TI: ti.com/lit/an/sprt703/sprt703.pdf This is a simplified model as you said! – Gregorio Aiello Oct 2 '18 at 16:57

## 1 Answer

It's quite possible they used the simplified model you cite. It's how I do motor controllers. It's based on the observation that the attainable bandwidth of the current loop is well over 10 times that of the attainable bandwidth of the motor speed or position loops. That means that you can pretty much treat the motor dynamics as an independent DC disturbance to the current loop.

Now, should you be designing some super high-bandwidth motor servo loop and you find that the motor's armature control bandwidth is getting within 10x of the current loop bandwidth -- you'll need to change your thinking.