Not a member?

# Discussion Groups | Comp.DSP | Filtering for a Inverter PWM Driver

There are 8 messages in this thread.

You are currently looking at messages 1 to .

Is this discussion worth a thumbs up?

0

# Filtering for a Inverter PWM Driver - Anand P. Paralkar - 2012-08-25 05:56:00

```Hi,

I am referring to two app. notes from Microchip -

1. PICREF-1
2. AN1279

These app.notes deal with making a Un-interruptible Power Supply.

I see that both these app. notes use a (digital) filter (in the control
software) to drive the PWM.  The PWM is used to generate the sine wave
output from the inverter.  Here's the flow:

1. Sample output voltage.
2. Compare with sine PWM reference table.
3. Calculate the error.
4. *Filter the error*.
5. Use the filter output as the PWM pulse width.

I am not able to make out the exact sampling rate used for filter in
step 4.  But the two possible sampling rates are 32*50 Hz and 64*50 Hz
(50 Hz being the desired output frequency).  When I do the discrete to
continuous conversion (using a "d2c" in Matlab), these two possibilities
lead to a gain crossover frequency of 50 Hz or 100 Hz.  (Obviously.) (By
the gain crossover frequency, I mean the frequency at which the gain of
the filter falls to 0 dB.)

My question is, what seems more appropriate? - Does one write a filter
for a sine-PWM output with a gain crossover frequency for the desired
frequency (50 Hz) or for twice the desired frequency (100 Hz).

Thanks,
Anand

Here's the code:

numd=[0.09261 0.09261];  %coefficients from PICREF-1.
dend=[1 -1];
ffP;
fsÿ*32;  %or 64
Ts=1/fs;
sysd=tf(numd,dend,Ts);
syscÒc(sysd)

and it's result:

Transfer function:
0.09261 s + 296.4
-----------------
s

>> 296.4/(2*3.142)

ans
47.1674
```
______________________________

# Re: Filtering for a Inverter PWM Driver - Tim Wescott - 2012-08-26 15:17:00

```On Sat, 25 Aug 2012 15:26:59 +0530, Anand P. Paralkar wrote:

> Hi,
>
> I am referring to two app. notes from Microchip -
>
>    1. PICREF-1
>    2. AN1279
>
> These app.notes deal with making a Un-interruptible Power Supply.
>
> I see that both these app. notes use a (digital) filter (in the control
> software) to drive the PWM.  The PWM is used to generate the sine wave
> output from the inverter.  Here's the flow:
>
>    1. Sample output voltage.
>    2. Compare with sine PWM reference table. 3. Calculate the error.
>    4. *Filter the error*.
>    5. Use the filter output as the PWM pulse width.
>
> I am not able to make out the exact sampling rate used for filter in
> step 4.  But the two possible sampling rates are 32*50 Hz and 64*50 Hz
> (50 Hz being the desired output frequency).  When I do the discrete to
> continuous conversion (using a "d2c" in Matlab), these two possibilities
> lead to a gain crossover frequency of 50 Hz or 100 Hz.  (Obviously.) (By
> the gain crossover frequency, I mean the frequency at which the gain of
> the filter falls to 0 dB.)
>
> My question is, what seems more appropriate? - Does one write a filter
> for a sine-PWM output with a gain crossover frequency for the desired
> frequency (50 Hz) or for twice the desired frequency (100 Hz).
>
> Thanks,
> Anand
>
> Here's the code:
>
>    numd=[0.09261 0.09261];  %coefficients from PICREF-1. dend=[1 -1];
>    ffP;
>    fsÿ*32;  %or 64
>    Ts=1/fs;
>    sysd=tf(numd,dend,Ts);
>    syscÒc(sysd)
>
> and it's result:
>
>    Transfer function:
>    0.09261 s + 296.4
>    -----------------
>            s
>
>    >> 296.4/(2*3.142)
>
>    ans >
>       47.1674

Without actually looking at the app notes in question (so these comments
may be howlingly inappropriate), there's really two different goals you
may be wanting to pursue:

One: you're trying to control the harmonics of the output to get a nice
clean sine wave.  In this case, you'd want a total loop gain with a
crossover frequency well above the line frequency (and 2x is not well
above).

Two: you're trusting to circuit design (or luck) to control the
harmonics, and you're just interested in controlling the RMS voltage
out.  In this case raising the loop-closure frequency is nice, but not
super necessary.

Without knowing the gains in the rest of the system I couldn't say for
sure, but the fact that the sampling rate is well above the line
frequency points to the possibility that they're trying to control
harmonics (even though 64x the line frequency is only going to let them
control up to the 6th harmonic with any real reliability).

If you really want to analyze the loop behavior you need to do three
things:

1: come up with a difference equation that describes the behavior of the
circuit from the PWM command back to the ADC.

2: make a z-domain model of it

3: ditch the discrete-to-continuous approximation, and just do your
control design in the z domain.  It ain't hard: Bode, Nyquist, Evans root
locus and factoring polynomials for stability all work as well in the z
domain as in Laplace.

3a: The controller in question started life as a simple analog
integrator.  Some applications engineer opened a book on digital control
systems design to the middle, found the Tustin approximation, and applied
it without knowing why, and got H(z) = 0.0463 * (0.5 * (z + 1)/(z - 1)).
It doesn't even make sense to do a discrete-to-continuous time conversion
of that, as the zero "frequency" maps to infinity.

3b: There's some small possibility that H(z) above is the result of
subtle genius and not naive design.  I very much doubt it.  I once helped
hire a guy who had been a Microchip applications engineer, writing app
digital control systems, and had, in fact, recommended an integrator
algorithm that is used when you've got a known function you want to
integrate, but only adds tons of complexity and delay in a real system.
And I'm not knocking the guy: he was an excellent software engineer who
I'd hire in a minute for nearly any embedded programming job, but he had
no background in digital control.

If Microchip has continued on the path of using good software guys who
are out of their depth in digital control, then the H(z) you have would
be the exact result of translating an analog circuit into a digital
design.

--
My liberal friends think I'm a conservative kook.
My conservative friends think I'm a liberal kook.
Why am I not happy that they have found common ground?

Tim Wescott, Communications, Control, Circuits & Software
http://www.wescottdesign.com
```
______________________________

