Main Content

Battery Modeling Workflow

Simscape™ Battery™ includes MATLAB® objects, functions, and apps to automate the creation of Simscape battery models. Use these tools to define your own battery design specifications, visualize your battery in a 3-D space, customize the modeling resolution during simulation, and generate a Simulink® library that contains your custom generated battery blocks. You can use these blocks to assist with virtual battery design and verification, help develop battery control algorithms using Simulink software, explore design sensitivities, and design thermal management strategies.

You can develop and test battery control strategies by simulating your custom battery blocks with the blocks in the Battery Management System (BMS) library of Simscape Battery. You can also thermally couple your custom battery models in Simulink with the blocks in the Thermal Management System library. Alternatively, you can define your own custom battery control and cooling system blocks.

By using the battery objects in Simscape Battery, you can specify several electro-thermal features that you want to model in your battery simulation. For example, you can:

  • Add a cell-balancing circuit to every parallel assembly or cell for BMS control.

  • Add custom thermal boundary conditions, such as thermal resistors, that represent ambient heat dissipation paths.

  • Enable battery aging models in the cell-level model block.

All battery models are scaled up from a single cell model block, which by default is defined as the Battery (Table-Based) block. You can define your own custom battery cell as long as it meets specific requirements.

You can customize the model resolution before model creation to suit the model requirements of your specific engineering problem. A larger number of equivalent circuit models of a battery provides a higher resolution. By default, the model resolution is Lumped, which is the lowest resolution and provides the best simulation speed and compilation time. This resolution indicates that only one “scaled-up” equivalent circuit model represents your system. If you increase the model resolution to Grouped, you can customize the number of electrical and thermal models required to answer your specific engineering question while increasing simulation speed. If you require a very detailed battery model, you can choose to simulate every single cell inside your battery electrically and thermally. This level of resolution comes at a great performance cost. To support real-time simulations, keep the number of equivalent circuit models equal to or less than 30. All custom Simscape Battery models support the Simscape scalable compilation feature.

To create your own battery model, follow these steps:

This workflow applies whether you are creating your battery model at the MATLAB Command Window or by using the Battery Builder app.

Define Battery Design

Create a Simscape Battery object and specify its properties. These are the battery objects you can create:

You can create these objects either at the MATLAB Command Window or by using the Battery Builder app. The Battery Builder app allows you to interactively create, modify, visualize, and build your MATLAB battery objects.

You can also create these objects without any inputs and define them with the required level of detail. You can create the battery models with or without defining the geometrical characteristics of the battery cells and the battery topology. High-level models without consideration of geometry are normally used as value models early in the design stages of a prototype pack to evaluate key performance indicators. Battery mass and packaging volume are dependent properties that you can obtain by querying the Mass and PackagingVolume properties of the battery object. Use the CumulativeCellCapacity and CumulativeCellEnergy properties to understand how the cell-level capacity and energy values scale up at system level without considering non-cell component losses or other operating conditions. To determine the actual delivered energy and capacity of your battery pack, you must simulate your battery model first.

Visualize Battery

The batteryChart object provides a custom battery visualization function to verify the hardware specifications of your battery, such as the cell dimensions, inter-cell spacing, inter-module spacing, number of cells, selected parallel assembly topology, and many more. Geometry and cell layout are required properties to perform more detailed thermal modelling with thermal management system blocks, like the coupling of a battery module block with one of the cooling plates blocks provided in the Thermal library of Simscape Battery.

Inside the Battery Builder app, the Selected Battery panel automatically displays a 3-D plot of the selected object. You can edit multiple properties of the plot under the Battery Chart tab, such as axes labels, axes direction, title of the plot, and lights. You can also check the current simulation strategy and model resolution of the selected battery object.

Define Model Resolution

Set a suitable model resolution or simulation strategy by specifying the ModelResolution property in the ParallelAssembly and Module levels. When you specify the resolution of your battery model, you must consider the trade-off between model resolution and model speed.


To obtain optimal performance, keep the number of models to lower than or equal to 30.

You can simulate specific regions or areas of your battery by using a grouped model resolution and by specifying the SeriesGrouping and ParallelGrouping properties. With this flexible approach, you can simulate specific subcomponents of your battery that exhibit the hottest and coldest temperatures, or the highest and lowest state of charge. You must capture these spreads to correctly test and develop the battery control strategy.

Build Battery Model

Use the buildBattery function to create a custom battery model from the ParallelAssembly, Module, ModuleAssembly, and Pack objects.

To build the battery model in the Battery Builder app, under the Battery Builder tab, in the Library section of the toolstrip, select Create Library.

This function creates one or two libraries in your current working directory that contain the necessary subsystems and variables you need to simulate the battery. The buildBattery function creates one library for the Simscape-level battery blocks of the object hierarchy (ParallelAssembly and Module), and another library for the Simulink-level battery subsystems, ModuleAssembly and Pack. If you also specify the MaskParameters and MaskInitialTargets name-value arguments, the buildBattery function generates a parameterization script that helps you managing the run-time parameters of the different modules and parallel assemblies inside the pack.

See Also




Related Topics