BEAN-CAN GatewayPUBLIC

BEANalyzer UltraPro 5 — Replay → Mapping v3 → CAN Runtime

Date: 2026-09-20 Status: IMPLEMENTED IN CODE / CANalyst-II HARDWARE VALIDATION PENDING Edition: FULL Runtime: GatewayRuntimeV3 Purpose This runtime completes the bench workflow: Recorded BEAN traffic ↓ Replay ↓ Gateway Mapping v3 ↓ CAN composition / scheduling ↓ python-can ↓ CANalyst-II ↓ target…

Date: 2026-09-20 Status: IMPLEMENTED IN CODE / CANalyst-II HARDWARE VALIDATION PENDING Edition: FULL Runtime: GatewayRuntimeV3

Purpose

This runtime completes the bench workflow:

Recorded BEAN traffic
        ↓
Replay
        ↓
Gateway Mapping v3
        ↓
CAN composition / scheduling
        ↓
python-can
        ↓
CANalyst-II
        ↓
target CAN device

A physical BEAN interface is not required when the BEAN source is a Replay.

Recommended bench setup

Computer running BEANalyzer UltraPro 5 FULL
        │
        ├── BEAN source: Emulator / Replay
        │
        └── USB → CANalyst-II → CAN-H / CAN-L → target ECU/display/logger

The BEAN emulator is a virtual input source only. It does not electrically drive BEAN.

Preparation

1. Select the virtual BEAN source

At the top of BEANalyzer:

BEAN Source:
Emulator / Replay (no BEAN hardware)

Press:

Activate Emulator

This step expresses the intended bench topology. The Replay runtime itself does not open or require a BEAN serial adapter.

2. Connect CANalyst-II

Open:

Devices / CAN Gateway

Configure the python-can interface, channel and bitrate, then connect.

Example:

Interface: canalystii
Channel:   0
Bitrate:   500000

Mapping v3 automatic Replay output currently uses the python-can backend.

3. Design and save Mapping v3

Open:

Open Gateway Mapping Editor...

For every CAN message that should transmit automatically:

  • enable the mapping;
  • choose a CAN ID and DLC;
  • add the required fields;
  • choose a Trigger other than Manual / test only;
  • configure stale behavior;
  • Save the document.

A manual-only mapping remains available for Preview/Test but does not participate in automatic Replay output.

Starting automatic Replay → CAN

Open:

Replay / Export

Load the BEAN CSV, then use:

Enable physical BEAN stream   OFF
Enable Mapping v3 → CAN       ON

Press Start Replay.

Before physical output starts, BEANalyzer verifies:

  1. python-can is connected;
  2. Mapping v3 JSON loads and validates;
  3. at least one mapping is enabled;
  4. at least one enabled mapping uses an automatic trigger.

BEANalyzer then asks for confirmation because the selected python-can backend will transmit onto the physical CAN bus.

Runtime data path

For each Replay BEAN frame:

ReplayWorker
    ↓
Replay filter
    ↓
Replay dispatch queue
    ↓
GatewayRuntimeV3
    ├── preserve raw CTX/DID/MID/DATA
    ├── decode BEAN signals when definitions exist
    ├── update signal cache
    ├── update raw matched-message state
    └── evaluate event-driven mappings
    ↓
normal BEANalyzer Replay visualization

A dedicated 5 ms Qt timer executes periodic and heartbeat Mapping v3 schedules while Replay is active.

Gateway ingestion happens before Live-table display filtering. UI settings such as Only decoded, Only changes or a text filter therefore do not remove data from the gateway runtime.

Raw messages without BEAN-DBC definitions

Mapping v3 does not require every Replay message to exist in the BEAN-DBC.

When the CSV includes explicit columns such as:

context
did
mid
data

the Replay parser preserves those values separately and the Mapping v3 runtime uses them for selector matching and raw-field extraction.

This permits mappings for messages that are still:

UNKNOWN
HYPOTHETICAL
VALIDATION PENDING

without promoting them to a decoded/confirmed semantic signal.

Trigger modes

Every matching BEAN message

matching BEAN Replay frame
        ↓
compose CAN
        ↓
TX

Use this when CAN should follow each matching source event.

On output value change

The runtime evaluates semantic mapped source values.

Counters and checksums are not used as change triggers by themselves.

Example:

speed 50 → TX
speed 50 → no TX
speed 51 → TX

Fixed periodic rate

The runtime sends from the latest cached source state at the configured period.

Example:

period_ms = 20
≈ target 50 Hz

The period uses host wall-clock time.

Changing Replay speed changes how quickly historical source values evolve; it does not automatically change a configured 20 ms CAN period.

On change + heartbeat

The runtime sends immediately when mapped values change and also sends at the configured heartbeat interval when unchanged.

Manual / test only

No automatic Replay transmission.

Use Preview/Test TX from the Mapping editor instead.

Multi-message CAN composition

A single outgoing CAN message may depend on decoded signals learned from several different BEAN messages.

Example:

BEAN FE/26 → RPM
BEAN FE/24 → speed
BEAN FE/2C → coolant

        ↓ cached state

CAN 0x500
B0-B1 RPM
B2-B3 speed
B4 coolant
...

The runtime maintains the latest numeric decoded value and update timestamp for each signal.

Stale / missing source policy

Per mapping:

timeout_ms
action
invalid_value

Supported actions:

Keep last value

Continue using the latest known value after it becomes stale.

If a required source has never been observed, transmission waits because there is no last value to keep.

