version 1.27 (2.16 MB) by
Javier Gazzarri

Lithium ion battery characterization, state estimation, cell balancing, and thermal management

**Editor's Note:** Popular File 2020

This file contains Simscape Electrical Lithium-ion battery models for parameter estimation and simulation.

1. Unzip the project.

2. Double-click BatteryModeling.prj to set up the MATLAB path. The html index contains links to open each example.

Demos:

1. 3S-1P battery pack CCCV charge with passive balancing using Simscape Electrical. Charge / discharge cycling with passive balancing, including thermal effects.

2. EV battery cooling. Liquid cooling of an automotive battery pack.

3. Cell characterization. Parameter estimation of single cell using pulsed discharge experiments.

4. SOC Estimation using UKF.

5. SOH (internal resistance) online estimation using EKF. Internal resistance grows over time and the nonlinear Kalman Filter estimates its evolution.

6. Battery App. This app can be used to find battery parameters from datasheet information.

This site contains additional information on battery modeling using MathWorks(R) tools:

https://www.mathworks.com/solutions/power-electronics-control/battery-models.html

----------------------------------------------------------------------------

Additional literature:

SAE 2015: Model-Based Parameter Identification of Healthy and Aged Li-ion Batteries for Electric Vehicle Applications

http://www.mathworks.com/company/newsletters/articles/model-based-parameter-identification-of-healthy-and-aged-li-ion-batteries-for-electric-vehicle-applications.html

Webinar: Battery Data Acquisition and Analysis Using MATLAB

http://www.mathworks.com/videos/battery-data-acquisition-and-analysis-using-matlab-89170.html

Webinar: Lithium Battery Model with Thermal Effects for System-Level Analysis

http://www.mathworks.com/videos/lithium-battery-model-with-thermal-effects-for-system-level-analysis-81886.html

IEEE 2012: Lithium Battery Model with Thermal Effect

https://www.mathworks.com/content/dam/mathworks/tag-team/Objects/i/71900-ieee-2012-high-fidelity-lithium-battery-model-with-thermal-effect.pdf

SAE 2013: Simplified Extended Kalman Filter Observer for Battery SOC Estimation

https://www.mathworks.com/content/dam/mathworks/tag-team/Objects/s/76108-sae-2013-simplified-ekf-battery-model.pdf

SAE 2013: Battery Model Parameter Estimation Using a Layered Technique

http://www.mathworks.com/company/newsletters/articles/battery-model-parameter-estimation-using-a-layered-technique-an-example-using-a-lithium-iron-phosphate-cell.html?s_tid=srchtitle

SAE 2014: Battery Pack Modeling, Simulation, and Deployment on a Multicore Real Time Target

http://www.mathworks.com/company/newsletters/articles/battery-pack-modeling-simulation-and-deployment-on-a-multicore-real-time-target.html?s_tid=srchtitle

Webinar: Optimizing Vehicle Electrical Design through System-Level Simulation

http://www.mathworks.com/videos/optimizing-vehicle-electrical-design-through-system-level-simulation-81919.html

Video: Real-Time Simulation of Battery Packs Using Multicore Computers

http://www.mathworks.com/videos/real-time-simulation-of-battery-packs-using-multicore-computers-92061.html

Video: MATLAB & Simulink Racing Lounge: Battery Modeling with Simulink

http://www.mathworks.com/videos/matlab-simulink-racing-lounge-battery-modeling-with-simulink-96690.html

Using Model-Based Design to Build the Tesla Roadster

http://www.mathworks.com/company/newsletters/articles/using-model-based-design-to-build-the-tesla-roadster.html

----------------------------------------------------------------------------

MathWorks(R) Consulting offers services on this topic. For assistance, please contact me or your MathWorks(R) representative.

http://www.mathworks.com/services/consulting/proven-solutions/battery-simulation-and-controls.html

