BMS Software Architecture: Layers, Tasks and Safety Partitioning

BMS Software Architecture: Layers, Tasks and Safety Partitioning
In this article

Cet article existe aussi en français. Lire en français →

Battery management system software turns raw measurements into decisions: is every cell inside its limits, how much energy is left, how much power can be given, when to open the contactors. In a production BMS it is also a safety-critical system, which shapes how it is structured, written and verified.

1–10 msfastest protection and contactor tasks
100 msa typical estimation period
2 partitionssafety-related and QM, with freedom from interference
MIL → SIL → HILthe verification ladder

The layers

BMS software layers and safety partitionsASIL / SIL PARTITIONQM PARTITIONMeasurement + plausibilityProtection + fault managerContactor state machineSafe-state handlingSOC / SOH / SOPBalancingCharging communicationLogging, calibrationRuntime environment, OS with memory and timing protection, E2E protectionDrivers and MCAL: ADC, SPI (AFEs), CAN FD, timers, NVM, watchdog
Safety-related functions run in a protected partition; estimation and communication in a QM partition. Both sit on an OS and drivers with memory and timing protection.

Most automotive BMS software follows AUTOSAR Classic or a similar layered approach: drivers and microcontroller abstraction at the bottom, basic services (communication, diagnostics, non-volatile memory, OS) in the middle, and application components on top. Industrial and rail products often use lighter frameworks, with the same principles.

Application components

ComponentWhat it does
Measurement acquisitionReads cell voltages and temperatures from the AFEs, current and high voltages; filters and timestamps
Plausibility and diagnosticsChecks sensors against each other and against limits; open-wire, stuck values, communication errors
Protection and fault managerCompares with thresholds and timers, decides derating or safe state, stores diagnostic codes
Contactor state machineSequences precharge and contactors, detects welding
State estimationSOC, SOH and SOP (see Kalman filter SOC estimation)
BalancingSelects cells to balance and schedules it
Thermal requestsAsks the cooling or heating system for what the cells need
ChargingTalks to the charger or the PCS, applies charge maps
Logging and calibrationEvent and history logs, calibration parameters through XCP

Task periods

PeriodTypical content
1 msCurrent measurement, fast overcurrent checks, contactor feedback
10 msProtection logic, contactor state machine, power limit updates
100 msCell voltage and temperature acquisition cycle, state estimation, balancing decisions
1 sAgeing models, logging, thermal requests, housekeeping

The periods must be consistent with the fault tolerant time intervals: detection and reaction of each fault must fit, including worst-case execution time and communication delays.

Safety partitioning

  • Memory protection: the MPU prevents QM code from writing into safety-related data.
  • Timing protection: the OS supervises execution budgets so a QM task cannot starve a safety task.
  • End-to-end protection of data between partitions and over CAN: CRC, counters, timeouts.
  • Independent paths for the most critical reactions, sometimes in hardware, so a software failure cannot prevent the safe state.

How it is developed

  • Model-based design for algorithms (estimation, state machines), with automatic code generation, or hand-written C for drivers and services.
  • Coding rules (MISRA C), static analysis and unit testing with structural coverage, at the rigour the integrity level requires.
  • Model-in-the-loop and software-in-the-loop for algorithms, then hardware-in-the-loop for the real ECU, including fault injection.
  • Calibration in the vehicle or system with measurement tools, under configuration management.
  • A bootloader and update strategy designed with cybersecurity from the start.

FAQ

What does BMS software do?

It acquires cell measurements, checks them, protects the battery, estimates state of charge, health and power, manages contactors, balancing, thermal requests and charging, and communicates with the system.

Is BMS software developed with AUTOSAR?

Most automotive BMS use AUTOSAR Classic or a similar layered architecture; industrial and rail BMS often use lighter frameworks with the same principles.

What is freedom from interference?

The guarantee that non-safety software cannot corrupt the data, timing or execution of safety-related software sharing the same microcontroller.

How is BMS software tested?

With unit tests and static analysis, model-in-the-loop and software-in-the-loop for algorithms, and hardware-in-the-loop testing of the real ECU, including fault injection.

Which language is BMS software written in?

Mostly C, often generated from models for algorithms, following MISRA C rules for safety-related code.

Learn it live

This topic is covered in depth, with industrial case studies, in the Battery systems & BMS program. Join the waitlist to hear first when it opens — or browse the 64 free guides in the meantime.

Mohamed Yasser El Mekadem, Technical Leader in battery systems and power electronics

Written by

Mohamed Yasser El Mekadem

Technical Leader on a 1500 V rail traction battery. Eight years in onboard railway energy: power converters, HIL validation, battery systems.

Waitlist

Learn this live, with industrial case studies.

Three programs — power electronics, battery systems & BMS, HIL validation. Join the list to hear first when one opens.

One email when a program opens. Unsubscribe in one click. Privacy policy.

Keep reading

Related articles

Drone batteries: LiPo vs Li-ion, specific energy, flight time and BMS
Batteries & BMS

Drone Batteries: LiPo vs Li-Ion, Wh/kg, C-Rate and BMS

A drone battery is the heaviest component in the aircraft and the one that sets its endurance. LiPo against Li-ion, the Wh/kg of real packs and cells, how flight time depends on battery mass, what C-rate a mission actually needs, and what the BMS of a flight battery does differently.

Read the article →