Output filter for PWM sine-wave inverter / modulator - Page 1
Forum section: electronics / general

author: adammunich
author_rank: Contributor
timestamp: October 14, 2020, 06:52:46 am
content: As some of you in CA may know, Pacific Graft & Extortion has been fumbling the ball these past few years and personally, I've had it with their power outages, absurd charges, and incompetence. I want to take the 250+ kWh of lithium batteries I have in the shed and give them a little competition.So, I began work on an inverter, or rather, software-controlled h-bridge, to take an HVDC bus and turn it into something useful my appliances can use. But now, I must choose some output filtering technique.It looks like what most people use is a pair of LC single ended filters on the two phases, followed by a common mode (coupled-inductor) choke across the phases. This begs the question,1. Is this really the best way to do this? It feels... elementary?2. What is the purpose of the coupled inductor choke? I don't see how noise it would filter, could be generated by any other means than having some kind of absurdly mismatched propagation delay between the switches. Especially in a battery system, where, it is physically impossible to have current flow from one terminal to "earth" unless there is some kind of fault between the battery shell and "earth". I_out must equal I_in... unless your battery is a magic battery that can accumulate unbalanced charges.Cheers

author: fourtytwo42
author_rank: Super Contributor
timestamp: October 14, 2020, 07:20:47 am
content: I assume when talking of two phases you are talking about the us system of household electricity distribution, namely center tapped 220V ?In any case the normal output filter configuration for a simple single phase pwm is LC, as a 50/60hZ sine wave is being synthesized the corner frequency is considerably higher to avoid distortion yet also considerably lower than the carrier, in my case where the latter is 25Khz the corner frequency (from memory) of the LC filter is 3Khz.Common mode filtering will always be required to limit EMI and everything has capacitance to ground hence the generation of common mode noise. Some techniques can be used to limit the amount of EMI filtering required such as various means of soft switching (ZVS, resonant etc) vs hard switching that is the worst yet simplest.

author: adammunich
author_rank: Contributor
timestamp: October 14, 2020, 07:26:09 am
content: My first attempt will only be single-phase, 110V, 50A. I suppose I should have clarified, by phases here, I mean, "pairs of mosfets", as I am used to working on 3ph motor control.I figured I would target 100 kHz as my PWM frequency and have the corner frequency of the LC filter be sub-5 kHz. But naturally, this would mean very large magnetics, which I am hoping to reduce as much as possible.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: October 14, 2020, 07:36:23 am
content: 1. Yes, but you're missing some parts.You need a current sensor (a Hall effect sensor is a fine choice), which feeds back to the control circuit, so that the transistors can be turned off when load current rises too far. This is done in a proportional fashion, so that output current is always under control, regardless of what the output voltage is being pulled around to (such as from short circuits, but also if mains happens to get cross-wired to it).You can use the same basic PWM modulator circuit. A control voltage is compared to a ramp waveform, and the result of the comparison is driven to the inverter. The control voltage is set by a current error amplifier, which "compares" output current to another control voltage.This sounds pretty useless because we want a constant 120V or whatever output, well that's fine we can just set the current control voltage with one last error amp. This compares output voltage to a final input control voltage, which we wire to a sine wave oscillator or whatever.So we use two error amps and one comparator, plus the ramp generator and a signal source, to do full control.For the error amps, I put "compare" in quotes, because it's not a digital comparison (if ((input_p - input_n) > 0) output = '1' else output = '0'), but a subtraction and a time-dependent gain (an integrator, with some tweaks). That is, for a small input difference, the output might change immediately by a proportional amount, then over time, it continues to change, at a ramp rate also proportional to the input. Bigger input error = bigger response, no input = output stays put. Always a controlled response.The best feature of this scheme is, we can set the scale factor for the control voltages, such that the maximum possible output range from the previous stage, simply commands the full nominal output from a given stage. That is, say the voltage error amp saturates at +/-5V (which it will do when it sees the output is very far from where it needs to be; say the output is shorted: it will call for maximum possible output current, trying to force the voltage up from zero). Well, we can set the current error amp so that +/-5V input is, say, +/-30A output (which should be about enough peak capacity for a 120V 15A outlet, say). And then we can design the inverter to handle those 30A forever and ever, with no worry about it overheating or exploding or anything. (Or if not forever, then with enough time to soak it up before a thermal cutout detects it, or etc.)Then just do it twice, to get +/-120V split phase. Simple enough.Keep in mind there is also additional logic, for controlling voltage and current in certain ways, to deal with various load conditions including reactive loads, open circuit, or harmonic distortion or backfeeding (if you ever want to make it a grid-tie inverter, which, probably not, there's a bunch more stuff to consider for the various operating modes those can do; but you could, if you're feeling really ambitious). You'll have to figure that out yet...2. There are many sources of CM noise, partly just the residual that passes the normal-mode filters, but also ground-loop crap from non-ideal routing/layout, capacitive coupling from switching nodes to ground (especially the low-side drain tab to heatsink), etc.Simple way to do it, just get one of those line filter blocks, the kind with free terminals on it. Just wire it up. I'd say a panel-mount receptacle, but heh, you'd be using the IEC or whatever receptacle backwards, which wouldn't be great.The filters by the way, need some damping. Instead of just an LC for the switching filter, consider putting an R+C2 in parallel with the C, with C2 >= 2.5 C and R = sqrt(L/C). This accounts for the lack of termination resistance -- mains loads in general aren't something you can depend upon having losses, at switching frequencies. A space heater would be okay, but a motor, transformer or switching supply, who knows? A filter always needs some termination or damping resistance somewhere. Also, you aren't getting it from the inverter -- it has an extremely low output resistance (about Rds(on)).Can also be a good idea to put a R||L in series with the output, which similarly decouples and dampens the filter from a heavy capacitive load, or short circuit. Same R, and L some modest fraction of the other one; but in this case, you don't want to go overboard with the L, because it has to carry load current, and its reactance (yes even at 60Hz) has a little voltage drop, costing performance. Best practice, do a series of simulations with all kinds of equivalent loads, and tweak the R, L and C to get adequate filtering in all cases.The CM filter doesn't usually need as much damping, because it has a high impedance, and a lossy core. It can help to use 'Y' caps with ferrite beads, to introduce some losses at high frequencies, or an R+C to dampen it in the same way as before.TimEd: oh good, you work with motor control, so a fair bit of this should be old hat.

