The problem
Cells in a series string drift apart in SOC because of manufacturing spread and uneven self-discharge, and the weakest cell then limits charge and discharge for the whole pack. Passive balancing is simple and widely used, but slow and wasteful. Simulation shows how balancing current, thresholds and timing affect results.
Objectives
- Build a 4S pack from individual cell models with parameter spread.
- Model switched bleed resistors across each cell.
- Implement balancing logic with thresholds, hysteresis and charge-phase enable in Stateflow.
- Measure balancing time, energy dissipated and pack usable capacity before and after.
- Study the effect of bleed resistance and threshold choice.
What you need
Tools and toolboxes
- Simulink — Test harness, charger control, logging and sweeps.
- Simscape Electrical — Cell models (Battery (Table-Based) or foundation elements), bleed resistors and ideal switches such as the Controlled Switch or Ideal Semiconductor Switch.
- Stateflow — Balancing logic per cell: enable, threshold comparison, hysteresis and timing.
Software
- MATLAB R2023b or later
- Simulink, Simscape and Stateflow
- Cell OCV–SOC and resistance data (published or from an earlier ECM project)
Extra parts and data
None beyond the software above.
Key concepts
- Cell imbalance
- Differences in SOC or capacity between series cells. The pack stops charging when the highest cell reaches its maximum voltage and stops discharging when the lowest reaches its minimum.
- Passive balancing
- A resistor is switched across a cell with higher voltage or SOC so it discharges until it matches the others. The excess energy becomes heat.
- Bleed current
- Approximately cell voltage divided by bleed resistance, for example about 120 mA through 33 Ω at 4.0 V. Larger currents balance faster but produce more heat.
- Balancing threshold
- The voltage or SOC difference above which a cell is bled. Too small a threshold reacts to measurement noise; too large leaves imbalance.
Step-by-step guide
- 1
Define the pack and test
Use an example 4S pack of 3 Ah cylindrical cells with capacities of 3.00, 2.95, 3.05 and 2.90 Ah and initial SOCs of 50, 55, 48 and 60 per cent. Bleed resistors of 33 Ω, a threshold of 10 mV and a hysteresis of 3 mV. Define the test: CC–CV charge with balancing enabled, then a rest and a full discharge. Metrics: final SOC spread, balancing time, energy dissipated and usable pack capacity.
Checkpoint: A test plan and parameter script with example values labelled.
- 2
Build the cell model
Create a reusable first-order ECM cell subsystem with physical ports, either the Simscape Electrical Battery (Table-Based) block or a Controlled Voltage Source with OCV lookup, series resistance and an RC branch. Expose capacity and initial SOC as mask parameters. Test one cell alone with a 1C discharge. Save the cell as a library block or referenced subsystem so all four cells share one tested implementation and differ only in their parameters.
Checkpoint: A single cell discharges in about one hour at 1C and its voltage follows the OCV curve minus I·R.
- 3
Assemble the 4S string
Connect four cells in series, each with its own parameters, and a Controlled Current Source as the charger or load. Add voltage sensors on each cell and a current sensor on the string. Add a Solver Configuration and use a variable-step solver such as daessc. Run a constant-current discharge and confirm the weakest cell reaches its limit first. Record the remaining charge in each cell at cut-off.
Checkpoint: In a discharge, the cell with the lowest charge reaches minimum voltage first and the others still have charge left.
- 4
Add bleed circuits
Across each cell, connect a Resistor in series with a Controlled Switch driven by a balancing command. Measure bleed current with a Current Sensor. Test by turning on one bleed switch while the string rests and check that the cell discharges at about V/R and that the other cells are unaffected. Log bleed power in each resistor so the total energy dissipated can be integrated later.
Checkpoint: Bleed current near the expected V/R value and SOC of only the bled cell falling.
- 5
Design balancing logic in Stateflow
Create a chart that, every 1 s, finds the minimum cell voltage and turns on a cell's bleed switch if its voltage exceeds the minimum by more than the threshold, turning it off below threshold minus hysteresis. Enable balancing only during charge and rest above a minimum voltage. Add a maximum bleed time for thermal reasons. Log each cell's bleed state as a signal for later analysis.
Checkpoint: During a rest test with imbalance, bleed switches turn on for high cells and off when within the band, without chatter.
- 6
Model the charger
Implement CC–CV charging: constant current (for example 1.5 A) until the highest cell reaches 4.2 V, then reduce current to hold the highest cell at 4.2 V, ending when current falls below C/20. Use the highest-cell voltage, not pack voltage, for control so no cell is overcharged. Implement the charger as a separate subsystem with its own Stateflow or MATLAB Function logic, so it can be reused in the active balancing study.
Checkpoint: No cell exceeds 4.2 V during charge, and the charge ends at the cut-off current.
- 7
Run the baseline and the balanced case
Run charge–rest–discharge without balancing, then with balancing, possibly over several cycles if one charge is not enough. Record final SOC spread, discharged pack capacity, energy dissipated in bleed resistors and total balancing time. Use the Simulation Data Inspector to compare the cell voltages between the two cases. Check that the energy dissipated in the bleed resistors matches the integral of bleed power, as a consistency check on the logging.
Checkpoint: A table showing smaller SOC spread and greater usable capacity with balancing, plus energy dissipated.
- 8
Parameter study
Sweep bleed resistance (for example 10–100 Ω) and threshold (5–30 mV) with a script, and run each case for several cycles. Plot cycles to balance and energy dissipated against bleed resistance, and final spread against threshold. Add a measurement-noise model to the cell voltages and see how a small threshold behaves. Note the heat each resistor produces and whether it is acceptable on a small BMS board.
Checkpoint: Trade-off plots for bleed resistance and threshold, including the effect of measurement noise.
- 9
Report
Present the pack model, bleed circuits, Stateflow logic, charger, baseline and balanced results, and parameter study. Note that a capacity mismatch cannot be fixed by balancing SOC once: the weaker cell will still limit discharge. Recommend bleed resistance and threshold for the example pack and explain the heat limit on the BMS board. Include the Stateflow chart and test scripts for reuse.
Checkpoint: A report with a recommended balancing design and quantified benefits.
Testing & validation
- Single-cell discharge matches capacity.
- Bleed current matches V/R.
- No cell exceeds the voltage limit during charge.
- Energy dissipated equals the integral of bleed power.
- Balancing logic does not chatter with measurement noise.
Expected results
A Simscape and Stateflow model of passive balancing for an example 4S pack with quantified balancing time, dissipated energy and usable capacity gain, plus design guidance on bleed resistance and threshold.
Take it further
- Balance on estimated SOC instead of voltage.
- Add a thermal model of the bleed resistors on the BMS board.
- Scale to a 16S pack and study balancing time.
- Compare with active balancing in the next project.
Viva and review questions
Why balance mainly during charging?
Voltage differences near full charge are clearer, and topping the pack up evenly lets every cell reach full charge, which is where passive balancing gives the most usable capacity.
Can passive balancing fix a low-capacity cell?
No. It equalises SOC, but the cell with less capacity will still reach its minimum voltage first on discharge and limit the pack.
Why add hysteresis to the balancing threshold?
Without hysteresis, measurement noise near the threshold would switch the bleed resistor on and off rapidly.
Learn it at DIYguru
These DIYguru courses and programmes teach what this project needs.
