# Lithium Pack Cell Balancing

This example shows how to implement a passive cell balancing for a Lithium-ion battery pack. Cell-to-cell differences in the module create imbalance in cell state of charge and hence voltages. In this example, the balancing algorithm starts when the battery pack is idle and the difference in the cell state of charge is above a certain predefined value.

### Model Overview

### Parameters and Inputs Overview

To use this model to create a unique battery module, first specify the number of series- and parallel-connected cells. Then specify the cell type for all individual cells by choosing one of these options for the **Choose cell type** parameter of the **Battery Module** block:

`Pouch`

`Can`

`Compact cylindrical`

`Regular cylindrical`

The battery module in this example comprises ten series-connected pouch cells.

The two output ports, **SOC** and **Temp**, provide information regarding the state of charge and the temperature of each cell in the module. The thermal port, **Amb**, is used to define the ambient temperature in the simulation. The electrical ports, **pos** and **neg**, define the electrical positive and negative terminals, respectively. The two input ports, **FlwR** and **FlwT**, define the battery coolant flow rate control and inlet temperature into the module. The third input port, **SW**, defines the switch state, either on or off, for the passive cell balancing through a resistor.

The figure below shows examples of battery cells in `Pouch`

and `Can`

configurations.

The figure below shows examples of battery cells in `Compact cylindrical`

and `Regular cylindrical`

configurations.

These are the parameters in the battery module:

**Vector of temperatures, T**— Temperatures at which the cell or module data for temperature-varying properties are tabulated, specified as a vector.**Single cell Ahr rating, baseline**— Cell capacity at the temperatures defined in the**Vector of temperatures, T**parameter, specified as a vector.**Vector of state of charge values, SOC**— Range of values between 0 and 1 at which the cell electrical parameters are defined, specified as a vector.**Vector of coolant flowrates, L**— Coolant mass flow rate values at which a lookup table for cell cooling is defined. This parameter needs to cover multiple points in the flow range of interest. This parameter defines the size of the**Effective rate of coolant heat transfer**parameter and is specified as a vector.

**No load voltage, V0**— Cell open-circuit potential values at different**Vector of state of charge values, SOC**and**Vector of temperatures, T**points, specified as a matrix.**Terminal resistance, R0**— Cell ohmic resistance values at different**Vector of state of charge values, SOC**and**Vector of temperatures, T**points, specified as a matrix.**Self-discharge**— Cell self discharge option;`Disabled`

is selected for this example.**Polarization resistance**— Polarization resistance values at different**Vector of state of charge values, SOC**and**Vector of temperatures, T**points, specified as a matrix.**Time constant**— Time constant at different**Vector of state of charge values, SOC**and**Vector of temperatures, T**points, specified as a matrix.

**Cell thermal mass**— Thermal mass of a single cell, specified as a scalar.**Cell thermal conductivity**— Cell through-plane conductivity for pouch and can cells, or the radial conductivity for cylindrical cells, specified as a scalar.**Heat transfer coefficient to ambient**— Heat transfer coefficient value, specified as a scalar.

**Number of series connected cells Ns**— Number of strings in series, specified as an integer.**Number of parallel connected cells Np**— Number of parallel-cells in a string, specified as an integer.**Choose cell type**— Type of cell, specified as either`Pouch`

,`Can`

,`Compact cylindrical`

, or`Regular cylindrical`

.**Cell height**— Cell height, specified as a scalar.**Cell width**— Cell width for`Pouch`

and`Can`

cells, specified as a scalar.**Cell thickness**— Cell thickness for`Pouch`

or`Can`

cells, specified as a scalar.**Cell diameter**— Cell diameter for`Compact cylindrical`

or`Regular cylindrical`

, specified as a scalar.**Number of cylindrical cells in a straight line**— Number of cylindrical cells arranged in a straight line for packaging, specified as an integer.**Accessory total resistance**— Resistance that combines all inline resistance in a module, specified as a scalar. This resistance is the sum of cell tab, busbar, cable and/or weld resistances, specified as a scalar.**Cell balancing**— Cell balancing method, specified as either`none`

or`passive`

. In this example, this parameter is set to`passive`

. Upon selection of`passive`

cell balancing, four parameters become visible. These parameters are:**Shunt resistor**,**Switch closed resistance**,**Switch open conductance**and**Switch operation threshold**. Passive cell balancing is shown schematically in the figure below:

**Effective rate of coolant heat transfer from each cell**— Estimate of the thermal resistance (W/K) of heat transfer from battery cells to coolant, specified as a 3-D matrix of scalar values. The 3-D matrix size depends on the**Vector of temperatures, T**,**Vector of coolant flowrates, L**and**NsxNp**parameters. The**NsxNp**parameter is the total number of cells in the module. The battery cooling is represented as a lookup table or 3-D matrix of size [T,L,Ns*Np] and the values are calculated using detailed 3-D methods such as computational fluid dynamics. The values of the matrix depend on the actual hardware design of the cooling system or cold plates in the module. This matrix is set to zero in the current example, in the file`ee_lithium_pack_cellBalancing_ini.m`

.**External heat**— External heat input to each cell in a module due to a hot component placed near the module, specified as a vector. It is set to zero in the current example.

**Vector of initial cell temperature**— Cell initial temperature, specified as a vector.**Vector of initial cell state of charge**— Cell initial state of charge, specified as a vector. First cell is imbalanced and has the lowest state of charge compared to other cells, as specified in the file`ee_lithium_pack_cellBalancing_ini.m`

.**Cell Ahr rating variation**— Cell-to-cell variations in cell capacity at all**Vector of temperatures, T**points for each cell, specified as a vector of scalar values. If you set this array to 1, all cell capacity is the same. The array values for a cell are multiplied with the value specified in the**Single cell Ahr rating, baseline**parameter to calculate the actual capacity or the Ahr rating of the cell.

To define the battery coolant flow rate and temperature, specify these inputs:

**FlwR**— Value between 0 and 1, specified as a scalar. The**FlwR**input value is used to dynamically choose the right value of the flow rate during the simulations. The value of the**FlwR**input defines the actual flow rate in the module. In the**Vector of coolant flowrates L**parameter,**FlwR**equal to 0 means no flow, while**FlwR**equal to 1 means highest flow rate value.**FlwR**is set to a low value of 0.001 in this example.**FlwT**— Positive or negative value that, when summed to the ambient temperature, equals the coolant inlet temperature. A value of +15 for the**FlwT**input and 273.15 K at the**Amb**port makes the coolant inlet temperature equal to 273.15 + 15 = 288.15K. A value of -15 for the**FlwT**input and 273.15 K at the**Amb**makes the coolant inlet temperature equal to 273.15 - 15 = 258.15 K.**FlwT**is set to 0 in this example.

In this example, the battery pack starts at an ambient temperature of 25 degrees Celsius. The battery pack is idle and there is no current flowing through it. The cell balancing algorithm activates when the minimum difference in the cell state of charge is greater than 0.05% and the battery pack is idle. The algorithm charges closes switches for all cells other than the one with lowest state of charge. Small current flows through the balancing resistor and all the cell state of charge come to almost similar values in about 2400s.

### Simulation Results from Simscape Logging

The plot below shows the battery current, the state of charge, the maximum difference in the cell state of charge, and the switching operation based on the logic defined in the Balancing algorithm subsystem. All cells, other than the first cell with lowest state of charge, have their switch closed and lose energy through the balancing resistor. All cells of the module reach almost identical state of charge values in less than 45 minutes.