Battery management is of paramount importance for lithium ion cells to ensure safe operation and durability. Charging needs to happen in a controlled way, typically using a constant-current / constant-voltage profile. It is also essential to ensure that individual battery cells are kept in balance to avoid under-utilization of the pack capacity.
In this example, Simscape® components model the behavior of a single battery cell, which is in turn replicated to create a series connection. A 3-RC + R equivalent circuit represents the electrical phenomena, linked in turn to thermal effects via a thermal mass and the assumption of Joule effect being the only source of heat.
Additionally, Simscape Electronics(TM) components provide the semiconductor devices responsible for the selective charge bleed that enables the balancing while charging. Temperature buildup is non-uniform because of the uneven current flow and the non-symmetrical thermal design: insulation on one end and natural convection on the other end. A supervisory logic strategy implemented in Stateflow® establishes the moment and duration of the charging current bleeding.
The Stateflow® block can generate embeddable C-Code by right-clicking and selecting C/C++ Code -> Build This Subsystem (requires Embedded Coder(TM)).
If using a MATLAB version different from R2018a please run the README.m file the first time to generate the battery cell library blocks.
Create scripts with code, output, and formatted text in a single executable document.