Author Topic: Battery Modeling - What am I Doing Wrong?  (Read 2032 times)

0 Members and 1 Guest are viewing this topic.

Offline SolidBanksTopic starter

  • Contributor
  • Posts: 11
  • Country: us
Battery Modeling - What am I Doing Wrong?
« on: January 20, 2022, 09:57:20 pm »
Hello all,

I'm looking to model a system where there are 3 sources tied in parallel. Two batteries of the same open circuit voltage but with different capacities, and a current source. The point of modeling this is mainly for my edification but I've become quite frustrated with myself for not being able to figure out why my model outputs an eventual and unexpected decay in SOC and voltage of the two batteries.

I'm attaching a presentation I put together that describes my approach to the model and the result I'm talking about. Could someone smarter than me please take a look and tell me what I'm missing? I've been staring at this for far too long. lol

-Cheers
« Last Edit: January 21, 2022, 08:35:41 pm by SolidBanks »
 
The following users thanked this post: Spike

Offline Daixiwen

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: no
Re: Battery Modeling - What am I Doing Wrong?
« Reply #1 on: January 21, 2022, 07:27:53 am »
On page 4 when you are using the superposition model, I think you made a mistake with the current source. When you turn off a source, a voltage source becomes a short circuit (U=0) but a current source becomes an open circuit (I=0).
The way you did it the batteries will discharge in both RL and R2, and it could explain why the SOC of your batteries decreases so quickly.
 

Offline SolidBanksTopic starter

  • Contributor
  • Posts: 11
  • Country: us
Re: Battery Modeling - What am I Doing Wrong?
« Reply #2 on: January 21, 2022, 02:52:11 pm »
Daixiwen,

After thinking through it, I'm inclined to agree with you that I might have made an error in my superposition analysis. I'll re-run the calculations and see what the model puts out. Thanks for responding!
 

Offline SolidBanksTopic starter

  • Contributor
  • Posts: 11
  • Country: us
Re: Battery Modeling - What am I Doing Wrong?
« Reply #3 on: January 21, 2022, 08:34:04 pm »
So I doublechecked my calculations and I do treat the current source as an open when it's removed during superposition, my charts were wrong as it showed that I didn't. I've since updated the charts to correctly reflect how it's being calculated. Thanks for the feedback though, made my charts better.
« Last Edit: January 21, 2022, 08:36:26 pm by SolidBanks »
 

Offline Daixiwen

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: no
Re: Battery Modeling - What am I Doing Wrong?
« Reply #4 on: January 24, 2022, 07:51:12 am »
What conditions are you using when you do your plot? If Is is off, the batteries will discharge in RL and their SOC and voltage will fall to 0. If Is is on, then both voltages will converge towards RL*Is and their current will fall to 0 at the end of the simulation.
By the way you don't need R2 in your model, it is just in series with an ideal current source and can be removed without changing anything.
 

Offline SolidBanksTopic starter

  • Contributor
  • Posts: 11
  • Country: us
Re: Battery Modeling - What am I Doing Wrong?
« Reply #5 on: January 24, 2022, 10:55:45 pm »
Conditions:
-RL is under a load profile that demands around 1kW for eight minutes every 86 minutes, approximately.
-IS is also under a current sourcing profile that contributes around 15A for 60 minutes every 36 minutes.

As you describe, when IS is off, I expect the battery SOC and voltage to drop. But what happens is that, after minute 1489, the 15A isn't enough to recover the battery voltages and then an exponential decay results in an unrecoverable system. By my accounts, everything unchanged, the whole plot should basically be the performance noted from minute 0 to minute 1489 repeated every cycle; no exponential decay.
 

Offline Daixiwen

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: no
Re: Battery Modeling - What am I Doing Wrong?
« Reply #6 on: January 25, 2022, 08:01:58 am »
Yes indeed, when I look more closely to your curve something weird happens around 1400-1500 minutes, it looks like the SoC doesn't increase as much as the other times during the charge cycle, and this happens just before the first sudden drop.
What function do you use to calculate the voltage depending on the SoC? Could you also trace the 3 currents on the same curve? The one in Rl, and the one in each battery model?
 

Offline SolidBanksTopic starter

  • Contributor
  • Posts: 11
  • Country: us