# Re: Filtering for a Inverter PWM Driver - Anand P. Paralkar - 2012-08-27 08:35:00

```On 27-08-2012 00:47, Tim Wescott wrote:
>
> Without actually looking at the app notes in question (so these comments
> may be howlingly inappropriate), there's really two different goals you
> may be wanting to pursue:
>
> One: you're trying to control the harmonics of the output to get a nice
> clean sine wave.  In this case, you'd want a total loop gain with a
> crossover frequency well above the line frequency (and 2x is not well
> above).
>
> Two: you're trusting to circuit design (or luck) to control the
> harmonics, and you're just interested in controlling the RMS voltage
> out.  In this case raising the loop-closure frequency is nice, but not
> super necessary.
>
> Without knowing the gains in the rest of the system I couldn't say for
> sure, but the fact that the sampling rate is well above the line
> frequency points to the possibility that they're trying to control
> harmonics (even though 64x the line frequency is only going to let them
> control up to the 6th harmonic with any real reliability).
>
> If you really want to analyze the loop behavior you need to do three
> things:
>
> 1: come up with a difference equation that describes the behavior of the
> circuit from the PWM command back to the ADC.
>
> 2: make a z-domain model of it
>
> 3: ditch the discrete-to-continuous approximation, and just do your
> control design in the z domain.  It ain't hard: Bode, Nyquist, Evans root
> locus and factoring polynomials for stability all work as well in the z
> domain as in Laplace.
>
> 3a: The controller in question started life as a simple analog
> integrator.  Some applications engineer opened a book on digital control
> systems design to the middle, found the Tustin approximation, and applied
> it without knowing why, and got H(z) = 0.0463 * (0.5 * (z + 1)/(z - 1)).
> It doesn't even make sense to do a discrete-to-continuous time conversion
> of that, as the zero "frequency" maps to infinity.
>
> 3b: There's some small possibility that H(z) above is the result of
> subtle genius and not naive design.  I very much doubt it.  I once helped
> hire a guy who had been a Microchip applications engineer, writing app
> notes for digital control.  He had the most superficial knowledge about
> digital control systems, and had, in fact, recommended an integrator
> algorithm that is used when you've got a known function you want to
> integrate, but only adds tons of complexity and delay in a real system.
> And I'm not knocking the guy: he was an excellent software engineer who
> I'd hire in a minute for nearly any embedded programming job, but he had
> no background in digital control.
>
>    If Microchip has continued on the path of using good software guys who
> are out of their depth in digital control, then the H(z) you have would
> be the exact result of translating an analog circuit into a digital
> design.
>

Hi Tim,

Thanks for looking into this.  I was hoping to get your response.

When controlling harmonics, did you mean to say we need the crossover
well *below* the 2X frequency?  If I understand correctly, we want to
exclude, not include the harmonics.  (I see that the loop response is
that of a low pass filter.)

I forgot to mention, the PWM output is applied to an LC filter so as to
change the rectangular waveform to a sine waveform, before the output is

I agree that if the intention was to eliminate the harmonics, then I
really don't know how setting the crossover frequency to 2X is going to
help.  (I posted this question because I couldn't figure out where else
this filter is helping.)

Do you think this has something to do with stability?  Say applying or
vice-versa)?

I really wish someone who has designed a sine-PWM based inverter can
throw some light onto this.

Wish you a great day.

Thanks,
Anand

```
______________________________

