C3 · Lesson 21 · AC power lab
Real and apparent power from sampled waveforms, sizing correction capacitors, neutral currents, THD by FFT and true power factor, in Python
Lessons 16 to 20 computed power from phasors: P, Q and S from a voltage, a current and the angle between them, then power-factor correction, three-phase loads and distorted waveforms. A power analyzer doesn't see phasors. It samples voltage and current thousands of times a cycle and computes everything from the samples. In this lab you'll do the same: average the instantaneous power, size a correction capacitor, add three phase currents, take a waveform apart with an FFT, and split a distorted load's power factor into its two causes.
- The curves are a sinusoidal voltage, a current lagging it by the slider's angle, and their product, the instantaneous power, all over one cycle.
- The power swings at twice the line frequency. Its average is P = VI cos φ; where it dips below zero, energy flows back to the source.
- At 90° the average is zero: pure reactive power, energy sloshing back and forth with none consumed. The readouts give P and Q for 230 V and 5 A RMS.
Predict
A rectifier draws a current with 80% THD whose fundamental is exactly in phase with the voltage. What's its power factor?
About 0.78. Only the fundamental carries real power with a sinusoidal voltage, but every harmonic adds to the RMS current, and so to the apparent power. The distortion factor is = 0.781, and with no phase shift that's the whole power factor. Step 5 computes both parts from samples.
Name it
Power from samples
Over a whole number of cycles, real power is the average of the instantaneous product, , and the RMS values are the square roots of the averaged squares. Apparent power is and the power factor . These definitions hold for any waveform, sinusoidal or not.
Sizing a correction capacitor
To move a load of real power P from power factor to , the capacitors must supply , and a capacitor at RMS voltage V and angular frequency ω supplies :
Three phase currents
In a four-wire wye, the neutral carries the phasor sum of the three phase currents, at 0°, −120° and +120°. Balanced currents cancel; for unequal in-phase currents a, b and c, .
Harmonics by FFT
An FFT of exactly an integer number of cycles puts each harmonic in its own bin. The amplitude of harmonic n is twice the magnitude of bin n·(cycles) divided by the number of samples, and
True power factor
With a sinusoidal voltage, the power factor of a distorted current splits into a displacement factor, cos φ₁ of the fundamental's phase, and a distortion factor, . Their product equals .
Worked example
A power analyzer samples 230 V RMS and a 5 A RMS current lagging by 30°. What does it report?
Show the solution
- Real power. Averaging over whole cycles gives
- Apparent power. The RMS values are 230 V and 5 A, so
- Power factor.
- Reactive power.
- No phase angle needed. The analyzer never computed a phase angle: the average of the product does it implicitly.
- Why that matters. That's why the same method works for a dimmer or a switch-mode supply, where no single angle describes the current.
Answer it reports P = 996 W, S = 1150 VA, a power factor of 0.866 and Q = 575 var.
Worked example
A 10 kW load at power factor 0.7 runs from 230 V, 50 Hz. What capacitance corrects it to 0.95?
Show the solution
- Tangents of the two angles.
- Reactive power to cancel.
- Capacitance.
- In practice. That's a large AC capacitor; in practice it's a bank of smaller ones, switched in steps as the load changes, so the plant never swings to a leading power factor at light load.
Answer 416 µF.
Worked example
A wye of resistive loads draws 10, 8 and 6 A in its three phases. What does the neutral carry?
Show the solution
- Add the phasors. For , and :
- Take the square root.
- Unbalance. Unbalance of a few amps leaves only a few amps in the neutral.
- Harmonics. Harmonics are another matter: third harmonics from the three phases are in phase with each other, so they add in the neutral instead of cancelling, which is why buildings full of computers once overheated their neutral wires.
Answer the neutral carries 3.46 A.
Check
Step 1. Write powers(v, i) for samples spanning whole cycles, returning (P, Vrms, Irms, S, pf).
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 2. Write pf_capacitor(P, V, f, pf1, pf2) returning the correcting capacitance in µF.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 3. Write neutral_current(a, b, c) returning the magnitude of the phasor sum of in-phase currents a, b and c on phases at 0°, −120° and +120°.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 4. Write thd(x, cycles, nmax) for samples spanning exactly cycles periods, returning the THD from FFT harmonic amplitudes 2 to nmax.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 5. Write pf_parts(v, i, cycles) returning (displacement, distortion, total): cos of the phase between the voltage's and current's fundamentals (from the FFT), , and P/S from the samples.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
A load draws 2 A RMS from 120 V RMS, lagging by 45°.
(a)
What real power does it take?
Write units the way you normally would: 1.5 W, 1500 mW and 0.0015 kW are the same answer.
(b)
What reactive power?
Check
A 5 kW load at power factor 0.8 runs from 230 V, 60 Hz. What capacitance corrects it to 0.95?
Write units the way you normally would: 1.5 µF, 1500 nF and 0.0015 mF are the same answer.
Check
A wye of resistive loads draws 12, 6 and 10 A. What does the neutral carry?
Write units the way you normally would: 1.5 A, 1500 mA and 0.0015 kA are the same answer.
Check
A load's current has THD 0.5 (as a fraction), with its fundamental in phase with the voltage. What's its power factor?
Explain why
Why do harmonic currents lower the power factor even when they're perfectly in phase with the voltage?
With a sinusoidal supply voltage, only the current at the same frequency can carry real power: the product of a 50 Hz voltage and a 150 Hz current averages to zero over a cycle, whatever their phases. But the harmonic currents still flow through every wire and transformer, so they add to the RMS current and to the apparent power VI. The ratio P/S therefore falls by the factor . A capacitor can't fix this, because it only supplies current at the fundamental; the cure is to make the load draw a sinusoidal current, which is what active power-factor-correction circuits do.
Practice
Keep practicing
6 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.