BMS Testing

Testing the Battery Management System (BMS) is fundamentally a control system verification problem, not a checklist of bench tests. The BMS sits in a closed loop with the cells, the contactors, the cooling system and the wider vehicle or system controller, and every one of its core functions has to be proven correct before it ever touches a real cell. The discipline that gets you there is the same one used across the automotive and aerospace control system world: a structured maturity ladder that runs from pure software, through processor and hardware emulation, into real cells and modules, and finally the complete pack and system. Each rung adds fidelity (and risk) while removing abstraction. What doesn’t change is the requirement, the test case, or the pass/fail criterion behind it; only the level at which it gets exercised does.

The core BMS test domains, what you’re actually trying to prove regardless of where in the ladder you prove it, are:

  • Startup / shutdown logic and initialisation checks
  • HV system control (precharge, contactor sequencing, isolation monitoring)
  • SoX algorithm performance (SoC, SoH, SoP, SoE)
  • Fault injection and diagnostic response
  • Handshake and communication to the wider system
  • Error codes, DTC reporting and logging

A defect found at SIL costs minutes to fix. The same defect found at system level, on a live pack, can cost weeks, and in the worst case, a cell.

The Test Maturity Ladder
  • Model-in-the-Loop (MIL): the control algorithm, still as a model, tested against a plant model of the cell, pack and thermal system, before a line of production code exists
  • Software-in-the-Loop (SIL): the production C/C++ code, compiled for the host PC and tested against the same plant model, off-target
  • Processor-in-the-Loop (PIL): the compiled binary running on the actual target microcontroller (or a cycle-accurate equivalent), still closed-loop against the plant model
  • Hardware-in-the-Loop (HIL), Cell-Emulated: real BMS hardware (AFE, master, harness, sensors) closed-loop against a real-time plant model, with programmable power supplies and cell simulators standing in for the cells
  • Hardware-in-the-Loop (HIL), Cell/Module-in-the-Loop: real cells or modules replace some or all of the simulated channels, exposing real measurement noise, real OCV hysteresis and real thermal behaviour
  • Module / Pack-Level Testing: the live pack (production harness, contactors, fuses, cooling, full HV bus) in a test cell
  • System / Vehicle Integration: the pack inside the full system, with the real VCU, charger and cooling controller, exercised against drive cycles and real-world duty profiles
  • Fault Injection & Diagnostic Coverage: cross-cutting, applied at every rung above, against a requirements traceability matrix, so the same fault class is provably tested at the level it needs to be caught at
Model, Software & Processor-in-the-Loop (MIL / SIL / PIL)

This is the cheapest and fastest place to find a defect, and because nothing is destroyed, fault injection here can be as aggressive as the test plan allows. The discipline that makes this stage worth doing properly is requirements-based testing: every safety and functional requirement should trace to at least one test case, executed automatically, with a recorded result.

Algorithm Verification (MIL)

  • Back-to-Back Testing (Model vs. Reference)
    • Procedure: Run the same input vector through the model and a reference implementation (independent script or prior-generation algorithm); compare outputs bit-for-bit or within tolerance
    • Outputs: Pass/fail per signal; deviation plot vs. time
    • Relevance: Confirms the model itself is correct before any code is generated from it
  • SoX Algorithm Verification Against Synthetic Cell Data
    • Procedure: Drive the model with synthetic OCV / DCIR / ageing datasets covering the full SoC × temperature × ageing envelope
    • Outputs: SoC / SoH / SoP estimation error vs. ground truth, across the full operating envelope
    • Relevance: Establishes a baseline accuracy figure before the cell-level uncertainty of real hardware is introduced
  • Requirements-Based Test Case Generation
    • Procedure: Each functional and safety requirement is mapped to one or more test cases; coverage tracked in a traceability matrix
    • Outputs: Requirements coverage percentage; orphan-requirement and orphan-test-case reports
    • Relevance: The single biggest driver of whether the rest of the ladder finds the right defects

