X

High-performance motors need a control mechanism that ensures enhanced smoothness, reliability, and efficiency. One of the most apt examples of such an application is the motor used in electric-vehicle (EV) powertrain, which can be controlled by a field-oriented-control (FOC)-based system.

For an EV powertrain to drive smoothly, the control scheme should be such that the motor is able to operate over a wide range of speed and produce maximum torque at the lowest of speeds. Technically speaking, the motor control must be based on torque and magnetic flux, so we are able to control the torque accurately by controlling the current.

The basic principle of rotating a motor’s rotor is to produce magnetic field in the stator. This is done by energizing the stator coils with alternating current. The secret to the smooth operation of a motor lies in knowing the position of the rotor, which is the angle between the flux axis of the rotor and the magnetic axis of the stator. Once this value is known, the stator current is aligned with the torque axis of the rotor. To achieve peak efficiency, the stator magnetic flux must be perpendicular to the rotor magnetic flux.

**FOC-based motor control**

On paper, a typical field-oriented control (FOC)-based motor control system appears as shown in **Figure 1**.

**Figure 1** The diagram shows hardware and software components of an FOC-based motor control system. Source: Texas Instruments

Let’s understand each of the software and hardware components:

**Three-phase inverter**: A three-phase AC/DC inverter provides the three-phase voltage to the PMSM/BLDC motor for drive. It takes pulse-width modulation (PWM) signals from the space vector modulation (SVM) block.**QEP interface**: It interfaces with an encoder to obtain mechanical position of the rotor and pass it on to other blocks.**Speed/position estimation block**: As the name suggests, calculations for obtaining the rotor position and speed are performed in this block.**PID control**: Proportional integral derivative (PID) is a control loop that relies on feedback from the motor in the form of torque. By calculating the difference between the desired torque and the torque received from the Park transform block, it makes the correction.**Clarke transform**: The Clarke transform block converts the stator current (ia, ib) to flux and torque (d-q) coordinate system using the Clarke transform formula. The stationary reference frame of a three-phase system is transformed into a two-quadrant system in a stationary reference frame.**Park transform and inverse Park transform**: This block converts the stationary reference frame to rotating reference frame with a two-phase system with orthogonal axes. The orthogonal components are d-q, which are motor direct and quadrature axis, respectively. The inverse Park transform block comes in picture when the stator output voltage has to be converted back to stationary frame reference (stator reference).**Space vector modulation**: It’s a technique to determine the PWM signal that is to be applied to the motor. SVM takes stator voltage vector as input and produces three-phase output voltage as the output.

Next, we’ll explore how these components are put to use in driving a motor using the FOC algorithm.

**A view of FOC workflow**

For a three-phase electric motor to be controlled, we have to provide proper voltage to the motor by reading phase current Ia, Ib, Ic. Without having a control on them, it’s not possible to create a stator flux vector, which is at 90 degrees to the rotor flux vector.

FOC is a math-intensive algorithm that helps achieve this and more with ease, although developing FOC is quite complex. The FOC algorithm is able to simplify the control of three-phase sinusoidal currents reference frame by decomposing them to flux and torque (d-q) reference frames. These two components can be controlled separately.

Figure 1 shows the encoder/Hall that determines the position of the rotor and passes it on to the speed/position block. This value is also fed to the Park and inverse Park transform block. At the same instance, the phase currents (ia, ib) from the motor are fed to the Clarke transformation block. The phase currents from the motor are converted by Clarke transform to two orthogonal currents (iα, iβ). The newly-converted phase currents now signify as torque-producing and flux-producing currents, respectively. Although we have successfully decomposed the phase current to flux and torque components, they are still sinusoidal, which makes it difficult to control as they keep on changing.

The next task of the FOC algorithm is to do away with the sine waves, which requires one important input—the rotor position. We see in the diagram that this value is fed to the Park-transform block as well. In this block, the trick is to move from a stationary reference frame—from the stator’s point of view—to a rotating reference frame from the rotor’s point of view. Simply speaking, the Park-transformation block converts the two AC currents (iα, iβ) to DC currents. That makes it quite easy for the PID block to control it the way it wishes.

Let’s bring the PID block into the picture now. The input to the PID block from the FOC block is Iq and Id, torque and flux component. In the context of an EV, the PID block will receive a speed reference when the driver operates the throttle. The PID block now compares the two values and calculates the error. This error is the value for which the PID block has to rotate the motor. The output that the PID block gives is Vq and Vd. This output reaches the inverse Clarke and Park transform where the exact opposite of Clarke and Park transformation takes place. The inverse Park transformation block transforms the rotating reference frame to the stationary reference frame so that their phases of motors can be commutated.

**Figure 2** The output from PID reaches the inverse Clarke and Park transform where the exact opposite of Clarke and Park transformation takes place. Source: Texas Instruments

In the last step of FOC-algorithm-based motor control, the role of space vector modulation (SVM) assumes a lot of importance. SVM’s role is to generate the PWM signals that are fed into the inverter which, in turn, generates the three-phase voltage that drives the motor. In a way, SVM also does the job of an inverse Clarke transformation.

A three-phase inverter has six transistors that deliver the output voltage to the motor. There are essentially two states in which these outputs have to be with either top transistor closed and bottom one open or vice-versa. With two states and three outputs, total eight states (2^{3}) can be calculated. When you plot these eight states, also called base vectors, on a hexagonal star diagram, you will find that each adjacent vector is 60 degrees apart in terms of phase difference. The SVM finds the mean vector that gives the output voltage (V_{out}).

**De facto EV motor control**

FOC as a motor control scheme is indispensable for EV designs. With the kind of noiseless and smooth motor operation demanded by an EV, FOC stands out as a good fit. Many OEMs and control system developers often tweak the standard FOC algorithm to suit the unique requirements of their EV program, but the core concept remains the same.

The advancements in automotive-grade MCUs, like PIC18Fxx39 family of microcontrollers from Microchip or C2000 real-time microcontrollers from TI, are able to expedite the development of an FOC algorithm for EV motor-control systems.

*This article was originally published on **EDN**.*

*Vaibhav Anand** is a d**igital **m**arketing **e**xecutive** at **Embitel**.*

*Saurabh S**.** Khobe** is an e**mbedded **e**ngineer** at **Embitel**.*