Papers on the Mathematical Basis for Using PWM for Sine-Wave Generation

In summary: Not an exact comparison, but here is an old 16W transformer power supply (1172 grams) and modern 12.5W switching supply (70 grams).
  • #1
maxwells_demon
41
9
TL;DR Summary
Was wondering why PWM is widely-used in present inverter technology, instead of just outright filtering a square wave? What's the mathematical basis? Or is it somehow more technologically convenient or efficient? Are there papers pointing out why they are so?
Need some sources on why PWM is widely used in inverters for DC - AC conversion applications, and their mathematical basis?

Basically, I was wondering why inverters had to use PWM, instead of just getting a square wave of let's say a 50Hz frequency and just filtering out the odd order harmonics that comprise it by using some series of low pass filters to arrive at the fundamental 50Hz sine wave? What makes PWM for Sine-Wave Generation better than outright filtering a square wave?
 
Engineering news on Phys.org
  • #2
This is a tricky question. If the filters are LC circuits (no R), what happens to the energy of the harmonics?

As for "technologically convenient", if you can make a square wave, you might as well make a PWM wave.
 
  • #3
Keith_McClary said:
This is a tricky question. If the filters are LC circuits (no R), what happens to the energy of the harmonics?

As for "technologically convenient", if you can make a square wave, you might as well make a PWM wave.

RC circuits can be passive low pass filters too. Also square waves are easier to implement from scratch than a PWM wave, all you'll need is a 555 timer and an H-bridge. You'll need at least a microcontroller to replicate a PWM with an H-bridge.

Basically I was just wondering that since a square wave can be decomposed into a fundamental frequency and its odd order harmonics, then eliminating those odd order harmonics would be a piece of cake with RC filters. So there must be something in using PWM applications to generate a sine wave that somehow makes them advantageous, since this application is widely available in the market. But for the life of me, I can't find a paper or reference that explains why this is the case? I was hoping somebody in here would be well-versed in the subject.
 
  • #4
maxwells_demon said:
But for the life of me, I can't find a paper or reference that explains why this is the case?
This link gives a clue about what's happening in PWM. The harmonic content of PWM modulation with a sine wave varies over the cycle. There is less LF than HF content near the zero crossings of the sinusoid and. near the peaks of the sinusoid, the PWM has the harmonic content of a square wave.
So it seems to me that PWM is more efficient. The mean power that flows through an LC LF filter, for a PWM waveform will be less than for a square wave. The impedance (reaction) of an LC filter at HF will limit the actual power drawn from the DC supply.
 
  • Like
Likes maxwells_demon
  • #5
sophiecentaur said:
This link gives a clue about what's happening in PWM. The harmonic content of PWM modulation with a sine wave varies over the cycle. There is less LF than HF content near the zero crossings of the sinusoid and. near the peaks of the sinusoid, the PWM has the harmonic content of a square wave.
So it seems to me that PWM is more efficient. The mean power that flows through an LC LF filter, for a PWM waveform will be less than for a square wave. The impedance (reaction) of an LC filter at HF will limit the actual power drawn from the DC supply.

ohohoho. finally. thanks lots, will read what this says.
 
  • #6
sophiecentaur said:
This link gives a clue about what's happening in PWM. The harmonic content of PWM modulation with a sine wave varies over the cycle. There is less LF than HF content near the zero crossings of the sinusoid and. near the peaks of the sinusoid, the PWM has the harmonic content of a square wave.
So it seems to me that PWM is more efficient. The mean power that flows through an LC LF filter, for a PWM waveform will be less than for a square wave. The impedance (reaction) of an LC filter at HF will limit the actual power drawn from the DC supply.

no, i don't think this link describes what i was searching for.

Basically, the PWM I'm searching for looks like this blue line:
1607020491624.png


the link describes this sort of PWM:
1607020532332.png


So I guess the search continues...
 
  • #7
A 50% duty cycle square wave contains the fundamental and all odd harmonics. A PWM square wave will not contain the lower frequency harmonics that a plain old square wave does. It is easier to filter out a PWM signal and keep the fundamental while rejecting the harmonics.
 
  • Like
Likes Baluncore
  • #8
I suspect LC filters of 150hz are large, heavy, expensive and energy consuming compared to a PWM circuit of the same power.

Not an exact comparison, but here is an old 16W transformer power supply (1172 grams) and modern 12.5W switching supply (70 grams).
S6300459.JPG
 
  • #9
