Electronic Design
A Multi-Level Approach Makes Understanding Motor Control Easier

A Multi-Level Approach Makes Understanding Motor Control Easier

Regardless of their primary field, sooner or later, most designers have to deal with motor controls. Broadly speaking, there are two methods to incorporating these components in your design. First, designers can start with one of the many choices of microcontrollers that are available and then address the challenges of making the control do what they want. Or second, designers can start at the other end and examine the interaction between motors and controllers—what goes into and comes out of the feedback loops, for example.

LEVEL 1: HEURISTICS
Ignoring the subtleties, it’s reasonable to say that a variable-speed ac drive system rectifies the incoming ac and pulsewidth modulates the output voltage and frequency of a three-phase power inverter, which it applies to the motor. A closed-loop controller calculates switching frequency and voltage required to achieve any desired speed and torque, based on control signals and various inputs from the motor.

In operation, the controller executes initialization and diagnostic instructions in a power-up sequence. Then, the motor is started and run with the control loop open until the back electromotive force (EMF) reaches a minimum level, at which point the control loop is closed.

It would be fairly easy to write a control algorithm that used feedback from a resolver to indicate the rotor’s mechanical position at any time, but it proves expensive to implement. Given economies of scale, and a fast enough computing engine, software is cheaper. Moreover, the control task can be accomplished simply by sampling voltages and currents.

Borrowing from some general information about motor control on the Analog Devices Web site, the basic pulse-widthmodulation (PWM) motor-control loop includes a system control interface block that provides I/O via some communications protocol link (Fig. 1). A number of isolation devices will separate the digital controller and its grounds from the rest of the circuit.

The controller itself can be a microcontroller, FPGA, DSP, or custom logic. Following the motor-control device and its isolation, a gate driver and the power devices apply the PWM drive to the motor itself. The power devices can be MOSFETs or insulated gate bipolar transistors (IGBTs).

For voltage and current sensing, one or more analog-to-digital converters (ADCs) monitor voltage and current for each of the motor’s phases. In the case of a three-phase motor, this might be a six-channel, simultaneously sampling ADC. Given the relatively low switching frequencies, it often employs a successive-approximation register (SAR) architecture with a 250-ksample/s sampling speed or greater, providing 12 or more bits of resolution per channel.

There also will be a current-sense amplifier and ADC to monitor the MOSFET or IGBT output current. As a result, the controller can shut down the drive if the motor starts to draw excess current, as it would if the motor stalled or shorted a winding.

LEVEL 2: BASICS VECTOR AND FIELD-ORIENTED CONTROL
In vector control, the stator phase currents are digitized and converted into a corresponding complex (space) vector, which is then transformed to a coordinate system rotating with the machine’s rotor. It isn’t necessary to use a resolver to obtain the rotor position, since position can then be obtained by integrating the shaft speed.

A rotor flux linkage vector can be estimated based on the stator current vector and the magnetizing inductance. Then, using the rotor flux linkage vector, the stator current vector can be transformed into a coordinate system whose real axis is aligned with the rotor flux linkage vector. This makes it possible to use the real-axis component of the stator current vector in the rotating coordinate system to control the rotor flux linkage while the imaginary y-axis component is used to control torque.

The most efficient approach to vector control is field-oriented control (FOC). In an FOC feedback loop, an algorithm in the controller digitizes the stator phase currents and converts them to a complex vector. By integrating the speed of the rotating vector, it’s possible to extract shaft position information, producing a rotating vector that’s stationary with respect to the position of the machine’s rotor. That part eliminates the need for a resolver on the motor shaft.

Next, the rotor flux linkage vector is estimated by multiplying the stator current vector with magnetizing inductance and lowpass- filtering the result with the rotor no-load time constant, i.e., the ratio of the rotor inductance to rotor resistance. Using this rotor flux linkage vector, the stator current vector is further transformed into a coordinate system where the real x-axis is aligned with the rotor flux linkage vector.

Now the real x-axis component of the stator current vector in this rotor flux-oriented coordinate system can be used to control the rotor flux linkage, while the imaginary y-axis component would control the motor torque. Typically, proportional integrated (PI) controllers control these currents to their reference values. But bang-bang-type current control, which provides better dynamics, is also possible.

