Case study 01 / 25Data Science
Self-calibrating leak detection for a slurry channel, applied live
Replayed over seven months: 0 false alarms instead of 7,372, and 23 of 68 channel sections now catch a 40 % leak instead of none.
My roleDesigned it and led a team of up to 3: set its standards, mentored it, agreed the roadmap with operations and the client, presented to leadership.
Stack
- C#
- Python
- OPC UA
- SQLite
- PowerShell
01 · How it works
- TodaytoChanged in this work
- Data flow
What it does
A long channel that carries slurry is watched by a mass-balance leak detector: each of its 68 sections compares the flow in and out, computed from level sensors, and alarms when the difference passes that section's tolerance.
Read more
I replaced the hand-set correction factors and the one wide tolerance every section shared with values fitted to each section's own months of data. Then I built the separate service that recalculates them every day and hands them to the running detector without a restart.
5 connections· select a part to trace it
- Plant data server to Calibration service: levels + inflow every 30 s
- Calibration service to Channel config file: writes after 9 checks pass
- Channel config file to Leak detector: reloaded live, in calmchanged
- Leak detector to Control room: alarms past each tolerance
- Calibration service to Field review: what needs eyes on site
02Results
- R01Lower is better
False alarms in seven months of replayed history
Before 7,372, after 0, eliminated. Lower is better.BeforeAfter - R02Higher is better
Channel sections that catch a 40 % leak (of 68)
Before 0, after 23, from zero. Higher is better.BeforeAfter - R03Lower is better
Median flow error of each level sensor
Before 28.1%, after 4.9%, 5.7× lower. Lower is better.BeforeAfter
What it achieved
- What the control room gets: 7,372 false alarms in seven months of replayed history → 0, and sections that catch a 40 % leak 0 → 23 of 68 (a 20 % leak: 0 → 3)
- Each level sensor's flow against the slurry that entered: a median 28.1 % off → 4.9 %, with its own factor and zero offset
- Calibration: by hand, once, in a spreadsheet → a separate service that recalculates every day and writes only when nine checks pass and the change has held for three days
Read more
- New values in the running detector: a restart → 0 restarts, taken live between two cycles while no section is confirming a leak
- A fresh installation: no write in 90 days under the old rule → a first, capped write after 50 minutes
- Time to alarm on a 20 % leak: 8.8 min → 5.0 min, with the service and the reference tool agreeing on 68 of 68 sections, field by field
03Decisions and trade-offs
- Constraint
Normal operation included minutes-long level jumps from single sensors.
DecisionEach tolerance is the smallest with no false alarm in six months, plus 10 %.
What it cost18 sections stay wide until their sensors are fixed in the field.
- Constraint
A bad value in a running leak detector could blind a section.
DecisionA separate read-only service writes only after nine checks and three steady days.
What it costA real change in the channel reaches the detector days later.
- Constraint
Fitting and checking on the same months would flatter the values.
DecisionCheck them on months the fit never saw.
What it cost68 false alarms appeared there: the values are better, not perfect.
The challenge
The detector's correction factors had been set by hand, once, in a spreadsheet, and every section shared the same wide tolerance. Replayed over seven months of level history, those values raised 7,372 false alarms, yet not one section could see a 40 % leak.
The channel has no flowmeters, so each sensor's flow was off by a median 28.1 % against the slurry entering the channel, and a fixed factor could not fix it: a sensor whose zero sits slightly high reads 31 % high at low level and only 6 % at high level.
Read more
The data also held faults no factor could absorb: one section measured by the same sensor at both ends, 14 sensors sitting where the channel changes size, and one sensor frozen 92 % of the time.
What I learned
A tolerance is a promise, not a tuning knob: setting each one to the smallest value that stayed silent through months of normal operation, plus 10 %, made the trade-off between false alarms and missed leaks explicit and testable. The factor that seemed to drift with operation was a sensor's zero offset in disguise; fitting both per sensor removed what no fixed factor could.
Read more
And replayed history flatters: values fitted on earlier months still raised 68 false alarms on later ones, which is why the service writes only after nine checks and three steady days.
Stack
- C#
- Python
- OPC UA
- SQLite
- PowerShell
Skills
- Hydraulic model calibration
- Leak detection tuning
- Robust statistics
- Safe live configuration
- Industrial data integration