# Re: Filtering for a Inverter PWM Driver - Tim Wescott - 2012-08-27 10:44:00

```On Mon, 27 Aug 2012 18:05:34 +0530, Anand P. Paralkar wrote:

> On 27-08-2012 00:47, Tim Wescott wrote:
>>
>> Without actually looking at the app notes in question (so these
>> comments may be howlingly inappropriate), there's really two different
>> goals you may be wanting to pursue:
>>
>> One: you're trying to control the harmonics of the output to get a nice
>> clean sine wave.  In this case, you'd want a total loop gain with a
>> crossover frequency well above the line frequency (and 2x is not well
>> above).
>>
>> Two: you're trusting to circuit design (or luck) to control the
>> harmonics, and you're just interested in controlling the RMS voltage
>> out.  In this case raising the loop-closure frequency is nice, but not
>> super necessary.
>>
>> Without knowing the gains in the rest of the system I couldn't say for
>> sure, but the fact that the sampling rate is well above the line
>> frequency points to the possibility that they're trying to control
>> harmonics (even though 64x the line frequency is only going to let them
>> control up to the 6th harmonic with any real reliability).
>>
>> If you really want to analyze the loop behavior you need to do three
>> things:
>>
>> 1: come up with a difference equation that describes the behavior of
>> the circuit from the PWM command back to the ADC.
>>
>> 2: make a z-domain model of it
>>
>> 3: ditch the discrete-to-continuous approximation, and just do your
>> control design in the z domain.  It ain't hard: Bode, Nyquist, Evans
>> root locus and factoring polynomials for stability all work as well in
>> the z domain as in Laplace.
>>
>> 3a: The controller in question started life as a simple analog
>> integrator.  Some applications engineer opened a book on digital
>> control systems design to the middle, found the Tustin approximation,
>> and applied it without knowing why, and got H(z) = 0.0463 * (0.5 * (z +
>> 1)/(z - 1)). It doesn't even make sense to do a discrete-to-continuous
>> time conversion of that, as the zero "frequency" maps to infinity.
>>
>> 3b: There's some small possibility that H(z) above is the result of
>> subtle genius and not naive design.  I very much doubt it.  I once
>> helped hire a guy who had been a Microchip applications engineer,
>> writing app notes for digital control.  He had the most superficial
>> an integrator algorithm that is used when you've got a known function
>> you want to integrate, but only adds tons of complexity and delay in a
>> real system. And I'm not knocking the guy: he was an excellent software
>> engineer who I'd hire in a minute for nearly any embedded programming
>> job, but he had no background in digital control.
>>
>>    If Microchip has continued on the path of using good software guys
>>    who
>> are out of their depth in digital control, then the H(z) you have would
>> be the exact result of translating an analog circuit into a digital
>> design.
>>
>>
> Hi Tim,
>
> Thanks for looking into this.  I was hoping to get your response.
>
> When controlling harmonics, did you mean to say we need the crossover
> well *below* the 2X frequency?  If I understand correctly, we want to
> exclude, not include the harmonics.  (I see that the loop response is
> that of a low pass filter.)

If you want to forcibly generate a clean sine wave, you'll have a
sinusoidal look-up table in software, to which you servo the output
voltage with a loop with a bandwidth much higher than the line frequency.

> I forgot to mention, the PWM output is applied to an LC filter so as to
> change the rectangular waveform to a sine waveform, before the output is

Check the values.  An LC filter big enough to turn a 50Hz square wave
into a 50Hz sine wave is going to be humongous.  Are you sure it's not
just there to filter out the PWM frequency?

> I agree that if the intention was to eliminate the harmonics, then I
> really don't know how setting the crossover frequency to 2X is going to
> help.  (I posted this question because I couldn't figure out where else
> this filter is helping.)
>
> Do you think this has something to do with stability?  Say applying or
> vice-versa)?

Yes, using feedback here is for the purpose of stabilizing the supply
against load changes.  Using feedback should make the output much more
stable.

> I really wish someone who has designed a sine-PWM based inverter can
> throw some light onto this.

Yup.  I know theory, but I don't know what all has been done in
practice.  There's a world of possibilities; by this time maybe most have
been tried.

--
Tim Wescott
Control system and signal processing consulting
www.wescottdesign.com
```
______________________________

