feat: restore bench section UI with controls, PID RPM ramp, flowmeter charts, and fix CAN IDs

Restore the full bench control panel from the old source with MVVM architecture:

- Two-column left panel layout: bench info displays (RPM with target/voltage,
  temps, pressures, Q-flow, pump live values) and user commands (direction
  toggle, start/stop with RPM popup and quick-select buttons, oil pump toggle,
  turn downcounter with CAN send)
- PID RPM ramp controller (BenchPidController) with bumpless startup,
  anti-windup, and derivative-on-measurement for smooth motor speed transitions
- Real-time flowmeter charts (LiveChartsCore) for Q-Delivery and Q-Over
  with tolerance band overlays
- Bench/pump CAN liveness detection in PcanAdapter (receive-only IDs)
- K-Line connection status indicator (placeholder)
- Periodic relay bitmask sender (~21ms) and ElectronicMsg keepalive start
  on CAN connect, pump sender starts immediately on pump load

Fix critical CAN message ID bug: default bench XML values were incorrectly
converted from old source (decimal-notation hex parsed as actual hex digits,
e.g. "10" -> "A" instead of keeping "10" which parses as 0x10). Corrected
all IDs to match hardware: 0x10, 0x11, 0x13, 0x14, 0x15, 0x50, 0x51, 0x55.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-11 14:24:59 +02:00
parent 6d5605cddf
commit e343006f45
13 changed files with 1242 additions and 141 deletions

View File

@@ -113,9 +113,33 @@ namespace HC_APTBS.Services
/// <summary>
/// Commands the bench motor to the specified RPM by computing and applying
/// the corresponding voltage from the RPM-to-voltage lookup table.
/// Used by automated test execution for direct voltage jumps.
/// </summary>
void SetRpm(double rpm);
/// <summary>
/// Starts the PID-based RPM ramp controller to smoothly reach the target RPM.
/// Sends an initial voltage jump from the RPM-voltage lookup table, then hands
/// control to the PID loop after an approach delay.
/// Used for interactive (manual) bench control.
/// </summary>
/// <param name="targetRpm">Desired RPM setpoint.</param>
void StartRpmPid(double targetRpm);
/// <summary>
/// Stops the PID RPM controller, sends 0 V to the motor.
/// </summary>
void StopRpmPid();
/// <summary>The last RPM target that was commanded via <see cref="SetRpm"/> or <see cref="StartRpmPid"/>.</summary>
double LastTargetRpm { get; }
/// <summary>The last voltage value sent to the motor CAN parameter.</summary>
double LastCommandVoltage { get; }
/// <summary>Raised after a voltage command is sent to the motor (from <see cref="SetRpm"/> or the PID loop).</summary>
event Action? RpmCommandSent;
// ── Temperature control ───────────────────────────────────────────────────
/// <summary>
@@ -136,6 +160,18 @@ namespace HC_APTBS.Services
/// <param name="state">True = ON, false = OFF.</param>
void SetRelay(string relayName, bool state);
/// <summary>
/// Transmits the current relay bitmask once. Called on CAN connect so the
/// bench controller receives the initial relay state immediately.
/// </summary>
void SendInitialRelayState();
/// <summary>Starts the periodic relay bitmask sender (~21 ms cycle).</summary>
void StartRelaySender();
/// <summary>Stops the periodic relay bitmask sender.</summary>
void StopRelaySender();
// ── Test execution ────────────────────────────────────────────────────────
/// <summary>