Main Content

Pack Bar SOC Estimator (Adaptive Kalman Filter)

Average state-of-charge and terminal resistance estimator for battery pack with Kalman filter

Since R2025a

Libraries:
Simscape / Battery / BMS / Estimators

Description

The Pack Bar SOC Estimator (Adaptive Kalman Filter) block implements an estimator that calculates the average state of charge (SOC) and terminal resistance of a battery pack by using the Kalman filter algorithms. The average state of charge, polarization voltage, and average terminal resistance are the internal estimator states, the current is the control input, and the average pack voltage is the measurement.

This block supports single-precision and double-precision floating-point simulation.

Note

To enable inherited single-precision floating-point simulation, the data type of all inputs and parameters, except for the Sample time (-1 for inherited) parameter, must be single.

For continuous-time simulation, set the Filter type parameter to Extended Kalman-Bucy filter or Unscented Kalman-Bucy filter.

Note

Continuous-time implementation of this block works only in a double-precision floating-point simulation. If you provide single-precision floating-point parameters and inputs, this block casts them to double-precision floating-point values to prevent errors.

For discrete-time simulation, set the Filter type parameter to Extended Kalman filter or Unscented Kalman filter and the Sample time (-1 for inherited) parameter to a positive value or -1.

Equations

The bar filter technique estimates the average states of the battery pack. The equations for the average mathematical model for a battery pack with two time-constant dynamics are:

dSOC¯dt=i3600AH¯dV1¯dt=iC1(SOC¯,T¯)V1¯R1(SOC¯,T¯)C1(SOC¯,T¯)dV2¯dt=iC2(SOC¯,T¯)V2¯R2(SOC¯,T¯)C2(SOC¯,T¯)dR0¯dt=0V¯t=V0(SOC¯,T¯)iR0¯V1¯V2¯

where:

  • SOC¯=1Nsi=1NsSOCi is the average state of charge of the battery pack.

  • i is the current.

  • V0 is the no-load voltage.

  • Vt¯ is the average terminal voltage of the battery pack.

  • AH¯ is the average ampere-hour rating of the battery pack.

  • R0¯ is the terminal resistance of the battery pack.

  • R1 is the first polarization resistance.

  • C1 is the first parallel RC capacitance.

  • R2 is the second polarization resistance.

  • C2 is the second parallel RC capacitance.

  • T¯ is the average temperature of the battery pack.

  • V1¯ is the polarization voltage over the first RC network.

  • V2¯ is the polarization voltage over the second RC network.

A time constant τ1 for the first parallel section relates the first polarization resistance R1 and the first parallel RC capacitance C1 using the relationship C1=τ1/R1.

A time constant τ2 for the second parallel section relates the second polarization resistance R2 and the second parallel RC capacitance C2 using the relationship C2=τ2/R2.

For series-connected cells, the cell currents are equal. When balancing the battery, the cell currents might not be equal and the currents must be averaged.

The outputs from the bar filter are the estimated average state of charge of the battery pack, SOC¯, the average dynamic overpotential voltage, Vdyn¯=V1¯+V2¯, and the average terminal resistance, R0¯.

To learn more about the internal implementation and equations of each Kalman filter algorithm of this block, see the Equations section of the SOC Estimator (Kalman Filter) block.

Examples

Assumptions and Limitations

The process and SOC noises are independent, zero mean, Gaussian noises.

Ports

Input

expand all

Average current of the battery pack, in ampere, specified as a scalar.

Average voltage of the battery pack, in volt, specified as a scalar.

Average temperature of the battery pack, specified as a scalar.

Average charge of the battery pack, in ampere-hour, specified as a scalar.

Initial state of charge, specified as a scalar in the range [0,1].

Initial terminal resistance, in ohm, specified as a scalar.

Output

expand all

Average state of charge of the battery pack, returned as a scalar.

Average terminal resistance of the battery pack, returned as a scalar.

Average dynamic overpotential voltage of the battery pack, returned as a scalar.

Parameters

expand all

To edit block parameters interactively, use the Property Inspector. From the Simulink® Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.

Main

Type of Kalman filter that this block uses to estimate the average state of charge of the battery pack.

Coefficient that controls the spread of the sigma points. The block uses this parameter in its implementation of the equations for the unscented Kalman filter and the unscented Kalman-Bucy filter.

Dependencies

To enable this parameter, set Filter type to Unscented Kalman filter or Unscented Kalman-Bucy filter.

Coefficient related to the distribution. The block uses this parameter in its implementation of the unscented Kalman filter and the unscented Kalman-Bucy filter.

Dependencies

To enable this parameter, set Filter type to Unscented Kalman filter or Unscented Kalman-Bucy filter.

Coefficient that controls the spread of the sigma points. The block uses this parameter in its implementation of the equations for the unscented Kalman filter and the unscented Kalman-Bucy filter.