The controllers’ outputs are the x-y components of the voltage-reference vector for the stator. Usually due to the cross coupling between the x- and y-axes, a decoupling term is further added to the controller output to improve control performance when there are big and rapid changes in speed, current, and flux linkage.

Generally, to avoid destabilization caused by by switching noise, the PI controller also needs lowpass filtering at either its input or output. Unfortunately, the filtering also limits the dynamics of the control system. To deal with this, designers will use quite high switching frequencies (typically more than 10 kHz).

Next, the voltage references are transformed to the stationary coordinate system. Subsequently, they’re fed into a modulator that uses one of the many PWM algorithms that defines the required pulse widths of the stator phase voltages and controls the transistors (usually IGBTs) of the inverter.

LEVEL 3: FOC IN DETAIL
FOC is based on three major points: the machine current and voltage space vectors, the transformation of a three-phase speed and time-dependent system into a two-coordinate time-invariant system, and effective PWM pattern generation.

Control of the stator currents is based on projections that transform the three-phase time- and speed-dependent system (the digitized time-varying currents and voltages) into a two-coordinate time-invariant system, represented by d and q coordinates. FOC starts with two reference constants: torque (aligned with the q coordinate) and flux (aligned with the d coordinate).

In the (d,q) reference frame, torque (m) varies with ΨR × iSq, where ΨR is the constant rotor flux and iSq is the torque component of the stator current vector.

What’s required is first to represent the combined current of the three phases of the motor windings as a vector sum in 3D phase space. The second step is to successively apply two mathematical transforms—the Clarke transformation and the Park (dq0) transformation.

The Clarke transformation outputs a two-coordinate time-variant system in terms of α and ß. The Park transformation turns that into a two-coordinate time-invariant system in terms of the direct and quadrature axes.

It’s not necessary to develop the code to accomplish this every time there’s a need to design a motor controller. According to Texas Instruments, its applications teams have worked out the code that will accomplish all of this painlessly on a TMS320 DSP chip (Fig. 2). Applications engineers with other chip vendors are equally happy to assist.

It’s only necessary to measure the instantaneous currents in two of the motor phases (ia and ib). These are processed through the Clarke and Park transforms (Fig. 3) and compared in separate PI controllers to the control inputs: the flux reference (iSdref) and torque reference (iSqref). The error signal is applied to an inverse of the Park transform process, and the resulting time-varying signals control the PWM.

In other words, the outputs of the inverse transform are the components of the stator vector voltage in the α, ß stationary orthogonal reference frame. These are the inputs of a “space vector” (SV) PWM circuit. (Analysis of space vector switching in three-phase circuits is more or less what R.H. Park intended the dq0 transform to simplify when he conceived it in 1929.)

Something is still missing in this explanation, though. It’s absolutely necessary to know the motor’s rotor flux position, because the variable of the rotor flux must be aligned with the d-axis. And, that’s different depending on whether one is dealing with a synchronous motor (rotor flux speed is the same as rotor speed) or an induction motor (there is slip as a function of torque).

As noted earlier, in a synchronous motor, rotor flux position can be determined by integration of rotor speed. In an induction machine, a current model that employs certain equations of the motor model in the d,q reference frame must be applied. That’s significantly beyond the scope of this explanation, and even TI refers designers to three conference papers—two of which are in Italian!

THE MICROCONTROLLER
What microcontroller do I use for motor control, and how do I get it to work? That’s often the question a designer or manager asks when confronted with a motor. Unfortunately, the answer is difficult because the parameters and options vary significantly. There are dozens of different motors, from brushless dc (BLDC) to multiphase ac motors. In some cases, many 8-bit micros are overkill, while at the other end of the spectrum a 32-bit DSP may be sucking wind trying to deliver the desired electric motor control. However, during the decision-making process, many designers are finding that there’s a lack of understanding about the complexity of motor control, even at the low end of the compute spectrum.

“Motor-control engineers are some of the most frustrated engineers I know,” says Dave Wilson, motion products specialist for Freescale. “Most managers don’t understand or appreciate the sophistication required to make the motor shaft go ‘round and round.’ To complicate matters, design times are getting shorter all the time, which puts further pressure on the engineer to release the product earlier. It is critical that vendors understand this phenomenon and respond by making the design process easier and quicker from start to finish.”

