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.