Saturday, October 26, 2013

Harmonic Elimination PWM Comparison and Uses

I've been doing a series about how to calculate the switching times of harmonic elimination PWM waveforms and I thought it was time to compare HEPWM to another method and look at how it can be used.  To catch up on the theory so far, have a look at the rest of the series.


All the code for this post can be found here.

A simple well known method for generating PWM waveforms is to compare a sawtooth wave to the desired signal and set the value of the PWM waveform high whenever the signal is higher than the sawtooth wave.  It gives reasonably good results, but I'd like to know how it compares to the HEPWM method when it comes to controlling harmonics.  When you're switching power loads there will be switching losses.  Ideally you want to minimise the amount of switching you do, but it comes with the price of not being able to control harmonic distortion as well.  It's one of those engineering trade-offs you have to make based on your design.  So to be fair and compare apples with apples, both the PWM and HEPWM waveforms below each have 40 switching transitions per cycle.  This means that switching losses should be equal and we can compare them using other metrics.


Waveform
A half cycle of the PWM waveform is generated as mentioned above.  This and an inverted copy of it are concatenated to produce a full wave.
PWM Waveform
Although the generated waveform is inverted (my bad) it's hard to tell it apart from the HEPWM wave below.  Upon closer inspection you can see that the switching times are different, but on first glance everything looks the same.
PWM Waveform
Below is the real test.  The HEPWM waveform knocks out the harmonics right up to the 20th harmonic, whereas the basic PWM signal only kills the harmonics up to the 10th before they start creeping up.  This may be fine for what you're doing, but if you absolutely need to control certain harmonics, HEPWM is the way to go.  It might mean that your output filter is cheaper, or lighter, or takes up less space.  If you need to control a specific harmonic, HEPWM can do it.  It may be an issue with EMC you have to take care of.  If for some reason the geometry of the enclosure you're using is letting a certain frequency through, taking care of that in software rather than adding more shielding is going to save yourself a headache.
FFT of a PWM Waveform
FFT of a PWM Waveform
HEPWM also allows you to easily control the magnitude of the output while controlling harmonics.  If you're making a power inverter, ideally you want to run at nearly full magnitude to get the most out of your design, but you can still trim the output if you need to.  The graph below shows how you can pre-compute switching time for different magnitudes.  While running, the magnitude can be changed by selecting the set of switching times for the desired output magnitude.
Switching Times
HEPWM has some disadvantages, it's only useful in situations where you can pre-calculate the waveform.  It's not going to work with a signal like audio.  It's suited to power inverters and other niche applications where you want to reduce harmonics of a simple waveform like 50/60 Hz mains power.  It may not be for everything, but when the situation does call for it you've now got the right tool for the job.

To learn more I encourage you to read this thesis by Yu Yang.  It gives an overview of some other switching techniques and goes into a little more depth on some of the details.

4 comments:

  1. I have installed Octave on my Linux Mint 17 box, and downloaded your Octave scripts. They don't run yet but I'll keep at it. Thanks very much for this valuable resource!

    ReplyDelete
  2. The link http://www.ee.kth.se/php/modules/publications/reports/2007/XR-EE-EME_2007_004.pdf is bad.

    ReplyDelete
    Replies
    1. Thanks for the Info. I've updated the post with a cached version I had saved.

      Delete

Note: Only a member of this blog may post a comment.