Averagesupernova said:
A 50% duty cycle square wave contains the fundamental and all odd harmonics. A PWM square wave will not contain the lower frequency harmonics that a plain old square wave does. It is easier to filter out a PWM signal and keep the fundamental while rejecting the harmonics.

basically, it's this PWM output waveform that i am particularly interested in:
1607027985452.png


some papers cite this as the "idealized" dc output of an inverter. this PWM has a varied duty cycle over time, but there are points of symmetry. I'm curious as to what this PWM output's harmonic content looks like, and whether it really does get rid of harmonics better than a plain old 50% duty cycle square wave.
 
  • #10
1. The DC input voltage to the inverter is not fixed and can vary widely over each cycle.
2. The AC output load on the inverter can change rapidly within each cycle.
The PWM output can respond to both of those changes, and it can do it several hundred times in each cycle.
 
  • Like
Likes DaveE
  • #11
Many inverters require isolation from the source. In that case the isolation transformer and LPF magnetics can be much smaller if you operate PWM with a high frequency carrier. If you want to make a 50/60Hz square wave and then filter it you will have big, heavy, expensive parts.
 
  • #12
maxwells_demon said:
basically, it's this PWM output waveform that i am particularly interested in:
View attachment 273631
It is the exact same thing I am referring to.
some papers cite this as the "idealized" dc output of an inverter. this PWM has a varied duty cycle over time, but there are points of symmetry. I'm curious as to what this PWM output's harmonic content looks like, and whether it really does get rid of harmonics better than a plain old 50% duty cycle square wave.
Yes it does. Been there, done that.
 
  • #13
maxwells_demon said:
no, i don't think this link describes what i was searching for.
My point and also the point in that link I quoted, is that the spectrum of PWM is different from square wave in a way that allows more of the fundamental power through and less of the harmonic power to pass through a LP filter. That makes it more efficient. The waveform only tells part of the story.
Baluncore said:
The PWM output can respond to both of those changes, and it can do it several hundred times in each cycle.
Is that because the duty cycle can be varied / regulated over the cycle?
 
  • #14
If I did my Parseval's theorem sum correctly, roughly 76% of the energy of a square wave is in the fundamental, so that is the best any lowpass linear filter will do.
Smoothing the PWM signal can be far more efficient than that depending upon how fast you want to chop, and how much ripple you can abide.
 
Last edited:
  • Like
  • Informative
Likes DaveE, Keith_McClary and Averagesupernova
  • #15
