BMS & MBDT - Designing Battery Management System with Matlab and Simulink

cancel
Showing results for 
Search instead for 
Did you mean: 

BMS & MBDT - Designing Battery Management System with Matlab and Simulink

BMS & MBDT - Designing Battery Management System with Matlab and Simulink

Introduction

A couple of months ago, we've posted an article titled How to use your own C code in our Toolbox. The aim of the article was to provide a step by step guide on how to use custom code in the Simulink models. By presenting this MathWorks feature, we provided to our users the power of using the familiar libraries or C pieces of code directly in their models, making our controllers capable to connect to any external devices.

Since one of the greatest education theories is ‘learning-by-doing’ we chose to present the custom code insertion as a hands-on approach on how to add support in Simulink for a family of battery cell controllers, the MC3377xB. Because the article has created a great community interested in using the NXP parts in the Simulink Models, we decided to add native Simulink support for the battery cell controllers.

With the latest release of MBDT for S32K, we provided with our library a couple of blocks designed to cover most of the MC3377xB family functionalities. Starting with configuration, measurements and even cell balancing, our NXP users can use native blocks for interfacing the S32K with the MC3377xB controllers both on classic SPI protocol or on TPL.

In the following articles, we are going to detail the capabilities of our BMS blocks and how to use them on the NXP battery cell controller DevKits.

  1. SPI communication
  2. TPL communication
  3. Connecting Li-Ion Cells

What is a Battery Management System?

A Battery Management System is a device that manages, monitors, balances and protects a rechargeable battery.  The battery can consist of a single cell or multiple connected cells (battery pack). BMS is also responsible for

There are two types of values that defines a battery pack:

  • directly measured (voltage, current, temperature)
  • determined (State of Charge, State of Health, State of Safety, etc)

What is a Battery Cell controller?

A battery cell controller, also known as the Analog Front End, is a circuit able to perform all the analog measurements and functions for the operation of a BMS. It can measure the voltage for each cell, pack current and temperatures. It also handles the balancing circuitry that improves the pack health by equalizing the cell states of charge.

“NXP’s battery cell controllers are designed to address safety risks related to Li-Ion batteries by accurately controlling critical Li-Ion cell characteristics (voltages, temperatures, current) and by providing embedded balancing functions along with extensive system diagnostics. These robust ICs meet automotive and industrial requirements and are fully automotive qualified—making them ideally suited for in-vehicle battery management, energy storage systems, and uninterruptible power supply applications.” [BATTERY CELL CONTROLLERS]

Why choosing Model-Based Design?

Simulink is a great environment when it comes to developing such algorithms. Before running the BMS Algorithm on real hardware with real Lithium cells, the algorithm can be designed and validated using Simulink. To have a look at this kind of model, please visit the Battery Management System that Mathworks provides for free alongside videos and webinars explaining the model.

MBDT  Battery Management System Library

NXP Model-Based Design Battery Cell Controllers libraryNXP Model-Based Design Battery Cell Controllers library

The Battery Management System Library is fully integrated into the MBDT for S32K1xx. Once installed, the BMS blocks can be accessed under the External Devices Library.

With these blocks, NXP offers access to all the NXP’s Cell controllers features in Simulink environment. For example, this performs important measurements for a cell (voltage, temperature) as easy as adding a Simulink block from the library into the model.

The Library offers blocks for BCC Configuration, registers read/write and balancing. Basically all the data acquisition is performed by the NXP BCC blocks. The user can focus exclusively on the BMS Algorithm, Instead of dedicating time for reading the Battery Cell controller Reference Manual and writing the C code for data acquisition.

All the generated code is based on the Embedded SW: Battery Cell Controller Software Driver for MC33771B/MC33772B

MC3377xB Hardware

NXP BMS Testing HardwareNXP BMS Testing Hardware

MC3377xB is an NXP Li-Ion battery cell controller family of ICs designed for automotive and industrial applications such as HEV, EV, ESS, UPS systems.

The boards main features are:

  • ADC conversions on the differential cell voltages and currents as well as coulomb counting and temperature measurements.

  • Embedded balancing transistors and diagnostics to simplify applications with Onboard 300mA Low Rdson passive cell balancing MOSFETs with diagnostics.

  • Support standard SPI and transformer isolated daisy chain communication (with MC33664) to an MCU for processing and control.

  • Up to 7 GPIOS that allows adding up to 7 NTC thermistors for temperature measurements.

 

The MC3377xB has 4 different derivatives. I will try to explain how to identify the best suitable one for your application related to the number of cells required:

  • Small Battery Packs – up to 14 Cell Battery packs

For this kind of application, the MC3377xBSPI is suitable for the project. This chip connects to the main MCU over the SPI protocol. The MC33771BSPI can handle 7 up to 14 cells, while the MC33772BSPI can handle 3 up to 6 cells.

  • Larger Battery Packs

This kind of application requires dividing the whole pack in smaller modules, only for measurement. For each module we need to connect one cell controller the MC3377xBTPL. Same, the MC33771BTPL can handle 7 up to 14 cells, while the MC33772BTPL can handle 3 up to 6 cells. All the cell controllers need to be connected in a daisy chain topology. Now, to connect the MCU in the same network, the MC33664 transceiver needs to be used. This is a transceiver physical layer transformer driver designed to conveniently interface a microcontroller to a high-speed isolated communication network. MCU SPI data bits are directly converted to pulse bit information and transferred to the bus network.   

Full Datasheet and more documentation are available on docstore.nxp.com (NDA required).

Follow up on the next articles to understand all of the controllers mentioned above in your Simulink projects.

References

  1. How to use your own C code in our Toolbox - Battery Management System example
  2. Model Based Design Toolbox for S32K1xx Automotive 
  3. Embedded SW: Battery Cell Controller Software Driver for MC33771B/MC33772B
  4. BATTERY CELL CONTROLLERS
  5. Mathworks Battery management system 
Version history
Revision #:
2 of 2
Last update:
2 weeks ago
Updated by:
 
Contributors