Motors are no longer just turned on and off. Ramping speed up and down are critical to power efficiency and motor lifetime. Luckily, microcontroller vendors targeting motor-control applications are providing the sophisticated algorithms as sample source code or runtime libraries.

For example, Texas Instruments includes the StellarisWare Peripheral Driver library in ROM in most of its flash-based Cortex- M3 Stellaris microcontrollers. Designers can use their own algorithms. But more often, these standard libraries provide the needed sophistication and only require basic configuration. Still, there’s always room for improvement.

“I was working on a new running control algorithm and noticed that my startup routine (forced ramp-up to speed) was being tripped up by something,” says Ward Brown, staff applications engineer with the Security, Microcontroller and Technology Division at Microchip Technology. “On closer inspection, I noticed that my running algorithm was trying to take control before my startup routine was completed. On a hunch, I took out the startup routine altogether, and voila! Unexpected success. I discovered that my new running control algorithm was self-starting. Not only that, it started much better than my forced startup ever did.”

CHIPS TARGET MOTORS
These days, designers usually choose from microcontrollers designed specifically for motor-control applications. Some have PWM timers with a granularity in the picosecond range. Dead-time control, another feature that’s common for multiphase PWM support, separates the start and top times of timers (Fig. 4). This requirement is common in an H-bridge application, where the pair of PWM signals controls complementary transistors. Turn both transistors on at the same time even for a fraction of a second, and the short circuit can fry the electronics.

Microcontrollers that use feedback mechanisms as sensorless BLDC motor-controller designs often synchronize peripherals. Though this can be done in software, going the hardware route will reduce processor overhead and can lower performance requirements, allowing for a less expensive core. Dedicated hardware configurations abound, but programmer-configurable systems are becoming more common.

Companies such as Atmel, Energy Micro, Microchip, and Silicon Labs have peripherals with programmable trigger interconnects. This enables scenarios with an analog comparator input that triggers a timer that, in turn, triggers an ADC to capture an analog signal and convert it to a digital value. The processor doesn’t get an interrupt until the value is ready. In a software-only implementation, the processor would be interrupted three times and have to manually start each peripheral in response to the interrupt.

Cypress Semiconductor’s PSoC 3 and 5 lines include programmable analog and digital blocks in addition to an 8051 or Cortex-M3 processors (see “Field-Programmable I/O Augments 8-Bit Microcontroller”). These blocks can be linked together, including basic state machine support for standalone operation (Fig. 5). Cypress doesn’t have a separate product line for motor control since every chip is customizable.

Don’t overlook speciality controllers. For example, the Renesas 100-MHz, 200 MIPS, 32-bit SH7286 is designed to control a pair of motors (see “Mechatronics Means Motors”). It includes hardware to make the job easier.

The bottom line when choosing a micro is to check out all of the options. There are many motor-control applications that even the sophisticated programmable system-on- a-chip (PSoC) block configuration can’t handle, such as where floating-point precision is required. In this case, the high-end DSPs are often the best solution for multiphase motor-control applications.

COORDINATED NETWORKED MOTORS
It’s easy to overlook other aspects of a system when concentrating on motor-control designs. But these days, communications play a big part. Tim Resker, product marketing manager for Blackfin in industrial instrumentation, notes that Analog Devices is “seeing a trend toward integration of real-time Ethernet controllers with motor control.” Developers are becoming more aware of timing-related standards such as IEEE 1588 on Ethernet.

Resker also sees more intelligence per node and sometimes multiple motors being controlled by one chip. Adding communication to the mix adds overhead. But with augmented hardware, the processors often have plenty of headroom to handle even a Web server. Coordinated communication between motor-control nodes for emergency shutdown and with a central controller tend to be standard fare.

“Software engineers who focus strictly on writing motor-control code will be out of work within a decade,” says Dave Wilson, motion products specialist for Freescale. “As ‘model-to-code’ tools become more sophisticated and reliable, more engineers are turning to the CAD tools to actually generate the code. In contrast, motor-control system engineers will be in high demand, as there will be a need for individuals who understand the design problem from a system level and to input the problem to the computer.”

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish