In the previous lesson you learned equations that describe a physics-based model of a lithium ion batteries cell. This model uses coupled partial differential equations. Evaluating these equations in a battery management system in real-time would require far too much computation, than is reasonable. So, we're going to need to find ways to approximate these equations and we will look at methods to do so in the next lesson. But before we do that, we can still understand some important cell level variables quite easily from these equations as they already exist and that is our focus in this lesson. So, in this lesson we will review the ideas of open circuit potential and you will learn how to compute cell total capacity and state of charge and approximate cell voltage using the model that we have developed so far. Let's begin with open-circuit voltage. Remember that open-circuit voltage is this steady-state terminal voltage of a battery cell when the cell is allowed to rest. The steady-state condition means that both the electrodes surface concentration and the electrolyte concentrations of lithium are uniform throughout the electrodes and throughout the cell. Remember that open-circuit voltage can be related to the open-circuit potentials of the individual electrodes where we compute the overall open-circuit voltage of the cell as the open circuit potential of the positive electrode minus the open circuit potential of the negative electrode and to have a high-voltage cell for high-energy density we require a positive electrode material that has a high potential and a negative electrode material that has low potentials versus a reference of lithium metal. You've seen the figures on the slide before in the first course I believe where you learn some fundamentals of battery cell behaviors. But that was a long time ago so I repeat them here to refresh your memory. The left-hand figure shows the open circuit potential as a function of stoichiometry for some common negative electrode materials. Remember this stoichiometry is a unit less value where I take the present concentration of lithium and I divide it by the maximum concentration and get a value between zero and one. That's what the stoichiometry is. The right-hand figure shows open-circuit potentials as a function of stoichiometry for some common positive electrode materials. So, again stoichiometry is the concentration of lithium in the solid divided by the maximum theoretically possible concentration. So, the horizontal axes are normalized concentration if you will of lithium and the electrode and maybe that can help you begin to make a connection between what you saw in the previous lessons about the physics models that you've learned so far and the open circuit voltage of a cell at least. So, these figures remind us that these potentials are functions of lithium concentrations and as the cell is charged and discharged the concentrations of lithium inside the electrodes are going to change. So, the resting voltage of this cell will change because of that. That's why open-circuit voltage is a function of the state of charge of this cell. Now let's consider how cell total capacity is related to some fundamental electro-chemical and physical quantities. In some extreme case, the cell might be able to utilize its electrode from a completely empty capacity to a completely full capacity. But you've already learned that practical lithium-ion battery cells do not use the entire possible range of stoichiometry. Instead we use only from x0% to x100% in the negative electrode and from y0% to why y100% in the positive electrode. If we were to try to use concentrations outside of those ranges, we generally cause very rapid deterioration of the materials due to structural collapse or different kinds of side reactions. So, the stoichiometry ranges are chosen already to help us to avoid aging in some ways. So, if we know the range of stoichiometry used in each electrode, we can multiply that range by the maximum possible concentration of lithium in the electrodes and that gives us an overall change in lithium concentration between a fully charged state and a fully discharged state in units of moles per meter cubed. If we multiply that quantity by Faraday's constant and divide by 3600 then we can convert the moles per meter cubed into amp hours or ampere hours per meter cubed. So, that is getting pretty close to a definition of total capacity and ampere hours. But remember that the negative electrode has solid electrode materials in it. But it also has electrolyte in it. So, the electrode does not comprise the entirety of the volume of the negative electrode. So, the volume occupied by the negative electrode is just the current collector area A multiplied by L which is the the width of the electrode. But A times L also must be multiplied by epsilon e which is the ratio of how much volume is used by the solid electrode materials versus the electrolyte materials. So, overall we have A times L times epsilon S is the volume of the solid electrode materials in meters cubed and then Cs max times x100 minus x0 is the number of moles per meter cube and then we multiply by Faraday and divided by 3600 to get all of that in amp hours per meter cube. Multiplying everything together the final units are in ampere hours. We can perform exactly the same calculation for the negative electrode and the positive electrode of course using the respectively different parameter values and we get the total capacity of a battery cell from primitive physical and electro-chemical quantities. Now, the capacity of the negative and the positive electrode fundamentally have to be equal to each other because when I move charge from out of the negative I have to put it into the positive and vice versa. So, when one electron goes down, the other electrode goes up in terms of its state of charge and that requires that I have identical total capacities. The way that we match the total capacities is by matching the range of the stoichiometries and the electrodes so that the amp hour capacities are the same. Now, in the second course of this specialization, and I think also in the fourth course of this specialization, I made a claim that the total capacity of a battery cell is not a function of temperature and it's not a function of rate. Even though the discharge capacity of the battery cell is a strong function of temperature and rate. Now you can see physical justification for this claim. All of the values of these two equations are strictly constant, they change only due to aging effects and not due to any short-term time-varying effects. So, the total capacity of a battery cell is something that is not a function of temperature or of rate and these equations can help justify that. So, now you can compute open-circuit voltage of a cell if you know the open circuit potential relationships and the stoichiometries of the present operating point. You can also compute total capacity of a cell based on some primitive parameters of that cell. But, how do we compute state of charge? Now the state of charge at the cell level can be related either to the total amount of lithium in the negative electrode or the total amount of lithium in the positive electrode. All of that is spread around spatially inside of the electrodes. We can also take the total amount of lithium and either one of those electrodes and divide by the volume of the solid material in that electrode to get kind of an average concentration if you will of that electrode. That would give us a different way of thinking about state of charge but it's equivalent. Now, when a cell is fully charged, the average concentration in the negative electrode divided by the maximum possible concentration is equal to x100%. That is; when the cell is fully charged the stoichiometry of the negative electrode is x100%. Now, at the same time the ratio of the average concentration to maximum concentration in the positive electrode is equal to y100% or the stoichiometry of the positive electrode when the cell is at 100% state of charge is y100%. Similarly, when the cell is fully discharged the ratio in the negative electrode is equal to x0% and the ratio on the positive electrode is equal to y0%. These are the limiting values of average concentrations based on the cell level state of charge and the concentrations actually change linearly as the cell state of charge changes unless the resting average state of concentrations do. So, its possible to compute cell state of charge using either the stoichiometry of the negative electrode or the stoichiometry of the positive electrode using the equations that I share with you here which are really just scaled linear relationships relating the average concentration to some limiting values. So, we can now compute some important cell level quantities using physical parameter values, but what about voltage? How do I compute voltage? Well, unfortunately to compute voltage accurately using the physics-based model, we need to simulate the entire coupled set of partial differential equations. That is a lot of computation and it's a difficult subject to teach and to actually implement. But what if we want to approximate the voltage in a much simpler way? If we're content for a little imperfect nature of our voltage but at least to get an idea of how the processes are working inside of the lithium ion battery cell. So, it turns out that if we look at the time constants of the different diffusion mechanisms in the lithium cell, the time constant of diffusion in the solid is the slowest process and that if I change the amount of current that a battery cell experiences, all of the equations have some kind of a transient change to them. But the one that really dominates over a long period of time is diffusion in the solid. So, if we can approximate the diffusion in the solid in a very simple way, then we should be able to approximate the overall behavior of a battery cell by simply ignoring all of the other equations and focusing only on the equation that describes diffusion in the solid electrode particle. Suppose we can also ignore the one-dimensional or even three-dimensional nature of an electrode and make an average value over the entire electrode, make a zero-dimensional model, that's what we're going to do. We're going to approximate the behaviors of the negative electrode using a single spherical particle from the negative electrode as a representative. So, that particle represents on average what's happening to all of the particles in the electrode, but we simulate only one particle. We do the same for the positive electrode. We select one particle to represent the positive electrode and simulate that particle, and that represents everything that's happening there. We completely ignore the electrolyte lithium concentration and the potential dynamics. So, this kind of a physics-based model, the simplified approximate physics-based model is called a single-particle model because it uses a single particle of the electrode material to describe what's happening in each of the electrodes. Even though this is quite a crude approximation to what is really happening, I think that the model is a really great learning tool for helping you to understand how lithium ion cells respond to different input stimuli and it can also be used inside of some state of charge estimation methods to give good state of charge estimates. We can boil this method down a little bit farther than I do in this lesson and use it inside of a Kalman filter for example, to get good state of charge estimates. So, for the rest of this lesson, my plan is to share with you a way to simulate one particle and one electrode of the single-particle model. You've already learned how to simulate linear diffusion using a finite-difference method in a previous lesson this week. In this lesson, I will share with you how to simulate spherically symmetric diffusion using a finite-volume method instead. We are going to simulate the change of lithium concentration throughout the interior of this spherical electrode particle. To model the different concentrations at different points in the particle, we are going to model the particle by dividing it up into equal thickness spherical shells. We're making our particle look like an onion. So, I have an inner core and then an outer ring, another ring, another ring, another ring. Each one of these rings has the identical thickness, but of course as the radius grows, the volume of each one of these shells is going to be increasing. So, inside of the simulation, every time step, we're going to calculate lithium movement from one shell to another shell, and then we're going to update the concentrations inside of each one of these shells based on that computation of lithium movement. The electrical current applied to the terminals of the overall battery cell will cause us to update the amount of lithium in the outermost shell of the particle. Externally applied current is either forcing lithium into the particle or forcing lithium out at the surface. So, we're going to develop a method and some octave code to do this simulation. In this model, I will denote the number of shells as N_r and the thickness of any one of these shells is going to be called dR, and that thickness is equal to the total radius of the particle divided by the number of shells. We will need to know the outer surface area and the volume of each one of these shells. The smallest shell at the very center of the particle has a volume of four-thirds pi times dR cubed, and it has a surface area of 4 pi dR squared. The next shell, the second shell, has the volume equal to four-thirds pi R cubed for a radius of 2dR because that's its outermost radius. But then I have to subtract the volume occupied by the the shell inside of it, so I subtract the volume of four-thirds pi times dR cubed. The surface area of this second shell is just going to be 4 times pi R squared for the outer radius. We can generalize this result to the nth shell, and so the nth shell has a volume of four-thirds pi R cubed for the nth radius minus the four-thirds pi R cubed for the n minus first radius. It has an outer surface area equal to 4 pi R squared of the total radius up to the exterior of that shell. In the code that I will share with you shortly, there is a Vector dV that contains the volume of each one of these shells, so dV_1 is the center core volume and the final value of dV is the volume of the outermost shell. Sa is the outer surface area of each one of these shells. In the model, lithium moves from one point in the particle to another point by diffusion and so for us, we're thinking about lithium moving from one shell to an adjacent shell by diffusion mechanism. So, if we look at the diffusion equation that I shared with you in a previous lesson, we can find that the flux or the rate of movement of lithium from one shell to another across a boundary, can be computed as the negative diffusivity constant multiplying the gradient of lithium concentration at that location. So, we can approximate the flux as equal to the negative diffusivity constant multiplying the difference in concentration between two adjacent shells, divided by the difference in radii between those locations. Specifically, the flux at the boundary between shell n and shell n plus 1, is computed as the negative diffusivity constant multiplying the concentration in shell n plus 1 minus the concentration in shell n, all divided by the distance between those two shells. When this variable is negative, that means that lithium enters the nth shell from the n plus first shell and when it is positive, it means that flux leaves the nth shell and travels to the nth plus first shell. So, positive flux lithium is going outward towards the surface of the particle and negative flux lithium is moving toward the center of the particle. In the code that I will share with you, the vector N computes this flux at all shell boundaries, except for the outermost boundary, the surface boundary and we'll treat that separately. In the code, the rate of material transfer is computed equal to the flux N, which has units of moles per meter squared per second, multiplied by the surface area in meters squared through which the flux is moving to give a total material movement in moles per second, and the material movement is stored in the vector M in the code. The net amount of material movement into the nth shell then is how much material is moving across its outer boundary and how much material is moving across its inner boundary and those two added together more subtracted, I guess depending on how you're thinking about it. The change in concentration then is multiplying this material movement by the change in time and dividing by the volume. So, all of that defines diffusion happening inside this cell, from one shell to another shell in the interior of the particle rather. But so far, we have not described how the external current applied by the load or by a charger to the battery cell is going to force lithium into or out of the outermost surface of the particle. So, the particle surface, we must arrive in overall flux j in moles per meters squared per second. Once we know this j, we multiply its value by the surface area of the particle and we multiply it by Delta t and divide by the outer shell volume to give a change in the outer shell concentration due to that flux, and that's how we're going to handle that. But how do we compute the individual particle flux given the total electrical current applied to the overall batteries cell? To begin with, we need to know how much surface area there is of all particles inside of the electrode because we're computing what is the representative flux into this particle, we're not putting all of the battery flux into one particle because it would not be able to take it. So, what is the representative amount of flux going into an average into a particle? So, to find this, we need to figure out how much surface area there is for all particles per unit volume of the electrode. This can be computed to be equal to the total surface area's spheres in a given volume divided by the total volume of a sphere. The surface area of one sphere is equal to four pi R squared and we multiply that by the volume fraction of electrode material and the volume, and we divide by the total volume of a sphere, which is four-thirds pi R cubed. Overall, we have the result that the specific surface area which we call a sub s. The specific surface area of the electrode is three times Epsilon s divided by the radius of a sphere, and the units are in meters squared per meters cubed. That is how much surface area is there in the electrode per unit volume of the electrode. Now we can cancel and we could write this as one divided by meter, but I prefer the way that I've written it here because it's more descriptive. It reminds us that this is talking about the number of meters squared of surface area divided by meters cubed of volume. So, now we're ready to convert the cell current and ampere's to flux and moles per meter squared per second using the total surface area of the electrode. This value of flux is the average flux experienced in the negative electrode and is the exact flux used by the approximate single-particle method that I'll share with you in code. So, we're now nearly ready to convert all of this background information into code, just a few more details. Remember the state of charge depends on average concentration of lithium in the electrode, but voltage depends on the surface concentration of lithium in the particle. The code that I share with you, this is called CSE. When simulating a full lithium ion cell using a single particle method, we actually must simulate two particles; one represents the negative electrode and the second represents the positive electrode. These two different electrodes have possibly two different diffusion constants, and different electrode particle radius values, and so forth. So, the parameter values or the constants used in the simulation of the two different particles, are going to be different. But the code for simulating the particles is exactly the same, it's the same mechanism going on. So, I'm going to share with you only how to simulate one particle, and if you desire to simulate a whole battery cell, you would replicate the code for the other electrode. Finally, you would compute the open circuit potential of each of the electrodes, using the surface concentration. Then you would take the surface concentration divided by CS max, that would give you your stoichiometry is x and y, and you would compute the open-circuit potentials of the positive and the negative and you would subtract them. That would give you your overall cell voltage approximation. Again, we're going to look only at simulating the concentration of one particle, but this is how you would generalize to be able to simulate a cell voltage. So, let's look at some code. This first section of code is setting up this simulation by defining some constants, and it's also going to define the input profile of electrical current versus time, the geometry of the particle, the electrode, and so forth. In this example, we set the radius of the particle equal to one micrometer, we set the maximum concentration to 12,000 moles per meter cubed, we set the initial concentration of lithium and the particle to 9,500 moles per meter cubed, we define a value of flux applied to the exterior of the particle when discharging the particle. So, notice I did not in this case specify the current that's applied to the overall battery cell. I have already done some calculations on the side and converted that battery current into a flux value j, and that is what is defined here. We then define the diffusivity equal to one times 10 to the minus 14 meters squared per second, and that is the rough range of diffusivities in the solid. So, just to give you an idea of what order of magnitude to expect. In the simulation, we will first discharge the particle, we will extract lithium from it, and then we'll rest, and then we will charge the particle, put lithium into it, and then rest. So, we define a jk variable to be the flux at the surface of the particle as a function of time. Here, we have 1,800 seconds of discharge and then 3,600 seconds of rest. Then we repeat this profile with a negative sign to accomplish an additional 1,800 seconds of charging, and then 3,600 seconds of rest. When modeling a single particle, we choose to use 20 shells radially, we compute the thickness of every shall equal to the total radius divided by the number of shells, we compute the essay vector to be the external surface area of each one of these shells, and we compute the dv vector to be the volume of each of the shells. Finally, we set the simulation timestep equal to one second in this example. With the definitions from the previous slide, we are ready to initialize and run the simulation. We initialize the concentration of every one of the shells to be equal to c0, and we reserve memory for the CSE variable. Which is the surface concentration as a function of time, and we set the initial CSE value to c0. So, before the simulation begins because the concentrations are uniform everywhere, the cell is perfectly rested, it's in equilibrium. Now, we're ready to go and to apply some current profile, some j profile really vs time to see what happens. We do that when we enter the main simulation loop. Inside of the loop, we compute the next Net flux from shelters shell, the variable n, and then we compute the amount of material transferred across each surface. That's the variable m, and this allows us to compute the change in material in each shell, and hence the change in concentration in each shell. We modify the concentration of the outermost shell by taking the flux forced by the external cell applied current using the jk variable, and we multiply that by the shell surface area and multiply by dt and divide by dv to get everything in the right units. So, at this point, we have updated all of the concentrations inside of this particle, and we set the CSA variable, the CSE variable rather at this timestep equal to the outermost concentration or the surface concentration. So, that I can later look at the surface concentration versus time. That concludes the main simulation loop and the remainder of the code is just plotting code, that plots the surface concentration as a function of time. So, you can visualize what is happening. So, that concludes this lesson. In this lesson, you've learned a number of important things regarding using a physics-based model to compute some familiar quantities, you learned how to compute open-circuit voltage from electrode open-circuit potentials, you learned how to compute battery cell total capacity and state of charge, you also learned how to use a finite volume method to simulate the operation of a single particle. The figure on this slide shows an example output from running the code that I provided for you on the previous slides. Remember, that the code discharged a particle, rested, charged the particle, and then rested. In the figure, you can see that the particle surface concentration begins at 9,500 moles per meter cubed, just as we initialized it. Then the discharge for half an hour draws the surface concentration of lithium in the particle down. The subsequent rest for the next hour, allows the concentrations inside of the particle to equalize by the diffusion processes. Of course, diffusion is always happening but we see it most easily during rest. Because the only thing that's happening during rest is diffusion, and we're not forcing any lithium into or out of the particle at the surface. Then after the first rest interval, we charge the particle and that causes the surface concentration to increase. Then the final rest, allows all of the concentrations to equalize once again, and so the surface concentration relaxes. So, remember this plot shows surface concentration as a function of time for a single particle, it does not show potential as a function of time for that particle. Although you would map this surface concentration through the open circuit potential function and you could get that electrode potential quite easily from that. It also doesn't show you the overall cell voltage versus time, because to do that we wouldn't need to simulate both electrodes and combine their responses in order to get that output. So, to simulate a salary, you would simulate the positive particle using the code that I've showed you. You would simulate the electrode, the negative electrode particle using the same code basically with different parameter values. Then you would take the two different surface concentrations at every point in time, compute open circuit potential, and then subtract them to get the open-circuit voltage. So, once you have everything together, you would be able to simulate a battery cell. Now, you've seen simulations of battery cells with profiles of current versus time that are not too different from this, you've even seen some lab test data, and you can recognize looking at this figure that, yeah, that's what I would expect the voltage to do roughly speaking in terms of its shape. Now, you can see that the shape in the plot of voltage versus time from a cell test for a pulse tests like this, is largely determined. Not completely determined, but it's largely determined by what's happening inside of the solid electrode particles of the diffusion in those barnacles, and the slow time constants involved to give you figures that look like this. Now, you know why. So, that brings us to the end of simulating a single particle or reduced order model. In the next lesson, you'll learn how we can generalize to a more predictive reduced order model of all of the equations of the physics based model.