# Four Steps to Field-Oriented Control -– The Final Two

Concluding Dave's series on implementing field-oriented control, he looks at what to do with the error signals derived in step two.

In the previous blogs of this series, we discussed measuring motor current as well as the most critical piece in the field-oriented control (FOC) process, comparing the measured current to desired values and generating error signals. Now that we have two error signals based on a rotating reference frame (Figure 1), we need to complete our four-step process. What do we do with the signals? More importantly, how do we translate our signals back down to the stationary reference frame? We will answer these questions by proceeding to the final two steps of FOC.

*. If you’ve made it this far, you can relax a bit; these last two steps are super easy. Just like with brush DC motor torque control, we turn to our old friend the P-I controller to take the current error signals and amplify them to create the motor voltages. The only difference with this step compared to a brush DC motor is that we now have two P-I controllers: one for the d-axis and one for the q-axis. And since they exist on a rotating reference frame synchronous to the rotor flux axis, both d and q currents are DC VALUES when the motor is operating under steady-state conditions, regardless of speed! Figure 2 shows the two P-I controllers along with recommended tuning coefficient values.*

**Amplify the error signals to create correction voltages**

*. Combining Vd and Vq using vector math results in a voltage vector which we need to apply to the stator windings. But Vd and Vq exist on the*

**Modulate the correction voltages onto the motor windings***rotating*reference frame. The stator windings exist on the

*stationary*reference frame. (You can probably see where I am going with this.) In order to put these voltages onto the motor windings, we first need to jump off of the rotor, and translate Vd and Vq into equivalent waveforms in the stationary frame. So we take the Park transform (which is what got us up on the rotor to begin with), and rearrange the terms to solve V

_{α}and V

_{β}.

When finished with this step, we now have two voltage waveforms: one on the α axis, and one on the β axis. When plotted as a function of rotor angle over time, the result will be a cosine wave and a sine wave, respectively. These waveforms simply represent the magnitude of the net voltage vector (which is spinning) when it is reflected onto the stationary α axis and β axis. This is graphically represented in Figure 3.

If we had a two-phase motor, we would be done. All we would have to do is drop the scaled instantaneous values of V_{α}(t) and V_{β}(t) into the PWM module, and congratulate ourselves for our motor control prowess. But since we have a three-phase machine, we have to convert V_{α} and V_{β} into three voltage values (Va, Vb, and Vc), which can be directly applied to the three motor windings. To do this, Edith Clarke once again rides to the rescue by providing the *inverse* Clarke transform. Because the zero-sequence (common mode) voltage term is zero, the inverse Clarke transform takes the following form:

We now have our three voltage values! Put them in the PWM module and then exit the Interrupt Service Routine. By the time we get our next interrupt, the three voltages should have done their work on the motor to hopefully drive the motor currents closer to their desired values. We then do the whole process over again. On a microcontroller such as TI’s C2000 TMS320F28069, all of these calculations can be done in less than 12 µS! The entire FOC process is summarized in Figure 4.

Hopefully by now you have a good understanding of how FOC can be used to control the torque of a permanent magnet synchronous motor. But what about other motor topologies? In my next blog, we will take what we have learned so far and use it to control the torque on an AC induction motor.

**Related posts:**