Anomaly detection case study · energy

Which of 1,584 Strings Is Losing Money?

A string running 7% low is worth real money and invisible on a plant dashboard. Comparing every string with the fleet median cancels the weather; four robust detectors catch disconnects, shading, degradation and soiling; and the output is a work-order list ranked by what each fault costs a year.

ContextKish Solar Trading Co. · Nir plant, Yazd (2016–19) · open-source demonstrator, 2026
Analytics stages
QualitativeDescriptiveDiagnosticPredictivePrescriptiveSoftware
Technology
PythonNumPypandasmatplotlibRobust statistics (MAD)Theil–SenTime-series anomaly detectionCLI tool18 tests
ResultPrecision 1.00, recall 0.93 against 14 injected faults; faults ranked by annual revenue loss.
Business problem

1,584 strings and one maintenance crew

Nir PV plant, Yazd · Kish Solar Trading Co.

A 10 MW plant has 1,584 strings and one maintenance crew. Output drifts down over a season and nobody can say which strings are responsible. A disconnected string is obvious; a string running 7% low is worth real money and invisible on a plant-level dashboard. Absolute thresholds do not survive a real site either: performance ratio moves with season, temperature and soiling, so a threshold tight enough to catch a 7% loss in June raises hundreds of alarms in December.

What is real and what is synthetic. The plant is real: the geometry comes from the 10 MW Nir PV plant in Yazd province, from the project profile I authored as R&D expert at Kish Solar Trading Co. — 36,432 modules of 280 Wp, 1,584 strings, nine 1 MW central inverters, 20,465 MWh expected in year one at a performance ratio of 87%. The SCADA is synthetic, built in 2026 to reproduce the plant’s behaviour: solar geometry, a Haurwitz clear-sky model, Erbs diffuse split, transposition to a 30° tilt, NOCT cell temperature and an arid cloud regime. Faults are injected at known strings so the detector can be scored rather than admired.
Descriptive analysis

Compare each string with its neighbours, not with a threshold

Peer comparison against the fleet median for the day.

All strings on one site see nearly the same weather, so each string is measured against the fleet median for that day. Season and temperature affect the numerator and the denominator together and cancel out: a healthy string sits at 1.0 all year, and a faulted one separates from the pack.

Fleet overview of string performance against the fleet median, with faulted strings separating from the pack
String performance relative to the fleet median: healthy strings stay at 1.0, faulted ones separate.
Diagnostic analysis

Four detectors, one for each fault signature

Robust statistics throughout, because one overcast day should not move the answer.
DetectorSignatureCatches
Zero outputConsecutive days near zero while peers produceDisconnects, blown fuses
Peer ratioPersistent gap to the fleet median, robust (MAD) z-scoreShading, degradation, chronic underperformance
TrendNegative Theil–Sen slope over the whole recordSteady degradation
Windowed trendWorst 30-day rolling slopeSoiling that rain partly resets

The windowed detector exists because of a specific failure: soiling builds for weeks and is then largely washed off, so the slope across the whole record is nearly flat even though the string lost real energy. Scanning shorter windows and keeping the worst lifted soiling recall from 1 of 4 to 4 of 4. Theil–Sen is used instead of least squares because a single overcast day would drag an ordinary slope around; the median of pairwise slopes ignores it.

The four detectors replayed day by day over 1,584 strings, flagging injected faults
The detectors replayed over the 120-day record, seeing only the data up to each day. Red: flagged.
Prescriptive · what the crew does next

A work-order list, ranked by what each fault costs

Not an alarm feed.
StringInverterDetectorsLost kWh/yrLost €/yr
string_14129peer ratio + windowed trend + zero output9,497760
string_14449peer ratio + windowed trend + zero output5,620450
string_03553peer ratio1,592127
string_00081peer ratio + trend + windowed trend1,534123

The crew attends to the €760-a-year string before the cheap ones — the list is the decision.

Validation · software

Scored against known faults, and honest about the miss

120 days of 30-minute data, 14 injected faults.
1.00
precision — no healthy string flagged
0.93
recall — 13 of 14 faults found
0.96
F1 score
18
deterministic tests

Every fault type was found — disconnects 2/2, shading 2/2, degradation 3/3, soiling 4/4 — except one chronic underperformance of 5%, which sits below the fleet’s own manufacturing spread and cannot be separated from noise in 120 days of data. That is a limit of the method, not a tuning problem, and it is stated as one.

Python with NumPy, pandas and matplotlib; a command-line tool that simulates, detects and scores, and runs unchanged on a real SCADA export. Open source under MIT.