# Re: Filtering for a Inverter PWM Driver - Andre - 2012-08-27 11:24:00

```On 26.08.2012 21:17, Tim Wescott wrote:
> On Sat, 25 Aug 2012 15:26:59 +0530, Anand P. Paralkar wrote:
>
>> Hi,
>>
>> I am referring to two app. notes from Microchip -
>>
>>     1. PICREF-1
>>     2. AN1279
>>
>> These app.notes deal with making a Un-interruptible Power Supply.
>>
>> I see that both these app. notes use a (digital) filter (in the control
>> software) to drive the PWM.  The PWM is used to generate the sine wave
>> output from the inverter.  Here's the flow:
>>
>>     1. Sample output voltage.
>>     2. Compare with sine PWM reference table. 3. Calculate the error.
>>     4. *Filter the error*.
>>     5. Use the filter output as the PWM pulse width.
>>
>> I am not able to make out the exact sampling rate used for filter in
>> step 4.  But the two possible sampling rates are 32*50 Hz and 64*50 Hz
>> (50 Hz being the desired output frequency).  When I do the discrete to
>> continuous conversion (using a "d2c" in Matlab), these two possibilities
>> lead to a gain crossover frequency of 50 Hz or 100 Hz.  (Obviously.) (By
>> the gain crossover frequency, I mean the frequency at which the gain of
>> the filter falls to 0 dB.)
>>
>> My question is, what seems more appropriate? - Does one write a filter
>> for a sine-PWM output with a gain crossover frequency for the desired
>> frequency (50 Hz) or for twice the desired frequency (100 Hz).
>>
-snip-
> One: you're trying to control the harmonics of the output to get a nice
> clean sine wave.  In this case, you'd want a total loop gain with a
> crossover frequency well above the line frequency (and 2x is not well
> above).
>
> Two: you're trusting to circuit design (or luck) to control the
> harmonics, and you're just interested in controlling the RMS voltage
> out.  In this case raising the loop-closure frequency is nice, but not
> super necessary.

Three: It may want to sync to mains voltage before switching back when
mains power resumes

-snip-
```
______________________________

# Re: Filtering for a Inverter PWM Driver - Anand P. Paralkar - 2012-08-27 13:07:00

