Parameters identification providing derivative

14 visualizzazioni (ultimi 30 giorni)
Hello, I'd need to perform parameters identification of a battery model. Let's say I have a simplified model that can be described by a single RC branch:
where the parameters I want to identify are R0, R and C (or the time constant tau instead of C). I have the data of V_measured, V_oc and I. The RC branch voltage needs to be calculated using the provided derivative.
Now, my question is: how can I set up the problem to estimate the parameters using the two equations that I have provided? I don't really need the full code, just some workflow would be fine, because I have no idea how to setup a problem like this.
I know that there is a toolbox that performs this kind of parameters estimation, but I'd like to have a little more control on how the algorithm performs.
  6 Commenti
Torsten
Torsten il 6 Mar 2024
So there is no separate theoretical equation for I such that you could solve the two equations
dI/dt = ? or f(t,I(t),V_1(t)) = 0
C*dV_1/dt = I(t) - V_1(t)/R
for I and V_1 ?
Daniel Lotano
Daniel Lotano il 6 Mar 2024
No, I is a free parameter. I could set any given current in the model, i.e. I can charge the battery with any profile current or I could connect any load that could absorb any current with any profile. There is no real equation to describe that.

Accedi per commentare.

Risposta accettata

Star Strider
Star Strider il 6 Mar 2024
The differential equation needs to be integrated in order to use . This does not appear to be as straightforward as I would have hoped, however it may do what you want. (It has the virtue of running without error using random data, however that is all I can say for it.) Note thet the time vector needs to be an input as well as the variables acquired at those times.
Try this —
syms Vmeas V_oc I R_0 V_1(t) C R V_10
sympref('AbbreviateOutput',false);
eqn1 = Vmeas == V_oc - I * R_0 - V_1
eqn1(t) = 
eqn2 = C*diff(V_1) == I - V_1/R
eqn2(t) = 
V_1(t) = dsolve(eqn2, V_1(0) == V_10)
V_1(t) = 
eqn1 = subs(eqn1)
eqn1(t) = 
eqn1 = simplify(eqn1, 500)
eqn1(t) = 
clearvars
% % % R_0 = b(1), R = b(2), C = b(3)
fcn = @(b,V_oc,Vmeas,V_10,I,t) Vmeas + exp(t/(b(3)*b(2))).*(V_10 - I*b(2)) + I*b(2) + I*b(1) - V_oc;
t = 0:10;
Vmeas = randn(size(t));
V_10 = 0;
I = randn(size(t));
V_oc = randn(size(t));
B0 = rand(3,1)
B0 = 3x1
0.7564 0.9149 0.8188
B = fminunc(@(b)norm(fcn(b,V_oc,Vmeas,V_10,I,t)), B0)
Local minimum found. Optimization completed because the size of the gradient is less than the value of the optimality tolerance.
B = 3x1
0.7961 2.8837 3.4689
I used fminunc here, it also works with fminsearch, (although producing differnt parameter estimates) and would probably work as well with fmincon if you wanted to constrain the parameters.
.
  15 Commenti
Daniel Lotano
Daniel Lotano il 7 Mar 2024
@Star Strider I don't really know what's wrong running the files. I have run them on 2 different machines and there are no issues. I just open working_parameters_optimization.m and press Run.
Star Strider
Star Strider il 7 Mar 2024
Modificato: Star Strider il 7 Mar 2024
The problem is not with the files.
The problem is the Answers site. I have no idea wwhy they will not run here using the run function. They should, and this has worked in other Answers.
I am reporting it to MathWorks as a bug. It needs to be fixed.
EDIT — (7 Mar 2024 at 17:21)
Report a bug Case 06860945 created successfully
Our offices are closed March 7 to March 12 for a staff development program. If this is an urgent matter that cannot wait for our return, call your local office to leave a message. We will respond as soon as possible.
.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by