FAILURE MAP
← Case archive

FA-93591 / Solar tracker geometry / Open access

Torque-tube inclinometer rotation: angle quadrant · case 01

A level tracker reads 90 degrees.

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

atan2 arguments are swapped.

VERIFIED REPAIR

Rotation = atan2(ax, az).

Unsuccessful approach: A plain arctangent loses the quadrant when the tube is past vertical.

Case contract

ax (across-axis) and az (normal) are gravity components in g. The magnitude must be within [0.8, 1.2] g, else [None, 'fault']. Rotation = atan2(ax, az) in degrees, negated for a sensor mounted on the west side, then minus the calibration offset, normalised to (-180, 180]. Return [angle rounded 2, 'ok'].

Why this case matters

Single-axis and dual-axis solar trackers turn a sun direction into actuator commands; a sign, frame or limit mistake points a whole plant away from the sun or into a mechanical stop.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(ax, az, mount, offset):
    mag = math.hypot(ax, az)
    if not 0.8 <= mag <= 1.2:
        return [None, 'fault']
    ang = math.degrees(math.atan2(az, ax))
    if mount == 'west':
        ang = -ang
    ang -= offset
    ang = (ang + 180) % 360 - 180
    if ang == -180:
        ang = 180.0
    return [round(ang, 2), 'ok']
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: magnitude at lower bound', [0.0, 0.8, 'east', 0], [0.0, 'ok']],
  ['boundary: magnitude at upper bound', [1.2, 0.0, 'east', 0], [90.0, 'ok']],
  ['boundary: upside-down reading', [0.0, -1.0, 'east', 0], [180.0, 'ok']],
  ['regression: angle quadrant', [0.7778, -0.7778, 'west', 5], [-140.0, 'ok']],
  ['regression: angle quadrant (partial repair)', [-0.0175, -0.9998, 'west', 0], [179.0, 'ok']],
  ['control 1', [-1.1, 0.0, 'west', 0], [90.0, 'ok']],
  ['control 2', [-0.4, 0.6928, 'east', 0], [None, 'fault']]],
 [['boundary: magnitude at lower bound', [0.0, 0.8, 'east', 0], [0.0, 'ok']],
  ['boundary: magnitude at upper bound', [1.2, 0.0, 'east', 0], [90.0, 'ok']],
  ['boundary: upside-down reading', [0.0, -1.0, 'east', 0], [180.0, 'ok']],
  ['regression: angle quadrant', [0.0, -1.0, 'east', 2], [178.0, 'ok']],
  ['regression: angle quadrant (partial repair)', [0.5657, -0.5657, 'west', 2], [-137.0, 'ok']],
  ['control 1', [-0.7778, 0.7778, 'east', 0], [-45.0, 'ok']],
  ['control 2', [0.0, 1.1, 'east', 2], [-2.0, 'ok']]],
 [['boundary: magnitude at lower bound', [0.0, 0.8, 'east', 0], [0.0, 'ok']],
  ['boundary: magnitude at upper bound', [1.2, 0.0, 'east', 0], [90.0, 'ok']],
  ['boundary: upside-down reading', [0.0, -1.0, 'east', 0], [180.0, 'ok']],
  ['regression: angle quadrant', [0.2588, 0.9659, 'east', 0], [15.0, 'ok']],
  ['regression: angle quadrant (partial repair)', [-1.0392, -0.6, 'east', 5], [-125.0, 'ok']],
  ['control 1', [0.25, 0.433, 'west', 2], [None, 'fault']],
  ['control 2', [0.8485, -0.8485, 'west', -3], [-132.0, 'ok']]],
 [['boundary: magnitude at lower bound', [0.0, 0.8, 'east', 0], [0.0, 'ok']],
  ['boundary: magnitude at upper bound', [1.2, 0.0, 'east', 0], [90.0, 'ok']],
  ['boundary: upside-down reading', [0.0, -1.0, 'east', 0], [180.0, 'ok']],
  ['regression: angle quadrant', [0.9526, 0.55, 'west', 0], [-60.0, 'ok']],
  ['regression: angle quadrant (partial repair)', [0.0, -1.0, 'east', 5], [175.0, 'ok']],
  ['control 1', [0.5657, -0.5657, 'east', -3], [138.0, 'ok']],
  ['control 2', [-0.6, 1.0392, 'east', 0], [-30.0, 'ok']]],
 [['boundary: magnitude at lower bound', [0.0, 0.8, 'east', 0], [0.0, 'ok']],
  ['boundary: magnitude at upper bound', [1.2, 0.0, 'east', 0], [90.0, 'ok']],
  ['boundary: upside-down reading', [0.0, -1.0, 'east', 0], [180.0, 'ok']],
  ['regression: angle quadrant', [-0.866, -0.5, 'west', 2], [118.0, 'ok']],
  ['regression: angle quadrant (partial repair)', [0.7071, -0.7071, 'east', 0], [135.0, 'ok']],
  ['control 1', [0.6928, 0.4, 'east', 5], [None, 'fault']],
  ['control 2', [-0.55, 0.9526, 'east', 2], [-32.0, 'ok']]]]
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 fixtureActualExpectedOutcome
boundary: magnitude at lower bound[90.0, 'ok'][0.0, 'ok']Failed
boundary: magnitude at upper bound[0.0, 'ok'][90.0, 'ok']Failed
boundary: upside-down reading[-90.0, 'ok'][180.0, 'ok']Failed
regression: angle quadrant[40.0, 'ok'][-140.0, 'ok']Failed
regression: angle quadrant (partial repair)[91.0, 'ok'][179.0, 'ok']Failed
control 1[180.0, 'ok'][90.0, 'ok']Failed
control 2[None, 'fault'][None, 'fault']Passed