```On 27-08-2012 20:14, Tim Wescott wrote:
> On Mon, 27 Aug 2012 18:05:34 +0530, Anand P. Paralkar wrote:
>
>> On 27-08-2012 00:47, Tim Wescott wrote:
>>>
>>> Without actually looking at the app notes in question (so these
>>> comments may be howlingly inappropriate), there's really two different
>>> goals you may be wanting to pursue:
>>>
>>> One: you're trying to control the harmonics of the output to get a nice
>>> clean sine wave.  In this case, you'd want a total loop gain with a
>>> crossover frequency well above the line frequency (and 2x is not well
>>> above).
>>>
>>> Two: you're trusting to circuit design (or luck) to control the
>>> harmonics, and you're just interested in controlling the RMS voltage
>>> out.  In this case raising the loop-closure frequency is nice, but not
>>> super necessary.
>>>
>>> Without knowing the gains in the rest of the system I couldn't say for
>>> sure, but the fact that the sampling rate is well above the line
>>> frequency points to the possibility that they're trying to control
>>> harmonics (even though 64x the line frequency is only going to let them
>>> control up to the 6th harmonic with any real reliability).
>>>
>>> If you really want to analyze the loop behavior you need to do three
>>> things:
>>>
>>> 1: come up with a difference equation that describes the behavior of
>>> the circuit from the PWM command back to the ADC.
>>>
>>> 2: make a z-domain model of it
>>>
>>> 3: ditch the discrete-to-continuous approximation, and just do your
>>> control design in the z domain.  It ain't hard: Bode, Nyquist, Evans
>>> root locus and factoring polynomials for stability all work as well in
>>> the z domain as in Laplace.
>>>
>>> 3a: The controller in question started life as a simple analog
>>> integrator.  Some applications engineer opened a book on digital
>>> control systems design to the middle, found the Tustin approximation,
>>> and applied it without knowing why, and got H(z) = 0.0463 * (0.5 * (z +
>>> 1)/(z - 1)). It doesn't even make sense to do a discrete-to-continuous
>>> time conversion of that, as the zero "frequency" maps to infinity.
>>>
>>> 3b: There's some small possibility that H(z) above is the result of
>>> subtle genius and not naive design.  I very much doubt it.  I once
>>> helped hire a guy who had been a Microchip applications engineer,
>>> writing app notes for digital control.  He had the most superficial
>>> an integrator algorithm that is used when you've got a known function
>>> you want to integrate, but only adds tons of complexity and delay in a
>>> real system. And I'm not knocking the guy: he was an excellent software
>>> engineer who I'd hire in a minute for nearly any embedded programming
>>> job, but he had no background in digital control.
>>>
>>>     If Microchip has continued on the path of using good software guys
>>>     who
>>> are out of their depth in digital control, then the H(z) you have would
>>> be the exact result of translating an analog circuit into a digital
>>> design.
>>>
>>>
>> Hi Tim,
>>
>> Thanks for looking into this.  I was hoping to get your response.
>>
>> When controlling harmonics, did you mean to say we need the crossover
>> well *below* the 2X frequency?  If I understand correctly, we want to
>> exclude, not include the harmonics.  (I see that the loop response is
>> that of a low pass filter.)
>
> If you want to forcibly generate a clean sine wave, you'll have a
> sinusoidal look-up table in software, to which you servo the output
> voltage with a loop with a bandwidth much higher than the line frequency.
>
>> I forgot to mention, the PWM output is applied to an LC filter so as to
>> change the rectangular waveform to a sine waveform, before the output is
>
> Check the values.  An LC filter big enough to turn a 50Hz square wave
> into a 50Hz sine wave is going to be humongous.  Are you sure it's not
> just there to filter out the PWM frequency?
>
>> I agree that if the intention was to eliminate the harmonics, then I
>> really don't know how setting the crossover frequency to 2X is going to
>> help.  (I posted this question because I couldn't figure out where else
>> this filter is helping.)
>>
>> Do you think this has something to do with stability?  Say applying or
>> vice-versa)?
>
> Yes, using feedback here is for the purpose of stabilizing the supply
> against load changes.  Using feedback should make the output much more
> stable.
>
>> I really wish someone who has designed a sine-PWM based inverter can
>> throw some light onto this.
>
> Yup.  I know theory, but I don't know what all has been done in
> practice.  There's a world of possibilities; by this time maybe most have
> been tried.
>
Tim,

The LC filter at the inverter output is to filter out anything having a
frequency higher than a 50 Hz sine wave.  (The output from the voltage
inverter is not a 50 Hz square wave, its a sine wave in a PWM format and
the PWM has a relatively high switching frequency.  So then, the LC
filter is not all that large.  Yeah, 50 Hz square wave would have been
crazy big!)

Indeed, the software has a sine look-up table.  Could you please
elaborate on "to which you servo the output voltage with a loop with a
bandwidth much higher than the line frequency"?  I really trying to
understand what determines (or what should determine) the loop bandwidth.

Thanks once again,
Anand
```
______________________________

# Re: Filtering for a Inverter PWM Driver - Tim Wescott - 2012-08-27 15:00:00

