grokkingstuff Home Blog Projects Wiki Calculators About

Battery Management System Control

date2026-07-24tags:ele: :control:

The Battery as a Control Plant

A battery management system is, at root, a feedback controller. Its plant is an electrochemical cell, its primary sensor is the terminal voltage (a noisy proxy for the internal state), and its defining failure mode is thermal runaway — a positive feedback loop that the controller must break before it becomes self-sustaining [fn:: One might object that the BMS is "just" a protection circuit, not a controller in the servo-mechanism sense. This conflates the implementation (often a threshold-comparator chain) with the function: the BMS closes a loop from voltage/current/temperature back to current limits, and that loop has a design bandwidth. A protection relay has no bandwidth worth speaking of; a BMS does. The distinction matters because a relay that trips too late is a controller with excessive phase lag.]. The battery is arguably the hardest common control plant because its internal state — state of charge (SOC) and state of health (SOH) — is not directly measurable. You cannot put a "fuel gauge" into a lithium-ion cell the way you can into a petrol tank; the quantity of charge lives in the electrode potentials and the lithium concentration gradients, none of which present themselves at the terminals.

Terminal voltage is the only directly observable quantity, and it is a poor proxy. It conflates SOC, internal polarization dynamics, temperature, and aging into one number. Every BMS algorithm is, in the end, an attempt to factor this single scalar back into the hidden state that produced it. This is an inverse problem, ill-posed without a model. The model's parameters themselves drift that is being estimated — a circularity we return to below.

Consider the difficulty. A 2 Ah 18650 cell at room temperature, mid-SOC, sits at 3.70 V. Is it at 50%? At 55%? The OCV curve moves ~30 mV per percent of SOC there. A 12-bit ADC over a 0–5 V range has ~1.2 mV LSB — so quantization alone is ~0.04%. But the cell's own polarization after a 1 A discharge pulse can sit at 20–50 mV for tens of seconds, swamping the signal by a factor of a thousand. You are reading a voltmeter to infer a chemical concentration through a low-pass filter you do not fully know.

SOC Estimation: Three Methods and Their Fusion

There are three established SOC estimation methods. A mature BMS uses all three, because each covers the failure mode of the others.

Coulomb counting

The simplest method: integrate current over time.

\[ \mathrm{SOC}(t) = \mathrm{SOC}(t_0) + \frac{1}{Q_{\text{nom}}} \int_{t_0}^{t} \eta\, i(\tau)\, d\tau \]

where $Q_{\text{nom}}$ is nominal capacity in coulombs (a 2 Ah cell stores $Q_{\text{nom}} = 7200$ C) and $\eta$ is the coulombic efficiency (~1.0 for Li-ion at moderate currents, less at high rates due to side reactions). This is bookkeeping, not measurement. It captures fast transients by literally counting the charge entering and leaving. It has one strength: the estimate is dynamic, so it tracks fast transients by literally counting the charge entering and leaving. Its weakness is integration error. The current sensor has bias and noise, and the bias integrates into unbounded drift. (1 mA of bias on a 2 Ah cell is 0.05% per hour, or 1.2%/day — enough to make the gauge useless over a week.) The initial SOC at t₀ is also unknown after a long rest or a reset [fn:: The integration is a pure integrator, which is to say a pole at the origin — marginally stable in the control-theoretic sense. Any bias, however small, is an unbounded-mode input. This is why pure Coulomb counting has never survived a product cycle without some reset mechanism.].

Open-circuit voltage

The OCV method exploits the near-Nernstian relation between open-circuit voltage and SOC: let the cell rest until polarization relaxes (minutes to hours, depending on diffusion timescales), read $V_{\text{OC}}$, look it up in the SOC–OCV curve (which for a LiNMC cell spans roughly 3.0 V at 0% to 4.2 V at 100%, but is flat enough in the middle — roughly 3.6–3.9 V for 20–80% SOC — that a few mV of noise maps to several percent of SOC [fn:: This middle-region flatness is the curse of voltage-based SOC for the common chemistries; LFP is worse, its curve has a plateau so flat that OCV barely moves across 40% of the SOC range, making voltage-based estimation there nearly impossible without a precise ADC and a very good model. This is an argument from physics for why LFP BMS designs lean harder on Coulomb counting plus occasional OCV re-anchoring.]). OCV is accurate when you can measure it, but you can only measure it when the cell is at rest — which, in a vehicle or a grid battery, it almost never is.