Set zero

Replace stale/missing dynamic data with zero.

Set configured invalid value

Replace stale/missing dynamic data with the mapping's configured invalid value.

Suppress CAN frame

Do not transmit while required data is stale or missing.

Rolling counters

Counter fields advance only after a successful CAN TX.

Example 4-bit counter:

0 1 2 3 ... 14 15 0 1 ...

If CAN transmission fails, the counter is not advanced.

When Replay Loop Mode starts a new pass, runtime state and counters are reset so values from the end of the previous historical pass do not leak into the next pass.

Checksums

XOR8, SUM8 and configured CRC8 continue to be calculated by the Mapping v3 composer after normal fields have been packed.

Counters therefore advance for the next frame, while the current frame checksum covers the current packed payload.

Pause / Resume

Replay Pause also pauses Mapping v3 scheduling.

No automatic CAN frames are emitted by the runtime while paused.

On Resume, source freshness and scheduling timestamps are rebased by the duration of the pause. A long user pause therefore does not cause every cached signal to become stale immediately.

Timeline seek

When an active Replay is moved to another timeline position:

  1. current Replay producer is stopped;
  2. queued old-position frames are discarded;
  3. Mapping v3 runtime is stopped/reset;
  4. Replay restarts at the selected CSV row;
  5. the previously authorized Mapping v3 → CAN mode is restored;
  6. no second physical-output confirmation is shown merely because of the seek.

Warm-up limitation

A seek does not currently pre-read earlier CSV rows to reconstruct state.

For multi-message mappings, cached signals therefore start empty at the selected position and become available as the required source messages appear after that point.

Stale/missing policy controls behavior during this warm-up.

Replay filter interaction

Replay filtering happens before Mapping v3 ingestion.

If a required BEAN message is unchecked in the Replay filter, the Mapping v3 runtime never sees it.

For multi-message mappings, ensure every required source message is included.

CAN backend failure

If python-can raises during automatic TX, Mapping v3:

  • records the backend error;
  • immediately deactivates the runtime;
  • stops automatic CAN output;
  • leaves Replay itself free to continue visually;
  • exposes the error in Replay status/log.

This fail-closed behavior avoids continuously hammering a disconnected or broken CAN interface.

CAN Gateway Monitor

Automatic TX from Mapping v3 is visible in the CAN Gateway Monitor.

TX events include notes similar to:

Gateway Mapping v3: Aftermarket ECU Engine Data [periodic 20 ms]

or:

Gateway Mapping v3: Body Status [value change]

This makes automatic traffic distinguishable from manual TX.

Timing characteristics

The runtime is a desktop development tool, not a hard-real-time controller.

Current scheduling architecture:

Replay source timing
    ↓
Qt Replay dispatch
    ↓
event-driven Mapping v3 sends

plus

5 ms Qt timer
    ↓
periodic / heartbeat Mapping v3 sends

Expected use includes normal gateway prototyping and ECU bench testing. Exact jitter, maximum sustainable rate and long-duration behavior must be measured on the target computer and packaged build before a timing-critical implementation is considered validated.

Evidence classification

  • Replay parser → Mapping v3 ingestion: CONFIRMED BY CODE
  • Raw CTX/DID/MID/DATA preservation: CONFIRMED BY CODE
  • Multi-message decoded signal cache: CONFIRMED BY CODE
  • Trigger scheduler implementation: CONFIRMED BY CODE
  • Stale policy implementation: CONFIRMED BY CODE
  • Counter advancement/reset implementation: CONFIRMED BY CODE
  • Pause / seek / loop integration: CONFIRMED BY CODE
  • Automatic python-can TX callback: CONFIRMED BY CODE
  • CANalyst-II backend compatibility path: CORROBORATED BY EXISTING BACKEND IMPLEMENTATION
  • Real Replay → Mapping v3 → CANalyst-II electrical output: PENDING USER/HARDWARE VALIDATION
  • Exact timing/jitter under sustained load: PENDING VALIDATION

Regression source

The branch includes:

tests_original/test_gateway_runtime_v3.py

with coverage for raw automatic mapping, periodic decoded output, on-change behavior, stale suppression, rolling counters, loop reset, pause/freshness handling, backend failure and Replay integration ordering.

The regression source is committed, but a successful GitHub Actions execution is not claimed because the repository's recent temporary Actions runs failed before exposing executable job steps or usable logs.

CANalyst-II automatic channel recovery

BEANalyzer's bundled CANalyst-II wrapper now monitors the controller transmit-error state during automatic and manual python-can transmission.

The wrapper serializes USB RX/TX operations and samples the CAN controller status. If the transmit error counter approaches the controller's passive-error threshold, or Bus-Off is reported, BEANalyzer reinitializes the active CAN channel at the existing bitrate and resumes operation.

Runtime status exposes:

CANalyst TEC:<transmit-error-counter> REC:<automatic-recovery-count>

Example:

CANalyst TEC:0 REC:2

means BEANalyzer has automatically reinitialized the CANalyst-II channel twice during the session.

The recovery mechanism is transport-level and is independent of Mapping v3. It also protects manual CAN Gateway Monitor TX that uses the same python-can/CANalyst-II connection.

The upstream CANalyst-II USB protocol is unofficial/reverse-engineered, so exact controller-status field naming remains partially inferred. For this reason the auto-recovery implementation is classified as IMPLEMENTED / HARDWARE REVALIDATION REQUIRED until reproduced successfully on the user's CANalyst-II.