FA-92066 / PLC ladder logic scan cycles / Open access
Task watchdog faults on an execution exactly equal to its limit · case 01
A task that finishes precisely at the watchdog time causes a major fault.
ROOT CAUSE
The watchdog test uses >= instead of >.
VERIFIED REPAIR
Fault only when execution strictly exceeds the watchdog time.
Unsuccessful approach: Exempting the first execution from the watchdog misses a genuine first-scan overrun.
Case contract
Periodic task triggered every period ms from t=0; exec_times[k] is how long the k-th triggered execution would take. A trigger arriving while the previous execution is still running (trigger time < completion time) is an overlap: it is counted and skipped, not queued; a trigger exactly at completion starts normally. An execution longer than watchdog raises a major fault at start + watchdog and scheduling stops. Return [start_times, overlap_count, fault_time or None].
Why this case matters
Ladder programs are executed as repeated scans; each defect here changes what a rung, timer, counter or data-table instruction reports on a particular scan, which is how commissioning and field faults are actually observed.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(period, watchdog, exec_times):
t_free = 0
starts = []
overlaps = 0
fault = None
for k, ex in enumerate(exec_times):
trig = k * period
if trig < t_free:
overlaps += 1
continue
starts.append(trig)
if ex >= watchdog:
fault = trig + watchdog
break
t_free = trig + ex
return [starts, overlaps, fault]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: exact watchdog', [20, 30, [30, 5, 5, 5]], [[0, 40, 60], 1, None]],
['regression: first execution overruns', [10, 25, [30, 5]], [[0], 0, 25]],
['control: mixed overlaps', [10, 50, [5, 15, 3, 10, 12, 4]], [[0, 10, 30, 40], 2, None]],
['control: watchdog exceeded', [10, 12, [5, 13, 4]], [[0, 10], 0, 22]],
['control: skip then drift', [10, 100, [25, 1, 1, 1, 1, 1]], [[0, 30, 40, 50], 2, None]],
['regression: scenario 1', [50, 100, [100, 100, 100, 100, 50, 25]], [[0, 100, 200, 250], 2, None]],
['regression: scenario 2', [20, 100, [100, 100, 60, 39, 20, 40, 54, 40]], [[0, 100, 140], 5, None]],
['regression: scenario 3', [50, 40, [50, 100, 50, 100, 100, 40]], [[0], 0, 40]]],
[['regression: scenario 1', [20, 60, [60, 20, 36, 40, 20]], [[0, 60], 3, None]],
['regression: scenario 5', [25, 40, [53, 25, 25, 50, 50, 25, 25, 50]], [[0], 0, 40]],
['control: mixed overlaps', [10, 50, [5, 15, 3, 10, 12, 4]], [[0, 10, 30, 40], 2, None]],
['control: watchdog exceeded', [10, 12, [5, 13, 4]], [[0, 10], 0, 22]],
['regression: exact watchdog', [20, 30, [30, 5, 5, 5]], [[0, 40, 60], 1, None]],
['regression: first execution overruns', [10, 25, [30, 5]], [[0], 0, 25]],
['control: skip then drift', [10, 100, [25, 1, 1, 1, 1, 1]], [[0, 30, 40, 50], 2, None]],
['regression: scenario 2',
[10, 100, [10, 10, 10, 10, 10, 20, 100, 3, 20, 10, 100]],
[[0, 10, 20, 30, 40, 50, 70, 80, 100], 2, None]]],
[['regression: scenario 3',
[20, 30, [20, 30, 6, 30, 40, 39, 61, 36, 40, 40, 30, 20]],
[[0, 20, 60, 100], 2, 130]],
['regression: scenario 9', [50, 30, [50, 29, 42, 100, 100, 41, 5, 30, 100, 12]], [[0], 0, 30]],
['control: mixed overlaps', [10, 50, [5, 15, 3, 10, 12, 4]], [[0, 10, 30, 40], 2, None]],
['control: watchdog exceeded', [10, 12, [5, 13, 4]], [[0, 10], 0, 22]],
['regression: exact watchdog', [20, 30, [30, 5, 5, 5]], [[0, 40, 60], 1, None]],
['regression: first execution overruns', [10, 25, [30, 5]], [[0], 0, 25]],
['control: skip then drift', [10, 100, [25, 1, 1, 1, 1, 1]], [[0, 30, 40, 50], 2, None]],
['regression: scenario 1', [20, 100, [100, 20, 60, 100, 40, 20, 30, 12]], [[0, 100, 120], 5, None]]],
[['regression: scenario 5', [10, 30, [30, 30, 30, 28, 10, 30]], [[0, 30], 4, None]],
['regression: scenario 15', [50, 60, [100, 60, 60, 33, 50, 24, 100, 60, 60]], [[0], 0, 60]],
['control: mixed overlaps', [10, 50, [5, 15, 3, 10, 12, 4]], [[0, 10, 30, 40], 2, None]],
['control: watchdog exceeded', [10, 12, [5, 13, 4]], [[0, 10], 0, 22]],
['regression: exact watchdog', [20, 30, [30, 5, 5, 5]], [[0, 40, 60], 1, None]],
['regression: first execution overruns', [10, 25, [30, 5]], [[0], 0, 25]],
['control: skip then drift', [10, 100, [25, 1, 1, 1, 1, 1]], [[0, 30, 40, 50], 2, None]],
['control: scenario 1', [20, 30, [21, 20, 20, 20, 40, 30, 20, 30, 40, 30, 40]], [[0, 40, 60, 80], 1, 110]]],
[['regression: scenario 10',
[10, 40, [40, 40, 40, 20, 10, 40, 14, 21, 20, 40, 41, 10]],
[[0, 40, 50, 90], 8, None]],
['regression: scenario 7', [50, 40, [44, 9, 44, 100, 40, 68, 54, 100, 5, 40, 50]], [[0], 0, 40]],
['control: mixed overlaps', [10, 50, [5, 15, 3, 10, 12, 4]], [[0, 10, 30, 40], 2, None]],
['control: watchdog exceeded', [10, 12, [5, 13, 4]], [[0, 10], 0, 22]],
['regression: exact watchdog', [20, 30, [30, 5, 5, 5]], [[0, 40, 60], 1, None]],
['regression: first execution overruns', [10, 25, [30, 5]], [[0], 0, 25]],
['control: skip then drift', [10, 100, [25, 1, 1, 1, 1, 1]], [[0, 30, 40, 50], 2, None]],
['regression: scenario 1', [25, 60, [70, 25, 60, 35, 25, 15, 60, 60, 25, 50, 25, 4]], [[0], 0, 60]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: exact watchdog | [[0], 0, 30] | [[0, 40, 60], 1, None] | Failed |
| regression: first execution overruns | [[0], 0, 25] | [[0], 0, 25] | Passed |
| control: mixed overlaps | [[0, 10, 30, 40], 2, None] | [[0, 10, 30, 40], 2, None] | Passed |
| control: watchdog exceeded | [[0, 10], 0, 22] | [[0, 10], 0, 22] | Passed |
| control: skip then drift | [[0, 30, 40, 50], 2, None] | [[0, 30, 40, 50], 2, None] | Passed |
| regression: scenario 1 | [[0], 0, 100] | [[0, 100, 200, 250], 2, None] | Failed |
| regression: scenario 2 | [[0], 0, 100] | [[0, 100, 140], 5, None] | Failed |
| regression: scenario 3 | [[0], 0, 40] | [[0], 0, 40] | Passed |
SHA-256 / d18b5ee00ab19d0a089c51d0559d3b5742f2b89680a7e5d74d4e682f2bed16ca
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(period, watchdog, exec_times):
t_free = 0
starts = []
overlaps = 0
fault = None
for k, ex in enumerate(exec_times):
trig = k * period
if trig < t_free:
overlaps += 1
continue
starts.append(trig)
if ex > watchdog and k > 0:
fault = trig + watchdog
break
t_free = trig + ex
return [starts, overlaps, fault]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: exact watchdog', [20, 30, [30, 5, 5, 5]], [[0, 40, 60], 1, None]],
['regression: first execution overruns', [10, 25, [30, 5]], [[0], 0, 25]],
['control: mixed overlaps', [10, 50, [5, 15, 3, 10, 12, 4]], [[0, 10, 30, 40], 2, None]],
['control: watchdog exceeded', [10, 12, [5, 13, 4]], [[0, 10], 0, 22]],
['control: skip then drift', [10, 100, [25, 1, 1, 1, 1, 1]], [[0, 30, 40, 50], 2, None]],
['regression: scenario 1', [50, 100, [100, 100, 100, 100, 50, 25]], [[0, 100, 200, 250], 2, None]],
['regression: scenario 2', [20, 100, [100, 100, 60, 39, 20, 40, 54, 40]], [[0, 100, 140], 5, None]],
['regression: scenario 3', [50, 40, [50, 100, 50, 100, 100, 40]], [[0], 0, 40]]],
[['regression: scenario 1', [20, 60, [60, 20, 36, 40, 20]], [[0, 60], 3, None]],
['regression: scenario 5', [25, 40, [53, 25, 25, 50, 50, 25, 25, 50]], [[0], 0, 40]],
['control: mixed overlaps', [10, 50, [5, 15, 3, 10, 12, 4]], [[0, 10, 30, 40], 2, None]],
['control: watchdog exceeded', [10, 12, [5, 13, 4]], [[0, 10], 0, 22]],
['regression: exact watchdog', [20, 30, [30, 5, 5, 5]], [[0, 40, 60], 1, None]],
['regression: first execution overruns', [10, 25, [30, 5]], [[0], 0, 25]],
['control: skip then drift', [10, 100, [25, 1, 1, 1, 1, 1]], [[0, 30, 40, 50], 2, None]],
['regression: scenario 2',
[10, 100, [10, 10, 10, 10, 10, 20, 100, 3, 20, 10, 100]],
[[0, 10, 20, 30, 40, 50, 70, 80, 100], 2, None]]],
[['regression: scenario 3',
[20, 30, [20, 30, 6, 30, 40, 39, 61, 36, 40, 40, 30, 20]],
[[0, 20, 60, 100], 2, 130]],
['regression: scenario 9', [50, 30, [50, 29, 42, 100, 100, 41, 5, 30, 100, 12]], [[0], 0, 30]],
['control: mixed overlaps', [10, 50, [5, 15, 3, 10, 12, 4]], [[0, 10, 30, 40], 2, None]],
['control: watchdog exceeded', [10, 12, [5, 13, 4]], [[0, 10], 0, 22]],
['regression: exact watchdog', [20, 30, [30, 5, 5, 5]], [[0, 40, 60], 1, None]],
['regression: first execution overruns', [10, 25, [30, 5]], [[0], 0, 25]],
['control: skip then drift', [10, 100, [25, 1, 1, 1, 1, 1]], [[0, 30, 40, 50], 2, None]],
['regression: scenario 1', [20, 100, [100, 20, 60, 100, 40, 20, 30, 12]], [[0, 100, 120], 5, None]]],
[['regression: scenario 5', [10, 30, [30, 30, 30, 28, 10, 30]], [[0, 30], 4, None]],
['regression: scenario 15', [50, 60, [100, 60, 60, 33, 50, 24, 100, 60, 60]], [[0], 0, 60]],
['control: mixed overlaps', [10, 50, [5, 15, 3, 10, 12, 4]], [[0, 10, 30, 40], 2, None]],
['control: watchdog exceeded', [10, 12, [5, 13, 4]], [[0, 10], 0, 22]],
['regression: exact watchdog', [20, 30, [30, 5, 5, 5]], [[0, 40, 60], 1, None]],
['regression: first execution overruns', [10, 25, [30, 5]], [[0], 0, 25]],
['control: skip then drift', [10, 100, [25, 1, 1, 1, 1, 1]], [[0, 30, 40, 50], 2, None]],
['control: scenario 1', [20, 30, [21, 20, 20, 20, 40, 30, 20, 30, 40, 30, 40]], [[0, 40, 60, 80], 1, 110]]],
[['regression: scenario 10',
[10, 40, [40, 40, 40, 20, 10, 40, 14, 21, 20, 40, 41, 10]],
[[0, 40, 50, 90], 8, None]],
['regression: scenario 7', [50, 40, [44, 9, 44, 100, 40, 68, 54, 100, 5, 40, 50]], [[0], 0, 40]],
['control: mixed overlaps', [10, 50, [5, 15, 3, 10, 12, 4]], [[0, 10, 30, 40], 2, None]],
['control: watchdog exceeded', [10, 12, [5, 13, 4]], [[0, 10], 0, 22]],
['regression: exact watchdog', [20, 30, [30, 5, 5, 5]], [[0, 40, 60], 1, None]],
['regression: first execution overruns', [10, 25, [30, 5]], [[0], 0, 25]],
['control: skip then drift', [10, 100, [25, 1, 1, 1, 1, 1]], [[0, 30, 40, 50], 2, None]],
['regression: scenario 1', [25, 60, [70, 25, 60, 35, 25, 15, 60, 60, 25, 50, 25, 4]], [[0], 0, 60]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: exact watchdog | [[0, 40, 60], 1, None] | [[0, 40, 60], 1, None] | Passed |
| regression: first execution overruns | [[0], 1, None] | [[0], 0, 25] | Failed |
| control: mixed overlaps | [[0, 10, 30, 40], 2, None] | [[0, 10, 30, 40], 2, None] | Passed |
| control: watchdog exceeded | [[0, 10], 0, 22] | [[0, 10], 0, 22] | Passed |
| control: skip then drift | [[0, 30, 40, 50], 2, None] | [[0, 30, 40, 50], 2, None] | Passed |
| regression: scenario 1 | [[0, 100, 200, 250], 2, None] | [[0, 100, 200, 250], 2, None] | Passed |
| regression: scenario 2 | [[0, 100, 140], 5, None] | [[0, 100, 140], 5, None] | Passed |
| regression: scenario 3 | [[0, 50], 0, 90] | [[0], 0, 40] | Failed |
SHA-256 / 59fc6dfb935f92a2f9418661e23eb3ab4bf13758d3e06dc46b8b47e59a2d2df2
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(period, watchdog, exec_times):
t_free = 0
starts = []
overlaps = 0
fault = None
for k, ex in enumerate(exec_times):
trig = k * period
if trig < t_free:
overlaps += 1
continue
starts.append(trig)
if ex > watchdog:
fault = trig + watchdog
break
t_free = trig + ex
return [starts, overlaps, fault]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: exact watchdog', [20, 30, [30, 5, 5, 5]], [[0, 40, 60], 1, None]],
['regression: first execution overruns', [10, 25, [30, 5]], [[0], 0, 25]],
['control: mixed overlaps', [10, 50, [5, 15, 3, 10, 12, 4]], [[0, 10, 30, 40], 2, None]],
['control: watchdog exceeded', [10, 12, [5, 13, 4]], [[0, 10], 0, 22]],
['control: skip then drift', [10, 100, [25, 1, 1, 1, 1, 1]], [[0, 30, 40, 50], 2, None]],
['regression: scenario 1', [50, 100, [100, 100, 100, 100, 50, 25]], [[0, 100, 200, 250], 2, None]],
['regression: scenario 2', [20, 100, [100, 100, 60, 39, 20, 40, 54, 40]], [[0, 100, 140], 5, None]],
['regression: scenario 3', [50, 40, [50, 100, 50, 100, 100, 40]], [[0], 0, 40]]],
[['regression: scenario 1', [20, 60, [60, 20, 36, 40, 20]], [[0, 60], 3, None]],
['regression: scenario 5', [25, 40, [53, 25, 25, 50, 50, 25, 25, 50]], [[0], 0, 40]],
['control: mixed overlaps', [10, 50, [5, 15, 3, 10, 12, 4]], [[0, 10, 30, 40], 2, None]],
['control: watchdog exceeded', [10, 12, [5, 13, 4]], [[0, 10], 0, 22]],
['regression: exact watchdog', [20, 30, [30, 5, 5, 5]], [[0, 40, 60], 1, None]],
['regression: first execution overruns', [10, 25, [30, 5]], [[0], 0, 25]],
['control: skip then drift', [10, 100, [25, 1, 1, 1, 1, 1]], [[0, 30, 40, 50], 2, None]],
['regression: scenario 2',
[10, 100, [10, 10, 10, 10, 10, 20, 100, 3, 20, 10, 100]],
[[0, 10, 20, 30, 40, 50, 70, 80, 100], 2, None]]],
[['regression: scenario 3',
[20, 30, [20, 30, 6, 30, 40, 39, 61, 36, 40, 40, 30, 20]],
[[0, 20, 60, 100], 2, 130]],
['regression: scenario 9', [50, 30, [50, 29, 42, 100, 100, 41, 5, 30, 100, 12]], [[0], 0, 30]],
['control: mixed overlaps', [10, 50, [5, 15, 3, 10, 12, 4]], [[0, 10, 30, 40], 2, None]],
['control: watchdog exceeded', [10, 12, [5, 13, 4]], [[0, 10], 0, 22]],
['regression: exact watchdog', [20, 30, [30, 5, 5, 5]], [[0, 40, 60], 1, None]],
['regression: first execution overruns', [10, 25, [30, 5]], [[0], 0, 25]],
['control: skip then drift', [10, 100, [25, 1, 1, 1, 1, 1]], [[0, 30, 40, 50], 2, None]],
['regression: scenario 1', [20, 100, [100, 20, 60, 100, 40, 20, 30, 12]], [[0, 100, 120], 5, None]]],
[['regression: scenario 5', [10, 30, [30, 30, 30, 28, 10, 30]], [[0, 30], 4, None]],
['regression: scenario 15', [50, 60, [100, 60, 60, 33, 50, 24, 100, 60, 60]], [[0], 0, 60]],
['control: mixed overlaps', [10, 50, [5, 15, 3, 10, 12, 4]], [[0, 10, 30, 40], 2, None]],
['control: watchdog exceeded', [10, 12, [5, 13, 4]], [[0, 10], 0, 22]],
['regression: exact watchdog', [20, 30, [30, 5, 5, 5]], [[0, 40, 60], 1, None]],
['regression: first execution overruns', [10, 25, [30, 5]], [[0], 0, 25]],
['control: skip then drift', [10, 100, [25, 1, 1, 1, 1, 1]], [[0, 30, 40, 50], 2, None]],
['control: scenario 1', [20, 30, [21, 20, 20, 20, 40, 30, 20, 30, 40, 30, 40]], [[0, 40, 60, 80], 1, 110]]],
[['regression: scenario 10',
[10, 40, [40, 40, 40, 20, 10, 40, 14, 21, 20, 40, 41, 10]],
[[0, 40, 50, 90], 8, None]],
['regression: scenario 7', [50, 40, [44, 9, 44, 100, 40, 68, 54, 100, 5, 40, 50]], [[0], 0, 40]],
['control: mixed overlaps', [10, 50, [5, 15, 3, 10, 12, 4]], [[0, 10, 30, 40], 2, None]],
['control: watchdog exceeded', [10, 12, [5, 13, 4]], [[0, 10], 0, 22]],
['regression: exact watchdog', [20, 30, [30, 5, 5, 5]], [[0, 40, 60], 1, None]],
['regression: first execution overruns', [10, 25, [30, 5]], [[0], 0, 25]],
['control: skip then drift', [10, 100, [25, 1, 1, 1, 1, 1]], [[0, 30, 40, 50], 2, None]],
['regression: scenario 1', [25, 60, [70, 25, 60, 35, 25, 15, 60, 60, 25, 50, 25, 4]], [[0], 0, 60]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: exact watchdog | [[0, 40, 60], 1, None] | [[0, 40, 60], 1, None] | Passed |
| regression: first execution overruns | [[0], 0, 25] | [[0], 0, 25] | Passed |
| control: mixed overlaps | [[0, 10, 30, 40], 2, None] | [[0, 10, 30, 40], 2, None] | Passed |
| control: watchdog exceeded | [[0, 10], 0, 22] | [[0, 10], 0, 22] | Passed |
| control: skip then drift | [[0, 30, 40, 50], 2, None] | [[0, 30, 40, 50], 2, None] | Passed |
| regression: scenario 1 | [[0, 100, 200, 250], 2, None] | [[0, 100, 200, 250], 2, None] | Passed |
| regression: scenario 2 | [[0, 100, 140], 5, None] | [[0, 100, 140], 5, None] | Passed |
| regression: scenario 3 | [[0], 0, 40] | [[0], 0, 40] | Passed |
SHA-256 / 9990d158802793ee1670d13333c256df57d670b4f2cacd8b1dae50ef8989e2bc
Verification & scope
A deterministic bounded teaching model of one PLC instruction or rung pattern evaluated scan by scan. The stated contract is a stipulated toy convention, not a claim of conformance to any vendor controller or IEC 61131-3 runtime. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:51:42.313706+00:00.
Case digest / fdc08f00e3787e0515ab7944c3234b8c8b81f46dbbbd1f4dfa5d3aac38932e15