The Kalman filter as fusion

The Kalman filter fuses the two: the process model is Coulomb counting (predict the next SOC by integrating current), and the measurement update is OCV (correct the prediction whenever the voltage residual — the difference between predicted and measured terminal voltage — is non-zero). The Kalman gain weights the correction by the ratio of prediction covariance to total (prediction + measurement) covariance, so when the current sensor is trusted and the voltage model is noisy, it leans on integration; when the cell is near rest and OCV is trustworthy, it leans on the voltage [fn:: Why is the Kalman filter the standard rather than, say, a particle filter or an H-infinity estimator? Because the linearized cell model — the Thévenin-equivalent RC network described below — is approximately linear in the small-signal regime away from the knee of the discharge curve, and for linear-Gaussian models the Kalman filter is provably the minimum-variance unbiased estimator. The cell is approximately linear where it matters. Beyond linearity, a particle filter buys robustness to the nonlinear knee and to multi-modal noise at a ~10× compute cost that the typical embedded BMS cannot afford. H-infinity would guard against worst-case noise distributions, but cell noise is, empirically, close enough to Gaussian that the robustness premium is not worth paying.].

The filter's state vector is not just SOC. A first-order model carries SOC plus one polarization voltage; a second-order (dual RC) model carries SOC plus two polarization voltages, capturing the fast and slow diffusion timeconstants separately — $\mathbf{x} = [V_{p1}, V_{p2}, \mathrm{SOC}]^T$. The measurement is $V_{\text{term}} = V_{\text{OC}}(\mathrm{SOC}) - i R_0 - V_{p1} - V_{p2}$, with $R_0$ the ohmic resistance.

A concrete gain illustration. Suppose at a given step the prediction covariance $P = 4 \times 10^{-4}$ (0.02 SOC in variance) and the measurement-noise-converted covariance $R = 1.6 \times 10^{-3}$. Then the Kalman gain $K = P/(P+R) \approx 0.20$: the filter pulls 20% of the way from its prediction toward the voltage-implied estimate each update. Drive the current sensor harder (lower $R$, more trust in OCV) and $K$ rises. Sit in the flat OCV middle (the measurement is uninformative, $R$ large) and $K$ falls toward zero — the filter ignores the voltmeter there and falls back on integration. This is the self-adaptive weighting that no fixed lookup table can match.

The Cell Model and the Parameter Identification Problem