Re: Battery Modeling - What am I Doing Wrong?
« Reply #7 on: January 25, 2022, 10:21:38 pm »
Exactly!

The equation used to calculate each battery's terminal voltage is:
v(t) = OCV(SOC(t)) - R1*iR1(t) - RINT*i(t)

Where:
t = time
i = total current
iR1 = current through R1

There's more detail regarding terminal voltage from slide 9 - 11.
« Last Edit: January 25, 2022, 11:40:09 pm by SolidBanks »
 

Offline Daixiwen

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: no
Re: Battery Modeling - What am I Doing Wrong?
« Reply #8 on: January 26, 2022, 08:12:16 am »
I was more specifically wondering about your OCV() function. What kind of model did you use? Are you sure that the function is monotonous?
 

Offline SolidBanksTopic starter

  • Contributor
  • Posts: 11
  • Country: us
Re: Battery Modeling - What am I Doing Wrong?
« Reply #9 on: January 26, 2022, 05:29:35 pm »
Ah, I see. I updated the chart package to include an elaboration on OCV as a function of SOC. You can find it on slides 8 and 9. Let me know if this helps.
 

Offline Daixiwen

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: no
Re: Battery Modeling - What am I Doing Wrong?
« Reply #10 on: January 27, 2022, 07:58:28 am »
Oh I see. So you are using a purely linear model. It's not very accurate, but should be good enough to see how things work, and it shouldn't cause any instability.
I didn't notice at first how huge your value for C1 is. I wonder if this would cause some oscillations or weird values in the currents through the batteries. As I suggested before I think it would help to have on the same graph that you have on the last page the currents through the batteries. If you can also show the voltage across C1 maybe it will give some clues about what is going on
 

Offline SolidBanksTopic starter

  • Contributor
  • Posts: 11
  • Country: us
Re: Battery Modeling - What am I Doing Wrong?
« Reply #11 on: January 28, 2022, 09:04:04 pm »
I'll work on it this weekend and reply again when I'm done.
 

Offline amosborne

  • Contributor
  • Posts: 38
  • Country: us
Re: Battery Modeling - What am I Doing Wrong?
« Reply #12 on: January 29, 2022, 05:22:27 am »
I have done this sort of modeling before for the closed loop control and energy balance of spacecraft power electronics, solar arrays, and lithium ion batteries.

You should consider the energy balance of your model. You are injecting energy with your current source, and the load is consuming is energy. But you are also losing energy due to the batteries internal resistance. I bet that you are losing more energy than you are pushing in.

You said in a post above that the conditions are pulse source 60min every 36min and pulse load 8min every 86min. I don’t know exactly how you time that, but I guesstimate the beat frequency to be around 1/1000min, which explains the scallops.

It you are modeling the nonlinear open circuit voltage to state of charge relationship, that easily explains why the voltage craters at the end. Batteries don’t hold voltage well at low state of charge.

The fact that you have a “communication” model puts me on a spectrum somewhere between curious and concerned. I suppose it can work, but I guess you’re not taking advantage of ODE solvers to perform numeric integration.

By the way, the best way to determine the RC dynamic battery impedance is with a step response. And these parameters also end up being a function of state of charge ;)
 

Offline SolidBanksTopic starter

  • Contributor
  • Posts: 11
  • Country: us
Re: Battery Modeling - What am I Doing Wrong?
« Reply #13 on: January 31, 2022, 04:19:33 pm »
Attached include the following:
  • Both battery currents
  • Current source profile
  • C1 Voltage
  • Load Current
 

Offline SolidBanksTopic starter

  • Contributor
  • Posts: 11
  • Country: us
Re: Battery Modeling - What am I Doing Wrong?
« Reply #14 on: January 31, 2022, 04:33:01 pm »
My responses:

You should consider the energy balance of your model. You are injecting energy with your current source, and the load is consuming is energy. But you are also losing energy due to the batteries internal resistance. I bet that you are losing more energy than you are pushing in.
I provided the IS profile in a graphic in another response. That might be the case as I'm only source around 15A each time the IS is switched on.

You said in a post above that the conditions are pulse source 60min every 36min and pulse load 8min every 86min. I don’t know exactly how you time that, but I guesstimate the beat frequency to be around 1/1000min, which explains the scallops.
The graphic I attached in another reply might clear up what I was trying to communicate. It has the IS and load profile.

