Electronic – Why are two PID controllers needed for FOC (Field Oriented Control)

brushless-dc-motormotor controllerpid controller

I've been looking at code to do FOC and noticed that two PID controllers are usually used for torque control — one that keeps Id near zero and another that maximises Iq.

I understand why Id should be minimised and Iq should be maximised.

What I don't understand is why two PID controllers are needed to solve for what as I understand is essentially one unknown. My understanding (which probably needs correcting) is that the only goal of FOC is to figure out the torque and speed induced phase offset between the voltage and current which is caused by the windings' inductance and back-EMF.

If this is correct (that knowing this phase offset at any point in time would be enough to optimally determine what voltage to put on what windings) then why isn't there one PID loop which optimises for the percent of the output power that goes to Iq? Something like trying to get Iq/(Id+Iq) to be as close to 1 as possible.

Best Answer

Step back and think what Id does for you and equally the relationship between Vd and Vq

Injection into the quadrature axis will facilitate torque production while injection into the direct access with facilitate field weakening.

To maximise the torque production you ideally want zero Id as a direct current component will result in a reduction in torque production. How? via a vector rotation. Id and Iq are always in quadrature and thus if there is some Id for a given Iq, the overall frame of reference must rotate.

The two PI(D) controllers within the FOC current loop take in a current error and produce a voltage demand. This Vd and Vq, via an inverse Clarke & Park produce the three phase voltage demands that shall be applied to the stator to facilitate current flow. As you increase in rotor velocity the displacement power factor increases as the \$j\omega_e L \$ vector length increase with regards to the \$V_{bemf} \$ and the IR vector. This natural rotation as to where the current shall be injected occurs as the Id component is kept as close to zero as possible (resulting in an increasing Vd term).

Lets look at this rotation.

The inverse Clarke & Park equations are such.

\$ V_a = V_d \cdot Cos\Theta - V_q\cdot Sin\Theta \$

\$ V_b = V_d \cdot Cos(\Theta - \frac{2\pi}{3}) - V_q\cdot Sin(\Theta - \frac{2\pi}{3}) \$

\$ V_c = V_d \cdot Cos(\Theta + \frac{2\pi}{3}) - V_q\cdot Sin(\Theta + \frac{2\pi}{3}) \$

for a "perfectly aligned" rotor and zero Vd component, the anticipated waveforms can be seen below

enter image description here

With a 20% Vd component added the waveforms can be seen below: enter image description here

there is a clear phase-shift. If I overlay the two sets of Vabc it becomes very clear.

enter image description here

The waveforms now lead where they should be due to how a direct component rotates the vector. There is also a slight magnitude increase since the envelope of the 3phase sinewave follows \$\sqrt{V_d^2 + V_q^2}\$ and under current control the Vq component would have been reduced.

So it has been established that:

  1. The output of the two current controllers is a voltage demand, a demand needed to cause the desired current to flow
  2. A direct component causes a rotation (or a phase shift in the rotating 3phase domain)

then why isn't there one PID loop which optimises for the percent of the output power that goes to Iq? Something like trying to get Iq/(Id+Iq) to be as close to 1 as possible.

What would happen if aspects of Iq was used as the Id demand. For starters it would need to be aspects of Vq to influence Vd since the output of the PI(D) is voltage not current. What would happen if we had one PI controller that takes in an Iq demand and generates a Vq based upon the present Iq. From this produce Vd based upon say ... \$Vd = \frac{Vq}{Vd+Vq}\$ akin to the original query.

We would have a response which varies the phase relationship of the applied voltage based upon the quadrature current demand. Whenever there was a demand change or a load change the controllers response would result in a phase shift from the desired angle and thus compromise the ability of the system to generate torque effectively.

By implementing independent controllers for Id and Iq, their specific contributors to the overall system response can be controlled. Iq is free to change based upon a demand from an outer velocity loop while Id is controlled to rotate the vector due to any possible rotation due to acceleration or velocity.

Since Id (and thus Vd) has an impact of the torque angle, an Id demand can be used to produce field weakening to enable the system to reach higher velocities at the expense of torque production.