Javier Gazzarri (2021). Battery Modeling (https://www.mathworks.com/matlabcentral/fileexchange/36019-battery-modeling), MATLAB Central File Exchange. Retrieved .

Created with
R2019b

Compatible with R2019a and later releases

**Inspired by:**
Automotive Electrical System Simulation and Control

**Inspired:**
Automotive Electrical System Simulation and Control

More Files in the Power Electronics Control Community

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!Create scripts with code, output, and formatted text in a single executable document.

Gaur PrateekGood Morning, I have a small problem related to the same topic which I am unable to solve so I need your support. I am attaching the code for battery pack Aging, prepared by my but there are some problems with the time as the unit there is NOT days because no battery will age to 65% its original capacity during 8*10^-3 days. Please help me to solve this problem, I'll be highly thankful to you.

Code:

clear;

%% loading the OCV-SOC curve

load ocvSoc

f = polyfit(soc,ocv,20);

socTest = linspace(0, 100, 100);

ocvTest = polyval(f, socTest);

subplot(2,2,1)

plot(soc,ocv, socTest, ocvTest);

title('OCV-SOC curve');

xlabel('SOC (%)')

ylabel('OCV (V)')

legend('Simulink model', 'Curve-fitted');

Ah = 3.5; % Ah

%% input time-soc profile

Crate = 0.3;

DOD = 0.6;

SOCavg = 0.5;

cycles = 4000;

time = (0:1:(2*cycles-1)).*(3600*DOD/Crate);

SOC = repmat([SOCavg+DOD/2 SOCavg-DOD/2], [1 cycles]);

T = 36.94+273;

subplot(2,2,2)

plot(time, SOC)

title('SOC profile')

xlabel('time (s)')

ylabel('SOC (0 to 1)')

%% pre-process inputs to the aging model

vTrace = polyval(f, SOC*100);

V = mean(vTrace); % is it OCV or CCV?

quadVavg = sqrt(mean(vTrace.^2));

t = time(end)/3600/24; % time in days

Q = DOD*cycles*Ah; % do I have to multiply by 2 for charge?

subplot(2,2,3)

plot(time/3600/24,vTrace);

title('Aging');

xlabel('time(days)')

ylabel('vTrace (1 to 2.5)')

%% aging model evaluation

% is it additive? NO

% Calendar aging coefficients

% V: voltage at the mean SOC

% T: cycle test temperature (Let's just take the average temperature)

alpha_cap = (7.534 * V - 23.75)*10^6*exp(1)^(-6976/T);

alpha_res = (5.270 * V - 16.32)*10^5*exp(1)^(-5986/T);

% Cycle aging coefficients

% quadVavg: quadratic average voltage (RMS voltage)

% DoD: depth of discharge (0 to 1)

beta_cap = 7.348*10^-3*(quadVavg - 3.667)^2 + 7.600*10^-4 + 4.081*10^-3*DOD;

beta_res = 2.153*10^-4*(quadVavg - 3.725)^2 - 1.521*10^-5 + 2.798*10^-4*DOD;

% Resulting function, Crel and Rrel are relative capacity and resistance

% respectively

% t: time in days

% Q: charge throughput in ampere hours (how much charge has been moved in

% and out)

%CcycleRel = beta_cap * sqrt(Q);

%RcycleRel = beta_res * Q;

Crel = 1 - alpha_cap * t.^0.75 - beta_cap .* sqrt(Q);

Rrel = 1 + alpha_res * t.^0.75 + beta_res .* Q;

disp(['Crel: ' num2str(Crel)])

disp(['Rrel: ' num2str(Rrel)])

%% This cell is to plot aging pattern over time

t = (0:1:cycles).*(3600*DOD/Crate*2/3600/24);

Q = (0:1:cycles).*DOD*Ah;

%CcycleRel = beta_cap * sqrt(Q);

%RcycleRel = beta_res * Q;

Crel = 1 - alpha_cap * t.^0.75 - beta_cap * sqrt(Q);

Rrel = 1 + alpha_res * t.^0.75 + beta_res * Q;

subplot(2,2,4)

plot(t/3600/24, Crel)

title('Relative Cap')

xlabel('time (days)')

Fahmi NaimHi I have a question since I new with Matlab, How i want to use passive balancing and install it into my hybrid electric vehicle model. Do I need coding because I have 10 cells

Youngchen ZhangGreat project! I hope there will be more kinds of batteries in your next version.

Wolfgang FrauhammerIs there an older version of this model, so that i can run it on 2013b? Thank you!

Kai YuanSergei TurovetsWhen trying to run Demo 2 - EV battery cooling - I am, getting an error: " Unrecognized function or variable 'sscfluids_ev_battery_cooling'. "

When trying to run Demo 3 -Cell characterization - I am getting also and error : " Error using open (line 80)

File 'batteryParameterEstimation.slx' not found."

Please add these files in the package for downloads.

Phuong Thao BuGood morning,

I have a question about the model. Is this model only suitable for Lithium battery or also for another battery? I am trying to bild a model for a Redox-Flow-Battery.

Thank you

AMIT DESHMUKHgyubaek leeAMIT DESHMUKHyi linARAVINDAN PALANISAMY@srikanth dabbikar, from matlab applaication we can use the file, after open it needs to extract the file, it will automatically open.

Srikanth DabbikarHi I am unable to open this files..Can you help me

Farhan NizamHow to download it?

Christopher HarrisonAre some of the layers of "batteryParameterEstimation" Simulink protected and unable to be modified? I would like to change the exponential calculations.

Bibinsha M MI am getting following error while opening the project file BatteryModeling.PRJ 'Unable to find a definition folder for the project in resources/project error'

Downloaded and extracted files. Also installed all support packages needed.

I am using Matlab 2020b. Please help.

Wen YuanAHMED FAKHRI@Justyna Plotek, no you cannot because there is no data from SoC zero

You GongJe-Min SonHello,

I was hoping to use the model to mainly estimate SoC of my battery experiment data (time, current, voltage). How can I use my experimental values instead of the saved ones in the model?

xu dingIt's helpfull for my work, thank you very much!

Mudit Verma.mlproj not opening please provide another extensions in mudit.hayaran@gmail.com

Ever BerrioJustyna PlotekHello,

Is it possible to make parameter estimation for SoC of battery lower than 0.1?

Thank you for the model. It is great!

prajod kthe files are prepared on 2019b. How can i open the files in 2019a

sanya gode@javier gazzarri sir, I started working on Battery Modeling and the models developed by you are very helpful. It gave me an excellent undersstanding of how to model batteries. But I have few doubts -

In the model SOH estimation, why haven't we used an Unscented Kalman FIlter but an Augmented Extended Kalman Filter ?

What is the significance of the 'Noise Subsystem' which has moving averages of current and voltage noise.

The current profile EKF.mat MATLAB data file has been imported from some experimental data ? Can you please explain that what is time and current signal value in this data exactly. How does the online parameter estimation calculates R0 based on state and measurement update functions.

Also can I include this model for my thesis work sir.

Harish SMJavier Gazzarri@eduardo: thank you for your question. The EV cooling demo ships with MATLAB therefore it is not needed as part of the submission. You just need to type sscfluids_ev_battery_cooling at the MATLAB Command Window.

eduardoHi Javier,

Thank you for your model. The EV cooling demo seems to be missing from the zip. All the other content is available.

I was wondering if you could make the cooling available as well. Much apprecaited.

Kind Regards

Mou Xujonathan mouraHi Mr. Gazzarri,

some files require a newer version of Simulink. Would it be possible to make it available? In my case I use matlab 2018 and I can't run .mlprj

Thanks & best regards.

Xiaobo dongShirin PhadkeHi! Dear Sir,

The files have an extension of .mlproj which matlab2019a is not able to process. Is there any other way to open them?

AHMED FAKHRIDear Javier, in response to one of your comments when recommending using a pulse discharge for estimation and 'drive cycle' for model validation, do you agree with me that the battery parameters and the output are also function of the C-rate ( i.e. current profile) not just the temperature and SoC. That is why for example in the literature, it is stated that the ECM will never be valid outside the operating conditons used because we do the paramter estimation for the current vs voltage exp data then we fit the model. But if we change the current profile to diffeent one espically when charging using higher c-rates, I don't think the model will be valid even if validated using some random driving cycle. Thanks

Nicolas BasqueraIs it possible to access older versions of the simulations?

I have a 2018 matlab and cannot run .mlprj

thanks!

Steve CheugueuJavier Gazzarri@Joao Paulo Fumagalli: After doing the estimation it is important to validate the parameters using a data set different from that used for estimation. An acceptably low validation error indicates that the model is capable of reproducing a general current profile. Hence the importance of using estimation datasets that adequately exercise the parameters throughout the entire SOC and temperature range of interest. I typically recommend a pulsed discharge for estimation and a drive cycle for validation.

Md SalimullahAHMED FAKHRIHi. I extended the simulation to include 2RC but it takes ages the converge or estimate the parameters.

UNALapei zouDear genius:

It's my great honor to read your article. I'm working on the battery management system. Now I'm working on battery system modeling and battery parameter estimation. I hope I can ask you a few questions. Whether the gradient descent or Newton method is used to estimate battery parameters. How to improve the calculation speed of parameter estimation? What are the commonly used methods in the on-line SOC parameter engineering of real vehicles? How do these algorithms work in the actual engineering? What practical literature and information should I track?

Joao Paulo FumagalliHello gentlemen,

I am using the model Mr. Gazzarri developed with only a modification in the data. My doubt is: with the parameters estimated and a random current curve, can I predict the voltage behavior or the model cannot do this kind of thing?

Thanks for all the help.

Bo HuangLennard SchulzeHello,

Is it possible to implement an other thermal model ? For example a thermal model based on a 2-RC branch, where one branch represents the cell core and the other branch the cell surface (as Forgez explained in "Thermal modeling of a cylindrical LiFePO4/graphite lithium-ion battery").

How is the thermal dependence between the cells represented? And how can other thermal dependencies, e.g. between cells and the case, been representing?

Best regards and thank you in advance.

mallory19Hi,

How did you insert the ORANGE block and link the orange block to the parameter estimation gui?

Xiaojie QiuJavier Gazzarri@Jon Ostolaza: A few things to consider for initial condition improvement. 1) If your experiment has relatively long periods of time at open circuit (i=0), you can calculate the state of charge up to each of them (coulomb counting from the initial SOC) and use these SOC values as breakpoints for the SOC_LUT vector, and the OCV value at the end of the rest period as initial condition for Em. 2) If the experiment exhibits sudden changes in current, you can also manually calculate the initial R0 by doing R0 = delta_V/delta_I every time you have a current step change. 3) There is a Sensitivity Analysis function in Simulink Design Optimization that you can use to perform a quick Monte Carlo analysis to estimate sensitivity. 4) Would you be able to share a screenshot of the superposition of the experiment and the simulation at the end of the analysis so I can try to elucidate the convergence error?