It you are modeling the nonlinear open circuit voltage to state of charge relationship, that easily explains why the voltage craters at the end. Batteries don’t hold voltage well at low state of charge.
So I understand completely that battery performance worsens as it reaches low state of charge but I've been more confused about the battery performance earlier on in the simulation when things just seem to suddenly take a turn for the worse. Happens around 1489 minutes.

The fact that you have a “communication” model puts me on a spectrum somewhere between curious and concerned. I suppose it can work, but I guess you’re not taking advantage of ODE solvers to perform numeric integration.
Yeah this could be where my not knowing will get me. I'm trying to learn so it sounds like this could be something I use to improve the model. I never liked the separation I have between the circuit and the battery, where the results of one have to feed the other in order to continue progressing but I've heard that it's not uncommon.

By the way, the best way to determine the RC dynamic battery impedance is with a step response. And these parameters also end up being a function of state of charge
Indeed it is. I used a ballpark method in an attempt to estimate the parameters for RINT and the RC branch. That ballpark method included starting the battery model at a relaxed state and then applying a load to draw a steady current for an amount of time that allowed the magical 5 time constants. Now I had no idea that they'd be a function of SOC. Are you referring to the calculation of terminal voltage? When the OCV, as a function of SOC, is reduced because of the voltage drop across RINT and then the voltage drop across the RC pair? Or are you referring to something I'm completely missing?
 

Offline Daixiwen

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: no
Re: Battery Modeling - What am I Doing Wrong?
« Reply #15 on: February 01, 2022, 08:19:30 am »
The first thing that strikes me when looking at the curve is the load current that has some huge peaks from time to time, often corresponding to sudden drops of state of charge. The amplitude of the spikes is much higher than what the battery is supposed to produce from its voltage so there is clearly something wrong there.
Also if I read the graph correctly, the current in the load is actually higher when you turn off Is? That doesn't make a lot of sense either.
I'm still wondering if the big value for C1 doesn't make the simulation completely unstable. Just to check that hypothesis, could you run a simulation with a value of C1 lowered by several orders of magnitude?
 

Offline SolidBanksTopic starter

  • Contributor
  • Posts: 11
  • Country: us
Re: Battery Modeling - What am I Doing Wrong?
« Reply #16 on: February 02, 2022, 05:45:18 pm »
The first thing that strikes me when looking at the curve is the load current that has some huge peaks from time to time, often corresponding to sudden drops of state of charge. The amplitude of the spikes is much higher than what the battery is supposed to produce from its voltage so there is clearly something wrong there.
The amplitude of the spikes represent around a 1.2C discharge of the battery. It is undesirable for sure but my thinking is that it's not wrong.

Also if I read the graph correctly, the current in the load is actually higher when you turn off Is? That doesn't make a lot of sense either.
So this is a good observation and it highlights another failure on my part. I need to clearly communicate the timing of everything that I have right now, or redo the simulation so that it's simpler and try to find the flaws that way.

I'm still wondering if the big value for C1 doesn't make the simulation completely unstable. Just to check that hypothesis, could you run a simulation with a value of C1 lowered by several orders of magnitude?
I'm going to rerun the simulation making it simpler. For now, I'll hold off on making a change to the value of C1 until we can get a look at a graph that represents a single charge and discharge cycle.

I'm also wondering if my time stepping might be wrong. I'm using a time step of 1 in my ODEs. I apologize for not making this easier, hopefully the next graph will be more helpful.
 

Offline Daixiwen

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: no
Re: Battery Modeling - What am I Doing Wrong?
« Reply #17 on: February 03, 2022, 07:11:58 am »
The amplitude of the spikes represent around a 1.2C discharge of the battery. It is undesirable for sure but my thinking is that it's not wrong.
But you are using 0.8 ohms for RL when discharging, aren't you? If you have a look at the spikes at around 3000 minutes, the spikes go up to 36-38A if I'm not mistaken, which means a voltage of 32-34V, higher than the batteries OCV. It gets worse around 4900 minutes.

It is a good idea to try and change the time step. I also wonder if changing both IS and RL at the same time when you switch from charging to discharging (if I understand your document correctly) doesn't cause further unstability.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf