Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Plant Feeder Power Quality & Reactive Compensation

A 415V industrial feeder with a lagging motor and a 6-pulse VFD, simulated in pure Python (no Simulink, no MATLAB), to see how a plain capacitor bank can actually make harmonics worse, and why a detuned filter is the fix that's usually recommended instead.

python power_quality_analysis.py

The problem

Plants get penalized twice: once for low power factor, and again for the harmonic distortion VFDs dump onto the line. The obvious fix for PF is to drop in a capacitor bank, but that's a known trap — the bank can resonate with the source inductance and end up amplifying the harmonics instead of just correcting PF. The real fix puts a reactor in series with it, detuned so that resonance doesn't happen.

System modeled

  • 415V/50Hz, single-phase equivalent of a balanced 3-phase feeder
  • Source: Rs = 0.5 mΩ, Ls = 0.05 mH (typical LV transformer secondary)
  • 30 kW motor at 0.78 lagging PF (steady-state fundamental only)
  • 6-pulse VFD rectifier, ~15 kVA, harmonics h = 6k±1 with I_h ≈ I_1/h (standard result, Mohan/Undeland/Robbins)

Before any of that gets simulated, Step 1 checks the harmonic generator against that theory (5th ≈ 20%, 7th ≈ 14.3%, even/triplen ≈ 0), and the rest of the script won't run if it fails. After that, the feeder is just a phasor circuit solved one harmonic at a time: the VFD acts as a current source, and its harmonic current splits between the source impedance and whatever's connected in parallel, following the ordinary current-divider rule. It's the same relationship in every case — it just blows up under the naive capacitor and settles down under the detuned filter, depending on what that parallel branch looks like.

Results

Case THD Displacement PF True PF Total kVA
Baseline 8.36% 0.882 0.879 51.21
Naive capacitor 9.99% 0.960 0.955 47.11
Detuned filter (7%) 8.91% 0.965 0.961 46.84

Full table in results/compensation_comparison.csv, plots in plots/.

The naive ~202µF bank needed to hit 0.96 PF puts the resonance at 1583 Hz, which is order 31.7 — nowhere near the "classic" 5th or 7th harmonic. My first instinct was that the trap just didn't apply here. But THD still gets worse, because the amplification curve rises for every harmonic below resonance, not only the one sitting right on top of it. The 19th, sitting at roughly 60% of the resonant order, still comes out amplified 1.56x. Same trap, it's just not where the textbook example points.

The detuned filter (tuned to 189 Hz, below the 5th) does fix that — every harmonic's actual amplitude drops a bit, and total kVA drops further than under the plain capacitor. What it doesn't do is bring THD below the uncompensated baseline. THD is a ratio, and PF correction shrinks the fundamental faster than it shrinks the harmonics, so the ratio ticks up even as the real currents get smaller. Total kVA and per-harmonic amplitude are the honest numbers here, not THD%.

What this doesn't model

Three-phase imbalance, motor starting transients, capacitor switching transients, and an idealized 6-pulse spectrum rather than one measured off a real VFD. Steady-state fundamental + harmonic superposition, nothing more.

Economic note

Illustrative only, not a real tariff — actual LV demand charges vary by state and utility in India. At Rs 50/kVA/month, baseline vs. detuned filter works out to roughly Rs 219/month saved on this 45kW feeder. The number's small because the feeder is small; it's the method that's meant to carry over, not this figure.

Why I picked this problem

After doing the bearing fault project, I wanted a second project that hits a different everyday plant problem — not another "detect a fault" project, but something about the electricity itself. Power factor penalties and harmonics from VFDs are things every plant pays for whether anyone notices or not, and I'd read that fixing power factor with a plain capacitor bank can actually backfire if nobody checks for resonance with the supply. That felt like a good problem to actually simulate rather than just read about — I wanted to see the resonance-worsening effect happen in my own numbers, not just take the textbook's word for it.

What surprised me

That the naive capacitor's resonance landing at the 31.7th order, nowhere close to the 5th or 7th, didn't mean the trap was avoided. The amplification curve doesn't care that the peak is far away — it still lifts everything below it, so "far from resonance" in harmonic-order terms still cost 1.5x on the 19th.

The other one was the detuned filter's THD coming out higher than doing nothing at all, even though it's clearly the better fix on every other measure — lower kVA, lower absolute harmonic current, no resonance risk. I could have retuned it until THD dropped below baseline just to make the story cleaner, but that would've meant picking a number instead of reporting what the circuit actually does.

What I learned

One real bug came out of this: an early version computed total kVA in volt-amps but printed it labeled as kVA, so the baseline showed up as "51210 kVA" instead of 51.2. It's not an obvious error to spot unless you're checking it against the ~45kW you know went in. That's my default check now for any power calculation — does the number roughly match a hand estimate before I trust what the code says.

The bigger lesson is the THD one above. It's a ratio, not a direct measure of how much harmonic current is actually on the line, and PF correction moves the denominator. Reading THD% on its own would say the detuned filter barely helped. That's not exactly false, but it's not the number that tells you whether the fix worked.

Files

power_quality_analysis.py   everything - verification, simulation, plots, CSV
plots/                      baseline / naive-capacitor / detuned-filter figures
results/                    compensation_comparison.csv

About

Power factor correction and harmonic filter design for a plant feeder with a VFD load — Python simulation, IEEE 519-referenced

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages