Advertisement
Blogs
Advertisement

The Ten Commandments of Digital Control (Part 2)

Tue, 12/27/2011 - 10:00am
Dave Wilson, Motion Products Evangelist, Texas Instruments
Dave (Wisconsin) WilsonThis week, we are counting down to the number one commandment of digital control. Yesterday I discussed more generic issues related to simulation and code generation. But today I want to turn the spotlight onto the Analog-to-Digital Converter. The ADC is one of the most critical peripherals in a digital control application, as it forms the nexus between the analog and digital worlds. It is also one of the most misunderstood peripherals. When it comes to ADCs, many engineers are content to just know the number of bits and the conversion speed. But in digital control applications, we must dig much deeper into the ADC spec if we want to achieve satisfactory results. So continuing with our countdown, here is number 8:

8. Sample often.

Unlike an analog control system, a digital controller only gets discrete moments in time to observe and respond to the system’s behavior. This can reduce system performance if your sampling frequency is too low. Imagine driving your car while texting, and you only look up once every 10 seconds to sample your surroundings! The same effect can happen with your motor control processor. If it is too busy doing other tasks, and not looking at your motor feedback signals frequently enough, your motor will crash! For position and velocity loops, the minimum sampling frequency is dictated by the mechanical poles of your system. It is common to find position and velocity loops running at sampling frequencies of around 2-5 KHz. However, most motor control designs also include current loops. The electrical poles are much higher than the mechanical poles, so sampling frequencies for the current loops are typically between 10-20 KHz. For low inductance motors, this figure can be even higher! As a general rule of thumb, you should set the sampling frequency for a particular control loop to be at least one order of magnitude higher than the unity gain frequency of that control loop’s open-loop response. If you do this, the phase lag contribution from the sample and hold effect will be less than 18 degrees at the unity-gain frequency, as shown below. This is manageable in most cases. The only downside to higher sampling frequencies is that it requires more MIPS. But don’t worry. Eat all the MIPS you want! We’ll make more! :-)

7. Sample simultaneously and synchronously.

Often the controller is required to sample several signals to get the complete picture of what’s happening in the motor. Some of these signals (like the current) can change very rapidly. To get an accurate picture of what’s going on in the motor at that exact moment, you need to sample all of these signals as closely together as possible. Imagine trying to capture a football play by photographing different parts of the field at different times, and then splicing them together. The result will probably be a very inaccurate portrayal of the actual play. But splicing together images that were taken at exactly the same time will result in a much better picture. The same thing applies to a control system with multiple inputs. That’s why most TI processors designed for digital control contain ADCs with multiple channels which can be sampled simultaneously. Also, if your system employs an encoder or resolver, the same requirement applies to it. If you are transforming your current reading via the Park transform, the captured angle information must be acquired at exactly the same time as your current readings. If not, a spatial phase error will exist with the calculated current space vector. This problem is exacerbated at higher motor speeds.

Now let’s discuss why it is so important to sample synchronously. Most motor control systems utilize PWM signals to drive the motor. This results in your input signals being contaminated with noise consisting of integral harmonics of the PWM’s carrier frequency. Fortunately, in many cases you can “alias” out all of these noise harmonics by judiciously timing your sampling intervals to be synchronous with the PWM waveform. A common example of this is shown below, where current waveforms are sampled while using center-aligned PWMs. Right in the center of either the ON pulse or the OFF pulse of the PWM signals, the current waveforms will be transitioning through their theoretical average values for that PWM cycle. To try and exactly time this moment via software is extremely difficult. That’s why most microcontrollers from TI designed for digital control applications allow the ADC to be optionally triggered by the PWM module. I will have more to say about this later in this series.

Tomorrow I have one more VERY important point to make about ADCs before moving into the digital control algorithm itself. So stay tuned, and in the meantime...

Keep those motors spinning! :-)
Advertisement

Share this Story

X
You may login with either your assigned username or your e-mail address.
The password field is case sensitive.
Loading