Jin Kusaka@javier gazzari sir, I would like to know how you have given the values of Resistance R0, R1 and capacitance C1 in a matrix format in the program for lithium battery 80 cell in series. Is it experimental data?

Jon OstolazaHi,

I am using this model to estimate the battery model parameters using my lab test results. When I do the parameter estimation the algorithm converges to an error of 0.08 leading to a missmatch between simulated and measured curves. I am wondering if this is a local minima problem. I would also like to know how sensitive the model is to initial conditions and what would be an smart way to estimate these initial conditions to obtain a better fitting of the model.

Thank you in advance!!!

Pradipta Kumar PalJavier Gazzarri@Qihong: That message indicates the absence of a Simulink Design Optimization license.

Jin KusakaThe model says it the example requires 2017a, i would like to ask if would work on 2018a?

Kim SommerThe model info on this page says it requires 2017a but also

"Created with R2012a

Compatible with any release "

We are locked in at 2016a for the forseeable future and cannot open this model. Is there a version possible that can be opened with earlier versions?

Thank you

Will HeThe SOC can be smaller than 0?

In em_table.ssc, I find the code to prevent SOC>1 ('if Qe<0 && i>0 Qe.der == 0;'). The simulation gets stuck after I change the condition to 'if (Qe<0 && i>0) || (Qe>C && i<0) Qe.der == 0;'(of course I move the C calculation before the condition).

I can't understand why this condition can prevent SOC>1, and will not work when preventing SOC<0.

Thank you for your work.

Murtaza PashaThank you for this post. I tried to work on 'ssc_lithium_cell_1RC estim', however, when I try to estimate the parameters, while I hit the orange button, it doesn't take me to the parameter estimation session, instead, an error message shows up. What's the best way to resolve it? Please, let me know, Thanks.

Qihong NieError evaluating ‘OpenFcn’ callback of SubSystem block (mask)

‘ssc_lithium_cell_1RC_estim/Open GUI’. Callback string is ‘%

Speload(‘ssc_lithium_cell_SDO_Project’,’Project-

Ssc_lithium_cell_1RC_estim’,’One Temp Estim’);

Speload(‘ssc_lithium_cell_1RC_estim_spesession’)’

Undefined function ‘speload’ for input arguments of type ‘char’.

Qihong Nieplease let me know what is wrong with this error message!

mscmscfadi safadiHi there am getting this error when I run the simulation:

Error evaluating parameter 'C_Table' in 'ssc_lithium_cell_1RC_estim/lithium ion cell (1-RC equivalent circuit model, isothermal)/C1'

is there a solution for this?

Shailesh SonalikarIsaac Thompsonthe "requirements" section now says 2017a is required, as well as the parallel computing toolbox. will this still run on 2016b, and without the parallel computing toolbox?

Olcay SariJavier Gazzarri@Juan Villegas Ceballos

We created synthetic data for this example because the data presented in the paper is proprietary. Hence the change from 31 Ah (original) to 27.625 Ah.

tudouHi, I have a Primary problem about these simulation. How can I import the data for the singnal builder of current and ambient temperature ? i'm a college student ,and i want to learn about the subject.thanks.

Kazuaki Kisu@TonyN

I also get this question. I'd like to know the answer.

Ali BaheriHi, I have a general question about these files. How can I use set_param command in Simspace if I want to change battery parameter from a script? In fact, I have written my optimization algorithm, and I want to change the battery parameter after one round of simulation from workspace. Thanks for helping in advance.

Renos Rotas@TonyN

I get the same problem. Have you found any solution?

TonyNI am trying to run the R2012b sc_lithium_cell_1RC.mdl under R2017a. When I try and run I get the following errors.

Multiple compilation errors detected while compiling ssc_lithium_cell_1RC.

Caused by:

['ssc_lithium_cell_1RC/Lithium Cell (1RC equivalent circuit model)/C1']: Cannot find parameter 'i'. Please run ssc_build if you have made changes to Simscape file or if you are upgrading to a new version of Simscape.

['ssc_lithium_cell_1RC/Lithium Cell (1RC equivalent circuit model)/Em_table']: Cannot find parameter 'Qe'. Please run ssc_build if you have made changes to Simscape file or if you are upgrading to a new version of Simscape.

['ssc_lithium_cell_1RC/Lithium Cell (1RC equivalent circuit model)/R0']: Cannot find parameter 'i'. Please run ssc_build if you have made changes to Simscape file or if you are upgrading to a new version of Simscape.

