Motor Rotation Control
Increasingly, motor controls are passed over in favor of DSP control. Here's a primer on the behaviors that can be controlled.
Motors , of all sizes and shapes, are so common that how they are controlled is a subject often taken for granted. Nevertheless, the principles involved in causing a motor to turn and controlling its motion are by no means trivial. This is complicated by the existence of so many different kinds of motors. Not only do these motors sometimes involve different principles of operation, but may possess different physical implementations as well, some quite exotic.
This month, we will begin a description of the Park and Clarke algorithms common in both the analysis and control of DSP-based motion controllers. Because attempting to launch even an elementary description of these algorithms is impossible without knowing some basics about motors and their control, we will have to spend some time studying concepts and mechanisms that some may find unfamiliar.
The DSP is bringing the power of mathematics to a great number of machine tool applications, making it quite popular in this area. For that reason, it is rapidly replacing the older analog controls, providing greater freedom and precision. Today, high-end motion control involves signal processing, in both the time and frequency domains.
The field of motion control is a wide one, and there is not enough room here to describe all of its myriad implementations. So I will start with a simple application involving single- and three-phase permanent magnet motors and, from there, form the basis of operation for an induction motor.
The terms and concepts involved in motion control can be a bit daunting if you are new to the area, so we will take it a step at a time. We will also keep it simple. If you are interested in more detailed discussions, please refer to the Web links at the end of the column.
A magnetic pole creates a field in the space around it that exerts a force on other magnetic materials. This field is usually conceived in the form of lines of induction, which indicate the direction of the field. A popular method of viewing these lines of induction is to place a magnet beneath a piece of paper and sprinkle the surface of the paper with iron filings. Another name for these lines of force is flux.
Magnets have an affinity for certain kinds of metal. Called ferrous metals, the electrons in these types of metals have a tendency to align themselves with the north-south orientation of the magnet. In other words, placing a piece of such a metal near a magnet turns the metal into a magnet, in a sort of sympathetic action.Poles of opposite polarities attract one another. Placing the magnets on a tabletop, you can drag one around by bringing the second one close enough to establish a magnetic link. You can also push the other magnet around by rotating the pair so that similar poles are oriented toward one another.
It's not hard to see that if you fix one magnet on a pivot and bring another close enough to establish a link, you can cause the magnet on the pivot to rotate as you move the other one. This is a basic motor action.
The rotor (the magnet on the pivot) may be a magnet or an electromagnet. An electromagnet is a device in which an electric current passes through a wire coil wrapped around a soft iron (ferrous) core to produce a magnetic field. The strength of the magnetic field depends on the number of turns made by the coil of wire, the amount of current passing through the wire, and the magnetic permeability of the core. Electromagnets lose their magnetism when the current is discontinued.
As I have noted, we can cause the rotor to turn by leading its motion with another magnet. To create a motor we replace the other magnet with an electromagnet, which we call a stator. The stator forms a ring, or shell, around the rotor and is wrapped with wire to form the electromagnet. The trick is to control the flow of current in the stator so that the flux rotates through it in a circular fashion, taking the rotor with it.
In a single-phase permanent magnet motor, the iron core wrapped with wire forms a shell around a moving rotor. The stator is an electromagnet, and the rotor is a permanent magnet. Current flows in one direction in the stator, forcing the rotor to rotate as it tries to align with the electromagnetic flux. At a certain point in the rotation, the field is reversed and the rotor continues to turn, in an attempt to realign itself with the new field orientation. The switching that causes the current to change in the stator is called commutation. Commutation is commonly done with carbon contacts called brushes, or with semiconductors on brushless motors.
There are two ways of conceiving rotational speed. The most immediate is to think of it as a measure of how fast the shaft of the motor can complete one entire revolution, or 360 degrees. The other, more important concept-at least as far as motion control is concerned-is the electrical speed. It may already be apparent from the discussion that a complete electrical revolution occurs when the poles return to their original position relative to the stator. In a single-phase motor with a single pole-pair, this is the entire revolution of the rotor, but on motors with multiple pole pairs, a complete revolution is actually 360 degrees divided by the number of pole-pairs.
Controlling the wave of flux
The usual implementation employs a three-phase bridge (also called a power bridge) using transistors instead of mechanical switches. For a more concrete picture, refer to Figure 1. In the figure, we use switches instead of transistors. As you can see, the three-phase bridge is a parallel combination of three half-bridges in series with a DC voltage source. Each half-bridge is a series connection of two switches, one above the other. Each of the three windings is connected to the common point of a half-bridge.
In this configuration, a top and bottom switch are never closed simultaneously. This would cause a short circuit with all the current flowing back to the battery instead of to the motor and probably blowing fuses, or worse. Instead, when a top switch is “on”- current is flowing from the positive side of the voltage source into the winding-the bottom switch is forced off and when the top switch is off, the bottom switch is made to be on. The “on” time controls the amount of current that actually flows through the windings. This time is controlled so that only the desired amount of power is delivered to the motor. When the off-time equals the on-time, no current is flowing in the windings of the motor.
The technique used to drive a motor in this configuration is called pulse width modulation (PWM). A PWM signal is a binary signal-it has two states-in which the on-time (the time during which the signal is “on”) is used to control a load. To get an idea of how this works, imagine a null state. For PWM, this would be a 50% duty cycle-that is, half the time the signal is one and half the time it is zero. If the on-time is greater than the off-time, the signal is positive and if the off-time is greater than the on-time, the signal is negative.
In the three-phase power bridge in Figure 1, we call the time the upper switch in any phase is closed the “on time.” In the same manner, we call the time the lower switch is closed the “off time.” In the case of a three-phase motor, each of the phases is controlled by a PWM signal that is 120 degrees out of phase with the other two.The on-time and off-time are functions of the power you deliver to the motor and the desired position of the flux in the motor. The switching is also sequenced so that the current will flow in the motor windings relative to the desired direction of rotation. By sequencing the switching through the combinations, you can create a wave of magnetic flux that rotates around the stator and carries the rotor with it.
Components of motion
Consider the components of the angular motion of a motor from a static frame whose reference point is the stator flux. In the simplest terms, controlling the rate at which the flux rotates through the stator also controls the angular motion of the rotor or the speed with which it turns.
The goal is to create a sinusoidal current in the coils and generate a rotating field. We can do this with a DC source because (as in Figure 1) the windings are inductive. Modulating the duty cycle of the on-times of the switches (top and bottom) allows the current to build and decay in such a way as to form a sinusoidal current. And, with three phases, we can produce eight combinations, which allows finer control over the flux magnitude and position than with a single-phase motor.
There are two components to this motion of which we need to be aware: the direct and quadrature components. Let's suppose we have a permanent magnet motor (though an induction motor, which we will look at shortly, is only a little different). If we supply a current to the stator, the rotor will turn so that the two fields (stator and rotor) align. The direct component is aligned with the stator flux-it is the component that describes the amount of stator flux aligned with rotor flux. Using this, we can accomplish simple motion by “stepping” the flux around the stator as we would with a step motor.
To obtain torque, we make use of the quadrature component. The quadrature component leads the direct component by 90 degrees and advances the motion of the rotor in proportion to the value we assign it. As a note, if we allow the quadrature component to lag by 90 degrees, the motor becomes a generator supplying current rather than using it. A situation such as this can occur during rapid decelerations, so it's a good idea to place a voltage-sensing circuit and resistor (called a regeneration resistor) across the DC bus. When the voltage on the bus goes high enough to damage the circuit, the resistor will limit that voltage to a reasonable value.
The direct and quadrature components control the behavior of the rotor in a motor. But if a permanent magnet motor has magnets on the rotor, of what value is the direct component? Not much.The major difference between a permanent magnet motor and an induction motor is the rotor. On an induction motor, the rotor is also an electromagnet and must be magnetized before it can move or develop torque. Here the direct value is used to establish the rotor flux.
Whatever the type of motor, however, these two components exist, forming a frame that rotates with the flux around the stator. On a permanent magnet motor, the direct component may be set to zero, while the quadrature component is used to generate torque. On an induction motor, the direct component becomes much more powerful in terms of controlling torque and speed.
Next month we will see how these two values translate back into the real world and work with the PI loop and generate PWM for the motor.The following two links-one for Texas Instruments and one for Analog Devices-deal with this subject more technically and in greater depth. Both provide application notes and code for particular processors:
Don Morgan is a senior engineer at Ultra Stereo Labs and a consultant with 25 years of experience in signal processing, embedded systems, hardware, and software. Morgan recently completed 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.