sophiecentaur said:
Is that because the duty cycle can be varied / regulated over the cycle?
Yes. The sinusoidal theoretical PWM plotted in blue (post #9), is into an ideal load. But the PW is not predetermined, the PWM must be "lively", as it handles the real changes in real time through an error amplifier and feedback loop.

Or to put it another way...
The PWM switch with a LPF, is an efficient “energy flow throttle” that links the unregulated DC input voltage, to the unspecified load current, (with load harmonics).
The PWM switches to maintain close to a sinusoidal output voltage, independent of the variation of both the input voltage, and the output load current.
Generating a 50 Hz voltage waveform through a 10 kHz PWM gives 200 corrections per cycle. That is 50 corrections per quadrant. Each correction matches the changing DC voltage on the DC link reservoir capacitor, to the output current drawn by the load from the sinewave voltage.

A filtered 50 Hz square wave would have an amplitude dependent on the average DC input voltage. A filtered 50 Hz square wave could not produce the harmonic output currents, required by the arbitrary reactive nature of the load, without significant distortion of the output sinewave. The mass of the resonant 50 Hz filter, needed to store energy for the next cycle would be huge. The LPF for a 10 kHz PWM is much smaller and can change more rapidly.
 
  • #16
maxwells_demon said:
basically, it's this PWM output waveform that i am particularly interested in:
View attachment 273631

some papers cite this as the "idealized" dc output of an inverter. this PWM has a varied duty cycle over time, but there are points of symmetry. I'm curious as to what this PWM output's harmonic content looks like, and whether it really does get rid of harmonics better than a plain old 50% duty cycle square wave.

PWM generation of Sinewaves using that method is not as efficient as possible because the peak voltage of the sine is equal to the DC supply. What we want is to make the sine RMS value close to the DC supply. For three phase inverters the simple method for that is third harmonic injection of each voltage leg. We use PWM to generate this waveform that looks like a square-wave because we use harmonics to our advantage.
3-Figure8-1.png


With proper injection on all three legs the sine output voltage looks like this across the legs.
ThirdHarmonics.png


The peaks are higher than the DC supply.

5.jpg

Low pass filtered signals from a motor control demo using a 32-bit controller for waveform generation using PWM @ 20kHz for a sinewave of only a few Hz at the most. The high radio of carrier to signal frequency makes the filter design much easier. The center trace is the scope math function of difference between two sources.


3-phase Space Vector PWM generated from the controller before filter.

https://www.switchcraft.org/learning/2017/3/15/space-vector-pwm-intro
Fasten your seat belts and whip out your wand, because we are now heading towards the dark arts of electrical engineering.

As just shown, we are faced with a challenge with too low output voltage compared to what we really want. But we are also faced with physical limitations. Which we are going to bend. Slightly.
 
Last edited:
  • Like
Likes maxwells_demon
  • #17
maxwells_demon said:
Basically, the PWM I'm searching for looks like this blue line:
I appreciate that but that waveform shows the variation of Volts over the cycle and assumes a Voltage (zero impedance) Source. The instantaneous power delivered will depend on the the Current as well. An ideal filter will not just dissipate the power of the harmonics but present a high impedance at the harmonics, so the short-term current supplied will follow a 'smooth' curve that is near sinusoidal.
That's true for a square wave source too but the requirements for the filter are presumably easier for PWM.
Would that be because of the effect of source resistance and voltage excursions in the output stages?
I think my logic is OK here.(?)
 
  • #18
I think PWM is used because it gives the user the ability to control frequency. If you power an electric motor from the power line, you are stuck with 60 Hz in the USA, 50 Hz in much of the rest of the world. If we consider the USA only, your motor has synchronous speed of 3600 rpm, or 1800 rpm, or 900 rpm, or ... but you cannot get a synchrous speed of 1600 on a 60 Hz supply. With PWM, it can be done, and you can control your motor speed with ease.
 
  • #19
Dr.D said:
I think PWM is used because it gives the user the ability to control frequency. If you power an electric motor from the power line, you are stuck with 60 Hz in the USA, 50 Hz in much of the rest of the world. If we consider the USA only, your motor has synchronous speed of 3600 rpm, or 1800 rpm, or 900 rpm, or ... but you cannot get a synchrous speed of 1600 on a 60 Hz supply. With PWM, it can be done, and you can control your motor speed with ease.
PWM in and of itself does not give the ability to vary the frequency. This thread may have morphed into discussion about driving motors but the original question concerned advantages of approximating a sine wave with filtered PWM vs attempting to filter a 50% duty cycle square wave at the final operating frequency. There are many reasons to generate sine waves via PWM from a digitally derived source. A great many will require better filtering than a motor drive.
 
  • #20
The OP said, " Was wondering why PWM is widely-used in present inverter technology, instead of just outright filtering a square wave?" @ Averagesupernova are you saying that there are more common uses for PWM than for motor drives, even when we consider the vast number of motors thus driven today?

Averagesupernova said:
PWM in and of itself does not give the ability to vary the frequency.
In one sense, you are certainly correct; the change in frequency does not occur within the PWM operation. But it is the possibility of generating any frequency (through PWM) that makes it widely used.
 
  • #21
Dr.D said:
The OP said, " Was wondering why PWM is widely-used in present inverter technology, instead of just outright filtering a square wave?" @ Averagesupernova are you saying that there are more common uses for PWM than for motor drives, even when we consider the vast number of motors thus driven today?
I did not say that. There may be, but that's not the point

In one sense, you are certainly correct; the change in frequency does not occur within the PWM operation. But it is the possibility of generating any frequency (through PWM) that makes it widely used.
I can generate any frequency with a 555 timer IC within a useable range too and give it a 50% duty cycle after running it through a divide by 2 circuit but that doesn't make it a wise choice to attempt to drive anything with it.
 
  • #22
The advantage in using PWM is due to the fact that the waveform is essentially sampled at a higher frequency than (twice) the fundamental (mains) frequency. The samples do not vary in amplitude but they vary in duty cycle - but there's no basic difference. Single bit DACs are common and they have the same advantages as long as the higher sampling frequency required can be achieved. For mains frequencies, it's no problem. The resulting spectrum is inherently much easier to filter to produce the wanted waveform with least distortion and with least losses in the drive circuit.
 
  • #23
Averagesupernova said:
PWM in and of itself does not give the ability to vary the frequency. This thread may have morphed into discussion about driving motors but the original question concerned advantages of approximating a sine wave with filtered PWM vs attempting to filter a 50% duty cycle square wave at the final operating frequency. There are many reasons to generate sine waves via PWM from a digitally derived source. A great many will require better filtering than a motor drive.

I think the shift to PWM for motors was in response to the usage of PWM for power efficiency. If all you need is a sine wave with little power then harmonic filters for square waves might be a good design. Once you start to deal with higher power in DC to AC inverters (commonly seen in motor drivers) for any reason the advantages for PWM become apparent.

The other somewhat non-intuitive design aspect is we usually don't actually directly generate pure signal sine waves using PWM on the most power efficient designs. We actually generate a signal + harmonic(s) waveform using PWM that approximates a square signal shape with the harmonics phased to result in a sine wave across the load impedance. Harmonics are used to advantage instead of being filtered.
 
Last edited:
  • #24
@nsaspook I agree with you about power efficiency for sure. But the point is that with PWM vs filtering up a plain old square wave, filtering becomes simpler with PWM. If you want to synthesize audio frequencies over a range, say a couple of octaves, how could you filter efficiently if you start out with just a plain old square wave? The answer is that you can't. PWM might not be the first choice. You might use an 8 bit D/A convertor with a sample frequency selected so it is high enough to require a single filter that will easily remove the sample frequency. The spectrums between the two methods are similar and both greatly improved over the spectrum of a plain old square wave that will need the HECK filtered out of it.
 
  • #25
Averagesupernova said:
If you want to synthesize audio frequencies over a range, say a couple of octaves, how could you filter efficiently if you start out with just a plain old square wave?
Signal synthesis? I thought it plain that the application was power electronics. But re-reading the OP, I see that it's not explicit.

Expensive power inverters boast "true sine wave" while the cheapest ones are only half wave rectifiers.
 
  • #26
I'd say the thread started out about synthesizing a sine wave. I've tried to stay on that topic.
 
  • #27
anorlunda said:
Signal synthesis?
A rose is a rose is a rose, however you grow it. :smile: Sampling theory applies everywhere.
 
  • Like
Likes Averagesupernova
  • #28
I'd like to share a pic I snapped of the screen on my computer a while back that relates to this subject. What you are looking at is a pic shot from my cell phone of a spectral display from the program audacity running on the laptop. I wanted to show this to a friend so the quick shot with the cell phone cam was the easiest way to do it. I was generating a sine wave around 800 hertz with a sample rate of around 20 KHz. D/A convertor was an 8 bit convertor. Very simple R2R ladder. All done on a microcontroller. I simply fed this signal into the mic jack on the laptop after it was padded down to an appropriate level. No filtering. So the laptop got all the square-like steps that a sampled sine wave would have. Notice the fundamental frequency around 800 hertz. Also there are harmonics down a fair ways that go on up the spectrum. Now the big deal I want to make here is the two signals either side of the sampling frequency that are spaced by 800 * 2. This is what a PWM signal will look very similar to. Imagine filtering out the signals that are around 20 KHz while keeping the signals we want that in this case can be anything that is between 300 hertz and 3000 hertz. Very easy to do.

KIMG1143.JPG


Now imagine starting out with a square wave as the fundamental and trying to filter out everything we don't want starting with the second harmonic of the fundamental which in this case could be as low as 300 hertz. Keep in mind that THOSE harmonics will be much higher in amplitude than the ones shown in this spectral display. Now suppose we want to synthesize a signal at 800 hertz. We need to now switch in a different filter because what is appropriate as a filter when we want 300 hertz is no longer appropriate when generating 800 hertz.
 
  • #29
More than y'all probably wanted to know about the best way to minimize harmonics in a multi-level stepped waveform. If you aren't going to do high frequency PWM, you can choose the "best" time to switch your waveform.

https://vtechworks.lib.vt.edu/handle/10919/35333
 
  • Like
Likes nsaspook
  • #30
@DaveE I did notice as I dialed the fundamental frequency around harmonics would definitely change. Being tied to a fixed sample frequency it was unavoidable. It was also 'good enough'. I haven't read the link so I apologise if I misinterpret what it is about.
 
  • #31
The OP specified inverter technology (power based electronics) so that's my working premise of signal design. There are huge numbers of square wave (some are modified to use several steps from zero to peak voltages) power inverters that don't bother internally to filter square wave harmonics to something approaching a sine wave. The harmonic 'filter' is the load. For a typical AC to DC power modern switching power supply in a typical modern PC computer and monitor the shape of the incoming AC (most will also take an equivalent DC input voltage) from a inverter is usually not a problem as the incoming AC is converted to a DC power bus for high-frequency switching to the desired set of DC voltages. For the induction motors commonly seen in commercial products that square wave is usually a problem.

The load still acts as a filter but the harmonic content sees the motor winding as more of a resistive load causing overheating and excessive current from the inverter. Waveform sensitive loads like motors (reactive loads in general) really need the power efficiency and ease of signal purity PWM can deliver with proper design.

https://toshiba.semicon-storage.com/info/docget.jsp?did=61546
 
Last edited:
  • #32
Averagesupernova said:
@DaveE I did notice as I dialed the fundamental frequency around harmonics would definitely change. Being tied to a fixed sample frequency it was unavoidable. It was also 'good enough'. I haven't read the link so I apologise if I misinterpret what it is about.
That's exactly it. People like to move the noise away from the carrier, typically minimizing the 3rd or maybe the first several harmonics. Depends on the application and your filtering, of course. The common application is to keep big motors from getting hot; they really don't need great sinewaves after all.

BTW, I didn't read it either. I would bet only about 4 people have actually read through the whole thing. I stumbled across it looking for a much simpler article I remembered about this in one of those free magazines (Electronic Design, EDN, Power Technology, etc.).

Also, here's an odd one, a mix of PWM and multi-level. And no, I didn't really read this one either. I just linked to it for the waveform pictures.
https://www.researchgate.net/publication/326700690_Harmonics_reduction_of_a_five-level_inverter_by_unbalanced_carriers_and_over-modulation_techniques
 
  • #33
DaveE said:
More than y'all probably wanted to know about the best way to minimize harmonics in a multi-level stepped waveform. If you aren't going to do high frequency PWM, you can choose the "best" time to switch your waveform.

https://vtechworks.lib.vt.edu/handle/10919/35333
In the first page, they show a 3 bit ADC (7 level) output which is a lot harder to make at high power without very low efficiency. So PWM is clearly a better option.
The detailed spectrum of a PWM waveform will have components which are spaced by the basic sampling frequency, with sidebands of the wanted mains frequency. That's the same idea as for a multi-level ADC. The point is that the only low frequency component will be the 50 or 60 Hz mains and there will be a large gap to the first of the comb of frequencies due to the sampling.
I don't understand why there would be a problem with the motor dissipating the power of the sampling products because (probably?) they could be filtered out. But it may be that filter inductors components would be as lossy as a motor core if they are to handle seriously high powers.The 'worst' low harmonic content will be for square wave as there's no advantage from the 'sampling'. I don't know if a highly super-sampled one bit ADC would be a contender??
 
  • #34
Off topic a bit but while discussing sampling, built up sine waves by stepping, etc, I thought I'd mention something that I found interesting. When the sample frequency was very high in comparison to the desired synthesized waveform, a significant number of steps no longer had a period of the sample frequency. In other words, the changing voltage of the desired signal occurred so slow that one sample to the next did not cause a step in the waveform. This causes activity in the spectrum at half the sampling frequency. This sort of work was outside of my normal area so it was a bit surprising at the time. But, it shouldn't have as it is really just basic math.
 
  • #35
Averagesupernova said:
a significant number of steps no longer had a period of the sample frequency.
What exactly do you mean by this? Is it a time or frequency domain statement? Are you saying that, near max and min values, the quantised samples don't change in (digital) amplitude? This isn't surprising if the baseband waveform changes less than 1 bit.
Overall, it's a modulation effect. The sample frequency component (and its harmonics) is modulated by the baseband signal. Each comb frequency will have sidebands which will have the same basic structure as the baseband signal. If a single tone is being A/D coded (or synthesised) then the detailed sideband structure will be simpler and sidebands 'frozen'.
 

Similar threads

  • Electrical Engineering
Replies
10
Views
699
Replies
16
Views
1K
  • Electrical Engineering
Replies
1
Views
3K
Replies
7
Views
4K
Replies
139
Views
4K
Replies
5
Views
2K
  • Electrical Engineering
Replies
1
Views
3K
  • Electrical Engineering
Replies
10
Views
7K
  • Electrical Engineering
Replies
1
Views
2K
  • Electrical Engineering
Replies
11
Views
5K
Back
Top