Design and Simulate Battery and Energy Storage Systems with Simscape Battery
Overview
An accurate battery model is essential when designing battery systems: To create digital twins, run virtual tests of different architectures or to design the battery management system or evaluate the thermal behavior. Attend this webinar to learn how Simscape Battery can support these studies.
Highlights
- Battery pack design: Form cell to pack
- Including a thermal management system design
- Virtual testing of system behavior at varying conditions
About the Presenters
Lorenzo Nicoletti is a senior application engineer at MathWorks. He holds a master’s degree in automotive engineering, a master’s degree in mechanical engineering, and a Ph.D. in automotive engineering (all obtained at the Technical University of Munich). His area of expertise is physical modeling and simulation of electric vehicles. Before joining the MathWorks he collaborated in a three year long research project with AUDI AG.
Eva Pelster is a senior application engineer at MathWorks. She holds degree in Aerospace Engineering from the University of Stuttgart. Her area of expertise is model-based design workflows and the application of physical modeling. Before joining MathWorks, she worked in a technical consulting company.
Recorded: 6 Jun 2023
Hello and welcome to today's webinar, Design and Simulate Battery and Energy Storage Systems with Simscape Battery. My name is Eva. I'm an application engineer at MathWorks. And I focus mostly on physical modeling and simulation. And today, I'm joined by my colleague, Lorenzo.
Hello, everybody. My name is Lorenzo. I'm also an application engineer here at The MathWorks. And I focus on the topics of physical modeling and electrification.
So what will we see today. So, we will look at how Simscape enables physical modeling of multiple physical systems and how you can quickly create physical system models using some Simscape. And we will specifically look at one add-on Simscape battery, which supports workflows for designing and simulating battery and energy storage systems. So by using Simscape Battery, you are able to quickly look at different pack architectures and evaluate thermal and electrical requirements.
So let's start by looking at why using Simscape specifically for physical modeling. So, Simulink itself is known for signal-based modeling. So if you were to look at example. so here are simple electrical circuits, and you were to model this with Simulink-based blocks, you would have some kind of block. Here, a transfer function representing the system dynamics, which takes an input and calculates some output.
If you were to do the same using Simscape, you would have models or components representing specific physical components. And they allow bidirectional flow of energy. And so when you now make the system more complicated or bigger, representing the same in Simulink would require to reconnect all the blocks and reroute all the signals. And doing the same in Simscape, you simply have to extend the circuit by the new components that you added to the physical system.
So the benefit of using Simscape is that the entire equation system is formulated automatically based on the way you connect the circuit and based on the components you use. And these are solved simultaneously. And Simscape covers multiple domains, mechanical, electrical, thermal, and so on. So it is well-suited to look at the electrothermal behavior of a cell.
So, again, if you look specifically at Simscape Battery, besides the cell modeling, it also provides you with a whole workflow to simulate and design battery and energy storage systems. So besides the cell behavior, you get a tool or workflow for designing battery packs. And it also ships with components that represent different components of battery management systems or BMS.
So it allows you to quickly evaluate and analyze different pack architectures. And against those, you can test your elements and functions of your BMS. And it also is suitable for HIL testing.
So if we look at the workflow, how do we get from one cell to entire pack to do all these things, you start by defining the cell and then also defining stacking and topology. And based on that decision, you now scale up. So you start with a cell, and then go up by assembling the parallel assembly, module, module assembly, and pack.
And while you're doing that, you can visualize the architectures along the way, and also decide on a thermal strategy and a grouping strategy to define the model fidelity. And all of this, we will see in the following 15 or 20 minutes or so.
OK, so let's have a look on how the cell is modeled. So here we can see the basic cell block of Simscape Battery and its capability. So the cell is tunable with measured data. You can model both electrical and thermal behavior of the cell.
And additionally, you can also include fade and calendar aging. Here is an overview of the mask of this block. And if you want, there are also preparameterized cells available that you can pick up to parameterize your cell.
If we dive in more specifically in the electrical model, we can see that it is an equivalent circuit model. So we have an open circuit voltage, which is defined as a vector or as a lookup table. Additionally, the block can also account for the serial cell resistance and the discharge resistance. And we can also account for charge dynamics.
So we have first option would be not to include any dynamics. Or we can choose to model the dynamics with RC blocks. And we can pick up, up to five blocks. In the example here, there is only one block.
And as I said with the parameters, they are vectors or lookup tables. So they can be SOC dependent or depend from both SOC and temperature. So for example, the open circuit voltage can be a vector which depends only on the SOC, or it can be a lookup table, which depends on both SOC and temperature.
Of course, to parameterize the cell, you need the data. So you need these vectors and lookup table. There are two options here for the parameterization. So the first would be that you already have the vectors and lookup table, they are already known, and you can just type them in the block code. Or it could also be that you don't know these vectors and you have to estimate them.
As an example, we can see here, if we don't know this vector and we want, for example, to include a dependency from both temperature, and as you see, this would mean that for each element in this equivalent circuit, we need a corresponding lookup table that looks like the one for R1. How could we estimate this lookup table?
Well, if we have measured data, so for example, we have a real cell, and we apply a certain current and we can measure the output voltage on this real cell, we can use this data to parameterize also our cell model. So what we need to do is simply to build an equivalence Simscape model by using the Simscape Battery block. And we apply the same current to the Simscape model.
In the end, we then are going to obtain our voltage output, which is the model voltage of our Simscape Battery model. Now, we can compare both the output of the model and the output of the real cell and see if they are similar. If they are not, we can just iterate.
And in this iteration, we are going to slightly change each element of these lookup tables. And we are going to keep changing them iteratively until the output voltage of our model is similar or exactly similar to the output voltage of the measured real cell. And if that's the case, then we have a suitable parameterization for our Simscape model.
So now I'm going to explain how the thermal cell model works. It's simpler than the electrical model. The cell temperature, in this case, is estimated from the ohmic losses following this formula. So each cell can be parameterized with a certain thermal mass. And based on the ohmic losses, I can estimate how the temperature of the cell changes over time.
If we then use this cell in module and pack assembly, we can also define two separate thermal paths. So one thermal path with the cooling plate and one thermal path with the ambient. In this case, we define the thermal path with so-called thermal resistances. And we are going to show this later on in the presentation.
Another possibility is also to use custom cells. So if you're not happy with the electrothermal model that is currently implemented in Simscape Battery, you can create your own model, which would look like this. The model has to be created in Simscape language, which also requires a certain knowledge of the Simscape language.
And there are also some further requirements such as certain naming conventions and so on. But the biggest requirement here is the knowledge of the same language. If you are able to implement your model in Simscape language, then you can take your custom cell and easily integrate it in Simscape Battery to derive modules, battery packs, and so on.
So let's suppose that we have now chosen a cell that we want to use. And we can now scale it up to define a module and a battery pack. So for this, we can use the battery pack app or so-called Battery Builder. This is an interactive app that can be called directly from the app section.
And this app enables you to create interactively batteries starting from one cell. You can also use it to import already existing battery object directly in the app. And you can go step by step, starting from the cell going to the power assembly to the module and so on and so on.
And at each step, you can also visualize your battery as a 3D battery object plot. And now we are going to show how the Battery Builder app works.
We can see how easy it is to create a battery pack with the Simscape Battery Builder in this video. So first of all, we open the Battery Builder. There are already example cells and modules initialized. Here, we create a new cell.
First of all, we assign the name of the cell. We choose a geometry here. We can select the dimension of the geometry and plot it.
In the cell properties, we can assign mass, capacity, and energy. We can choose a parameterization from a specific manufacturer. Here, we can assign other properties such as thermal ports and so on.
Once the cell is created, we can create from a parallel assembly as shown here. We select the cell that we want to use in this parallel assembly. Then we select the number of cells for the parallel assembly, their topology, and how many rows that are disposed, and so on. And here, we can plot.
Here, we can see the modeling option that will be discussed later in the presentation. Then we can create a module from the parallel assembly. Again, we assign a name. We choose which assembly to use for this module. We select how many assemblies are built in this module.
We can change the positioning of the assembly, as shown here. Here, again, we have a different model option. We can now select a cooling plate to be assigned on the bottom.
And here, we can then create the library. We first have to assign a library name to it. And then we have to choose the link where the library will be saved.
And then once everything is ready, we just can click on Create Library. This will take a few seconds or minutes, depending on how big the battery is. If everything goes well, we will have successful message created library. And here, you have the library.
We can open it. In this case, we can visualize the module that has been created here with all the properties. Here's a description of the module. And we can also visualize here the parallel assembly that has been created.
So, Lorenzo just showed us how you can use the Battery Builder app to create the battery pack or module. Instead of that, you can also use a code-based approach. So this is a MATLAB API that supports the same things we just saw in the interactive workflow. So, with as much as six lines of code, you can define the entire battery structure. And the output of that will also be a library block.
So you can create a script, which you can quickly iterate on, made different changes to evaluate different designs. So let's also have a look at MATLAB to see how that works.
So in this example of the MATLAB-based workflow, we'll start from cell and build up to a module and a module assembly. So we'll start by defining a pouch type cell. Here, as we define it, we are already passing along geometric properties as well as activating the thermal modeling. This will create a cell object in the MATLAB workspace. The battery chart here is displaying the object we've just created.
In the next step, we are defining the parallel assembly. So again, we are defining a MATLAB object by, here, pointing to the cell object we've just created and defining additional conditions. Here, for example, is stacking axis and the number of parallel cells to combine. And as we go along, again, we can use the battery chart to display the object we have just created.
Simultaneously, we are defining the module object. So, again, we are pointing to the parallel assembly object we've just created and passing the number of series assemblies along. And again, we are also defining a thermal boundary condition.
And the battery chart here is displaying the module object and also the simulation strategy. So the orange lines indicate how many detailed cells we are modeling.
And in this bit, we are defining the module assembly where we are also already including the cooling plate. We'll see more about this later.
And the last step, we are generating the library. So this command will use all the definitions you just made, translate them into some Simscape language files. And these Simscape language files will then be compiled into a library component we can use in a Simulink model.
So here, we can see the files that have been created, for example, the library block. So this contains all the definitions we just made. And we see it has already been combined with a cooling plate. We'll learn more about that later.
And in the module block, we can see that it can be parameterized. We'll see the script for that in a minute. And we'll see the definitions we made for that specific library block.
The script was also automatically created. This contains the parameter definitions, which I could go on and adapt and make changes to the parameters.
So part of the workflow when scaling up is choosing the appropriate model fidelity as you go along. So you have the option of choosing between a detailed module, lumped module, or group module. So in this example, when we have six different cells, when we go for the detailed module, these would be represented by six individual temperatures, but also six individual cell voltages.
We could also lump all of them. So all of them would be represented by one temperature and one voltage. Or if we go for a group model, you decide in which region to group cells into one state. So again, we would, in this case, have two individual temperatures and two individual cell voltages. And this is to find the right compromise between simulation performance and precision of the model.
When you decide to include thermal modeling, you can also decide how to represent thermal path within the pack. So you have the option of modeling a intercell path or intercell radiative path. So again, if you are working with individual cell temperatures, within them or between them, you can decide to include thermal resistances for the thermal behavior between the individual thermal masses, or you can include radiative heat transfer conditions between them. And the connection are always made between neighboring cells.
And in addition to that, you can also decide on thermal boundary conditions that lead outside of the pack, so to model conduction and convection between the pack and the environment. So one path, or one optional path, is the thermal path to the ambient. And another one would be to the cooling plate.
So again, if you had different thermal masses representing the thermal behavior of the pack, you define either-- or you can define thermal resistances to the ambient and thermal resistances to the cooling. And in the case of the ambient thermal path, this will all lead to one single thermal node. And in case of the cooling plate thermal path, this would lead to an array of thermal nodes, which would then be mapped to the cooling plate.
OK, so now let's see how the cooling plates are modeled. So the cooling plates are there to model the heat transfer between the battery, the liquid cooling system, and the environment. And we have three different cooling plates that you can use. So edge cooling, parallel channel, and U-shaped channel.
And similarly to the model-- of the module, just as shown by Eva, we can also adjust the resolution of the thermal model on our cooling plate. And we do this by defining the quantity and placement of thermal nodes on the plate. And we will see this now in the next slide.
So we'll show these in the example of a parallel channel plate with two channels. And in the plate mask, one of the parameters that we can choose is the number of partition in x and in y direction. So this plate has parallel channel and does two channels in total. So it looks like this.
We can also see the x and the y direction on the plate and the direction of the coolant within the plate. So if we choose a number of partitioning x equal to 1 and the number of partitioning y equal to 1, this will mean that the entire plate will be considered as a lumped block.
So for each channel, we have two here, Simscape Battery is going to use a pipe element to model the channel. But since our plate is lumped, it's then going to fuse these together. And if we simulate this plate, over time, we will see only one temperature value, which is valid throughout the entire plate.
So if it is not enough, we can increase the number of partitions. So for example, we can change the partition in x from 1 to 2. What Simscape is going to do is it's going to divide the plate into two sections. And now, it's going to connect each channel to one different section.
So if I simulate this plate, I now have two different temperature measure, one on the left side and one of the right side. Of course, I can increase the number of partition also on the y direction. So for example, from 1 to 3. This is also the direction parallel to the channels.
So in this case, Simscape will automatically further discretize the channel. So instead of modeling one channel with one pipe element, it's going to use three pipe elements. The total is here now six pipe element, each one connected to a different section of the plate. And if I now simulate this plate, I will have six different temperature measurement on the plate.
And now we can combine together the temperature module of the module and the temperature model of the plate. So for example, I can combine a lumped module with the lumped plate, which would look like this. So if I simulate this system, I have one temperature for the module and one temperature for the plate.
Or I can choose a grouped approach. The total number of temperature here will be two for the module and two for the plate. Or I can choose a discretized module combined with an equally discretized plate. And now, we will show a demo which combines all of the topics that we have covered so far.
So let's do an example of an automatically built module as part of a Simulink model. So this is an example of a module that has been automatically created using the previously described workflow. And this is consisting out of 12 individual pouch cells, so the way we see it displayed right here.
So if we look what's inside this subsystem or this library block, we first of all, see the automatically created module block. So if we look at the interface, we can see how the individual parameters defined the initial boundary conditions, for example, temperature right here.
And we can also see what it consists of, so how it was created. So it's a detailed model out of three parallel assemblies. And there are four cells to every individual assembly. And this is also linked to the source code.
So this is the source code that was automatically assembled by Simscape Battery that's underneath that block. Part of it is also the cooling plate. So again, if we open this up, we see how the cooling plate is parameterized.
So we see that this characterisation, 2 by 12 partitions. The mapping to the model has been automatically created. And the blocks have been combined. We can make settings for the plate material, plate thickness, but also the conditions for the internal pipe, the geometry of the pipe, and so on. And again, we will set a target initial temperature to this block.
So, Lorenzo, what else do we see?
So now we can see that we can track different signals from this block. So for example, SOC, temperature, and so on for each cell. For example, the SOC, we can take it as an output and use it in a CC/CV charge discharge block. So what this block does, it will charge and discharge the battery with 150 per current. And it will use a CC/CV profile.
This block has also in-built controller system that enables it to charge and discharge the battery based on the current SOC. But we also see we can also take the temperature of the cell, the signal, and we connect it with another block of battery, which is the battery coolant control, which will ensure that the cell remain between 25 and 35 degrees of temperature. And it will do so by calculating coolant flow command.
We can see the coolant flow command goes down here and is connected to a controlled mass flow rate. So based from the signal, this block will impose a certain mass flow rate. In this case, it will pump coolant from this reservoir. So the coolant is assumed to have a certain constant temperature. And it will pump it in the cooling plate.
And we see it goes in from this side. And it will go to the plate and go out with the higher temper from the other side and end up in reservoir.
Finally, we can also see the ambient path connection. So we can see here the ambient models are the temperature source. And the module can exchange it with the ambient convective constraint.
And so now we can simulate this model for speed up. So the model here has been accelerated a bit. For the first simulation, the compiling will take a while. But then if you don't change anything on the model and you calculate it again, the compiling part will be much faster.
So the scenario we simulated here was a two-hour scenario. And let's look at the results. So first, we will look at the Simscape Explorer, which gives us individual signals and variables over time.
So if we open this up, we can navigate to different parts of the Simscape model. So first, we see the cell current. So we can nicely see the constant current constant voltage profile. We start by discharging and then charging the battery. So we can see the profile right here.
And next, we'll also look at the individual SOCs of the cells here. They are all the same because in this specific model, the electrical parameters were independent of the temperature. But if we navigate to the temperature of the different cells, we can see difference between them because we choose a detailed model. So we have individual temperatures that can be checked. Also, looking at the voltage and in this display.
So this is a plot of the plate temperatures. And here we can see, as soon as the cooling is active, we see a temperature variation across the plate. When the cooling is inactive, again, they start to converge. So, Lorenzo, you can now show us a customized script for a better view at the temperature.
Exactly. So if you want, you can create your custom script to visualize the results. So what I did, you can see the pack temperature on the upper left side and the module temperature on the right side. And we can see here, step-by-step, how the SOC changes, which would be the orange line, and how the coolant flow changes, and this would be the blue line.
So what we see here, our algorithm will keep the cells between 25 and 35 degrees. And this is done by switching on and off the coolant as required. So we can see that some are at a coolant flow is 0.1, which is the maximum set value. And in other areas, it's set to 0 because the cells are the correct temperature and is not needed to cool them down.
Now we can see the average SOCs following the CC/CV profile. The current decreases, not much heat is developed, so I don't need to cool down. And then I restart discharging full power, so I need to reactivate the coolant to bring the cells back to the correct temperature. And this is repeated once again here in the simulation.
So today, we focused mostly on the modeling aspects of battery cell and tech. But Simscape Battery also comes with building blocks for creating your battery management algorithms or battery management system. So these building blocks, for example, are for charge and discharge, cell balancing. It also contains estimators, for example, for SOC and SOH, and protection as well as thermal management algorithms. And you can use these as building blocks for your BMS, but also incorporate your own algorithms.
So to wrap up for today, we focused on looking at Simscape as an environment for quick, physical, multi-domain modeling and how Simscape Battery specifically supports workflows for designing and simulating battery systems and scaling up from cell to battery pack. So, thank you for attending today.