['ssc_lithium_cell_1RC/Lithium Cell (1RC equivalent circuit model)/R1']: Cannot find parameter 'i'. Please run ssc_build if you have made changes to Simscape file or if you are upgrading to a new version of Simscape.

Subsequently I try to run the ssc_build on LiBatteryElements, BUT... that library doesn't exist in 2012b. However it is in 2010b. I copied it into my working directory and rerun sec_build. Now I see this:

Failed to generate 'LiBatteryElements_lib'

Caused by:

Error using LiBatteryElements.C_table>equations (line 43)

Function, tablelookup, is wrong. Please check 1) whether input data points have correct sizes; 2) query

values are scalar; 3) query values and table data have the commensurate units; and 4) constants or compile

time parameters are passed to interpolation and extrapolation argument.

Argument 1 = [5x1 double]

Argument 2 = {[273.1500 293.1500 313.1500], 'K'}

Argument 3 = {[5x3 double], 'F'}

Argument 4 = [1x1 double]

Argument 5 = {[1x1 double], 'C'}

SOC_Table = [5x1 double]

Temp_Table = {[273.1500 293.1500 313.1500], 'K'}

C_Table = {[5x3 double], 'F'}

SOC = [1x1 double]

T = {[1x1 double], 'C'}

I looked at the code but could not tell what was wrong.

Any ideas?

Juan Villegas CeballosAccording to the file the battery used is 27.6 Ah, different from the referenced paper which use a 31Ah cell. I would like to know the reference of the cell with which the experimental curve was made.

Thank you

Ouettar ChikouSir I'd like to know if I can apply that model entitled "Lithium Battery Model, Simscape Language and Simulink Design Optimization" to simulate prismatic lithium ion batteries that are used in cell phones like (sumsung EB454357VU 1200mAh).

Thank you

Aditya SinghWhen Implementing the 80 cell pack I am getting an error

'Provided units 'C' and 'K' are not commensurate.'

Can anyone please help me with it? Thanks in advance. If you could maybe forward me the corrected model at 'ranjansami@yahoo.com' it would be of immense help.

RAJANNA VENKATA BODAPATIRobyn Sir can you please kindly send me Dymanic modelling of Vanadium Redox Flow Battery simulink model with custom library blocks. Sir my mail id is bv.rajanna@gmail.com

SilverSurferWhat sampling frequency would be optimal for capturing transient dynamics of the battery and estimating parameters correctly? I'm trying to use the pulsed discharge method for characterizing a lead-acid battery.

RAJANNA VENKATA BODAPATICan you please kindly help me Robyn sir in extending this lithium 2rc model to Vanadium Redox Flow Battery Model

RAJANNA VENKATA BODAPATIsir can you please kindly extend this lithium model to Vanadium Redox flow battery model and send me to my mailid:bv.rajanna@gmail.com

mohan kanthhi,

I used parallel computing toolbox for faster parameter estimation,

estimation has stopped and shown the following statement in the SDO tool

'optimization completed because the size of the gradient is less than the selected value of the function tolerance'

How can I solve this?

mohan kanthhi,

I used parallel computational toolbox for faster parameter estimation,

estimation has stopped and shown the following statement in the SDO tool

'optimization completed because the size of the gradient is less than the selected value of the function tolerance'

How can I solve this?

mohan kanthIn parameter estimation , plot- trajectory of parameter estimation have different lines in each parameter, what those lines represents?

mohan kanthIsaac Thompsonmohan Kanh,

after you open the "parameter estimation gui" you can click "new experiment" and then import data. Double click "Exp" under the experiments box, and you'll see the option to import from an excel file.

still trying to figure out how to use those imported current values in the original model though

mohan kanthhi Robyn Jackey,

U took 11*1 parameters matrix for discharge pulse

I want to give the input i.e current with charge and discharge pulse with different amplitudes, how I can have the parameters matrix?

Isaac ThompsonJosh Savitz,

I was able to get it working. I missed the "required products" section. you need to have the following installed:

Optimization toolbox

Parallel Computing toolbox

Simscape

Simulink

Simulink Design Optimazation (this is the one i was missing, and i ended up buying the student version of matlab and other required products to be able to open buy and use this toolbox)

Matlab

Josh SavitzI have the same problem @Isaac Thompson. The orange box to open up the parameter estimation when double clicked returns an error "Undefined function 'speload' for input arguments of type 'char'". Were you able to resolve this issue?

Anibal Moralesbabajide owoyeleymmchen18I'm unable to unzip this file. Has anyone else had this issue?

Isaac ThompsonI was able to install and run the examples, but trying to open the estimation example, double clicking on the orange box, i get the error "speload is not a valid command"

has anyone else ran into this issue?

taha sadeqShivaram N VHello Robyn,

I made a 2RC model from the 1RC estimation model and then tried estimating the corresponding parameters. But I am getting the following error:

