I am trying to model a Li-Ion battery in Matlab. Even though I have read different articles on battery modelling, since I am a newbie, most of these articles seems complicated to me. Also, I have some conceptual issues with real time simulation, hence I need simple answers for a few question.

Firstly, I do not want to use Simulink and want to directly implement my model via coding on Matlab (like writing a function). Is it possible (ok, it is probably possible, but I am asking whether it is feasible compared to using Simulink)?

Secondly, I checked the Matlab generic battery model page on here. I got most of the idea, however I could not think of a way to realize the integral part. (I guess we are using integral for calculating the extracted capacity of the battery) Since this I am aiming to make real time simulation, I do not know the exact time when simulation starts and stops. Besides, I should be observing the results during the simulation.

enter image description here

Another question is that why are we using a low pass filter like given in this image? What is the purpose of filtering the current here?

Finally, as I mentioned above I want to implement my model as a function. Is there a way to implement my model without using equivalent circuit model? If there is no way around, how can i implement electrical components such as capacitor?

Thanks in advance.

  • \$\begingroup\$ Simulink is just a graphical way to write Matlab code. So anything you make in Simulink will actually use underlying Matlab functions, ergo, you can write it in Matlab directly as well. What do you mean "real time simulation", Matlab handles numbers, time is also just a number to Matlab. If you want to simulate 0.1 femto Second or the age of the Universe, Matlab does not care. It does care how accurate you want that, obviously simulating 10 timepoints is faster than simulating 1000000 timepoints. How fast depends on your code's complexity and the computer you're running Matlab on. \$\endgroup\$ – Bimpelrekkie Feb 22 '17 at 15:49
  • \$\begingroup\$ how can i implement electrical components such as capacitor? You do not need to ask that, a capacitor model is discussed in the manual so read it ! Also I think that you want too much, too soon, start with something simple like a model of a capacitor and a resistor and simulate the charging of the capacitor. That will teach you how to work with Matlab. First you need to master the basics before you can tackle complex models of a battery. \$\endgroup\$ – Bimpelrekkie Feb 22 '17 at 15:51
  • \$\begingroup\$ @FakeMoustache thanks, my problem is with calculating the integral when I do not know the stop time. for instance, let's say my simulation starts at t=5s. and stops at t=9s. I can say 'ok, this is my equation, this is the time interval, calculate it'. however, in this case I need to give results simultaneously. let's say this time simulation starts at t=5s again, but it might not stop till I stop it. i still need to be observing results during this time. this is what confuses me. \$\endgroup\$ – cnucup Feb 22 '17 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.