SHA-256 / e8a5e63d1bc1fa0e9281dd2bd71c1aa36fb5845c838af13a11720ca6048ffe3b

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(ax, az, mount, offset):
    mag = math.hypot(ax, az)
    if not 0.8 <= mag <= 1.2:
        return [None, 'fault']
    ang = math.degrees(math.atan(ax / az)) if az else 90.0
    if mount == 'west':
        ang = -ang
    ang -= offset
    ang = (ang + 180) % 360 - 180
    if ang == -180:
        ang = 180.0
    return [round(ang, 2), 'ok']
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: magnitude at lower bound', [0.0, 0.8, 'east', 0], [0.0, 'ok']],
  ['boundary: magnitude at upper bound', [1.2, 0.0, 'east', 0], [90.0, 'ok']],
  ['boundary: upside-down reading', [0.0, -1.0, 'east', 0], [180.0, 'ok']],
  ['regression: angle quadrant', [0.7778, -0.7778, 'west', 5], [-140.0, 'ok']],
  ['regression: angle quadrant (partial repair)', [-0.0175, -0.9998, 'west', 0], [179.0, 'ok']],
  ['control 1', [-1.1, 0.0, 'west', 0], [90.0, 'ok']],
  ['control 2', [-0.4, 0.6928, 'east', 0], [None, 'fault']]],
 [['boundary: magnitude at lower bound', [0.0, 0.8, 'east', 0], [0.0, 'ok']],
  ['boundary: magnitude at upper bound', [1.2, 0.0, 'east', 0], [90.0, 'ok']],
  ['boundary: upside-down reading', [0.0, -1.0, 'east', 0], [180.0, 'ok']],
  ['regression: angle quadrant', [0.0, -1.0, 'east', 2], [178.0, 'ok']],
  ['regression: angle quadrant (partial repair)', [0.5657, -0.5657, 'west', 2], [-137.0, 'ok']],
  ['control 1', [-0.7778, 0.7778, 'east', 0], [-45.0, 'ok']],
  ['control 2', [0.0, 1.1, 'east', 2], [-2.0, 'ok']]],
 [['boundary: magnitude at lower bound', [0.0, 0.8, 'east', 0], [0.0, 'ok']],
  ['boundary: magnitude at upper bound', [1.2, 0.0, 'east', 0], [90.0, 'ok']],
  ['boundary: upside-down reading', [0.0, -1.0, 'east', 0], [180.0, 'ok']],
  ['regression: angle quadrant', [0.2588, 0.9659, 'east', 0], [15.0, 'ok']],
  ['regression: angle quadrant (partial repair)', [-1.0392, -0.6, 'east', 5], [-125.0, 'ok']],
  ['control 1', [0.25, 0.433, 'west', 2], [None, 'fault']],
  ['control 2', [0.8485, -0.8485, 'west', -3], [-132.0, 'ok']]],
 [['boundary: magnitude at lower bound', [0.0, 0.8, 'east', 0], [0.0, 'ok']],
  ['boundary: magnitude at upper bound', [1.2, 0.0, 'east', 0], [90.0, 'ok']],
  ['boundary: upside-down reading', [0.0, -1.0, 'east', 0], [180.0, 'ok']],
  ['regression: angle quadrant', [0.9526, 0.55, 'west', 0], [-60.0, 'ok']],
  ['regression: angle quadrant (partial repair)', [0.0, -1.0, 'east', 5], [175.0, 'ok']],
  ['control 1', [0.5657, -0.5657, 'east', -3], [138.0, 'ok']],
  ['control 2', [-0.6, 1.0392, 'east', 0], [-30.0, 'ok']]],
 [['boundary: magnitude at lower bound', [0.0, 0.8, 'east', 0], [0.0, 'ok']],
  ['boundary: magnitude at upper bound', [1.2, 0.0, 'east', 0], [90.0, 'ok']],
  ['boundary: upside-down reading', [0.0, -1.0, 'east', 0], [180.0, 'ok']],
  ['regression: angle quadrant', [-0.866, -0.5, 'west', 2], [118.0, 'ok']],
  ['regression: angle quadrant (partial repair)', [0.7071, -0.7071, 'east', 0], [135.0, 'ok']],
  ['control 1', [0.6928, 0.4, 'east', 5], [None, 'fault']],
  ['control 2', [-0.55, 0.9526, 'east', 2], [-32.0, 'ok']]]]
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 fixtureActualExpectedOutcome
boundary: magnitude at lower bound[0.0, 'ok'][0.0, 'ok']Passed
boundary: magnitude at upper bound[90.0, 'ok'][90.0, 'ok']Passed
boundary: upside-down reading[0.0, 'ok'][180.0, 'ok']Failed
regression: angle quadrant[40.0, 'ok'][-140.0, 'ok']Failed
regression: angle quadrant (partial repair)[-1.0, 'ok'][179.0, 'ok']Failed
control 1[-90.0, 'ok'][90.0, 'ok']Failed
control 2[None, 'fault'][None, 'fault']Passed

