Battery Charging and Discharging | Simscape Battery Essentials, Part 6
From the series: Simscape Battery Essentials
Simscape Battery™, a new product in R2022b, has been developed to provide a technology development framework that is assembled specifically to create a bridge between battery cell and battery system. The bridge directly supports upskilling as well as design exploration and design rigor, meaning you can navigate the battery system technology development cycle rapidly and with confidence. You will learn how to:
- Connect a battery cell with a constant-current–constant-voltage (CC-CV) algorithm and ideal charge/discharge components.
- Compare the responses of the CC-CV algorithm with the ideal charge/discharge components.
- Confirm the functional equivalence of the CC-CV algorithm and the ideal charge/discharge components.
- Consider the mapping of components of different fidelity with different stages in the technology development cycle.
Published: 20 Sep 2022
Hello, everyone. My name is Graham Dudgeon. And welcome to Part 6 in a series of videos where we'll provide insights and work examples on the use of Simscape Battery, a new product in the Simscape portfolio. Simscape Battery has been developed to provide a technology development framework that's assembled specifically to create a bridge between cell and system. This bridge directly supports upskilling, as well as design exploration and design rigor-- meaning you can navigate the technology development cycle rapidly and with confidence. Today, I will discuss battery charging and discharging.
So here is an example that I'm basing our session today on-- the battery charging and discharging example, which you can find in the documentation. And if I open up the scripts, then I were to run the script as is, it would first open the system model, set some parameters, simulate, and then plot some results. And in fact, if I just close this MATLAB file down, it's this script which will generate this MATLAB plot here, which shows you a charge/discharge cycle.
Now, I'm going to base my session today on this model. But I'm also going to compare it with some other blocks which are available within Simscape Battery. So let me bring my model up, and then we'll explore the model in more detail.
So here's my test model. Let me just go to full screen, press Spacebar. I have a representation of the shipping example. So we have a table-based battery model with thermal port exposed, connected to a fixed ambient temperature, and we have a temperature sensor. For more detail in this representation of the electrical and thermal characteristics of a table-based battery model, please refer to Part 5 in this series.
I have a constant current-constant voltage algorithm, which, as it's input, is measuring the cell voltage. We also define current when charging and current when discharging. So that is set to 15 amps when charging and minus-15 amps when discharging. And we also have an enabled port. The constant current-constant voltage algorithm will output a current, which we feed directly into an ideal controlled current source.
On the bottom, I have an alternative representation of charging and discharging. So you can see that our battery is implemented the same way, but instead of having the constant current-constant voltage algorithm, I have two blocks that connect directly to the electrical circuit-- a charger block and a discharger block.
Now, these blocks are ideal representations of a charger and discharger. And the reason that we use blocks like this is that it allows us to focus on the physical response of the battery rather than on control design. And these blocks can be used as a precursor to more detailed control design. So ideal blocks like these, which provide a functionally correct response, can be invaluable in building a more complete system operational behavior that's in an early design stage, before a more comprehensive control system design is conducted.
Let me just show you where these blocks are in the Simscape Battery Library. We go to Simscape, Simscape Battery, and for the battery's constant current-constant voltage algorithm, we go to BMS, Battery Management System, Current Management, and you can see the battery constant current-constant voltage algorithm is here.
For the ideal charger and discharger which connect directly to the electrical circuit, we can find these under Cyclers-- you can see, we have Charger, Discharger, and also a Cycler. So with Simscape Battery, we have models that give us flexibility in choosing the right level of modal fidelity for a given design task.
Let's go back to our simulation.
So with the constant current-constant voltage algorithm, I'll just open up the block parameters here. Here, we define the maximum cell voltage, but we also have to choose some controller gains and an anti-windup gain. So there is a control design element to this. With our ideal charge and discharge blocks-- let me just double click on the charger-- so we set constant charging current and voltage thresholds, and also a lower current threshold when we're on the constant voltage charging pattern.
And for the discharger, we select the constant discharge current with a lower voltage threshold. And we set enable signals appropriately. I've set a very crude enable signal here. So for 12,000 seconds, I'm telling the charger to be enabled. And then, for the next 4,000, it's disabled. And for the discharger, for the first 12,000 seconds, the discharger is disabled. And then, for the next 4,000 seconds, it's enabled. And I'm just feeding the charger enable signal to the constant current-constant voltage algorithm.
So let me run this simulation. It's going to run for 10 hours. We're using fixed time steps here. So local solver in the Simscape Solver configuration, with a timestamp of one second in this particular case.
OK, let's take a look at the Data Inspector. The first thing we'll do is we'll take a look at our State of Charge-- the State of Charge 1 and State of Charge 2. You can see they're essentially overlaid. So starting at 0.3-- so 30%-- State of Charge, going up to just above 0.91. And then enabling discharge, coming back down to about 0.3. I'm just cycling that. So overlaid response is there.
If I look at temperatures T1 and T2, we see the responses are essentially overlaid. If you look closely, you'll see that there is some mismatch. But that's a consequence of the fact that we're using these ideal charge-discharge blocks and comparing them. But the responses are very comparable.
What this means is it builds our confidence. As we're putting together system-level models and looking at the functional response of the system, we gain confidence that we're seeing the behavior that we expect to see.
Let's look at the currents now. So you can see, on the charge pattern, which goes to the first 12,000 seconds, we start constant current at 15 amps. Then we switch to constant voltage when the voltage threshold is reached. And the consequence of going to constant voltage is current starts dropping-- like a first order decay. Now, we're discharging at a constant minus-15 amps, and then repeat the cycle.
And notice, I don't have voltage on this. So let's just quickly measure voltage. So I'm going to click on the voltage signal line. See, I've got three dots there. Go on those. Go to Log Selected Signal. Do the same with V1. So I'm now logging voltage as well. Let's just rerun the simulation.
Bring up the Simulation Data Inspector again, and we'll just look at these voltages now. So they are overlaid. See, they're actually both labeled Voltage. Let me bring down the Simulation Data Inspector. I've called them V1 and V2, but they're both called voltage. So what we do-- right click, go to Properties, and see how we're logging, and it's got custom logging name here set to Voltage-- just click that to Use signal name. And that will set it to V1.
Do the same with V2. Go to Properties. Click Use signal name, V2, Apply. Let's run that again-- one more time for luck.
I can bring up the Simulation Data Inspector for what's running. You can see now, labeled V1, V2, and they are overlaid. Let me just change the color of V2, re-plot it. So you can see they are very comparable.
So let's recap what we've discussed today. We've taken a look specifically at charging and discharging. So we've looked at two different ways of modeling charge/discharge cycles. In the top model, we implemented a constant current-constant voltage algorithm, which requires an element of control design to be conducted to get that algorithm working on a given system.
On the bottom, we used ideal charge and discharge blocks, which connect directly to the electrical circuit and provide a functionally correct response. Which can be invaluable in building a more complete system operational behavior at a narrowly designed stage, before a comprehensive control system design is conducted.
And so as we are working through our technology development cycle, a combination of ideal blocks for exploring functional response, before moving on to more detailed control design, helps us build that confidence that our system is doing exactly what we've designed it to do.
I hope you found this information useful. Thank you for listening.