Software Verification (SIL)

  • Static Analysis / MISRA C Compliance
    • Procedure: Automated static analysis of the production C code against MISRA C guidelines; manual deviation review for any flagged rule
    • Outputs: Rule violation report; deviation log
    • Relevance: Catches undefined behaviour and unsafe constructs before they reach a target
  • Structural Code Coverage (MC/DC)
    • Procedure: Execute the full SIL test suite while instrumenting the code; measure statement, branch and Modified Condition/Decision Coverage
    • Standard: ISO 26262 Part 6: MC/DC required for ASIL C/D software
    • Outputs: Coverage percentage per module; justification report for any uncovered code
  • Back-to-Back Testing (Code vs. Model)
    • Procedure: Identical test vectors run through the model (MIL) and the compiled production code (SIL); outputs compared
    • Outputs: Numerical deviation report covering fixed-point quantisation, rounding and overflow
    • Relevance: Confirms the code generation or hand-coding step introduced no behavioural change
  • Boundary and Range Testing
    • Procedure: Inputs swept to and beyond defined operating limits (voltage, current, temperature, SoC), including out-of-range and NaN/Inf injection
    • Outputs: Confirmed safe-state response at every boundary; no undefined behaviour
  • Software Fault Injection
    • Procedure: Corrupt internal signals, force stuck-at values, freeze a task, or starve the scheduler within the SIL environment
    • Outputs: Confirmation that downstream safety mechanisms (range checks, plausibility checks, watchdog) respond as specified
  • Startup / Shutdown State Machine Verification
    • Procedure: Exercise every transition of the BMS state machine (Init → Standby → Drive → Charge → Fault → Shutdown), including illegal and out-of-sequence transitions
    • Outputs: State transition coverage; confirmation no illegal transition is reachable

Processor-in-the-Loop (PIL)

  • Worst-Case Execution Time (WCET)
    • Procedure: Run the SIL test suite on the actual target core (or a cycle-accurate instruction set simulator); measure task execution time under worst-case input conditions
    • Outputs: WCET per task vs. scheduler budget; margin report
    • Relevance: Confirms the algorithm completes within its allocated time slice on real silicon, a class of defect SIL cannot find
  • Fixed-Point / Numerical Equivalence
    • Procedure: Identical test vectors run through SIL (host floating-point) and PIL (target fixed-point or embedded floating-point); outputs compared
    • Outputs: Quantisation error report; confirms target arithmetic does not erode SoX accuracy
  • Memory and Stack Verification
    • Procedure: Static stack depth analysis plus runtime stack/heap watermarking during the PIL test suite
    • Outputs: Peak stack usage vs. allocation; confirms no overflow risk under worst-case call depth
Hardware-in-the-Loop: Cell-Emulated

This is where the BMS first meets real hardware: real AFE/ASIC, real harness, real connectors, real master controller, but the cells themselves are still synthetic, produced by a real-time plant model driving programmable power supplies or dedicated cell simulators. Nothing here can be damaged by an aggressive fault campaign, which makes this the right place to exhaust the electrical and communication fault list before live cells are put at risk.

Real-Time Plant Model

  • Cell & Pack Model Real-Time Execution
    • Procedure: The same plant model validated at MIL/SIL/PIL is deployed to a real-time target and run in closed loop with the physical BMS hardware
    • Outputs: Confirms the model executes within the real-time deadline (typically sub-millisecond for cell voltage loops)
    • Relevance: Model fidelity validated earlier is now load-bearing, so any shortcut taken for real-time execution must be re-verified
  • Cell Voltage Emulation
    • Procedure: Programmable bidirectional power supplies or dedicated cell simulator channels reproduce individual cell voltages, including OCV-SoC behaviour and dynamic response under simulated load
    • Outputs: Per-channel voltage accuracy vs. commanded value; settling time

HV System Control

  • Precharge Sequence Verification
    • Procedure: Real contactors (or a contactor emulation rig) and precharge resistor in the loop; full precharge sequence exercised including timeout and abort paths
    • Outputs: Precharge time vs. spec; confirmation of correct contactor sequencing under nominal and fault conditions
  • Contactor Weld Detection
    • Procedure: Inject a simulated welded-contactor condition (voltage present where it shouldn’t be) and confirm detection and correct fallback
    • Outputs: Detection time; confirmation system enters the defined safe state
  • HV Isolation Monitoring Fault Injection
    • Procedure: Resistor network injects defined isolation faults (positive and negative leg) at the HV bus; BMS isolation monitor response is checked against the 500 Ω/V requirement
    • Outputs: Detected isolation resistance vs. injected value; response time vs. requirement
  • HVIL Loop Fault Injection
    • Procedure: Open the interlock loop at a connector, junction, or service disconnect point during operation
    • Outputs: Confirmation of correct fault latch and contactor-open response within the required time

Communication & Handshake

  • CAN/LIN Bus Fault Injection
    • Procedure: Real bus hardware with a fault injection tool: dropped frames, bit-flip corruption, bus-off, stuck-dominant/recessive, timeout
    • Outputs: Confirmation of correct DTC generation, fallback mode entry and bus recovery behaviour
    • Standard: ISO 11898 (CAN) as a baseline; OEM-specific communication matrix for application-level handshake. ISO 21434 increasingly informs message authentication and anti-spoofing test cases on this bus
  • System Handshake Sequence
    • Procedure: Emulated VCU/EMS exercises the full handshake sequence (wake-up, ready, drive enable, charge enable, sleep), including out-of-sequence and timeout cases
    • Outputs: Confirmation of correct response and fallback at every step
  • Error Code / DTC Reporting
    • Procedure: Every fault injected across the HIL campaign is cross-checked against the expected DTC, freeze-frame data and logging behaviour
    • Outputs: DTC coverage matrix; confirms every specified fault produces the specified diagnostic output, including the safety diagnostic measures (MAVD, RdV, dSOH) used to catch faults the primary limit checks miss

Electrical Fault Injection

  • Sense Line Open / Short Circuit
    • Procedure: Relay matrix opens or shorts individual voltage or temperature sense lines during operation
    • Outputs: Confirmation of plausibility check response, correct cell/sensor exclusion, and balancing inhibit where required
  • Connector / Harness Fault Injection
    • Procedure: Intermittent contact, cross-wiring and connector back-out simulated on the test harness
    • Outputs: Confirmation of robust detection without nuisance fault flagging under vibration-representative intermittents
Hardware-in-the-Loop: Cell & Module-in-the-Loop

At this rung, real cells or modules replace some or all of the simulated channels. This is the first point in the ladder where the BMS measurement chain is validated against genuine cell behaviour rather than a programmed approximation: real noise floor, real OCV hysteresis, real thermal mass, real ageing. It’s also where SoX algorithms move from “verified against the model” to “verified against the thing the model was built to represent.”

Measurement Validation

  • Voltage Measurement Accuracy
    • Procedure: Reference-grade meter (typically better than ±0.5 mV) measures true cell voltage in parallel with the BMS AFE channel across the operating range
    • Outputs: Measurement error vs. reference; confirms AFE accuracy under real cell impedance and noise, not just a calibration source
  • Four-Wire (Kelvin) Resistance Validation
    • Procedure: Compare the BMS-derived internal resistance estimate against a bench four-wire measurement on the same cell at matched SoC and temperature
    • Relevance: Standard reference technique for confirming field DCIR estimation isn’t contaminated by harness or contact resistance
  • Temperature Measurement & Virtual Sensor Validation
    • Procedure: Reference thermocouples placed at worst-case locations within the module; compared against both physical BMS sensors and any soft-sensor estimation algorithm
    • Outputs: Estimation error vs. ground truth across drive-cycle and fast-charge thermal transients
    • Relevance: The only stage where soft-sensor algorithms can be checked against truth rather than a model of truth

SoX Algorithm Closed-Loop Validation

  • SoC Estimation Accuracy
    • Procedure: Closed-loop cycling against a precision reference (Coulomb counter / cycler) over representative drive-cycle and idle profiles
    • Outputs: SoC error (%) vs. reference, across SoC range, temperature and current profile
    • Relevance: First point in the ladder where SoC accuracy, often built around a Kalman filter estimator, reflects genuine cell-to-cell variation rather than a single parameterised model
  • Cell Balancing Algorithm Validation
    • Procedure: Real cells deliberately imbalanced (controlled partial discharge); balancing algorithm run to convergence
    • Outputs: Time to balance; final imbalance (mV); confirms balancing current and thresholds match design intent against real cell capacity spread
  • State of Health Tracking Against Real Ageing
    • Procedure: Modules run through an accelerated ageing programme alongside reference RPTs; BMS SoH output compared against measured capacity fade and resistance growth
    • Outputs: SoH error vs. RPT-measured ground truth over the ageing programme; downstream remaining useful life prediction accuracy follows directly from this
    • Relevance: Long-duration test; many programmes run it in parallel with the module/pack ageing study rather than as a standalone HIL exercise

Real Fault Injection

  • Induced Cell-Level Faults
    • Procedure: Controlled, instrumented faults on sacrificial cells/modules: forced over-discharge of a single cell in a string, a deliberately degraded cell substituted into a healthy group, loose busbar torque
    • Outputs: Confirmation of detection threshold and time-to-detect against the safety requirement
    • Caution: Run in a contained, instrumented test cell; some of these tests are destructive by design and converge with the abuse test protocols and thermal runaway characterisation work
  • Connector Intermittent Fault Under Real Load
    • Procedure: As the HIL cell-emulated intermittent fault test, repeated with real cells under real charge/discharge current rather than a simulated load
    • Relevance: Real current transients couple differently into intermittent contacts than a simulated source
Module, Pack & System-Level Testing

The final rungs put the complete article together: production harness, real contactors and fuses, the full cooling loop and, at system level, the vehicle or installation the pack actually has to live inside. Very little new BMS logic is being tested here; what’s being proven is that everything verified in isolation at the rungs below still works once it’s all connected, packaged and subjected to the real environment.

