Current Regulator

Overview

A proper designed current regulator is the key to control the electric motor. As explained in FOC Overview section, following is an example of the control system:

Current regulator for embedded motor control.

Current regulator needs to perform following tasks:

  • Decoupling of dq frame
  • Anti-windup for output voltage commands
  • Flux weakening

The items need to be discussed one by one.

Decoupling

With voltage equations on dq frame:

Cross coupling terms.

It can be seen that there are cross coupling terms between dq axis. ud depends on not only id, but also iq. So does uq. Meanwhile, ud/uq outputs of the PI controller are only impacted by errors between id/iq command and feedback. This means the current controller performance will be very poor or even not working at all especially for high speed operation, when cross coupling term is the major factor. One of the ways to compensate this is using the feedforward terms:

Current regulator with decoupling feature.

The cross coupling terms are now calculated using machine parameters, and are then be added to the outputs of the PI controller. In order to achieve proper behavior, machine parameters including Lq, Ld and ฯ†pm need to be obtained offline. This will be discussed in Calibration section.

Anti-Windup

Since PI controller is used here, it shall be guaranteed that integration term of the controller will not keep adding up when output becomes saturated. Otherwise, it will take a very long time for output to change the direction later. Furthermore, since final output voltage is defined by sqrt(ud2 + uq2), controller shall making sure that this value won’t exceed the limitation as well. For maximum output voltage limitation, see PWM Generation section. Following is an example of current regulator code includes the anti-windup feature:

void CRF_T0() {

	Ud_PI.err = IeIDQ_T0_I_Id - IeCRF_T0_I_Id;  //err equals to command (IeIDQ_T0_I_Id) minus feedback (IeCRF_T0_I_Id)
	Uq_PI.err = IeIDQ_T0_I_Iq - IeCRF_T0_I_Iq;  //err equals to command (IeIDQ_T0_I_Iq) minus feedback (IeCRF_T0_I_Iq)

	PI(&Ud_PI, IeIDQ_T0_k_Udff); //voltage output equals to PI value plus feedforward value (IeIDQ_T0_k_Udff)
	PI(&Uq_PI, IeIDQ_T0_k_Uqff); //voltage output equals to PI value plus feedforward value (IeIDQ_T0_k_Uqff)

	IeCRF_T0_MI = Fast_Sqrt(Ud_PI.Out * Ud_PI.Out + Uq_PI.Out * Uq_PI.Out); //output voltage magnitude eqauls to sqrt(ud^2 + uq^2)

	//anti-windup
	if (IeCRF_T0_MI >= KeCRF_T0_k_Umax) { //if output voltage is higher than a pre-defined threshold (KeCRF_T0_k_Umax)

		//ud (Ud_PI.Out) and uq (Uq_PI.Out) are decreased equally
		Ud_PI.Out = KeCRF_T0_k_Umax / IeCRF_T0_MI * Ud_PI.Out; 
		Uq_PI.Out = KeCRF_T0_k_Umax / IeCRF_T0_MI * Uq_PI.Out;

		if (Ud_PI.Out > 0) // if output is bigger than 0, then stop PI from positive integration 
			Ud_PI.Upper_Sat = 1;
		else  // else, stop PI from negative integration
			Ud_PI.Lower_Sat = 1;

		if (Uq_PI.Out > 0) // if output is bigger than 0, then stop PI from positive integration 
			Uq_PI.Upper_Sat = 1;
		else // else, stop PI from negative integration
			Uq_PI.Lower_Sat = 1;

	}

	IeCRF_T0_k_Ud = Ud_PI.Out;
	IeCRF_T0_k_Uq = Uq_PI.Out;

}

Notice that linearly decreasing both ud and uq when output get saturated may not be a good idea for ceratin operation, since it will impact both id and iq.

Flux weakening

id* and iq* may not be achievable with existing dc link voltage, if they are not selected properly. This can due to miscalibration, motor parameter mismatch, etc. When this happens, current regulator shall be able to modify id* and iq*, so the commands become achievable. Usually, it means that more negative id shall be applied to decrease the flux. So it is also called flux weakening. Following shows one of the flux weakening approaches.

Current regulator with flux weakening function.

Where V is the output voltage magnitude, V* is the output voltage limitation. Vdc is measured dc link voltage. Notice that ฮ”V is single direction, and is limited up to 0. So Vdc* is smaller or equal to Vdc . While the selection of id* and iq* will be discussed in Operation Optimization section, smaller Vdc* will lead to decreasing of the output voltage.

Future Reference

Current regulator is a very complicated topic, or could be the most complicated topic for FOC. For future reference, following two papers can be a good starting point:

F. Briz, โ€œAnalysis and design of current regulators using complex vectorsโ€, IEEE Transactions on Industry Applications, vol. 36, pp. 817 – 825, May – Jun. 2000.

F. Briz, โ€œCurrent and flux regulation in field-weakening operationโ€, IEEE Transactions on Industry Applications, vol. 37, pp. 42 – 50, Jan. – Feb. 2001.