DEV Community

Cover image for Watts, VA and Power Factor: Checking an LED COB Light Schedule With Python
Ibrahim Nauman
Ibrahim Nauman

Posted on

Watts, VA and Power Factor: Checking an LED COB Light Schedule With Python

`"Check an LED COB light schedule in Python: watts, VA and current per circuit, power factor gaps, inrush flags and the backup load on Pakistani sites."

tags: python, beginners, tutorial, hardware

When a contractor sends us a lighting schedule for a showroom or office in Lahore, the electrical side is often a single number: total watts. Sixty LED COB lights at 6 or 12 watts each looks like almost nothing, so everything goes on one breaker and nobody thinks about them when sizing the generator. Usually that's fine. Sometimes it isn't, and the reasons are power factor, supply voltage and the surge at switch-on. None of them shows up in a watts column.

Power factor is the easiest to miss because it isn't always printed. On our own COB spot light page, the newer 6W and 12W models are marked PF 0.9, while some older ones don't state a figure on the listing at all. A schedule that mixes the two needs a way to handle that gap honestly instead of quietly ignoring it.

So this post builds a small Python script, standard library only, that reads a schedule as CSV and prints watts, apparent power and current for each circuit at two voltages. It flags every fitting whose power factor had to be guessed, and it reminds you which inrush figures you still haven't collected. Treat it as a checking tool. Your electrical consultant's design still wins.

Why watts undersell the load

Watts are real power, the part that ends up as light and heat. The breaker, the cable and the generator all see current, and current follows apparent power, measured in volt-amperes (VA). For an old incandescent bulb the two are the same. For an LED driver they aren't, and the ratio between them is the power factor.

A driver at PF 0.9 draws about 11% more VA than its rated watts. One at 0.5 draws double. On a single fitting that's noise. On a floor of LED COB lights all fed from the same generator during load-shedding, it's the gap between the number on the drawing and the number the generator actually carries.

One formula, two judgement calls

RMS current is I = P / (V × PF), where P is real power in watts, V is the supply voltage and PF is the true power factor from the datasheet. Apparent power is just P / PF. Everything else in the script is bookkeeping.

The first judgement call is voltage. Nominal single-phase supply here is 230 V, but plenty of sites in Lahore, Faisalabad and Multan sit well below that on a summer evening when every AC on the feeder is running. Most LED drivers behave roughly as constant-power loads, so a lower voltage means more current for the same light. The script runs each circuit at 230 V and at 200 V to show the spread.

The second is missing data. If a datasheet gives no power factor, the script uses an assumed 0.5 and labels the row. That's a deliberately pessimistic placeholder, not a measured value for any product. Replace it the moment the supplier gives you a real figure.

The schedule and the script

The schedule is plain CSV with one row per fitting type per circuit, pasted straight into the file so there's nothing else to manage. BACKUP lists the circuits that stay on when the grid drops. MAX_PER_BREAKER is empty on purpose, and we'll come back to why.

`python
import csv, io
from collections import defaultdict

SCHEDULE = """circuit,area,model,qty,watts,pf
L1,showroom front,12W-pf90,24,12,0.9
L2,showroom rear,6W-pf90,30,6,0.9
L3,cabins,7W-nopf,16,7,
L4,corridor,6W-nopf,10,6,
"""

ASSUMED_PF = 0.5 # used only when a datasheet gives no figure
VOLTS = (230, 200) # nominal, and a weak summer evening
BREAKER_A = 10
BACKUP = {"L1", "L3"} # circuits on the generator or inverter

fittings allowed per breaker for inrush, from the driver datasheet

MAX_PER_BREAKER = {} # e.g. {"12W-pf90": n} once the supplier confirms

def load(text):
rows = []
for r in csv.DictReader(io.StringIO(text)):
pf = float(r["pf"]) if r["pf"] else None
rows.append({**r, "qty": int(r["qty"]), "watts": float(r["watts"]),
"pf": pf, "pf_used": pf or ASSUMED_PF})
return rows

def circuits(rows):
out = defaultdict(lambda: {"w": 0.0, "va": 0.0, "n": 0, "guess": False, "rows": []})
for r in rows:
c = out[r["circuit"]]
w = r["qty"] * r["watts"]
c["w"] += w
c["va"] += w / r["pf_used"]
c["n"] += r["qty"]
c["guess"] |= r["pf"] is None
c["rows"].append(r)
return out

def report(rows):
print(f"{'ckt':<4}{'fittings':>9}{'watts':>8}{'VA':>8}"
+ "".join(f"{'A@'+str(v):>8}" for v in VOLTS) + " notes")
backup_va = 0.0
for name, c in sorted(circuits(rows).items()):
amps = [c["va"] / v for v in VOLTS]
notes = []
if c["guess"]:
notes.append(f"PF assumed {ASSUMED_PF}")
if max(amps) > BREAKER_A:
notes.append("over breaker")
for r in c["rows"]:
limit = MAX_PER_BREAKER.get(r["model"])
if limit is None:
notes.append(f"inrush: ask ({r['model']})")
elif r["qty"] > limit:
notes.append(f"inrush: {r['qty']} > {limit}")
if name in BACKUP:
backup_va += c["va"]
print(f"{name:<4}{c['n']:>9}{c['w']:>8.0f}{c['va']:>8.0f}"
+ "".join(f"{a:>8.2f}" for a in amps) + " " + "; ".join(notes))
print(f"\nOn backup: {backup_va:.0f} VA")

if name == "main":
report(load(SCHEDULE))
`

Running the LED COB light schedule for a Lahore showroom

The example is a two-room showroom with cabins at the back, roughly the kind of unit you'd find on a commercial strip in Gulberg or DHA. Two circuits use fittings with a stated PF of 0.9 and two use fittings with no figure. Running it prints this:

`text
ckt fittings watts VA A@230 A@200 notes
L1 24 288 320 1.39 1.60 inrush: ask (12W-pf90)
L2 30 180 200 0.87 1.00 inrush: ask (6W-pf90)
L3 16 112 224 0.97 1.12 PF assumed 0.5; inrush: ask (7W-nopf)
L4 10 60 120 0.52 0.60 PF assumed 0.5; inrush: ask (6W-nopf)

On backup: 544 VA
`

Look at L2 and L3. The cabins circuit has 112 W of fittings against 180 W in the showroom rear, yet it comes out at 224 VA against 200, because its power factor is unknown and the script assumed the worst. That's the whole reason to track VA. Watts alone would have told you L3 was the lighter circuit.

The currents themselves are tiny. Nothing here gets near a 10 A breaker, even at 200 V. With LED COB lights, steady current is almost never what trips a lighting circuit. The thing that does is sitting in the notes column.

Inrush, the figure nobody prints

When you flip the switch, each driver's input capacitor charges in a fraction of a second, and for that instant it pulls far more current than it does while running. One driver doesn't matter. A few dozen LED COB lights on one switch can trip a miniature circuit breaker that would carry their steady current all day without complaint. The usual fixes are fewer fittings per breaker, a different breaker curve, or splitting the switching.

Good driver datasheets give either a peak inrush figure or a maximum number of fittings per breaker type. Product pages, for most brands, don't. That's why MAX_PER_BREAKER starts empty and every row says "inrush: ask". Get the driver datasheet, enter the figures, and the script flags any circuit that's over.

This matters more here than in most places. The lights don't switch once a day. Every time the grid drops and the generator or inverter picks up, every circuit on backup switches at the same moment.

What the script leaves out

Harmonics, for one. LED drivers are non-linear loads, and on a three-phase board feeding a lot of lighting, the neutral can carry more current than a simple sum suggests. If you're spreading lighting across three phases in a plaza or a factory office block, that's a conversation for your electrical engineer.

It also ignores cable length and voltage drop, which start to matter on long warehouse aisles and mall corridors. And the backup figure, 544 VA here, is only the lighting. Add it to everything else on the generator or inverter before you decide anything about sizing.

Using it on your own job

Paste your schedule into the CSV block, set BACKUP to whichever circuits run through load-shedding, and replace each blank power factor with a real figure as you collect them. Run it again before the schedule goes out. If any row still says "PF assumed", the schedule isn't finished.

If you'd like help filling in the power factor and driver figures for the fittings on your schedule, the engineers at Hyundai LED are happy to dig them out for you.
`

Top comments (0)