Pack-Level (Live Pack)

  • Full HV System Control Verification
    • Procedure: Complete precharge, drive-enable and charge-enable sequences exercised on the assembled pack, including the Battery Disconnect Unit, at full operating voltage
    • Outputs: Confirms HIL-validated contactor and isolation logic holds true with production-impedance busbars and full pack capacitance
  • Module and Pack Thermal Validation
    • Procedure: Pack cycled in a thermal chamber across the full ambient range with representative drive-cycle current; cell-to-cell and zone-to-zone temperature spread measured
    • Outputs: Confirms thermal estimation and cooling control algorithms validated at module scale correctly to full pack thermal mass and cooling-loop dynamics
  • Pack-Level SoX Validation
    • Procedure: Full pack cycled against a precision DC source/sink or chassis dynamometer over representative duty cycles
    • Outputs: Pack-level SoC/SoP accuracy vs. reference; confirms the current limit tables hold under real string variation, and that cell-to-cell variation across the full string doesn’t degrade pack-level estimation beyond spec
    • Standard: GB/T 31467.1 (China); ISO 12405-1 international equivalent, for high-power traction pack/system performance test methods

System / Vehicle Integration

  • Full System Handshake
    • Procedure: Pack connected to the real (or production-representative) VCU, charger and thermal management controller; complete drive-cycle and charge-cycle sequences run
    • Outputs: Confirms the communication matrix and handshake logic validated against an emulated VCU at HIL behaves identically against the real one, and that the data path feeding cloud telemetry is intact end to end
  • Drive-Cycle and Duty-Cycle Validation
    • Procedure: Representative standard (WLTP, custom EV drive cycle, or application-specific BESS dispatch profile) run on the integrated system
    • Outputs: Confirms range/throughput prediction, thermal behaviour and SoX accuracy under genuine system-level duty rather than a synthetic profile
  • Stationary Storage: System-Level Convergence
    • Relevance: For BESS applications, this rung converges with BESS Factory Acceptance Testing: the same closed-loop duty-cycle and handshake verification, run as a 100%-of-units commissioning test rather than a one-off development exercise
  • End-of-Line and Production Validation
    • Procedure: The practical subset of the test ladder above that can run on every production unit: typically initial state checks, isolation resistance, communication handshake and a short functional cycle
    • Relevance: The final link between development-time verification and production-time confirmation that nothing has drifted

Functional Safety Closure

  • Safety Case Evidence Assembly
    • Procedure: Test evidence from every rung of the ladder mapped back to the safety goals and requirements defined at the start of the programme
    • Outputs: Completed safety case; confirmation every ASIL-rated requirement has traceable verification evidence at an appropriate level
    • Standard: ISO 26262 Part 4 (system) and Part 6 (software) confirmation measures, supported by process evidence from an Automotive SPICE / CMMI assessment. GB/T 38661 (China) covers equivalent BMS technical and test requirements for the Chinese market; the wider catalogue of pack and system standards is tracked in Legislation, Rules and Regulations
  • Regulatory SoH Accessibility
    • Relevance: The EU Battery Regulation (2023/1542) requires SoH to be readable from the BMS as part of the battery passport, so the SoH accuracy validated above is a market-access requirement as well as a performance one
Fault Injection & Traceability: The Discipline That Holds It Together

Every rung above includes its own fault injection campaign; that’s deliberate. The same fault class (a stuck-at voltage signal, say, or a CAN bus dropout) should be provably testable at more than one level: both to confirm it’s caught early and cheaply, and to confirm the detection mechanism still works once real hardware, real cells and real system integration are in the loop. What makes this a robust control system approach, rather than a collection of disconnected test rigs, is the traceability that ties it together.

Requirements Traceability Matrix

  • Structure: one row per requirement (functional or safety); columns for the rung(s) at which it’s verified, the test case ID, pass/fail status and evidence reference
  • Outputs: coverage report showing every requirement is verified at least once, and every safety-rated requirement is verified at the level appropriate to its ASIL

Fault Class Coverage

  • Sensor Faults: open circuit, short circuit, stuck-at, drift, out-of-range, plausibility failure: tested from SIL (synthetic) through HIL cell-emulated (electrical) through cell-in-the-loop (real intermittents)
  • Actuator Faults: contactor weld, contactor fail-to-close, precharge resistor failure: tested from SIL (logic) through HIL (electrical/timing) through pack level (full-voltage confirmation)
  • Communication Faults: bus-off, frame loss, bit corruption, timeout, message authentication failure: tested from SIL (protocol logic) through HIL (real bus hardware) through system level (real ECU-to-ECU)
  • Software Faults: task overrun, stack overflow, memory corruption, scheduler starvation: tested almost exclusively at SIL/PIL; rarely practical to inject meaningfully at hardware level

Regression and Re-Verification

  • Procedure: any change to algorithm, code, hardware revision or cell source triggers re-execution of the affected test cases at every rung downstream of the change, not just the rung where the change was made
  • Relevance: the most common way a robust V&V programme fails in practice isn’t gaps in initial coverage; it’s regression testing scoped too narrowly after a late-stage change

See also: Safety Testing, BMS Cybersecurity, BMS Sensors, Safety Case & Verification