```On Mon, 27 Aug 2012 22:37:04 +0530, Anand P. Paralkar wrote:

> On 27-08-2012 20:14, Tim Wescott wrote:
>> On Mon, 27 Aug 2012 18:05:34 +0530, Anand P. Paralkar wrote:
>>
>>> On 27-08-2012 00:47, Tim Wescott wrote:
>>>>
>>>> Without actually looking at the app notes in question (so these
>>>> comments may be howlingly inappropriate), there's really two
>>>> different goals you may be wanting to pursue:
>>>>
>>>> One: you're trying to control the harmonics of the output to get a
>>>> nice clean sine wave.  In this case, you'd want a total loop gain
>>>> with a crossover frequency well above the line frequency (and 2x is
>>>> not well above).
>>>>
>>>> Two: you're trusting to circuit design (or luck) to control the
>>>> harmonics, and you're just interested in controlling the RMS voltage
>>>> out.  In this case raising the loop-closure frequency is nice, but
>>>> not super necessary.
>>>>
>>>> Without knowing the gains in the rest of the system I couldn't say
>>>> for sure, but the fact that the sampling rate is well above the line
>>>> frequency points to the possibility that they're trying to control
>>>> harmonics (even though 64x the line frequency is only going to let
>>>> them control up to the 6th harmonic with any real reliability).
>>>>
>>>> If you really want to analyze the loop behavior you need to do three
>>>> things:
>>>>
>>>> 1: come up with a difference equation that describes the behavior of
>>>> the circuit from the PWM command back to the ADC.
>>>>
>>>> 2: make a z-domain model of it
>>>>
>>>> 3: ditch the discrete-to-continuous approximation, and just do your
>>>> control design in the z domain.  It ain't hard: Bode, Nyquist, Evans
>>>> root locus and factoring polynomials for stability all work as well
>>>> in the z domain as in Laplace.
>>>>
>>>> 3a: The controller in question started life as a simple analog
>>>> integrator.  Some applications engineer opened a book on digital
>>>> control systems design to the middle, found the Tustin approximation,
>>>> and applied it without knowing why, and got H(z) = 0.0463 * (0.5 * (z
>>>> + 1)/(z - 1)). It doesn't even make sense to do a
>>>> discrete-to-continuous time conversion of that, as the zero
>>>> "frequency" maps to infinity.
>>>>
>>>> 3b: There's some small possibility that H(z) above is the result of
>>>> subtle genius and not naive design.  I very much doubt it.  I once
>>>> helped hire a guy who had been a Microchip applications engineer,
>>>> writing app notes for digital control.  He had the most superficial
>>>> recommended an integrator algorithm that is used when you've got a
>>>> known function you want to integrate, but only adds tons of
>>>> complexity and delay in a real system. And I'm not knocking the guy:
>>>> he was an excellent software engineer who I'd hire in a minute for
>>>> nearly any embedded programming job, but he had no background in
>>>> digital control.
>>>>
>>>>     If Microchip has continued on the path of using good software
>>>>     guys who
>>>> are out of their depth in digital control, then the H(z) you have
>>>> would be the exact result of translating an analog circuit into a
>>>> digital design.
>>>>
>>>>
>>> Hi Tim,
>>>
>>> Thanks for looking into this.  I was hoping to get your response.
>>>
>>> When controlling harmonics, did you mean to say we need the crossover
>>> well *below* the 2X frequency?  If I understand correctly, we want to
>>> exclude, not include the harmonics.  (I see that the loop response is
>>> that of a low pass filter.)
>>
>> If you want to forcibly generate a clean sine wave, you'll have a
>> sinusoidal look-up table in software, to which you servo the output
>> voltage with a loop with a bandwidth much higher than the line
>> frequency.
>>
>>> I forgot to mention, the PWM output is applied to an LC filter so as
>>> to change the rectangular waveform to a sine waveform, before the
>>> output is given to the load.
>>
>> Check the values.  An LC filter big enough to turn a 50Hz square wave
>> into a 50Hz sine wave is going to be humongous.  Are you sure it's not
>> just there to filter out the PWM frequency?
>>
>>> I agree that if the intention was to eliminate the harmonics, then I
>>> really don't know how setting the crossover frequency to 2X is going
>>> to help.  (I posted this question because I couldn't figure out where
>>> else this filter is helping.)
>>>
>>> Do you think this has something to do with stability?  Say applying or
>>> vice-versa)?
>>
>> Yes, using feedback here is for the purpose of stabilizing the supply
>> against load changes.  Using feedback should make the output much more
>> stable.
>>
>>> I really wish someone who has designed a sine-PWM based inverter can
>>> throw some light onto this.
>>
>> Yup.  I know theory, but I don't know what all has been done in
>> practice.  There's a world of possibilities; by this time maybe most
>> have been tried.
>>
> Tim,
>
> The LC filter at the inverter output is to filter out anything having a
> frequency higher than a 50 Hz sine wave.  (The output from the voltage
> inverter is not a 50 Hz square wave, its a sine wave in a PWM format and
> the PWM has a relatively high switching frequency.  So then, the LC
> filter is not all that large.  Yeah, 50 Hz square wave would have been
> crazy big!)

Is it to filter out anything higher than 50Hz, or is it to filter out the
ripple from the PWM?

In a classic class-D amplifier (which is one way to make a sine wave
inverter), the output filter is there to filter out the PWM, and not much
else.

> Indeed, the software has a sine look-up table.  Could you please
> elaborate on "to which you servo the output voltage with a loop with a
> bandwidth much higher than the line frequency"?

Well, it's pretty much what I said.  You want to generate a nice clean
sine wave, so you design a feedback amplifier (that happens to have a
stage with a PWM and an LC filter) and you drive it from a nice clean
sine wave command.

In order for the output to be that nice clean sine wave in the face of
nonlinear loads, your bandwidth has to be such that the amplifier has low
output impedance at frequencies well above the sine wave frequency.  In
order to get that low impedance, you need a high bandwidth.

> I really trying to
> understand what determines (or what should determine) the loop
> bandwidth.

What _physically_ determines the loop bandwidth is the component parts:
the PWM generator, the H-bridge (or half H-bridge) itself, the LC filter,
the ADC, and the control algorithm.

What the loop bandwidth _ought_ to be has innumerable inputs: that
decision is part and parcel of the whole systems design, and is impacted
by circuit choices in the switching amplifier, the processor
capabilities, and (not least) regulatory requirements and the desired
performance of the inverter under load.

--
My liberal friends think I'm a conservative kook.
My conservative friends think I'm a liberal kook.
Why am I not happy that they have found common ground?

Tim Wescott, Communications, Control, Circuits & Software
http://www.wescottdesign.com
```
______________________________

