Skip to content

feat(analysis): lambda delay and acceleration enrichment table generators (#3, #4) - #90

Merged
SomethingNew71 merged 5 commits into
ClassicMiniDIY:devfrom
Barneyjm:claude/jolly-volta-kdvpll
Sep 18, 2026
Merged

SomethingNew71 merged 5 commits into
ClassicMiniDIY:devfrom
Barneyjm:claude/jolly-volta-kdvpll

Conversation

@Barneyjm

Copy link
Copy Markdown
Contributor

Closes #4, closes #3.

Summary

Implements the tuning-table generators designed in docs/plans/2026-07-16-tuning-table-generators.md, revised per the 2026-09-17 review comments on #3 and #4. One framework in src/analysis/tables/, two generators on top of it, and a window in the Tools panel.

Framework (src/analysis/tables/)

  • TableAnalyzer sibling trait (a table is not one value per timestamp); TableEvent with RejectReason, RunReport with the rejection breakdown ("41 events found · 39 rejected: 30 unsteady, 9 no response"), TableAccumulator that folds several logs into one grid and re-bins per measure.
  • stats.rs: median/MAD/percentile, sample-and-hold update instants, effective update interval, robust noise sigma over update-instant differences.
  • binning.rs: edge-list AxisSpec (lower-edge inclusive, capped at 64 bins), CellStats with Confidence tiers (Empty/Low/Medium/High), TableGrid; histogram.rs now shares uniform_bin.
  • channel_map.rs: channel roles with three-tier auto-suggestion (normalization → strong hints → spec category → generic hints) plus a data-plausibility veto; averaged sensors lose 10 points; ties are flagged ⚠.
  • events.rs: Haltech sentinel masking, steadiness gates, crossing interpolation that respects sample-and-hold sensors, rate-run detection and merging.
  • export.rs: CSV (value/count/MAD/confidence grids, blank empties) and tab-separated clipboard copy; delay unit conversion to engine cycles / ignition events.

Lambda delay (lambda_delay.rs, #4): PW steps → first wideband crossing of max(k·σ, min_delta); gates for steady RPM/load, spacing, PW floor, fuel cut, clutch, coolant, closed-loop movement, invalid samples, axis; dead time primary, t63 secondary; strict/relaxed profiles; injector dead-time parameter.

Accel enrichment (accel_enrich.rs, #3): tip-ins from a native rate channel (scale detected) or a computed TPS/MAP derivative; AFR window shifted by the session lambda-delay cell (Medium/High) or an assumed delay; signed excursion depth, duration, area vs target or baseline; suggested starting correction, clamped; additional kind when an ECU AE-activity role is mapped, with AeKindMismatch rejection so one cell never mixes kinds; gear-shift gate on an RPM drop.

UI (src/ui/table_generator.rs, tools panel section): setup with auto-suggested roles, editable axis edges, parameter grid; Viridis heatmap with confidence-coloured count badges, hover tooltips; per-cell event inspector with jump-to-time; add/remove log, reset, measure selector, CSV export, clipboard copy. Strings in all 15 locales.

Normalization: injector on-time names → Pulse Width; TPS DOT / Throttle Position Derivative / TPS Delta → new TPS Rate.

Tests

  • 57 unit tests in src/analysis/tables/ including synthetic ground truth: delay recovered across 10–100 Hz logs, 10 Hz sensors inside 100 Hz logs, σ ∈ {0, 0.005, 0.02}; AFR input = lambda input; every rejection reason; ragged log → error, no panic; lambda-delay → AE composition.
  • 11 fixture tests in tests/core/table_generator_tests.rs: auto-suggestion on Haltech / MegaSquirt / rusEFI, driving-log breakdown and low-rate warning, Haltech strict ≥ 90 % rejection with sentinels masked, tip-in detection against Haltech Transient Throttle Load Derivative and rusEFI Fuel: TPS AE Active, AE binning + export, timing guard on the 88 MB log.
  • cargo fmt --check, cargo clippy --all-targets --all-features -D warnings, cargo test --all-features, cargo doc --no-deps all clean on Rust 1.95.

Not in this PR (from the design)

MCP tools for the generators, per-ECU mapping presets on disk (session-only for now), the cross-correlation mode, the wiki page, and the version bump.

https://claude.ai/code/session_01VFsMnFcGNJfTPz6QBiEEUN

…) and accel enrichment (ClassicMiniDIY#3)

Adds src/analysis/tables/: a sibling TableAnalyzer trait for generators
whose output is a 2-D tuning table rather than one value per timestamp,
with robust statistics (median/MAD, update instants, effective update
interval), edge-list axes with lower-edge-inclusive binning and
confidence tiers, channel roles with three-tier auto-suggestion, event
primitives (sentinel masking, steadiness gates, sample-and-hold aware
crossing interpolation, rate runs), an accumulator that folds several
logs into one grid and re-bins per measure, and CSV/clipboard export.

Lambda delay: injector pulse-width steps to the first wideband crossing
of max(k*sigma, min_delta), gated on steady RPM/load, spacing, fuel cut,
clutch, coolant and closed-loop movement; dead time primary, t63
secondary; strict/relaxed profiles; ms, engine cycles or ignition events
on export.

Accel enrichment: tip-ins from a native throttle-rate channel (scale
detected) or a computed TPS/MAP derivative, AFR window shifted by a
session lambda-delay cell or an assumed delay, signed excursion depth,
duration and area against target or baseline, suggested starting
correction clamped, "additional" kind when an ECU AE-activity role is
mapped.

Synthetic ground-truth tests cover 10-100 Hz logs, 10 Hz sensors inside
100 Hz logs, noise, AFR vs lambda input, every rejection reason, ragged
logs, and lambda-delay to AE composition. LoadedFile gains a per-load
nonce so accumulated events never key on a file index; the histogram's
cell math now shares binning::uniform_bin.

Claude-Session: https://claude.ai/code/session_01VFsMnFcGNJfTPz6QBiEEUN
Injector 1 On Time, Injection Stage 1 Average Injection Time, Injection
Effective/Actual PW, Fuel: Last inj pulse width, Base PW and
INJ Duration(ms) now normalize to Pulse Width; TPS DOT, Throttle
Position Derivative and TPS Delta to a new TPS Rate canonical, so the
table generators' auto-suggestion resolves them outright.

Claude-Session: https://claude.ai/code/session_01VFsMnFcGNJfTPz6QBiEEUN
… rusEFI logs

Auto-suggestion regression on all three, driving-log rejection
breakdown and low-rate warning on MegaSquirt, sentinel masking and the
strict >= 90 % rejection on the Haltech blip log, tip-in detection
checked against Haltech's Transient Throttle Load Derivative and
rusEFI's Fuel: TPS AE Active, AE events binned and exported, lambda
delay grid feeding AE, and a timing guard on the 88 MB Haltech log when
present.

Claude-Session: https://claude.ai/code/session_01VFsMnFcGNJfTPz6QBiEEUN
Tools panel gains a Table Generators section opening a window with
setup (auto-suggested channel roles with ambiguity flags, editable axis
edges, parameter grid, gating profile), a Viridis heatmap with value
text and confidence-coloured count badges, hover tooltips, a per-cell
event inspector with jump-to-time, add/remove log, reset, measure
selector, CSV export and tab-separated clipboard copy. Strings under
table_gen.* in all 15 locales.

Claude-Session: https://claude.ai/code/session_01VFsMnFcGNJfTPz6QBiEEUN
Brings the 2026-07-16 design doc onto main with an implementation-notes
section, adds the Table Generators contracts to CLAUDE.md and the
feature to the README.

Claude-Session: https://claude.ai/code/session_01VFsMnFcGNJfTPz6QBiEEUN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Lambda delay table geneator [Feature]: Acceleration enrichment table Generator

3 participants