Altera BMS Reference Design
Altera BMS Reference Design
2016.04.02
The Altera® Battery Management System (BMS) Reference Design demonstrates battery state of charge
(SOC) estimation in an FPGA-based real-time control platform that you can extend to include other BMS
functionality such as battery state-of-health monitoring and charge equalization (cell balancing). It uses a
dual extended Kalman filter (DEKF) algorithm to estimate SOC values for 96 cells, using a MAX® 10
development kit. The reference design’s system-in-the-loop simulation runs on the MATLAB Simulink
software.
A BMS is a critical component in high-value battery powered applications such as electric vehicles or
energy storage. A BMS maintains the health of all the cells in the battery pack to deliver the power needed
by the application. It also protects the cells from damage and maintains all the cells within the manufac‐
turer-recommended operating conditions to prolong the life of the battery pack.
You can use an FPGA as a flexible and powerful platform for a BMS, using its high I/O count for parallel
connections to many battery modules. An FPGA can accelerate processor-intensive calculations such as
state-of-charge estimation.
Related Information
Improving Battery Management System Performance and Cost with Altera FPGAs
© 2016 Altera Corporation. All rights reserved. ALTERA, ARRIA, CYCLONE, ENPIRION, MAX, MEGACORE, NIOS, QUARTUS and STRATIX words and logos are
trademarks of Altera Corporation and registered in the U.S. Patent and Trademark Office and in other countries. All other words and logos identified as
trademarks or service marks are the property of their respective holders as described at www.altera.com/common/legal.html. Altera warrants performance ISO
of its semiconductor products to current specifications in accordance with Altera's standard warranty, but reserves the right to make changes to any 9001:2008
products and services at any time without notice. Altera assumes no responsibility or liability arising out of the application or use of any information, Registered
product, or service described herein except as expressly agreed to in writing by Altera. Altera customers are advised to obtain the latest version of device
specifications before relying on any published information and before placing orders for products or services.
www.altera.com
101 Innovation Drive, San Jose, CA 95134
AN-762
2 BMS Reference Design Software Requirements 2016.04.02
Send Feedback
AN-762
2016.04.02 Downloading and Installing the BMS Reference Design 3
9. Browse to select the bms_soc_max10m50.par file for the reference design and browse to the destina‐
tion directory where you want to install it.
Figure 1: Design Template Installation
Send Feedback
AN-762
4 Downloading and Installing the BMS Reference Design 2016.04.02
12.Click Next.
13.Click Finish.
The Quartus II software expands the archive and sets up the project, which may take some time.
Send Feedback
AN-762
2016.04.02 Setting Up the MAX 10 Development Board 5
Related Information
Altera Design Store
Related Information
MAX 10 FPGA Development Kit User Guide
The FPGA development board provides a hardware platform for evaluating the performance and features
of the Altera MAX 10 device.
Compiling the FPGA Hardware Design for the BMS Reference Design
You can compile your design or use the Altera-provided pre-compiled .sof and .pof from the /master_
image directory of your reference design
1. Launch Quartus II software.
2. Open project bms_soc_max10m50.qpf.
3. Click Processing > Start Compilation.
Note: You may edit the reference design project in Qsys.
Send Feedback
AN-762
6 Compiling the Nios Software for the BMS Reference Design 2016.04.02
Send Feedback
AN-762
2016.04.02 Downloading the BMS Reference Design Nios II Software to the Device 7
Send Feedback
AN-762
8 MATLAB Simulink Top-Level Design for the BMS Reference Design 2016.04.02
The driving cycle block allows you to select the speed profile.
Figure 5: Driving Cycle
Send Feedback
AN-762
2016.04.02 MATLAB Simulink Top-Level Design for the BMS Reference Design 9
The car model block allows you to select the car model parameters.
Figure 6: Car Model
The battery pack contains the battery model block, which allows you to select the battery parameters.
Send Feedback
AN-762
10 MATLAB Simulink Top-Level Design for the BMS Reference Design 2016.04.02
The DEKF-FPGA block communicates with the FPGA. It sends input, including initial values, voltage and
current data, to the FPGA, and receives SOC estimation, and updated battery model parameters from the
FPGA. Three scope windows, including cell 1 and 2 information, and SOC value for the first 12 cells,
appear by default when you open the Simulink top level design. You can add more scopes in the floating
scope block.
Send Feedback
AN-762
2016.04.02 MATLAB Simulink Top-Level Design for the BMS Reference Design 11
Send Feedback
AN-762
12 Running the BMS Reference Design in a System-in-the-Loop Simulation 2016.04.02
Related Information
Starting DSP Builder in MATLAB
Send Feedback
AN-762
2016.04.02 BMS Reference Design Functional Description 13
Note: The design only uses DDR3 SDRAM for Nios II processor storage. You can replace it with external
flash or another memory block.
Onchip memory
Car model (control registers,
measured current
and voltage,
estimated voltage
and SOC)
Battery model
System JTAG Avalon-
console Avalon DEKF IP MM Nios II
MATLAB bridge Interface processor
API
Equivalent algortihm Custom instruction
running in MATLAB floating-point core
Performance counter
DDR3 SDRAM
Send Feedback
AN-762
14 BMS Reference Design Car Model 2016.04.02
Harmonization of Vehicle Regulations. The various cycles differ in the average speed and electric power
required from the traction battery.
The reference design implements a dynamic model to simulate the behaviour of a car. You calculate the
mechanical power Pm as the sum of three contributions: one linked to the acceleration, one because of the
air resistance and another because of the rolling resistance:
Figure 11: Car Model Equation
1
P = Fv = ( Mv + ρ SC v2 + α Mg )v
m 2 air x R
where:
• M is the kerb weight
• S is the frontal area
• CX is the drag coefficient
• R is the rolling resistance
• ρair is the air density
• g is the gravity acceleration
• v is the speed.
You obtain the electric power Pe from Pm where:
• ηwheel is the efficiency from the battery to the wheels
• ηreg is the efficiency in the opposite direction, i.e., during the regenerative breaking.
Send Feedback
AN-762
2016.04.02 BMS Reference Design Battery Model 15
To obtain the battery current, divide the electric power by the sum of the cell voltages calculated by the
battery model.
R0 Ri iL
Ci +
VRC
i
+
iL Qn SOC + Voc VM
- -
-
The left hand side models the cell capacity Qn and evaluates the SOC as the voltage across a linear
capacitor with a capacity equal to Qn (expressed in Coulomb) divided by 1V. The cell voltage vM is the
sum of the open-circuit voltage VOC and a dynamic term, which accounts for the internal Ohmic
resistance R0 and the double layer effect (VRC1 ) and diffusion (VRC2 ) of the Li-ion during charging and
discharging (two RC branches). The model parameters change with manufacturing variations, ageing and
operating conditions, such as temperature and state of charge. To model the temperature and SOC
dependences, the reference design stores the parameter values in two-dimensional LUTs. You see the
variability of the cell behaviour by setting the model parameters, temperature, and capacity of each cell
individually
p( k + 1) = p( k ) + χ ( k )
Send Feedback
AN-762
16 BMS Reference Design DEKF Technique 2016.04.02
The measurement equation is the same for both filters. In the above equations:
• k is the discrete time
• p is parameters vector
• x = [SOC; VRC1] is the battery state vector
• χ, ξ and ψ are the parameters, the state and measurement noise, with zero mean and covariance matrix
Σχ, Σξ and Σψ, respectively.
Figure 17: Circuit Equations
T
SoCk SoCk −1 − iLk
xk = f ( SoCk , vRCk , iLk ) = = Q
r
vRCk
T T
τ + R(1 − e τ )i
− −
RCk −1
v e
Lk
Send Feedback
AN-762
2016.04.02 BMS Reference Design DEKF Technique 17
SoCk
xk = v
RCk
R0k
1
qk =
τ
Rk
1 0
Ak = −
T
0 e τ
dOCV ( SoC)
C xk = − 1
dSoC
dxk−
Cqk = [− iLk 0 0] + C xk
dq
dxk− 1 0 dx+ 0
k−1 +
0 0
= −T −T −T
dq 0 e τ dq 0 Te τ ( Ri − v ) (1 − e τ )i
Lk RCk−1 LK
dxk+−1 dxk−
= − Lxk −1C qk −1
dq dq
x0 , P0 , q0 , Pq 0
q k− = q k+−1
Pq−k = Pq+k −1 + Q q
(
xk− = f xk+−1 , u k −1 , q k+−1 )
− +
Pk = Ak P k −1 AkT +Q
Send Feedback
AN-762
18 BMS Reference Design Hardware Implementation 2016.04.02
(
Lxk = Pk−C xTk C xk Pk−C xTk + R )
−1
( (
x+k = xk− + Lxk yk − g xk− , uk , qk+−1 ))
+ −
Pk = ( I − Lxk C xk ) Pk
(
Lq k = Pq−k CqTk Cq k Pq−k CqTk + R )−1
( (
q +k = qk− + Lq k yk − g xk− , uk , qk+−1 ))
Pq+k = ( I − Lq k Cq k ) Pq−k
Related Information
R. Morello et al., "Comparison of state and parameter estimators for electric vehicle batteries,"
Industrial Electronics Society, IECON 2015 - 41st Annual Conference of the IEEE, Yokohama, 2015,
pp. 005433-005438
\software
\bms_soc_microc
\soc_kalman.h:
// 0 - Nios2 only
// 1 - Matrix processor
// 2 - DSP Builder IP
#define ACC 1
Send Feedback
AN-762
2016.04.02 BMS Reference Design uCode Controller Interface 19
The Faddeev core can calculate the operation: D + C * A-1 * B. The matrix multiply core can calculate the
(A * B) and (A * B + C) matrix expressions.
Figure 22: Matrix Processor Block Diagram
Faddeev
Processor core
interface User
memory
Matrix
Multiply
Core
uCode
controller
The matrix processor interface is the main interface between the matrix processor and the external
environment. It programs the matrix processor for certain uCode, provides input matrix argumentss and
reads-back results.
Send Feedback
AN-762
20 BMS Reference Design uCode Controller Interface 2016.04.02
In addition, to control registers, the uCode interface has a page with a uCode program stored in internal
memory. To configure the matrix pProcessor with your uCode program, fill values into the uCode
memory. The depth of the uCode memory is a compile-time parameter.
To configure the matrix processor to execute an algorithm, the CPU host must program it. To program,
fill data into the uCode program area and provide run-time configuration parameters.
Send Feedback
AN-762
2016.04.02 BMS Reference Design uCode Controller Interface 21
The uCode program structure has these fields that you must supply to the uCode controller. The fields are opCode
dependent. The matrix processor has three operation modes. .
Name Valid Entries Description
MAT_PROC_OPCODE 1, 3, 4 Operation mode:
1 – D + C * A-1 * B
3–A*B
4–A*B+C
In the matrix processor solution, the reference design accelerates part of the matrix operation using the
matrix processor. Meanwhile, the Nios II processor can also be doing calculations.
Send Feedback
AN-762
22 BMS Reference Design DEKF IP (Design C) 2016.04.02
The Nios II processor calculates the steps in the blue box. Then the matrix processor starts calculating the
equations in the red box. Meanwhile, the Nios II processor can process the steps in the green box. Finally,
the Nios II processor finishes the calculation in the yellow box.
Send Feedback
AN-762
2016.04.02 BMS Reference Design Benchmarking 23
Send Feedback