The left hand side is initialized and has an empty range of indices.

However, the right hand side returned one or more results.

Error in sldodialogs.VariableSelectorGC>lcbTableChanged (line 346)

CV{iVar,1} = sVars(ct);

Error in hgfeval (line 62)

feval(fcn{1},varargin{:},fcn{2:end});

Error in javaaddlistener>cbBridge (line 52)

hgfeval(response, java(o), e.JavaEvent)

Error in javaaddlistener>@(o,e)cbBridge(o,e,response) (line 47)

@(o,e) cbBridge(o,e,response));

Could you please let me know why this might be happening?

Shivaram N VHello Robyn,

I made a 2RC model from the 1RC estimation model and then tried estimating the corresponding parameters. But I am getting the following error:

The left hand side is initialized and has an empty range of indices.

However, the right hand side returned one or more results.

Error in sldodialogs.VariableSelectorGC>lcbTableChanged (line 346)

CV{iVar,1} = sVars(ct);

Error in hgfeval (line 62)

feval(fcn{1},varargin{:},fcn{2:end});

Error in javaaddlistener>cbBridge (line 52)

hgfeval(response, java(o), e.JavaEvent)

Error in javaaddlistener>@(o,e)cbBridge(o,e,response) (line 47)

@(o,e) cbBridge(o,e,response));

Neeta KhareHi Robyn,

Thanks for sharing your work. I would like to add Warburg element into the simscape model. Could you please guide me, how I can add library block in Simscape or if I can add a function block in the circuit.

Best,

Neeta

cris paulHello Robyn,thanks for your model and it has really has helped me a lot. Now I want to simulate the Li-ion battery with a 3 R-C branched model and I have watched your video and paper but I'm still not sure how to set up the starting point and end point at every estimation based on Layered Technique. What's more, I want to know how control the initial parameter values at every estimation ? And could you please share your program using 3 R-C branched model? Thank you in advance.

reshma konjariYujie Wangreshma konjariHello Robyn,really thanks for your models.

I'm getting this error when I run ssc_lithium_cell_1RC

Failed to find 'C_ext' in library 'LiBatteryElements_lib' referenced by 'ssc_lithium_cell_1RC/Lithium Cell (1RC equivalent circuit model)/C1/C_ext'

Can you please help me out with this.

Thank you

Daisy LiHi Robyn，thanks for your model!

I'm using Matlab R2014b to run the estimation model but errors as follow occurs:

Error evaluating parameter 'C_Table' in 'ssc_lithium_cell_1RC_estim/Lithium Cell (1RC equivalent circuit model, single temperature)/C_table_1Temp'

Undefined function or variable 'C1'。

Component: Simulink | Category: N.A.

Error evaluating parameter 'SOC_Table' in 'ssc_lithium_cell_1RC_estim/Lithium Cell (1RC equivalent circuit model, single temperature)/C_table_1Temp'

Undefined function or variable 'SOC_LUT'。

Component: Simulink | Category: N.A.

Could you give me advice?

Thank you !

RTHi Robyn, thanks for the file.

I want to estimate charge param. I tried use your model but it seems the results is not converged. I replace the PulseData.mat with my own experimental. The experiment is similar with your example, but the current is in charge mode. Could you give me advice? Thank you.

satendra kumarDear Robyn, thanks a lot for sharing this. I am working on cell balancing with 4 li-ion cells in series.

I want to start the simulation with different values of soc for all cells. I am using 2rc model.

My doubt is, how can I control the starting point of soc for cells.

Thanks a lot in advance.

KevinFor those who have a problem such as:

Failed to generate 'LiBatteryElements_lib'

Caused by:

Error using ne_buildpackage (line 32)

File: C:\<path>\C_table.ssc

Line: 9

Input 'T' declared with unit expression that contains an affine unit: 'C'. Affine units are not allowed when declaring members of this type.

Do the following:

Simscape language doesn't like other units than "Kelvin" for temperature. It needs to be converted by an affine transformation, and sometimes induce error when not used properly.

Change the unit 'C' by 'K', and modify the value for the temperature accordingly in the file "C_table.ssc"

Long NguyenDear Robyn Jackey,

I am working with a team to create a battery management system. I found out your "Lithium Battery Model, Simscape Language and Simulink Design Optimization" some weeks ago and it is very helpful. I want to thank you a lot. However, I have a big question, I tried to use it before and I watched your all videos many times,I saw you did mention about estimate parameters.But I am still not understand at all and I want to ask you how can we use the experiment results and input them in the model?

I watched all videos and I saw that you did not mention how can we input the look-up table into your model. I tried many ways but none of them working.

I am very appreciate your help, please answer me as soon as possible, many thanks.

Kind Regards,

Long Nguyen

Robyn Jackey@ John Arvanitis - Sorry for the delay. I tested the two model advisor checks in R2015a prerelease, and they worked ok. Were you on a prior release? You can email me from the "Contact Author" page if you like.

