To read original PDF of the print article, click here.
|Three-phase motors require proper care and feeding. Field-oriented control makes this easier.
Last month, we looked at how a three-phase motor works. Basically, it's a system in which an element (rotary or linear) can be moved by manipulating an associated magnetic field. Not only can we move it, we can move it as we wish.
The magnetic field that we control is in the stator of the motor. This is the shell of a rotary motor that surrounds the rotor (usually the element that moves). In a linear motor it is most likely to be the platform upon which the moving element rests. The magnetic field in the rotor is set up either through induction, as with an induction motor, or with the use of permanent magnets. For the rest of this column, we will refer only to a rotary device but the same information may be used to control a linear motor.
In a three-phase motor, the currents are controlled in each of the phase windings in such a way as to establish a magnetic field in the rotor-if this is not a permanent magnet motor-and cause the rotor to align with the field flux. Then, by properly controlling the currents in the stator field, we produce a vector that leads the shared magnetic field of the stator and rotor, which causes the rotor, and ultimately the shaft, to move. In a three-phase motor, the stator is an electromagnet made with a winding for each phase on a soft iron casting. In each winding, current may flow in a forward (positive) or reverse (negative) direction; this results in six unique steps or pole alignments. We control the amount of current that flows by either pulse width modulation (PWM) or analog means. The resolution of control actually depends on the resolution of the positioning feedback device, the current feedback, and the update rate.
The technique I have just described is called field-oriented control.
PWM versus analog
Another popular way of accomplishing the same end is to use an analog amplifier. Unfortunately, analog amplifiers are usually expensive and large compared to PWM amplifiers. In an analog amplifier, the transistors operate in their active region. They are neither fully on nor fully off. Instead, they dissipate power based upon the instantaneous voltage drop across them and the current they are supplying to the motor. These currents and voltages can be quite high.
PWM drives have an advantage in that the transistors only ever assume two states: fully on or fully off. When they are off, current flow is negligible and so, therefore, is heat. When they are on, the voltage drop across each device is only on the order of a couple of volts, so the power they dissipate is at a minimum. For this reason, PWM drives can be small, and therefore cheaper than analog.
Either way, the field-oriented control we describe is the same. It is only the last stage, in which the output values are either sent to an analog amplifier or converted to duty cycle varying pulses, that changes. Envision the output as a digital-to-analog converter (DAC), and you will have an idea of what is going on. It is only what occurs after the output at the DAC that changes.
Stator frame In a static frame-that is a frame in which we hold everything still for a moment-we see that two currents are involved in the motion of the rotor. One current, id, is associated solely with the stator flux. This is the current that induces a magnetic field in the rotor of an induction motor and, held constant, causes the rotor to align with it. With that current alone, we would have a device called a “stepper,” as its motion can be controlled by indexing the stator flux in a circular fashion. I will describe a technique shortly that does just that. This produces very little torque, however. The only torque it does produce results from the motion of the flux to the next indexed step.
The second current is 90 degrees out of phase with the first and is called the iq, or quadrature, current. This current produces a flux that either leads or trails the stator flux. If it trails the stator motion, the motor is a generator. If it leads, we have torque, and thus, a motor. The amount of iq current controls the amount of torque we have.
For more torque, you need more iq. For more rotor flux, you need more id. Knowing these two values, you can solve for the vector that represents the amount of torque in a motor. By feeding id, iq, and your command values to your PID controller, you can generate result values that may be used to correct the motion of position, velocity, or torque in your device.
But there's a catch…
At this point, let's go back and look at those three-phase currents. Remember, these transforms go both ways. We must use the forward transform to convert the currents and position for input to the PID controller and as reverse transforms to convert them back to individual phase values for output to the amplifier.
Figure 1: Three phase stator and power bridge
Figure 2: Phase currents
The Clarke transform We have two sources of information about the motor that we can use in our PID controller. One consists of the position of the rotor returned from the encoder or a similar device and the other is the current in the windings. Both are important. In order to produce values we can use to control or correct the motors operation, we need to know the current status. We need the currents and position.Because trying to control the motor using the individual phase currents is a complicated affair, we use the Clarke transform to change the reference of the three-phase currents, ia(t), ib(t), and ic(t) to currents in the two-phase orthogonal stator axis: ia and ib. This conversion is illustrated in Figure 1. Now, referring to the star-connected motor in Figure 2, we have:
which denote currents, voltages, and flux linkages. Please note that the final relationship maintains the balance of currents, voltages, or flux linkages as explained by Kirchoff's Law, that is, their sum will be zero. Anytime there is a current, voltage, or flux in one phase there must be corresponding currents, voltages or fluxes in the other two to balance it. Both the forward and reverse Park and Clarke transforms may be applied to currents, voltages, or linkages in exactly the same way. In the application described here, we use the currents we sense in the phase windings to compute new voltages for the PWM.With this in mind, the following relationship exists between a homopolar and three-phase system:
which may also be written as:
with the inverse as:
Though these two versions appear different, they are exactly the same. The real difference lies in what they communicate to the software engineer. The first, Equation 2, suggests a convolution and very likely a tighter program. The second, Equations 3 and 4, looks like an in-line operation. Generally, matrix coding and using the multiply-accumulate (MAC) instruction will produce cleaner, clearer code. The matrix notation makes it easy to see how this and the next step combine into one equation.
The Clarke transformation We can use the relationship we described involving the id and iq currents both to reflect the state of the currents in the motor and to control the field in the rotor and the torque. In general, these values may change for various conditions such as starting, accelerating, phase advance, and field weakening. But if the motor is simply to maintain a uniform speed and torque, they may not. In order to move our homopolar currents to a static frame suitable for a PID controller, we must use some sort of feedback device, such as an encoder, to detect the position of the rotor. The corresponding transform is known as the Clarke transform, but most people will know it as a simple coordinate transformation matrix:
The encoder gives us the q. Using the transform, we can create static (slowly moving) values from the instantaneous (and changing) homopolar values based on the rotor's position in the electrical revolution.
Algorithmically, this is commonly done with a lookup table. Encoders have a constant number of counts per revolution. If we divide a circle by this number, we will have the smallest arc we can measure. We can then make a table based on the sine and cosine of the angle this arc subtends. So each time we wish to update the amplifier that supplies power to the motor-a period usually called the servo update rate-we must get the current encoder position and use it to transform the id and iq values to meaningful ia and ib values.Of course, we may write this matrix in an algebraic form as well:
And the reverse transform may be expressed:
A short aside
Even though this looks efficient, take care. Depending upon the architecture of your processor, it can end up being more work because of the extra sinusoidal computations of position.
Using the algorithms
We can do this by applying a known and constant voltage vector to the stators. We do this in such a way as to cause the rotor to align with one of the poles. We use this positioning to establish our first position with the encoder and to reset the electrical position. In Table 1, you will see the eight states possible with three phases. In this table, the minus signs indicate when the bottom switches are all on; the plus signs mean that the top transistors are on.
Because there must be at least one minus sign and at least one plus sign in a single row for current to flow, only six of the states are workable. Therefore, to initialize the motor, we must choose one of the remaining six combinations and hold it constant. Under these conditions, current is flowing in the windings and the rotor will align with the stator flux. Although this will work on an induction motor, only the number of encoder counts per revolution is really required for initialization.
Next, we need to know how many encoder counts we have for each electrical revolution. If we do not know the number of encoder counts per electrical revolution, we may, at this point, deduce the number by “stepping” through the six combinations in the table sampling the encoder as we go.
At this point the electrical angle may be shifted by 90 degrees-this moves the id and iq axes apart. The rotor tends to align itself with the stator flux and the motor turns.
We must continually refresh the information about position and currents, however, or the motor will halt. These refresh points are known as servo updates. At these points, the encoder is read, along with the phase currents in the motor windings. We use the forward Park and Clarke transforms to compute the id and iq from the phase currents in the motor windings and the electrical angle. This information, along with the user control settings, is fed to the PID controller and a new (corrected) id and iq are returned. The change in notation indicates that we are actually controlling the voltages applied to the phases of the motor, as illustrated in Table 1. These values are then fed to the PWM or analog controllerThis id and iq are passed through the reverse transforms to give us new values for our phase currents. These values are then fed to the PWM controller or analog controller, as the case may necessitate.
Next month Next month, we will look at what is involved in using devices other than incremental encoders to approximate position. We will see how the DSP can calculate position given quadrature sinusoids (sinusoids that are 90 degrees out of phase) such as one might have with analog encoders and resolvers.
Don Morgan is senior engineer at Ultra Stereo Labs and a consultant with 25 years experience in signal processing, embedded systems, hardware, and software. Morgan has wrotten a book about numerical methods, featuring multi-rate signal processing and wavelets, called Numerical Methods for DSP Systems in C. He is also the author of Practical DSP Modeling, Techniques, and Programming in C, published by John Wiley & Sons, and Numerical Methods for Embedded Systems from M&T.