SHA-256 / d6a9ce4ebe99e4eca07f3c8dce3fc53aab0d38e3826a268966e55007cf335293

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(ax, az, mount, offset):
    mag = math.hypot(ax, az)
    if not 0.8 <= mag <= 1.2:
        return [None, 'fault']
    ang = math.degrees(math.atan2(ax, az))
    if mount == 'west':
        ang = -ang
    ang -= offset
    ang = (ang + 180) % 360 - 180
    if ang == -180:
        ang = 180.0
    return [round(ang, 2), 'ok']
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: magnitude at lower bound', [0.0, 0.8, 'east', 0], [0.0, 'ok']],
  ['boundary: magnitude at upper bound', [1.2, 0.0, 'east', 0], [90.0, 'ok']],
  ['boundary: upside-down reading', [0.0, -1.0, 'east', 0], [180.0, 'ok']],
  ['regression: angle quadrant', [0.7778, -0.7778, 'west', 5], [-140.0, 'ok']],
  ['regression: angle quadrant (partial repair)', [-0.0175, -0.9998, 'west', 0], [179.0, 'ok']],
  ['control 1', [-1.1, 0.0, 'west', 0], [90.0, 'ok']],
  ['control 2', [-0.4, 0.6928, 'east', 0], [None, 'fault']]],
 [['boundary: magnitude at lower bound', [0.0, 0.8, 'east', 0], [0.0, 'ok']],
  ['boundary: magnitude at upper bound', [1.2, 0.0, 'east', 0], [90.0, 'ok']],
  ['boundary: upside-down reading', [0.0, -1.0, 'east', 0], [180.0, 'ok']],
  ['regression: angle quadrant', [0.0, -1.0, 'east', 2], [178.0, 'ok']],
  ['regression: angle quadrant (partial repair)', [0.5657, -0.5657, 'west', 2], [-137.0, 'ok']],
  ['control 1', [-0.7778, 0.7778, 'east', 0], [-45.0, 'ok']],
  ['control 2', [0.0, 1.1, 'east', 2], [-2.0, 'ok']]],
 [['boundary: magnitude at lower bound', [0.0, 0.8, 'east', 0], [0.0, 'ok']],
  ['boundary: magnitude at upper bound', [1.2, 0.0, 'east', 0], [90.0, 'ok']],
  ['boundary: upside-down reading', [0.0, -1.0, 'east', 0], [180.0, 'ok']],
  ['regression: angle quadrant', [0.2588, 0.9659, 'east', 0], [15.0, 'ok']],
  ['regression: angle quadrant (partial repair)', [-1.0392, -0.6, 'east', 5], [-125.0, 'ok']],
  ['control 1', [0.25, 0.433, 'west', 2], [None, 'fault']],
  ['control 2', [0.8485, -0.8485, 'west', -3], [-132.0, 'ok']]],
 [['boundary: magnitude at lower bound', [0.0, 0.8, 'east', 0], [0.0, 'ok']],
  ['boundary: magnitude at upper bound', [1.2, 0.0, 'east', 0], [90.0, 'ok']],
  ['boundary: upside-down reading', [0.0, -1.0, 'east', 0], [180.0, 'ok']],
  ['regression: angle quadrant', [0.9526, 0.55, 'west', 0], [-60.0, 'ok']],
  ['regression: angle quadrant (partial repair)', [0.0, -1.0, 'east', 5], [175.0, 'ok']],
  ['control 1', [0.5657, -0.5657, 'east', -3], [138.0, 'ok']],
  ['control 2', [-0.6, 1.0392, 'east', 0], [-30.0, 'ok']]],
 [['boundary: magnitude at lower bound', [0.0, 0.8, 'east', 0], [0.0, 'ok']],
  ['boundary: magnitude at upper bound', [1.2, 0.0, 'east', 0], [90.0, 'ok']],
  ['boundary: upside-down reading', [0.0, -1.0, 'east', 0], [180.0, 'ok']],
  ['regression: angle quadrant', [-0.866, -0.5, 'west', 2], [118.0, 'ok']],
  ['regression: angle quadrant (partial repair)', [0.7071, -0.7071, 'east', 0], [135.0, 'ok']],
  ['control 1', [0.6928, 0.4, 'east', 5], [None, 'fault']],
  ['control 2', [-0.55, 0.9526, 'east', 2], [-32.0, 'ok']]]]
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 fixtureActualExpectedOutcome
boundary: magnitude at lower bound[0.0, 'ok'][0.0, 'ok']Passed
boundary: magnitude at upper bound[90.0, 'ok'][90.0, 'ok']Passed
boundary: upside-down reading[180.0, 'ok'][180.0, 'ok']Passed
regression: angle quadrant[-140.0, 'ok'][-140.0, 'ok']Passed
regression: angle quadrant (partial repair)[179.0, 'ok'][179.0, 'ok']Passed
control 1[90.0, 'ok'][90.0, 'ok']Passed
control 2[None, 'fault'][None, 'fault']Passed

SHA-256 / 39a378fbc312f82142b046707c415dee07d303b36d435776dc83c1b41193bdc5

Verification & scope

Deterministic stipulated toy contract for teaching; no claim of conformance with any standard, vendor protocol or production controller. 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:56.539938+00:00.

Case digest / d09f8c89300c6835b6e17dec7356a4bd8bbef7e9a372f4c5d0c1fa447fd342ee