Modeling and Simulation of Battery Systems with Simulink - MATLAB & Simulink
Video Player is loading.
Current Time 0:00
Duration 58:40
Loaded: 0.28%
Stream Type LIVE
Remaining Time 58:40
 
1x
  • Chapters
  • descriptions off, selected
  • captions off, selected
  • en (Main), selected
    Video length is 58:41

    Modeling and Simulation of Battery Systems with Simulink

    Overview

    Please join MathWorks at this webinar focused on modelling and simulating battery systems with Simulink®.

    We will demonstrate how battery models and battery management systems can be developed in order to provide insights to support decision making during the design process.

    Highlights

    Approaches to modelling batteries at different scales and fidelities appropriate to the task:

    • Developing battery cell models using characterisation experiments and parameter estimation
    • Scaling up battery cells to modules and packs, including thermal effects that are essential for thermal management design

    State-of-the-art techniques for developing battery management system (BMS) algorithms:

    • State of charge and state of health estimation using nonlinear observers

    About the Presenter

    Javier Gazzarri is a principal application engineer at MathWorks in Novi, Michigan, specialising in simulation tools as part of Model Based Design. His work focuses on battery modelling, from cell-level to system-level, parameter estimation for model correlation, battery management system design, thermal management, aging diagnosis, and state-of-charge estimation algorithms. Before joining MathWorks, Javier worked on fuel cell modelling at the National Research Council of Canada in Vancouver, British Columbia. He received a Mechanical Engineering Bachelor’s degree from the University of Buenos Aires (Argentina), a MASc degree (Inverse Problems), and a PhD degree (Solid Oxide Fuel Cells) both from the University of British Columbia (Canada).

    Recorded: 31 Mar 2022

    All right. Well, hello, everybody. Thank you very much for your kind attention and for sharing your time with us. As Luis you said, my name is Javier, been working for The MathWorks for the past just over 10 years at the Novi, Michigan office. And doing almost exclusively what you may have inferred from the title of this presentation. So I study battery systems, in particular, most of the time lithium-ion batteries.

    So I believe that if you are here with us today, I don't need to convince you of the fact that batteries are very important in nowadays lives-- phones, electric vehicles, laptops. Lithium-ion batteries are everywhere. And if you are like me, passionate about battery technology, well, we are not alone. Two years ago, lithium-ion batteries were the subject of a Nobel Prize. So it's really exciting for me to be studying this topic at this point in time.

    So we have a relatively short time today, so I am going to focus on a couple of things of what you can do in order to design systems that are powered by batteries, no matter their size, from an electric vehicle down to a mobile phone or hearing aid. It is quite well known that when you build a battery system, you need to take into consideration many aspects of the battery. One of them is its temperature effect. So one of the things that I will start with is to show you how in Simulink, you can take care of both the electrical and the thermal effects of the battery.

    Secondly, something really, really important in battery technology is state estimation. In particular, state of charge. So something indicative of how much energy remains in my battery, how much longer I'll be able to drive my vehicle or talk on my phone before I need to recharge it. The problem that is something that is not measurable directly, and the state of charge is something that we need to infer based on measurements of something else, typically voltage, current, and temperature. So I'll talk about that a little bit more.

    And last but not least, subject matter that everybody is looking at nowadays, we know that battery cells do not behave the same just when they are manufactured and a few years down the road. So battery degradation is a very, very important subject. And we need to take that aging effects into consideration, that performance degradation when we are designing a BMS.

    So in terms of topics for today, I thought I'd start with introducing the concept of physical modeling Simulink in the context of battery system modeling and simulation in case you haven't seen the libraries that I will use most of the times for subsequent examples. Secondly, I am going to show how to use a characterization experiment and Simulink and optimization to estimate the parameters of the equivalent circuit of the battery so that it behaves like a real life battery.

    And then an example of how to scale that up based on what I will have shown in the physical modeling part. And then hopefully, I'll have time to talk about state estimations. So I'll focus on first, the plan side of the business and then a little bit on the algorithm side of the business.

    So I will try to do most of my presentation using Matlab on Simulink. So that is going to be one of my last slides. So let me start with this Matlab. And I am going to open a blank Simulink model. And in case you haven't had exposure to Simulink lately, when you select that button to create a Simulink model, now what happens is that you have a whole bunch of options for templates to select from. And I am going to select this one here. Instead of a plain, blank Simulink model with nothing in it, I am going to select this generic Simscape template. And Simscape if the name of the library for physical modeling that I am going to use to create and use most of my examples. This I don't need for now.

    And as you can see, when I create a blank Simulink model with that template, I have a few blocks that pre-populate my Simulink canvas. So this is an almost empty Simulink model that I am going to start filling with battery-specific components. So it used to be the case that you needed it to drag and drop a component from the Simulink library here, and that is also a possibility. I could take a battery block from my Simulink library. And now there's shortcuts to do that.

    And it is if you know at least the beginning of the name of the component that you want, you can start typing it on the canvas, and Simulink is going to give options as to what is it that you may want to just select. So that is a single battery cell.

    So we are going to do some parameterization on it. The example in depth is going to be my second example. But for now, let's take a look at what is inside in that battery cell block. So I have a number of tabs that are associated with all of the parameters that the equivalent circuit with which I am modeling this unit cell need in order to behave like a real life battery.

    So for a specific cell of our choice, my next demonstration is going to focus on how to populate all of these parameters in order to ascribe a cell the characteristic of a specific cell for which I have experimental data. But now, I want to show you that you can also select from a list that our development team has created, so in case there is a cell that is close enough to the one that you want, you can select that commercially available cell. And when I update that, the parameters of that cell are going to be modified so that they reflect the physical behavior of that specific cell.

    Let's put a current source, a block connected to that. That is the one that I am going to use to inject or demand a current from the cell. And if you've only had exposure to Simulink before and you haven't seen this kind of components in the past, you'll notice that there's a significant difference between a typical Simulink block like these ones here that are connected with arrows that represent the flow of a signal as opposed to these kind of connections that are non-directional. These are physical connections.

    So as you will see, I am going to create the battery model pretty much as if I were drawing it on a piece of paper. And another thing that is in here is these translators from the Simulink world to the Simscape or the physical world, so that I can, for example, put a typical constant block from Simulink and put that current value in that current source. So according to our convention, if I connect the current source in that way, I need the current to be negative if I want to discharge. So I am going to let's say, discharge this battery cell with a current of 1 amp.

    And at the same time, I may want to measure the voltage connected to my battery cell. Every physical domain in Simscape needs to have a reference, so I am going to extend from here to create a ground. And as it is the case with every model that contains this kind of physical modeling components, I need to attach this software configuration block anywhere to the physical network. So we are almost done with a very, very simple model of a single cell.

    Now another thing that I said before is that we want to consider thermal effects. So as of now, all of the physical components are color coded in blue. If I right click on the block and select Block Choices, I have the ability to include thermal effects as well. And now what you can see is that in addition to the blue components, I have an orange component here that represents the thermal exchange, the heat transfer between that unit cell and the environment. And I can say, well, what happens, for example, if I don't let any heat go out from that cell.

    That is not a good idea, because the battery cell needs to dissipate the heat that's generated because of the current flowing through its internal resistances. But for the sake of this example, let's see how to capture this physical phenomena. Let's say that the battery cell is enclosed in a place that doesn't let the heat go out. And now we're almost ready to start measuring stuff.

    So let's get rid of the name of the block in there. And I'm going to convert from the physical world to the Simulink world all of the signals of that are of interest to me. And convert them to Simulink so that I can view them in this Simulink scope. So I'm going to connect these two. And let's also measure the temperature as well. So now another reference. Here, another converter. And we should be pretty much ready to go. So let's see. Let's attach these to my scope, open my scope, and select how many windows I want. So three windows is probably good. Side by side.

    And if I didn't forget anything, this should be ready to simulate. So one thing that I will do, because batteries, nothing pretty much happens within 10 seconds of starting to discharge the battery. So let's discharge it for one hour and see what happens.

    So that's how we can measure or simulate the SOC, the voltage, and the temperature excursion from this simple simulation. Now, you can see that the temperature excursion is very, very minimal, and the reason for that is that the thermal mass of this cell was not available from the data sheets, so the parameter was not set. So we need to put a more realistic number for this setting here. From the literature, more or less the specific heat of the materials of the cell is around 400 joules per kilogram Kelvin, and this specific cell is about 50 grams, so we can have that kind of thermal mass in joules per Kelvin.

    So if I do the simulation with that, we will hopefully see that the temperature evolution is more realistic. So this is what is happening-- look-- a little over 14 degrees Celsius temperature increase if the vessel is being discharged over one hour at 1 amp. So very quick introduction to physical modeling for battery cell modeling and simulation. So remember, blue is electrical, orange is thermal. We will revisit those concepts later.

    So second topic. Let's say the cell that I have is not in the list that is provided in our library, but I have the data or the possibility to perform some characterization measurements on my battery cell. So how can we calculate these parameters so that the equivalent circuit inside that battery cell block make it representative of the cell that I am interested in.

    So let me close this without saving, I don't care about that. And let's see, open my second example. So I am going to show how to do something that we call parameter estimation. Parameter estimation is a calculation procedure by which using some sort of experimental measurement like this one here, this is an isothermal pulsed discharge, and this is real experimental data. This is a 31 amp hour pouch cell right at 20 Celsius. And it is isothermal, and we will see why that is convenient to do a characterization. But I want you to focus on a typical response to a current pulse.

    When I impose a discharge pulse onto a battery cell, you see typically this kind of behavior. The voltage drops because of the internal resistance of the cell. During the pulse, the voltage keeps dropping. And then when the current disappears, when I go back to the open circuit state, their recovery has typically this shape, a shape that has an instantaneous recovery. And a portion of the recovery that is more or less exponential with time.

    That is the result of the diffusion of phenomena happening inside the cell that have a response in time, again, what happens with the capacitor. And that is why we use RC components in our equivalent circuit. So I think I have a question.

    We have a couple of questions.

    What do you mean with please name the block a thermal effect. So I didn't add a new block. What I did is I reconfigure the battery cell block to contemplate thermal effect. So there is a provision there that allows you to switch the thermal effects on and off. When it is off, the cell behaves as if it were isothermal, just contemplating the electrical phenomena. When I include the thermal effects, the internal resistance and all of the other phenomena inside the cell are also temperature-dependent. Hopefully that is a good answer to that question.

    What is the name of the current source block? It's named exactly that, a current source. Let me actually show you here. It is in Simscape, electrical sources, and it is the controlled current source. So we have fixed current blocks and controlled current blocks. The one that I use is the controlled one, because-- and you will see the reason in this example here-- I can configure it so that it has any type of current profile that I want.

    And the other question says, is it possible to use physical components and control system components in the same Simulink model? Yes, it is. So thanks to these kind of converters from Simscape and Simulink and back, you can combine a plant made out of Simscape components with a controller made entirely out of Simulink components. And the translator between a physical signal that has a physical unit and so on and a mathematical signal, which is the one that Simulink needs, is that little block, the PS-to-Simulink converter and the Simulink-to-PS converter.

    So and the last question is how to extract a cell datasheet, which is not in the template. So that is what I'm doing right now. Not from a data sheet, but from an experiment, but we can also mention the data sheet extraction later.

    And the f of x equals 0 can be connected anywhere. So the question reads, why you didn't connect f of x equals 0 to ground. That f of x equals 0, it doesn't matter where you connect it. As long as it is connected to some part of the physical network, it doesn't really matter. Perfect. So thank you for those questions. I will keep going in here.

    The estimation of parameters that I wanted to do with this example has as an objective to obtain in simulation the same result that I obtained in the measurement when I stimulate my model in the same way I simulated my physical cell. So that means that my battery cell block is going to have the same electrothermal response as my real cell.

    So what I am going to be doing here is I will impose this train of current pulses onto my cell and see what the model does in terms of the voltage response. And I need to do a couple of things in order to set up the estimation procedure. First, I need to propose an equivalent circuit topology. So it is typical that we say, OK, let's start simple. Let's say that my equivalent circuit has a voltage source, an internal resistance, and one RC component. That means that all of those exponential relaxation in voltage will be described by a first order exponential function given by the time constant being R times C in the RC component in the equivalent circuit.

    And then you see that in this dialog box here, I put variables instead of numbers. And that is because those parameters are going to change over time. They are going to be adjusted by optimization functions. But what I need at the beginning is an initial condition. I need a set of initial guesses for those parameters to start.

    So if I push play in the Simulink model before I do anything else, before I do the estimation as a response to this train of pulses, I am going to have a voltage response that like you can see here in orange, that is completely wrong with respect to what it should be, which is the blue curve here, which is the experimentally measured one. So the purpose of this procedure will be to find what parameters the equivalent circuit of that cell needs to have in order to minimize the difference between my simulation and my experimental measurement-- where I am and where I want to be.

    And one way to do that is by using parameter estimation, which I see it as bridge that links Simulink with Matlab's optimization function. In optimization, we call the objective function, the multivariable function that needs to be minimized, is basically the square of the difference between these two signals-- where I am and where I want to be.

    So when I give it a go with the equivalent circuit topology that I proposed first and its initial guesses, Simulink is going to start running the simulation over and over. Every time it runs a simulation, it evaluates where we are with respect to where we want to be.

    And for as long as it takes, as long as I am not close enough to where I want to be, the parameters of the equivalent circuit are slightly perturbed, slightly adjusted. And then the result of that perturbation is evaluated in the next one. And by doing that, by tuning the parameters of the equivalent circuit using the optimizer is how we will approach to the solution.

    Let's see, there's another question Here. One question is, is it possible to put the plus and minus terminals of the battery out of the subsystem, for example, to interconnect two cells in parallel. Yes, it is. The subsystems can have both signal and physical ports. And there's another question that says, let's assume more electrical systems are connected together. How to deal with the ground connection and how many solvers need to be used? OK, good one.

    So if it is one physical network, you only need one ground. There are however, situations where I might want to put different solver configurations. For example, when I am dealing with a physical system that has two very different relaxation times or characteristic times, in which case, it is convenient for computational efficiency reasons, to solve the fastest dynamics with a smaller time step and the slower dynamics with a more coarse time step. In that case, we need to separate the two physical networks and connect them with Simulink components. Hopefully that was--

    Yes, thank you, Javier. There is another question related to solvers.

    OK.

    So you mentioned that we can have a plant in Simscape and the control in Simulink, how do we then handle model solvers? We need to use Simscape's internal solvers?

    Not necessarily. You can, but not necessarily. So there's two options here. Option one is that the global solver in Simulink takes care of everything. The other one is that you configure the Simulink model with the global solver that takes care of the Simulink part, and you use a local solver that I am going to show in a second that only takes care of the Simscape part. That local solver is always going to be a fixed step solver, so you have to have a reason to do that. One very good reason is that a real time simulation is in your horizon. But you have the choice. Simulink you can take care of the entire thing with one solver or it can be separate.

    So in the interest of time, what I am going to do-- this takes about 10 minutes in total. So we don't have 10 minutes to wait. But you can see that the parameter estimation is progressing towards where it should be. So if I let the parameters reach their final values, they are going to be quite closer than they are now. But let me stop the estimation for now, and what I'm going to do is load the final values for the one-time constant case, and I'll point out a little problem that we have in here, which is the following.

    Here, everything is isothermal. So what is changing from left to right as time progresses is the SOC. So the SOC during this rest is higher than this one, and this is higher than this one. So what this is showing is that as a function of SOC, the parameters of the equivalent circuit are indeed changing. And they are changing in such a way that in here, the dynamic response of the cell is almost accurately captured by the one-time constant that I'm using. Not so much in here, and definitely not satisfactory in here.

    What is going on here is that what I see as the voltage response in the experiment is more complex than a single time constant relaxation. And that is why I see this kind of effect, I can reconfigure my Simulink model so that instead of having a one-time constant, it has more than one-- two or three. Typically between two or three, it is good enough.

    So when I do that, what changes in here is the dynamic portion of the off the block. Remember that before, there was just R1 and tau1. Now there's three of them. If I rerun the simulation-- I'm not going to do it, because it takes even longer time-- but I am going to load the final values with this shortcut in here. And if I rerun the simulation, you will hopefully see that now the response is better.

    Not perfect, maybe there's some room for improvement, but definitely, the fit is a lot better than it was before. And the reason for that is that now I am working with a better, with a more suitable, more dynamically rich circuit. I do this isothermally for all of the temperatures that I care about. And then I am going to be building column by column a lookup table that ultimately I will use to populate this battery cell block in here.

    So my next example is going to show-- actually, I have a question that says, show how to build a 2S2P model. The next example is going in that direction. Not 2S2P, a little more complex, but it will serve as an example of that.

    So what I am going to show now is an example of an 8S2P battery module that I, as you will see, configured in terms of its thermal boundary condition in an asymmetrical way-- on purpose. This is something that we want to avoid in practice. But in order to illustrate how to use simulation to detect a thermal effect, what I did-- so basically, the answer to this question is, well this is a 2S2P module. So my model is larger than that, it is 8S2P. But this is how you basically connect battery cells in series in parallel, both electrically and also thermally.

    So my thermal ports, the orange dots in here, you can see that I am connecting cell BS1 to cell BP1 via heat conduction. And same thing for these two. Same thing for these two and so on. So the topology of the real system, the 3D topology is going to dictate what kind of components to use and what their values are. Typically, I would have to combine conduction and convection, because convection only applies when there is heat transfer to a solid. But there might be some pockets of air in between or even active liquid cooling, which is something that I am not going to show today, but it's available as part of the fluids library.

    So what happens Here take a look at these components in here. These are almost like a go-to, but in a physical way. So this terminal, TS1, is repeated in here, which means that thermally speaking, these two cells are connected to the outside by this convective heat transfer block. So these two blocks represent these two blocks in here.

    On the bottom side, the pack is thermally Insulated so these two blocks, TS8 and TP8 are reproduced on this side, and I am using thermal insulation blocks. So the consequence of having done that without having a system for thermal management is that when I cycle this battery module, what happens is because the bottom part cannot get rid of the heat that is generated, and the top part can, there will be a thermal gradient in the vertical direction with the higher temperature at the bottom and the lower temperature at the top. Here are the temperatures as we run the simulation.

    But in addition to that, what will happen-- so these are all the temperatures of all the cells connected in series. Because the degradation mechanisms are also typically thermally activated or many of them, the capacity fade or the mechanisms leading to capacity fade are an example of that, the warmer the cell is, the faster it degrades. So what you're seeing there-- so this is capacity in amp hours. So these are small Sanyo 18650 cells. We start at 1.5 amp hours, and you can see that the rate of degradation-- so the two lines here represent one of these and one of these. So cells 1 or 8.

    Because of the thermal gradient, the rate of degradation is different. So when I cycle a battery pack that is configured or designed in this way, if I don't take care of those thermal gradients, I will have the problem of divergent degradation. Which is a bad thing, because you never want to combine cells that have different capacities in series, because the balancer is going to have to work very, very hard.

    Here's a very good question. The RC values used for the parameters you mentioned are derived from one C plot. Do you see further need of determining RC values for higher discharge rates like to 2C or 5C? Very, very good point.

    In many cases, people neglect the C rate effect, but I've seen cases in which that actually plays a role. Be careful, because the higher the C rate that you use to do the characterization, the more difficult it is experimentally to ensure that the vessel is isothermal. Because the higher the current, the more temperature buildup.

    So if the temperature control of your chamber is good enough, then by all means, that's fine. You can combine different C rates. Make sure that you measure the temperature of the cell, and don't assume that the temperature of the cell is the point of the chamber temperature.

    Will this model be available in examples to play after this session? Yes, excellent question. Everything that I am showing will be made available. I don't know what your plan is, but typically, what we do is in about five business days, we follow up with all the attendees with links and all the examples. These are all available, and I can share everything with you.

    Yeah.

    That's right?

    Yeah, that's right.

    Perfect. So I don't have time to talk much more about how I configured this model to contemplate degradation, but the only thing that I am going to mention is that the battery cell block has two provisions for degradation. One that is associated with aging due to cycling, the other that is calendar 80. So it is considered here. It is also in general, quite a difficult experiments to perform. So these are the lookup tables that I created for this. These are synthetic. I didn't have access to aging data for this cell.

    I just configured the model in such a way that the capacity faded over a cycle count and as a function of temperature as well. So this is qualitatively what you need. But by all means, please contact us if you have any more questions about this. We'd love to have a deeper discussion about this. I just don't have time to do that today. Perfect.

    So topic number 3-- let me see how far I am from where I want to be. So let's talk about state estimation. Oh, I think I closed more than I should have. One thing that we want to do is to estimate the internal states of the cell, in particular, the state of charge.

    The state of charge. No, sorry-- I wanted to show actually this. The state of charge is by definition the integral of the current divided by the total capacity. However, if I try to do this in a real application because my current sensor is not perfect, I am going to have a drift in the SOC estimation that will render the calculation pretty much useless after a few tenths of cycles.

    So what we typically do is we perform this state estimation using something a little more sophisticated than just an integrator. And the state-of-the-art way of doing that is with a Kalman filter, which I am not going to also go into details about this. But a Kalman filter is a technique in control design by which I have a model of the plant as part of my controller. And by measuring the inputs and outputs to and from my plant and performing a recurrent estimation and correction using those two, the algorithm resets itself every step. And in that case, by trying to make the estimated output equal to the measured output, I can estimate the internal states of the system.

    The good thing about this and pretty much the reason why I could do this easily without being a controls expert myself is because those algorithms, the Kalman filter in particular-- these are non-linear Kalman filters-- are part of our control system library. So if you take a look at control system toolbox in here, state estimation, these two are the nonlinear Kalman filters that I am using now. This is for linear systems, and this is an even more sophisticated one that you can use.

    But the good thing about this is that this is a shipping block that contains the parameters needed for you to fill in the characteristics of the cell and perform any type of state estimation. So what I need is basically two things. The Kalman filter block, and here, I am making two of them working parallel. In general, you won't do this, you will just pick one of them, the extended or the unscented Kalman filter.

    But they are going to be talking to a state transition function that contains all of the dynamics that I gathered from my characterization procedure that I showed in the parameter estimation section, which includes in this case, a version of the equivalent circuit in Matlab in here. So I'm using a 3RC equivalent circuit, that's why I have three states corresponding to the third order system plus the state that actually I am hearing about now, which is the state of charge.

    And the second part is the measurement function. So the estimation function is going to perform the estimation. The measurement function is going to perform the correction. This is all analogous to state space representation. So the former was x dot equals Ax plus BU, but it's a nonlinear version, so f of x and nu. And this one here, the measurement function, is y equals Cx plus Du. In this specific case, what we are taking as the output is the terminal voltage.

    So the output function-- so x is the state vector. State vector has four components, SOC and the three voltage drops across the RC components of the equivalent circuit. And I can say that the terminal voltage is equal to the open circuit voltage minus IR or IR0, which is the ohmic drop in the separator. So current times that internal resistance minus the voltage drops across the R1C1, R2C2, R3C3. Again, I am reusing the lookup tables that I gathered from my characterization procedure that I showed in example number 2. So that's important to take into consideration.

    So what does my plant look like in here. So I have a unit cell. So I'm using a very, very simple plant. Parameterized, in this case, in a full non-isothermal way, with the experimental characterization that I showed in the second example, with three RCs. And at this point, not considering any aging.

    And what am I measuring. Well, I'm measuring what I always measure in battery systems-- voltage, current, and temperature. And I am also contaminating those measurements with noise as well. So I am going to push play and show you how I cycle this. But one thing that I also want to mention is that even though I set the plant model in such a way that the initial state of charge of the unit cell was 50%, I initialized the initial SOC estimation of the two common filters as being 60%.

    So on purpose, I added a 10% discrepancy from the very beginning. And the reason for that is that I wanted to know the Kalman filter, how able it was to recover from a 10% SOC error. So what you're seeing on the screen is SOC as a function of time, this is times 10 to the 4. So this is a relatively long time, 20,000 seconds.

    The two Kalman filter estimations start at 60%. This is what I did in here, I started at 60% SOC. So this 0.6 is this 0.6 in here, while the real SOC was 50%. And we can see that here, this is almost like 0.3 something. So 0.3 something times 10 to the 4 is about one hour. So it takes about an hour of simulated time to converge to the real values.

    And here is one version of the Kalman filter called extended Kalman filter. Here's another version called unscented Kalman filter. They are both examples of nonlinear Kalman filters. Each of them has its pros and cons. The unscented Kalman filter is computationally more expensive. It is also more suitable for highly nonlinear systems. This one here is not so highly nonlinear. The only nonlinearity is the relationship between the OCV and the SOC, which is a mild one. So it is to be expected that the extended Kalman filter works pretty well.

    And the last thing that I wanted to mention about this is that because this is a shipping block, it generates code. So once I am happy with the parameterization of my Kalman feature, which, by the way, I didn't mention how I did it, but it's something that is in general not trivial at all. But once I like the way it works in simulation, I can generate C code from that subsystem and use it for embedded applications. So that's another good thing, in addition to not having to worry about the mathematics of the Kalman filter, another good thing about having it in the library.

    Oh, there's a number of questions. Can the Simscape statistical models be built on C code to use in real time? Yes, they can. So all of the components in Simscape can generate C for HIL applications. As a matter of fact, as future potential topics for future meetings, I suggested real time simulation. So you can definitely generate code from Simscape and do HIL.

    And yeah, the person asking the question, is mentioned in this space of Speedgoat. So both of them are available. And the other question is, I'm using Matlab Simulink 2019, but I don't see the battery model in the Simscape library. Is it only supported in the 2021 version? No, it should be there in 2019. What is probably different is the level of detail, but I think it's been around for at least five or six years. So please take a look at some Simscape Electrical and Sources, and it is called Battery Table-Based.

    Another question, is it possible to see the code implemented behind Simscape models like a mask, or do they act as blackbox models? Good question, as well. So let me show you the answer to that. So the answer is yes and no.

    So simple components, the ones that belong in the foundation library, have their code. Exposed let's say the convective heat transfer component, if I go to source code, I can see all its details and the definition of all the physics. And by the way, that allows you to modify it and recompile it to create your own custom component.

    So you can do that as long as the component belongs in the foundation library. However, the libraries that are the vertical libraries, the more detailed libraries, we don't expose the source code for IP reasons. So you can see that there's no link to the source code in here.

    What are you using as your system feedback in the state estimation filter. So all of that is taken care of internally by the Kalman filter and the two Simulink functions that are the state transition functions and the measurement functions. I don't need to worry about the internal mathematics inherent to the system. Another good thing about this-- the mathematics is taken care of automatically.

    So I think we're almost out of time, so let me actually go to the summary slide, and maybe entertain the last couple of questions. So whilst Stefani is typing up the last questions, I am going to summarize. So what did we see today. I presented a library that works on top of Simulink for modeling physical systems in a network-- physical-network-based. Some people call this acausal modeling, because there's no cost effect that is explicitly represented in the system. And that allows us to scale up the model like you saw. I showed a single cell, and then the connection of single cells to the 8S2P battery pack.

    Secondly, what happens if I want to parameterize the battery cell block using information that I gathered from an experimental procedure, characterization experiment. Pulses charged, HPPC, a drive cycle, whatever it may be. We used a combination of Simulink and Matlab optimization functions in order to perform parameter estimation, back-calculating the values of the equivalent circuit parameters so that the simulated response matched the measured response.

    In the third place, we scaled up from a single cell to a battery module. Of course, this can be done with a battery pack as well. And at the last example-- and my apologies for having run through it too quickly-- was about state estimation.

    So what else could we talk about in the future. Well, we have lots of examples about the algorithmic part of the BMS development. So how to develop algorithms for power limitation, state logic, logic self-balancing, fault, and so on. So if you're interested in that, please contact us. We will have a follow up discussion on that. As an alternative to the Kalman filter for the state estimation, there's many teams around the world considering using neural nets for state estimation, both state of charge and state of health.

    Last week, I recorded the second webinar about this subject matter, and the recording is going to be available hopefully by the end of next week or maybe the next. But basically, we showed how to use AI workflows, in particular, how to train a neural network to perform SOC estimation. And I am simultaneously working on a state of health estimation using AI workflows as well. So if you're interested in that, please let me know.

    Hardware deployment. We can generate code, embed the algorithms in hardware. And as I said before, real-time simulation is also something that we can talk about. It is 10 o'clock in Eastern USA. On behalf of The MathWorks, thank you so much for sharing your time with us. That is how you can contact me. Please write me an email, if you have any question, follow-up, or suggestion. And with that, Luigi, would you like to say goodbye words?

    Yes, sure. First of all, thank you, Javier. Very insightful presentation and demonstration.

    View more related videos