# Re: Filtering for a Inverter PWM Driver - 2012-08-27 18:40:00

```On Mon, 27 Aug 2012 14:00:06 -0500, Tim Wescott <t...@seemywebsite.com>
wrote:

>On Mon, 27 Aug 2012 22:37:04 +0530, Anand P. Paralkar wrote:
>
>> On 27-08-2012 20:14, Tim Wescott wrote:
>>> On Mon, 27 Aug 2012 18:05:34 +0530, Anand P. Paralkar wrote:
>>>
>>>> On 27-08-2012 00:47, Tim Wescott wrote:
>>>>>
>>>>> Without actually looking at the app notes in question (so these
>>>>> comments may be howlingly inappropriate), there's really two
>>>>> different goals you may be wanting to pursue:
>>>>>
>>>>> One: you're trying to control the harmonics of the output to get a
>>>>> nice clean sine wave.  In this case, you'd want a total loop gain
>>>>> with a crossover frequency well above the line frequency (and 2x is
>>>>> not well above).
>>>>>
>>>>> Two: you're trusting to circuit design (or luck) to control the
>>>>> harmonics, and you're just interested in controlling the RMS voltage
>>>>> out.  In this case raising the loop-closure frequency is nice, but
>>>>> not super necessary.
>>>>>
>>>>> Without knowing the gains in the rest of the system I couldn't say
>>>>> for sure, but the fact that the sampling rate is well above the line
>>>>> frequency points to the possibility that they're trying to control
>>>>> harmonics (even though 64x the line frequency is only going to let
>>>>> them control up to the 6th harmonic with any real reliability).
>>>>>
>>>>> If you really want to analyze the loop behavior you need to do three
>>>>> things:
>>>>>
>>>>> 1: come up with a difference equation that describes the behavior of
>>>>> the circuit from the PWM command back to the ADC.
>>>>>
>>>>> 2: make a z-domain model of it
>>>>>
>>>>> 3: ditch the discrete-to-continuous approximation, and just do your
>>>>> control design in the z domain.  It ain't hard: Bode, Nyquist, Evans
>>>>> root locus and factoring polynomials for stability all work as well
>>>>> in the z domain as in Laplace.
>>>>>
>>>>> 3a: The controller in question started life as a simple analog
>>>>> integrator.  Some applications engineer opened a book on digital
>>>>> control systems design to the middle, found the Tustin approximation,
>>>>> and applied it without knowing why, and got H(z) = 0.0463 * (0.5 * (z
>>>>> + 1)/(z - 1)). It doesn't even make sense to do a
>>>>> discrete-to-continuous time conversion of that, as the zero
>>>>> "frequency" maps to infinity.
>>>>>
>>>>> 3b: There's some small possibility that H(z) above is the result of
>>>>> subtle genius and not naive design.  I very much doubt it.  I once
>>>>> helped hire a guy who had been a Microchip applications engineer,
>>>>> writing app notes for digital control.  He had the most superficial
>>>>> recommended an integrator algorithm that is used when you've got a
>>>>> known function you want to integrate, but only adds tons of
>>>>> complexity and delay in a real system. And I'm not knocking the guy:
>>>>> he was an excellent software engineer who I'd hire in a minute for
>>>>> nearly any embedded programming job, but he had no background in
>>>>> digital control.
>>>>>
>>>>>     If Microchip has continued on the path of using good software
>>>>>     guys who
>>>>> are out of their depth in digital control, then the H(z) you have
>>>>> would be the exact result of translating an analog circuit into a
>>>>> digital design.
>>>>>
>>>>>
>>>> Hi Tim,
>>>>
>>>> Thanks for looking into this.  I was hoping to get your response.
>>>>
>>>> When controlling harmonics, did you mean to say we need the crossover
>>>> well *below* the 2X frequency?  If I understand correctly, we want to
>>>> exclude, not include the harmonics.  (I see that the loop response is
>>>> that of a low pass filter.)
>>>
>>> If you want to forcibly generate a clean sine wave, you'll have a
>>> sinusoidal look-up table in software, to which you servo the output
>>> voltage with a loop with a bandwidth much higher than the line
>>> frequency.
>>>
>>>> I forgot to mention, the PWM output is applied to an LC filter so as
>>>> to change the rectangular waveform to a sine waveform, before the
>>>> output is given to the load.
>>>
>>> Check the values.  An LC filter big enough to turn a 50Hz square wave
>>> into a 50Hz sine wave is going to be humongous.  Are you sure it's not
>>> just there to filter out the PWM frequency?
>>>
>>>> I agree that if the intention was to eliminate the harmonics, then I
>>>> really don't know how setting the crossover frequency to 2X is going
>>>> to help.  (I posted this question because I couldn't figure out where
>>>> else this filter is helping.)
>>>>
>>>> Do you think this has something to do with stability?  Say applying or
>>>> vice-versa)?
>>>
>>> Yes, using feedback here is for the purpose of stabilizing the supply
>>> against load changes.  Using feedback should make the output much more
>>> stable.
>>>
>>>> I really wish someone who has designed a sine-PWM based inverter can
>>>> throw some light onto this.
>>>
>>> Yup.  I know theory, but I don't know what all has been done in
>>> practice.  There's a world of possibilities; by this time maybe most
>>> have been tried.
>>>
>> Tim,
>>
>> The LC filter at the inverter output is to filter out anything having a
>> frequency higher than a 50 Hz sine wave.  (The output from the voltage
>> inverter is not a 50 Hz square wave, its a sine wave in a PWM format and
>> the PWM has a relatively high switching frequency.  So then, the LC
>> filter is not all that large.  Yeah, 50 Hz square wave would have been
>> crazy big!)
>
>Is it to filter out anything higher than 50Hz, or is it to filter out the
>ripple from the PWM?
>
>In a classic class-D amplifier (which is one way to make a sine wave
>inverter), the output filter is there to filter out the PWM, and not much
>else.
>

You will normally also want to filter out the harmonics of the
fundamental PWM frequency.  The output will have harmonics and will
cause EMI.  Running into an inductance or leakage inductance of a
transformer, which is common, will cause the waveform current to be a
triangle wave.  Can't get rid of the harmonics but can certainly  help
them.

boB

>> Indeed, the software has a sine look-up table.  Could you please
>> elaborate on "to which you servo the output voltage with a loop with a
>> bandwidth much higher than the line frequency"?
>
>Well, it's pretty much what I said.  You want to generate a nice clean
>sine wave, so you design a feedback amplifier (that happens to have a
>stage with a PWM and an LC filter) and you drive it from a nice clean
>sine wave command.
>
>In order for the output to be that nice clean sine wave in the face of
>nonlinear loads, your bandwidth has to be such that the amplifier has low
>output impedance at frequencies well above the sine wave frequency.  In
>order to get that low impedance, you need a high bandwidth.
>
>> I really trying to
>> understand what determines (or what should determine) the loop
>> bandwidth.
>
>What _physically_ determines the loop bandwidth is the component parts:
>the PWM generator, the H-bridge (or half H-bridge) itself, the LC filter,
>the ADC, and the control algorithm.
>
>What the loop bandwidth _ought_ to be has innumerable inputs: that
>decision is part and parcel of the whole systems design, and is impacted
>by circuit choices in the switching amplifier, the processor
>capabilities, and (not least) regulatory requirements and the desired
>performance of the inverter under load.
```
______________________________