author: f4eru
author_rank: Super Contributor
timestamp: October 14, 2020, 11:36:22 pm
content: to reduce the size, why not use two cascaded filters ?Also, one easy thing to do is to concentrate PWM switching onto a single side of the bridge, letting the other side witch only when the polarity changes -> only one heavy filter needed.Also one thing done to pass EMC is to spread out the switching frequency some 10% or so.This doesn't really lower global EMC, but gives you a better chance for compliance.

author: KaneTW
author_rank: Frequent Contributor
timestamp: October 14, 2020, 11:40:10 pm
content: You can use subharmonic elimination PWM to push the harmonics further out, at the cost of more switching losses. That might help simplifying filter design.

author: adammunich
author_rank: Contributor
timestamp: October 15, 2020, 01:10:19 am
content: Thanks for the replies folks!@T3sl4co1l, Yes I am well-versed in DSP particularly with sensorless motor control. I am hoping this project will be a lot less frustrating since most variables are directly, rather than indirectly observable.@f4eru, Do you mean spread-spectrum PWM clockrate? If so, I really like the idea. I used the same trick to reduce noise on a backlight driver circuit before when I was working on AR headsets. But, it may not be so simple to do in the STM32F4, as I use the PWM timer to trigger all my control loop routines@KaneTW, Thank you, I will look into these techniques.I put together this falstad circuit we can run some experiments with: so far I chose simple values for a differential mode filter and have no common-mode choke following it. As I expected the common mode noise is pretty low, since these are ideal parts there in theory, should be nothing there. But maybe if we add some parasitic components we'll see more?Uncoupled Inductors:https://tinyurl.com/y228a7etCoupled Inductors:https://tinyurl.com/y62aj6wt

author: f4eru
author_rank: Super Contributor
timestamp: October 15, 2020, 03:14:19 pm
content: frequency spreading doesnßt reduce EMC. But it reduces the amplitude of EMC peaks registering on a small bandwidth instrument.

author: jonpaul
author_rank: Super Contributor
timestamp: October 24, 2020, 03:46:03 pm
content: Adammunich: Terminology:I think you mean a common-mode choke with 2 windings of 1:1 ratio with each side of the line.Coupled inductor is usually used in SMPS topologies like flyback using a 2 winding inductor.In the bridge, Both CM and DM noise is generated.Careful CM choke design can provide the DM mode inductance as well.Check stock parts like from Coilcraft, TDK or other production magnetics firms.Bon chance,Jon