mohand hamoudaDear Mr. Jackey,

I have used their Li-Ion Battery model as part of my Master's thesis, as I have no real battery.

I would like design an MPC controller and an need a lienearized model , but I have to get a problem with linear-battery model. I can not linearize in a battery model an operating point.

can you please tell me to get help for the ÖLinearisierte model?

should I just leave the Battery and control a DC-DC converter Modllieren and then the battery?

I thank you in advance.

Yours sincerely

Hamouda

ValentinThank you very much for these nice examples!

We try to characterize a electronic car battery for appropriate SoC-estimation in the car.

Therefore we measured pulse data and are doing parameter estimation.

Now the question: How do you use the gained data later on in the devices (eg our car)? You normally generate look up tables and implement them in the ECU? Or you bring the complete model to the ECUs? What would be the typical way of proceeding?

Thank you in advance!

ValentinRobyn JackeyKirankumar - You can use drive cycles (validation) data with Simulink Design Optimization to tune parameters of a model. I would encourage doing so. However, the circuit parameter values may need to have good initial guesses for them to converge.

Pulse data is nice because it allows you to isolate the contributions of the different equivalent circuit elements.

KirankumarWe are trying to estimate parameters for Lithium-Ion battery with Rin+R1||C1 structure. For moment we shall not consider the thermal effect. All three parameters shall be 2-D look-up tables with breakups along SOC and Ibat(temperature in future).

We are looking for high accurate estimation(<10mV). Till now, we used System identification tool box to estimate the parameter for all the scenarios as per the breakups mentioned above. But, while validation with drive pattern data(validation data) we get huge error. We are thinking to try Parameter estimation toolbox to get better results.

My query is:

1) is it possible to directly feed the validation data to parameter identification toolbox for estimation? or its always necessary to provide the pulse data for estimation?

2) Intent is we do not have all the pulse data with different SOC and Ibat.

Regards,

kirankumar

John ArvanitisGreat Job (Lithium Battery Model, Simscape Language and Simulink Design Optimization)

Now we have an easy way to parameterize battery with accuracy on all conditions.

One question please:

1) During of Model Advisor usage we got

the following error

On Modeling Standards for DO-178C/DO-331 - Check safety-related optimization settings and

On Modeling Standards for DO-178C/DO-331 - Check safety-related code generation settings

Abnormal exit: BLAS loading error: mkl.dll: Not enough storage is available to process this command.

What could I do in order to over come this problem?

Johnny RicoThe downloaded zip archive appears to be damaged. I request the author to kindly re-upload the same.

Regards,

Johnny

Ali RostamiI have troule downloading the file from Mathworks.com

the error message is " the site is unavailable or cannot be found.

"

Has anyone experienced the same or any solution?

Thanks

Ali

hanRobyn JackeyI will be presenting during a workshop entitled "Developing Battery Management Systems Using Model-Based Design" at the American Control Conference on June 3rd in Portland, OR. If you are interested in attending, please see:

http://www.iet.unipi.it/f.baronti/acc14/registration.html

http://a2c2.org/conferences/acc2014/workshops.php#11

Robyn JackeyLu - can you email me directly through the contact author page?

LuHi Robyn, thank you for sharing.

I have a question about the paper"SAE 2013: Simplified Extended Kalman Filter Observer for Battery SOC Estimation

".

In this paper, you model the hysteresis effect, and use k as the hysteresis factor.

how can I understand the following sentence in Page5"The value of k was obtained by inspection by minimizing the difference between the experimental and simulated VOC vs. SOC curves. VOC(VSOC) is the instantaneous value of the OCV on the minor loop."

what's the experimental VOC(VSOC),is caculted by(VOCch(VSOC)+VOCdisch(VSOC) )/2?

and what's simulated VOC(VSOC), is the difference between measured terminal voltage (Vt) and VRC?

would you please share the progress of k fitting.

thanks

Robyn JackeyChristopher - I have not seen that license error before. Can you please try contacting MathWorks technical support?

ChristopherI was trying to follow the instructions in the README file, but step 2 is giving me a couple similar errors, for example:

"Error using save_system>i_builtin (line 188)

Cannot save this library because block R_table_1Temp requires a license for , which could not be obtained.

Please try again when a license becomes available."

I am using Matlab R2013A, Simulink 8.1, Optimization Toolbox 6.3, Parallel Computing Toolbox 6.2, and Simscape 3.9. It doesn't look like I Have the Simulink Design Optimization, but I don't think that's what is causing the error that I am seeing. Do you have any suggestions? I looked under the Simulink examples, and I don't see the battery demo even though it is supposed to ship with it.

Thank you!

