Battery Modeling - MATLAB & Simulink
Video Player is loading.
Current Time 0:00
Duration 22:16
Loaded: 0.17%
Stream Type LIVE
Remaining Time 22:16
 
1x
  • Chapters
  • descriptions off, selected
  • captions off, selected
      Video length is 22:16

      Battery Modeling

      From the series: Hybrid Electric Vehicles

      Learn about the latest tools for battery system modeling and simulation. Start with creating a single battery cell model using the new Battery Equivalent Circuit block, build a battery pack that includes thermal management, and see a new and efficient method for battery parameter estimation that finds equivalent circuit lookup tables using multiple characterization experiments simultaneously.

      Published: 4 Jun 2024

      Why is it that the range of an electric vehicle is shorter in the winter than it is in the summer? Why is the runtime of my three-year-old cell phone shorter than it was when it was new? And why is its battery runtime indicator less and less accurate as the device gets older?

      These questions relate to the behavior of one of the most important pieces of technology in modern life, a device that is present everywhere we look, one without which our lives would be very different from what they are, since it has enabled the portability of communication and personal computing and is now at the center of electric vehicles, EV tools, and smart grid development, the battery. My name is Javier. And I am an application engineer at MathWorks.

      Rechargeable batteries are everywhere. And lithium ion batteries are preferred in most electric and hybrid vehicles and consumer electronics because of their high specific energy, good cycle life, and very low self-discharge. However, with all these advantages comes the need for careful battery management to ensure good performance, safe operation, and acceptable durability. For example, temperature and voltage should remain within acceptable limits to avoid premature degradation, as should power delivery and acceptance.

      Typical questions relevant to a battery engineer are what do I have to consider when designing a battery system, how do I select the best battery chemistry for my application, how do I use modeling to help me design my battery and BMS, how do I make sure that my battery model behaves like the real battery, how much heat will it reject, what is the most efficient way to cool it down.

      Today, we will discuss workflows to help a battery engineer address these questions. And you will learn how modeling and simulation can help with the design of a battery system. First, we will create a model of a single battery cell and assign the characteristics of a commercially available battery with parameters from a library.

      Secondly, we will scale it up to a module in a pack that includes thermal effects. And finally, we will learn a new technique to estimate the parameters of a battery by fitting a model to a characterization experiment called model-based calibration.

      Let's start with the basics. The battery pack is comprised of individual cells of a certain type and from a given cell supplier with a unique electrothermal response, which depends on its materials and electrochemistry. These physical fingerprints are incorporated into the cell block as parameters of its equivalent circuits. Sometimes, we refer to this as ECM, equivalent circuit model.

      Maybe you're already familiar with this concept. It is an electrothermal analog to the battery cell that has a similar response of the cell in terms of current, voltage, and temperature, using an electrical circuit that is much simpler than an electrochemical model. It typically has a voltage source to represent open circuit voltage, typically referred to as OCV, and a collection of resistors and capacitors in series and parallel to represent ohmic, diffusional, and other losses.

      The topology of the equivalent circuit and its parameters are the fingerprints of a cell chemistry and form factor. This is why it is so important to find the right ECM to have a model that represents the behavior of our cell of choice within the operating range of interest. There are several ways of doing this. And our method of choice should depend on the level of accuracy and fidelity we need.

      Pack level simulation for thermal management design, for example, may only require low level of fidelity, whereas the development of state estimation algorithms will demand a more detailed representation. For the former, the information provided in battery specification data sheets may be sufficient. For the latter, we will need to fit a model to a dedicated characterization experiment. We will talk about this later.

      For now, let's create a simple single cylindrical cell model and simulate a 1 hour discharge to see how voltage, state of charge, or SOC, and temperature evolve during the process. The battery block base on lookup tables is a good start. Let's go inside and select a part number, for example this Panasonic 18650 cell.

      This controlled current source will discharge the cell at the specific rate, while the voltmeter will monitor the voltage. The remaining port is thermal and represents the heat exchange between the cell and its surroundings. In this simple model, we will not do any active thermal management, so we will connect the thermal port to the atmosphere model here as an ideal temperature source with a heat convection block.

      Now, we connect a temperature sensor to the battery thermal port and a thermal reference. The last thing we'll measure is SOC, which we can read using a probe. We finally add the signals coming out of the two new sensors and connect them to the Simulink scope.

      We should now be ready to simulate. Let's specify a simulation time of 1 hour and see what happens. As expected, 1 hour of discharge at a rate of 1C brings the SOC down to close to 0. At the same time, we see a temperature increase of about 30 Kelvin. If you're not happy with these results, we can quickly try a different cell and see the difference.

      Only in most unusual situations do we need only one cell. Typically, we connect cells in series and parallel in an assembly called a module. And the connection of modules make up a pack. Connecting cells in parallel builds up capacity. And connecting cells in series builds up voltage. The specifics of the application will help us determine the series and parallel counts.

      Say, for example, that we want to power a cordless handheld power tool. For an 18-volt system, we will need 5 cells in series if the nominal voltage of the battery cell is 3.6 volts. At the same time, there will be an electric current demand that depends on the task that the power tool needs to perform. This, in turn, will determine the rate at which the battery will drain. And we need to design the battery so that it provides a reasonable runtime by connecting cells in parallel as needed.

      Let's build a battery with the Battery Builder using the cell from the first example. The procedure is as follows. First, we create a new single cell with a parameterization from before. We make sure to enable Thermal Options, so we can keep track of the temperature evolution during the simulation. Secondly, we build a parallel assembly. Let's start with a 2P configuration, two cells in parallel.

      From this point, we can also specify the level of fidelity with which we model. And we need to find a balance between detail and simulation performance. A Lumped option will combine the individual cells into a single block whose parameters will be scaled to represent the multi-cell assembly.

      This is the coarsest option, but the one that will simulate the fastest. The Detailed option assigns a block to each individual cell we model, so we can monitor the evolution of each and every cell, allowing us to track inter-cell temperature differences and possible charge imbalances.

      Also, at this stage, we pick up layout geometry. In the case of cylindrical cells, we can arrange them in a rectangular or honeycomb grid. Then we build up voltage doing the series connection. We pick the parallel assembly from the previous step, specify the series count, and leave the stacking axis choice in the default value. We can also choose to include inter-cell heat transfer and the mode of thermal exchange between the module and the outside. In this case, we do not need to include a cooling plate because this battery pack is not liquid cooled.

      Once the module geometrical, electrical, and thermal characteristics have been defined, we need to package it up as a block, so we can use it in a model. The result of this step is a library block similar to the one from the previous example, but with the characteristics of a small pack.

      We can now use this block in simulation and find out if the runtime is adequate for a typical use cycle. Let's load the fully charged pack with a power of 300 watts and see for how long I can use my power tool and how warm the battery becomes during the process. A constant power discharge can be implemented, calculating the current as power divided by voltage. The blocks on the right stop the simulation if the temperature exceeds 330 Kelvin or if the terminal voltage per cell drops below 2.75 volts.

      Looks like we can get 15 minutes of usage out of this battery. And at the end, the temperature rose 9 degrees. If these values are acceptable, we can go ahead with this design. Otherwise, we may want to consider a different cell-- for example, one with a lower internal resistance or a different P count.

      All right, we'll now switch gears and talk about one last thing, cell characterization. Sometimes, the information we get from spec sheets is not enough. Sometimes, we need a deeper, more accurate description of the cell behavior. For example, we may want to use this to parameterize and tune a state observer, such as a Kalman filter, which needs information about the dynamic response of the battery.

      To this end, it is common practice to perform several carefully designed experiments on the battery and fit an equivalent circuit model to it. This results in a set of equivalent circuit parameters that describe the battery behavior within the operating conditions range under which the experiments were conducted.

      The experiments are typically done under controlled temperature. And they are repeated at several temperatures over a range that is relevant to the application. In automotive, for instance, we typically do this from negative 10 degrees to 50 Celsius. Because the battery ECM parameters are in general dependent on SOC and temperature, they are effectively lookup tables instead of scalars.

      The process by which we use experimental measurements to calculate the parameters of a model is called parameter estimation, model correlation, or calibration. It is an example of what mathematicians call an inverse problem. We know the end-- that is, the measurement that we want to reproduce in simulation-- and we need to calculate what model and with what parameters to do it.

      To understand the idea, let's think about what happens to a battery when we partially discharge it. Its voltage is sitting at some value. And as soon as current starts flowing through it, it drops due to its internal resistance and its OCV. When I let go of the current, the voltage recovers in a way that has some characteristic features.

      First, it does it instantaneously, and then more or less exponentially until reaching the new OCV corresponding to the new SOC. The instantaneous part is due to ohmic losses and the time-dependent part to diffusional and other losses. This is why it makes sense to model the battery using an equivalent circuit with a voltage source, a series resistor, and a set of RC pairs.

      The first one takes care of the voltage at open circuit. The second one models the ohmic drop. And one more, RC pairs, have a response that can be written as a sum of exponentials, each of them with a time constant given by R times C. So the goal is to fit the response of the equivalent circuit to the measured voltage. We can do this in several ways.

      The first way would be separating each pulse and finding the equivalent circuit parameters by fitting the voltage with the exponential function that describes the response of an RC pair to a step current. It looks something like this, if the relaxation starts from a fully polarized state.

      And it gets a little more complicated for partial initial polarization-- for example, when a current pulse is short compared to the battery characteristic time constant. Automating this process so that it is applicable to any experiment requires some Matlab coding to identify the beginning and end of each pulse and process them individually.

      A second way would be to simulate the experiment with an initial guess of the parameters, compare the simulation results against the experimental measurements, and modify the parameter values to improve the fit. This is a very general method that does not require any assumptions.

      But it needs many simulations for convergence because it is based on a nonlinear optimization scheme working on a large number of parameters. This is especially important for long experiments that take a long time to simulate. It also needs to be repeated for every temperature of interest. All of the above means that the entire procedure takes a few hours to complete.

      A recently developed alternative is to use model-based calibration. This method was originally meant to build lookup tables for internal combustion engine controls. However, its calculation procedure is perfectly suitable for any parameter estimation workflow where the parameters are lookup tables. Battery characterization is a good example. All the elements of the battery equivalent circuit are a function of at least temperature and SOC.

      What makes this tool especially efficient is the fact that the parameter estimation does not rely on a simulation of the experiment for the construction of the objective function in the optimization. Although the optimization is performed using nonlinear least squares, the method exploits the relative simplicity of the mathematical representation of the response of the equivalent circuit by calculating the objective function gradients analytically.

      Additionally, it uses Matlab's, vectorization and parallel computing. As a result, the tool calculates the lookup tables utilizing all the experiments simultaneously, reducing the time to completion from hours to minutes. Let's see how to do this with an example.

      These files contain the experimental data corresponding to five isothermal HPPC tests. HPPC stands for hybrid pulse power characterization and is a traditional test for battery fingerprinting. It imposes discharge and charge short pulses throughout the full SOC range with the goal of exposing the battery dynamics response over a range of temperatures. Pulses are very suitable for this because they allow the battery to show its ohmic and diffusional losses directly as the current disappears.

      The steps are as follows. Number 1, we select Feature Filling as the method to use. Feature Filling is another way of saying parameter estimation. Step number 2, select the Simulink model that contains the block whose equivalent circuit we want to use. In this step, we specify the ECM topology, namely the number of time constants and the lookup table dimensionality. This is battery-specific. And its choice typically requires some trial and error, especially for new battery chemistries.

      Then we point at the location of the experimental data. These files have time, voltage, current, and temperature and can be MAT files or spreadsheets. In the next step, we can specify parameter variability bounds. Since this is mathematically an inverse problem, setting reasonable parameter bounds is useful to mitigate non-uniqueness in the results and to make sure that we're not allowing the optimizer to waste time trying parameter values that are unphysical.

      Our a priori knowledge of the system is useful here. For example, in the choice of internal resistance ranges, a best practice when the ECM has more than one time constant is to separate the values of the time constants logarithmically. With that, we are all set to start the estimation process.

      While it runs, we can keep track of the shape of the lookup tables as they are being calibrated from their initial values. For an ECM with three time constants, we have eight lookup tables-- OCV, R0, and three RC pairs. As we can see, it only takes a few iterations over a couple of minutes to reach a point of acceptable accuracy.

      When we're satisfied with the error and parameter variability, we can accept the results. And the calibrated lookup tables will be updated in the Simulink block, which is now ready for us to use it as the unit cell in the design of a battery pack.

      To wrap up, let's go over the concepts we covered today. First, we created a single battery cell model that we discharged at a constant current and observed its voltage and temperature response. Then we scaled up this single cell to a small pack, selecting the parallel and series count and geometrical layout and turned the design into a block that we could use in simulation.

      Finally, we analyzed a set of five isothermal experiments to calculate the lookup tables to be used as parameters of a battery equivalent circuit. With this, I'd like to thank you again for sharing your time with us and for your interest in our solutions. I am Javier Gazzari. Until next time.

      Up Next:

      View full series (8 Videos)

      View more related videos