Leveraging Model Fidelity in Simscape Battery | Simscape Electrical Modeling Practices for Fast Simulation - MATLAB & Simulink
Video Player is loading.
Current Time 0:00
Duration 11:12
Loaded: 1.47%
Stream Type LIVE
Remaining Time 11:12
 
1x
  • Chapters
  • descriptions off, selected
  • en (Main), selected
    Video length is 11:12

    Leveraging Model Fidelity in Simscape Battery | Simscape Electrical Modeling Practices for Fast Simulation

    From the series: Simscape Electrical Modeling Practices for Fast Simulation

    This video introduces the concept of model fidelity for battery simulation, showing how it affects your model's performance and the richness of data you can extract from your simulation. Understanding how model fidelity works will allow you to balance between degree of accuracy and computational effort of your simulation. This will allow you to select the right strategy for battery simulation.

    Published: 7 May 2024

    Welcome, everyone. In this video, I want to talk about the concept of model fidelity, featuring one of our new products for battery simulation, which is Simscape Battery. And today, we will explore how adjusting the model fidelity influences the performance of your battery simulation and the richness of data that you can extract from your simulation.

    Understanding how model fidelity works will allow you to balance between the degrees of accuracy and the computational effort, which will finally empower you to choose the right strategy for battery simulation. All material that I'm using for this demonstration can be downloaded using the link below so that you can reproduce all steps and adjust them to your specific use case. And my name is Lorenzo Nicoletti. And I am an Application Engineer here at the MathWorks.

    So today, we are going to use a live script, which you can simply download from the link below. And to explain our model fidelity works, I will take a battery pack. And I will model it with two different fidelities. And then I will compare these fidelities in term of calculation time and information that I can get out of my model.

    Today, we will be using exclusively Simscape Battery. I'm not going too deep on the technical parts of Simscape Battery. But if you are interested, I have provided links throughout the whole script. So you can find out more by just following the links.

    So now let's understand how model fidelity works and what it is. To show this, I brought this figure, where we can see different model fidelities on a simple module, with six cells. Simply put, if you are interested in elements like temperature gradients between the cells within the module, then the right fidelity for you is a detailed model fidelity. I've shown you on the left.

    In this case, Simscape Battery will assign a thermal model for each cell and an electrical model for each cell. It might, however, as well be that you are not interested in simulating temperature gradients, for example, within your module. And you want a fast-calculating model. Then you might opt for a lumped model fidelity. In this case, Simscape Battery assumes that all cells within the module behave, electrically and thermally speaking, the same. So I just need one electrical model and one thermal model accounting for the entire module.

    Furthermore, if you want, there is also the possibility of using a grouped model fidelity, which is basically a combination of both. So also important to say the more models you have, the more information you get, of course, but at the same time, the more equation you have to solve. And therefore, this will also have an impact on your calculation time.

    Now that the concept of model fidelity is clear, we can move to the next step, where we will build a battery pack using first a lumped model fidelity and then a detailed model fidelity. So some information regarding the pack that we are going to build-- it's a battery that comprises eight modules. Each modules contains 24 pouch cells. And each module has a 2p12s electrical configuration, for a total of 192 cells.

    So here, what I'm doing is that I'm first creating the cell and then the parallel assembly by using the Simscape Battery API. I'm not going to go too deep and technical into this. You can check it out on our documentation if interested.

    Subsequently, once I've built my parallel assembly, I will call this function that I've created to first create a lumped version of my pack, which I'm going to save in the variable pack lumped, and then a detailed version of my pack.

    So how do these two packs now differ? So in the end, they are modeling the same battery. But I can highlight their differences by using the BatteryChart function, as shown here. So here, I'm just plotting the used simulation strategy, or model fidelity in this case, for both packs. And I've also have the image here.

    So what these plots are highlighting, in orange is the number of models that I'm using. So on the left, we see the detail battery pack. So we see every cell in the pack is highlighted, which means that I'm using a thermal and an electrical model for each cell. And on the right, we see the plot of my lumped battery pack. We see here, clearly, that every module is highlighted. So I'm using just a thermal and an electrical model for each module and not for each cell.

    Difference here is that, for example, from the electrical perspective, on the right side, I only need eight models, while on the left side, I need 192.

    So moving on, Simscape Battery also gives me the possibility to choose model fidelities for the cooling plate. I will connect these two packs with two different cooling plates for the lumped battery shown here on the right. I will use also a lumped cooling plate, which means that I will model the cooling plate as a big block, as a big thermal mass, while for the detailed model fidelity, I will connect it with a more detailed plate. As you see here, I've discretized the plate in 16 parts. So there are basically two portions of the plate for each module.

    Now, with that said, we can move to the next step. We have defined our model. We have defined our battery. I can call this function to create the battery libraries.

    So in this case, I've already called the script. And the battery libraries will be saved here. On the left, you can see them in the current folder. So as we can see, we have a battery library for the detailed pack and a battery library for the lumped pack.

    If you want to re-create this library once again, you have to delete this folder. And then you can recall this portion of script. And if you are interested to see how the library looks like, I have here, for example, I think this is the detailed library. So what has been generated is just a block of my entire battery, in this case for the detailed battery pack, which is ready to use and can be directly copied to a model and connected with electrical and thermal stuff, whatever you need.

    So I didn't want to do this process manually. So also for that, I have created a function, a custom function, which is also saved in this live script. So we will create two models that will simulate the same stuff, only that one model we use the lumped battery pack. And the other model we use the detailed battery pack.

    So what I do here, I just create-- first, I start with the lumped model. I create a new model called lumped model. And then calling this function, I assemble my entire model. And then I set the parameter that I want to set for the simulation.

    And here is the resulting model. As I said, this has been generated automatically. So that's why, exactly here, it looks a bit funny. But it's ready to go. It can be simulated right away. So we see here the battery pack-- in this case, the lumped pack. And it's being connected to some charge and discharge algorithm.

    And I generate the same identical model also for the detailed pack, which is stored, in this case, here. We can see it here. So it's the same model. The only thing that differs between the two model is, as I said, this one uses-- the one on the left uses the lumped pack. And the one on the right uses the detailed pack.

    So now that we have generated the models that we need, we can move on. And we can simulate them and finally compare them one another. So to simulate the model also here, I just parameterize them. And I set a couple of parameters. And then I can simulate them immediately.

    So I first simulate the lumped model. I collect the data on this variable. And then I do the same for the detailed model. And I collect the data in this variable. So now that I have the variables after the simulation for both model, I can compare them.

    In this case, I did two types of comparison. First, I decided to compare the results of the model. So what you can see here, the blue line represents the temperature of the one module of the lumped pack over time. So in the lumped case, I have just one temperature for each module. So I just have this blue line here.

    The same module in the detailed model gives me much more information because in the detailed model, I'm modeling every single cell. So instead of one line, I have, in this case, 24 lines, which are these red lines here. So we see the difference between the two approaches. Here, I think it's pretty clear. In the case of the lumped model, you will have an answer, which is the blue line, which is kind of realistic. But it's an averaged answer.

    If you are interested more in finding out what is actually the maximum and the minimum temperature within your module, you clearly need what's represented by this red line. So you clearly need a detailed model. So clearly, the detailed model gives you more information. But that comes with a cost, of course, that I've tried to represent here in this table.

    So more models means also more equation to solve. And here, we see the difference in the initialization and execution phase. So in the initialization phase, we see that our lumped model is three times faster. And in the execution phase, which would be like the actual simulation, we see that it's four times faster. So that's a potential advantage of the lumped model. It's clearly at least three times faster in both initialization and execution phase. So you have less information, but you can simulate way faster.

    So I hope that's clear. I just want to conclude with a brief discussion on factors that might impact the calculation speed. This is just a simple example. But these results, like the speed gains that you see here, they vary depending on the number of cell you're simulating, on how complex the model that you're simulating are, so how complex the electrical or the thermal model is, how many thermal paths you have activated.

    And it also depends, of course, on the type of cycle and the type of load that you're giving to the battery. So a highly dynamic load will, of course, be more computationally expensive than a pretty stationary load on your battery.

    And that concludes today's presentation. And I hope you can use what we saw today in your model. And I also hope to see you again in the next video.