Robyn JackeyWith R2013a and later, the ssc_lithium_cell_1RC and ssc_lithium_cell_2RC, along with the library LiBatteryElements are now shipping Simscape demos. The shipping versions should be used, because of a Simscape change requiring use of Kelvin rather than Celsius in Simscape language code. The additional demos in this MATLAB Central entry should work, just ensure that the older LiBatteryElements libraries are not added to your MATLAB search path, so it uses the shipping versions.

Maryam BahramipanahThanks Robyn. I did exactly what is written in Readme.text, but by running "ssc_build LiBatteryElements" , I am receiving this error :

Error using LiBatteryElements.C_table (line 9) Input 'T' declared with unit expression that contains an affine unit: 'C'. Affine units are not allowed when declaring members of this type.

:(. I am using the R2012a files.

Robyn JackeyHi Maryam,

You might need to add all the directories to your MATLAB search path first. To fix the error you encountered, you might need to rebuild the Simscape library for your platform and MATLAB version. There are directions in the included readme.txt file.

-Robyn

Maryam BahramipanahRobyn, I found that I have to run the liBatteryelemets before. SO, I have no problem with that any more. But there is another problem :( . when I started the estimation, I received this message "index exceed matrix dimension". Do you know what is it for?

Maryam BahramipanahHello. First of all thanks for uploading the files.

When I am trying to open each elements of the model (for instance R_table_1Temp), I receive this error:

"

Error Id: ne_dli: internal: unableToCreatDialog

unable to creat block dialog. If the block belongs to a custom simscape library, please run ssc_build to rebuild the library...."

Can you please help me with that?

Regards

zwbscgRobyn JackeyFor R2012b and later, there are shipping demos of ssc_lithium_cell_1RC and ssc_lithium_cell_2RC models. the LiBatteryElements package is also part of the shipping Simscape demo, so it's not included in the R2012b folder of the zip file.

VitaIsn't there any LiBatteryElements package in the R2012b folder?

Robyn JackeyHi Mengjia - Unfortunately the errors you see are expected and the model will not work in R2010a or earlier. The early versions of Simscape lookup tables required all dimensions to be a minimum of size 4, and my demo model only contains 3 temperatures. It will work fine in newer releases, otherwise it might work if you add a fourth temperature to the data for each lookup table.

MengjiaHello, I've got errors as below running ssc_lithium_cell_1RC.mdl

1. ssc_lithium_cell_1RC/Solver Configuration: Unable to compile the physical network.

2. sc_lithium_cell_1RC/Lithium Cell (1RC equivalent circuit model)/Main Branch Voltage Source (Em)/PS Lookup Table (1D): The size of the vector of input values or output values must be greater than 3.

3. ssc_lithium_cell_1RC/Lithium Cell (1RC equivalent circuit model)/C1/PS Lookup Table (2D): Y-vector must have no less than 4 elements.

And for other 3 lookup tables(2D) I've got the same Y-vector elements issue, so totally 6 errors.

I've followed the 2 steps as readme.txt stated, please kindly advise where go wrong?

PS: I am using the Matlab R2010a to run the files in folder R2010b.

Robyn JackeyTo answer your questions:

1. In the paper, we chose the initial conditions based on the driving cycle we used for validation. The temperature T=20 was based on a measured cell temperature (approximately same as electrolyte). Initial SOC was selected based on best fit of the measured vs simulated voltage at the very beginning part of the drive cycle.

2. You can modify the InputData*.xls files and import them into the Signal Builder block if you like to change the input curves. However, you will need to delete the "Copyright ..." string that was placed in cell E1 to avoid an error. Otherwise, Signal Builder tries to import data from column E, causing the error you found.

dang hongDear Sir,

In reference paper " high fidelity electrical model with model with thermal dependence for characterization and simulation of high power lithium battery cells", how to choose initial SOC = 45 %,T =20, ? For example, in the case of using ssc_lithium_cell_1RC.mdl.

when importing "InputData_1RC.xls" in signal builder of ssc_lithium_cell_1RC, there is a error " attempted to access td(:,3); index out of bounds because size(td)=[46,2]. How to import that file?

Robyn JackeyThe R2012a folder contains files that use newer features that will only work on R2012a or later. I suspect that is the reason for the build error. The R2010b model should work in that version and up, however it is a little less tidy because the lookup tables were external to the custom Simscape language blocks.

davidrun ssc_build LiBatteryElements

the following errors apeared.

Generating 'LiBatteryElements_lib.mdl' in the current directory 'C:\Documents and Settings\Jiucai\My Documents\Downloads\ssc_Li_cell_20120419\ssc_Li_cell_20120419\R2012a' ...

Failed to generate 'LiBatteryElements_lib'

Caused by:

Error using ne_buildpackage (line 32)

File: C:\Documents and Settings\Jiucai\My

Documents\Downloads\ssc_Li_cell_20120419\ssc_Li_cell_20120419\R2012a\+LiBatteryElements\C_table.ssc

Line: 13

Attribute Size is not supported for constructs of type

parameter.