DEV Community

Ricar Prisco
Ricar Prisco

Posted on Edited on Originally published at veilumen.com

Validate a Lighting Fixture Schedule with Python

A lighting schedule can look right in the editor while the exported CSV carries an old wattage total. It can also put a catalogue body dimension into a field intended for a site opening. The first issue is arithmetic. The second calls for a source field and a drawing check.

A small reproducible check

The sample represents two lines for the same 10 W open-frame bollard. The catalogue lists 400 mm and 600 mm heights. Row A changed from four units to seven, and its stored line total still says 40 W. Row B requests a height of 500 mm.

import csv
from decimal import Decimal
from io import StringIO

sample = """row,quantity,unit_w,stored_total_w,height_mm
A,7,10,40,400
B,2,10,20,500
"""
valid_heights = {400, 600}
catalogue_unit_w = Decimal("10")
total = Decimal("0")

for row in csv.DictReader(StringIO(sample)):
    qty = int(row["quantity"])
    unit_w = Decimal(row["unit_w"])
    stored_w = Decimal(row["stored_total_w"])
    height = int(row["height_mm"])
    if unit_w != catalogue_unit_w:
        print(f"{row['row']}: verify rated power for the selected model")
        continue
    expected_w = qty * unit_w
    total += expected_w
    if stored_w != expected_w:
        print(f"{row['row']}: stale total {stored_w} W; expected {expected_w} W")
    if height not in valid_heights:
        print(f"{row['row']}: confirm requested height {height} mm")

print(f"Calculated nominal load: {total} W")
Enter fullscreen mode Exit fullscreen mode

Expected output:

A: stale total 40 W; expected 70 W
B: confirm requested height 500 mm
Calculated nominal load: 90 W
Enter fullscreen mode Exit fullscreen mode

The script checks the arithmetic and flags heights absent from the selected catalogue entry. The 90 W total is nominal and includes row B, whose configuration still needs confirmation. In a multi-model export, use a lookup keyed by model and ordered version and report an unmatched model as a separate error. For recessed fixtures, keep body, cutout and sleeve as distinct fields with a source reference.

The sample values come from Veilumen’s fixture schedule guide. The order lines are illustrative.

AI disclosure. This technical adaptation and code example were generated with AI from Veilumen’s published guide.

Top comments (0)