Dependencies

To enable this parameter, set Filter type to Unscented Kalman filter or Unscented Kalman-Bucy filter.

Covariance matrix of the noise in the states.

Specify a 3-by-3 matrix if you set the Charge dynamics parameter to One time-constant dynamics or a 4-by-4 matrix if you set the Charge dynamics parameter to Two time-constant dynamics.

Covariance of the noise in the measurements.

Covariance matrix of the initial state error. This parameter defines the deviation in the initialization of the state.

Specify a 3-by-3 matrix if you set the Charge dynamics parameter to One time-constant dynamics or a 4-by-4 matrix if you set the Charge dynamics parameter to Two time-constant dynamics.

Time between consecutive block executions. During execution, the block produces outputs and, if appropriate, updates its internal state. For more information, see What Is Sample Time? and Specify Sample Time.

For inherited discrete-time operation, specify this parameter as -1. For discrete-time operation, specify this parameter as a positive integer. For continuous-time operation, specify this parameter as 0.

If this block is in a masked subsystem or a variant subsystem that supports switching between continuous operation and discrete operation, promote the sample time parameter. Promoting the sample time parameter ensures correct switching between the continuous and discrete implementations of the block. For more information, see Promote Block Parameters on a Mask.

Dependencies

To enable this parameter, set Filter type to Extended Kalman filter or Unscented Kalman filter.

System Model

Option to model the battery charge dynamics. This parameter determines the number of parallel RC sections in the equivalent circuit:

  • One time-constant dynamics — The equivalent circuit contains one parallel RC section. Specify the polarization resistance and the time constant using the First polarization resistance, R1(SOC,T), (ohm) and First time constant, tau1(SOC,T), (s) parameters.

  • Two time-constant dynamics — The equivalent circuit contains two parallel RC sections. Specify the polarization resistances and the time constants using the First polarization resistance, R1(SOC,T), (ohm); First time constant, tau1(SOC,T), (s); Second polarization resistance, R2(SOC,T), (ohm); and Second time constant, tau2(SOC,T), (s) parameters.

Vector of the state of charge breakpoints defining the points at which you specify lookup data. The entries of this vector must be in strictly ascending order.

Vector of temperature breakpoints defining the points at which you specify lookup data. This vector must be in strictly ascending order and greater than 0 K. The physical unit of this parameter must be the same as the physical unit of the AverageTemperature input port.

Lookup data for series resistance of the battery at the specified SOC and temperature breakpoints.

Lookup data, in ohm, for the first parallel RC resistance at the specified SOC and temperature breakpoints. The number of rows of this matrix is equal to the size of the Vector of state-of-charge values, SOC (-) parameter. The number of columns of this matrix is equal to the size of the Vector of temperatures, T parameter.

Lookup data, in second, for the first parallel RC time constant at the specified SOC and temperature breakpoints. The number of rows of this matrix is equal to the size of the Vector of state-of-charge values, SOC (-) parameter. The number of columns of this matrix is equal to the size of the Vector of temperatures, T parameter.

Lookup data, in ohm, for the second parallel RC resistance at the specified SOC and temperature breakpoints. The number of rows of this matrix is equal to the size of the Vector of state-of-charge values, SOC (-) parameter. The number of columns of this matrix is equal to the size of the Vector of temperatures, T parameter.

Dependencies

To enable this parameter, set Charge dynamics to Two time-constant dynamics.

Lookup data, in seconds, for the second parallel RC time constant at the specified SOC and temperature breakpoints. The number of rows of this matrix is equal to the size of the Vector of state-of-charge values, SOC (-) parameter. The number of columns of this matrix is equal to the size of the Vector of temperatures, T parameter.

Dependencies

To enable this parameter, set Charge dynamics to Two time-constant dynamics.

Lookup data, in volt, for open-circuit voltages across the fundamental battery model at the specified SOC. The number of rows of this matrix is equal to the size of the Vector of state-of-charge values, SOC (-) parameter. The number of columns of this matrix is equal to the size of the Vector of temperatures, T parameter.

Signal Attributes

Since R2025a

Option to choose the data type for the block algorithm, specified as one of these values:

  • Inherit: auto — You can simulate the block in both single and double precision. You must explicitly provide the inputs and parameters as either single or double.

  • double — The block algorithm casts all inputs and parameters to double data type.

  • single — The block algorithm casts all inputs and parameters to single data type.

  • <data type expression> — The block algorithm casts all inputs and parameters to the data type object you specify.

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the data type attributes. For more information, see Specify Data Types Using Data Type Assistant and Control Data Types of Signals.

References

[1] Plett, Gregory L. "Efficient Battery Pack State Estimation Using Bar-Delta Filtering,” 2009. https://api.semanticscholar.org/CorpusID:54178271.

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2025a