The equivalent circuit is a Randles-like network. It has a series resistance $R_0$ (contact + electrolyte + current collector), in series with one or two parallel RC branches. The timeconstants $\tau_i = R_i C_i$ model the electrochemical polarization — the fast branch ($\tau \sim 1$–$10$ s, charge-transfer kinetics) and the slow branch ($\tau \sim 100$–$1000$ s, solid-state diffusion through the electrode particles). The parameter identification problem is that $R_0$, $R_1$, $C_1$, $R_2$, $C_2$ are not constants. They change with temperature (Arrhenius dependence, roughly $R_0$ doubles for every 20 °C of cooling), with age (SEI growth, lithium plating, active-material loss — all slow, all monotonic), and — circularly — with SOC itself, which is the quantity being estimated [fn:: The circularity is real but not vicious: the parameters depend on SOC weakly and smoothly, so one iterates — estimate SOC, look up parameters, re-estimate SOC — and convergence is typically achieved in one or two passes because the sensitivity is low. The deeper worry is observability: at the flat middle of the OCV curve, the measurement Jacobian with respect to SOC is small, the filter's information channel is narrow, and SOC is weakly observable there — which is precisely where Coulomb-counting drift accumulates. The two methods are complementary not by coincidence but by structural necessity.].

This is why production BMS firmware carries a parameter map — a multidimensional lookup table of $R_0, R_1, \tau_1, \ldots$ indexed by $(\mathrm{SOC}, T, \mathrm{age})$, identified offline from pulsed-discharge data on a representative cell, and the online Kalman filter reads from it. The map is chemistry-specific and cell-specific; there is no universal cell model. A change of supplier, a change of electrolyte additive, a change of electrode loading — any of these invalidates the table and demands re-identification. This is the hidden engineering cost of a "drop-in" battery.

The strongest counter to the equivalent-circuit approach is the physics-based model (the Doyle–Newman pseudo-two-dimensional model, P2D), which solves the porous-electrode equations and the lithium diffusion PDE directly. It is in principle more accurate and more extrapolable outside the identification regime. Its cost is a PDE solve per Kalman step — minutes per update on the kind of MCU that fits in a battery pack, where you have microseconds. The industry has, rationally, chosen the empirical RC model with the P2D reserved for offline design and the rare high-end pack [fn:: Hybrid approaches are closing the gap: physics-informed neural networks that approximate the P2D solution at RC-model cost are a live research area, and a few production BMSes now run reduced-order P2D surrogates. The economics will likely flip within a decade as the compute per pack rises.]. Until then, the RC circuit is the dominant design because it is good enough, fast enough, and identifiable from the data the BMS already collects.

Charge-Current Limiting: CC–CV as a Constrained Controller

The standard lithium-ion charge protocol is constant-current / constant-voltage: charge at a fixed current $I_{\text{CC}}$ (often 0.5C–1C, e.g. 1–2 A for a 2 Ah cell) until the terminal voltage reaches the cutoff (4.2 V for a typical NMC, 3.65 V for LFP), then hold the voltage constant and let the current taper as the cell fills. The CV phase is the controller backing off as the cell approaches saturation: the cell's internal EMF rises toward 4.2 V, the driving voltage headroom $\Delta V = 4.2 - V_{\text{OC}}(\mathrm{SOC})$ shrinks, and under constant voltage the current $i = \Delta V / (R_0 + R_{\text{pol}})$ must fall. The protocol terminates when current drops below a threshold (typically C/10, i.e. 200 mA for the 2 Ah cell).

A numerical trace makes the controller's shape visible: at 90% SOC, $V_{\text{OC}} \approx 4.05$ V, so $\Delta V = 0.15$ V; with $R_0 + R_{\text{pol}} \approx 60$ mΩ the CV current is ~2.5 A — still near the CC setpoint. At 98% SOC, $V_{\text{OC}} \approx 4.17$ V, $\Delta V = 0.03$ V, current ~0.5 A. At 99.5%, $\Delta V \approx 8$ mV, current ~130 mA — below the C/10 floor, charge terminates. The CV phase is a graceful, model-free descent along the constraint $V_{\text{term}} = V_{\max}$; it is, in retrospect, the simplest possible MPC one could write for this plant.

But the current limit is not constant in $T$. Cold cells accept less charge because the internal resistance is high and the risk of lithium plating on the graphite anode rises sharply below ~5 °C — plating is irreversible and is the dominant degradation mode at low-temperature fast charge [fn:: The plating threshold is itself a function of the anode potential, which is not directly measured; the BMS infers it from the cell model and backs off the current conservatively. This is where fast-charge algorithms (the "charge in 10 minutes" claims) earn their complexity: they are navigating a constraint surface — temperature, anode potential, lithium diffusion — that is not directly observable. Conservative practice charges cold cells at C/10 or less; aggressive practice uses a pulsed or stepped profile to let the anode equilibrate between pulses, trading throughput for a smaller safety margin.]. Hot cells must charge less because above ~45 °C the side reactions accelerate and the SEI grows. So the current limit $I_{\max}(T, \mathrm{SOC}, \mathrm{SOH})$ is a three-dimensional constraint surface, and the charge controller is — whether or not its designers know it — solving a constrained model-predictive-control problem with a receding horizon. In production this is almost always a lookup table plus hysteresis, not an online optimizer, because the table is cheap and the optimizer is not [fn:: The steelman for the lookup table over the true MPC is not just cost: it is certifiability. A table is auditable — a safety reviewer can read every cell of it and bound the worst case. An online QP solver is a piece of software whose behavior under numerical pathology is hard to bound, and battery safety certification bodies (UL 1973, UN 38.3, IEC 62660) strongly prefer inspectable, deterministic logic. The control-theoretic optimality is sacrificed for a guarantee that the reviewer can sign. This tradeoff — optimal-but-opaque versus suboptimal-but-auditable — recurs throughout safety-critical control and is the real reason MPC has not penetrated BMSes the way it has process industries.].

Cell Balancing: Why Series Implies a BMS

Cells in series drift. No two cells have identical capacity, identical self-discharge, identical internal resistance; over cycles, the stronger cells charge the weaker ones through the bus, and the weakest cell hits its voltage limits first — over-charged on charge, over-discharged on discharge — while the pack average looks fine. Without balancing, the weakest cell limits the whole pack and eventually fails destructively [fn:: This is the engineering argument for parallel over series connection at the cell level: parallel cells auto-balance — they share a terminal voltage by construction, and current redistributes among them according to their internal resistances. Series connection requires a BMS, because the cells cannot exchange charge across the series bus. The grid-scale battery designer who can choose topology will prefer large parallel blocks (fewer BMS channels, natural balancing) up to the point where a single-cell fault takes out the whole block — a safety–economy tradeoff. Tesla's 18650 modules are many-in-parallel; this is not coincidence.].

Balancing strategies split into passive and active. Passive balancing bleeds charge from the high cells through a resistor (typically 30–100 Ω, dissipating ~40 mW per cell) until the low cells catch up. It is simple, cheap, and wastes exactly the energy imbalance it corrects — fine for small drift, untenable for large drift or for energy-constrained applications. Active balancing shuttles charge from high cells to low cells via capacitors, inductors, or a dedicated DC–DC converter — efficient (90%+ transfer) but complex, expensive, and a reliability liability (more semiconductors, more failure modes). The control problem is to balance without over-discharging the weakest cell — the balancing current must be limited so that the act of moving charge does not itself push a marginal cell below its safe floor.

The honest case for passive balancing, against the active-balancing evangelists: in a well-matched, well-conditioned pack the drift to be corrected is small — a few percent of capacity over weeks — and the energy wasted by bleeding is a rounding error against the pack's round-trip losses. Active balancing's efficiency advantage is real only when the imbalance is large, and a large imbalance is itself a symptom of a degrading pack that the BMS should be flagging, not quietly shuttling around. The passive design's simplicity is, in this view, a feature: it cannot fail in a way that makes things worse, and the active converter can. Both views have merit; the market has largely voted passive for consumer cells and active (or mixed) for large stationary and traction packs.

Thermal Management: Breaking the Positive Feedback Loop

Thermal runaway is, in control-theory terms, a positive feedback loop with an unstable fixed point. High current → $I^2 R_0$ heating → rising temperature → (in a fault condition) lower internal resistance and accelerated exothermic side reactions → more current / more heat → runaway. The BMS is the loop-breaker: it monitors cell temperature and derates or disconnects before the loop closes on itself [fn:: The thermal-runaway onset temperature — around 150 °C for NMC, higher for LFP — is the point where the exothermic decomposition heat generation rate exceeds the cell's thermal dissipation capacity. Below it, the cell is a stable thermal system with a stable equilibrium; above it, the equilibrium vanishes in a saddle-node bifurcation and the temperature runs away. The BMS must act well below this threshold because once the cell is self-heating faster than the pack can cool it, no controller can help — the actuator (current interruption) acts on $I^2 R$ heating, but the decomposition heat is internal and continues after disconnection. This is the "point of no return": the controller's authority has been exceeded.].

The thermal management loop has its own dynamics: the pack has a thermal timeconstant (minutes to tens of minutes, set by cell mass and cooling-channel geometry), the BMS sampling rate is seconds, and the thermal runaway timescale at the cell level is milliseconds once it initiates. The controller is fighting an instability that develops faster than its plant can be measured — which is why thermal protection is layered: slow derating for sustained over-temperature, fast hardware comparators for cell-level over-current and over-voltage, and a final mechanical fuse (the CID, current-interrupt device, in cylindrical cells) for the faults that defeat everything else.

The layering is itself a control-theoretic statement: no single loop has both the bandwidth to catch the fast fault and the stability to manage the slow drift. The fast comparator is high-bandwidth, high-gain, low-authority (it can only disconnect); the thermal derating loop is low-bandwidth, continuous, and has continuous authority (it can shape the current setpoint). The BMS is, in this sense, a cascade of controllers each tuned to a timescale — and the design problem is to ensure the loops do not fight each other, i.e. that the fast loop's transient does not destabilize the slow loop's setpoint.

SOH, Capacity Fade, and the Dual-Estimation Problem

SOC is the fast hidden state; SOH is the slow one — the gradual loss of usable capacity and the rise of internal resistance over hundreds of cycles. SOH cannot be estimated from a single measurement; it is observed only through the slow drift of the SOC estimate's consistency, the growing gap between predicted and measured voltage residuals, and — increasingly — the EIS spectrum. The cleanest formulation is a dual Kalman filter: a fast filter for $\mathbf{x} = [V_{p1}, V_{p2}, \mathrm{SOC}]^T$ and a slow filter for the parameters $\boldsymbol{\theta} = [Q_{\text{nom}}, R_0, \ldots]^T$, each feeding the other. The fast filter estimates state given parameters; the slow filter estimates parameters given state. This is joint state-and-parameter estimation, and it is the principled answer to the circularity flagged above — instead of iterating to convergence offline, the two filters run in parallel online and converge jointly [fn:: The dual-filter approach inherits a fragility: parameter observability requires persistent excitation — the current profile must be rich enough that the parameters are identifiable. A battery that sits at float, or that cycles in a narrow SOC window, is poorly exciting, and the parameter estimate (hence the SOH estimate) drifts. This is why EIS perturbation is valuable beyond its diagnostic content: it is a deliberate excitation signal that makes the parameters observable, turning an identification problem into a measurement. The cost is a few mV of imposed noise on the terminals; the benefit is a SOH estimate that does not silently rot.].

The Interlock to Electrochemistry

The BMS is where control theory and electrochemistry meet, and the meeting is not merely at the hardware interface. The diagnostic for state of health — the slow drift of capacity and resistance over hundreds of cycles — is increasingly electrochemical impedance spectroscopy (EIS): sweep the cell with a small AC perturbation (a few mV, a few Hz to kHz) and read the Nyquist plot, whose semicircle radii and Warburg tail encode the charge-transfer resistance, the SEI resistance, and the diffusion coefficient. As the cell ages, the spectrum changes — the charge-transfer semicircle grows, the Warburg slope steepens — and the BMS maps these to an SOH estimate. This is a direct application of Electrochemical Impedance Spectroscopy as an online diagnostic, and it is becoming practical as embedded EIS ICs (applying the perturbation during rest, sampling the response) reach the market.

The degradation mechanism itself is an electrochemical process — SEI growth, electrolyte oxidation, lithium plating, active-material dissolution — and these are, at bottom, corrosion reactions at the electrode interfaces. See Corrosion for the thermodynamics and kinetics; the BMS does not arrest these (they are thermodynamic) but it steers the operating point to minimize their rate — lower voltages, moderate temperatures, avoidance of low-temperature fast charge. The control objective is not just "keep SOC accurate" but "operate the cell in the region of $(V, T, I)$ space that minimizes the aging rate subject to the duty-cycle constraint," which is an optimal-control problem and links forward to Optimal Control: LQR, LQG & Riccati, State-Space Representation, and the constrained-MPC flavor of PID Control: Theory & Tuning. The closest cousin in the energy-stack domain is Electrolyzer & Fuel-Cell Stack Control, which faces the same hidden-state, same-degradation, same-thermal-runaway structure from the mirror side of the redox reaction.

Related