Interpolating the Interval Where the Signal Goes to Infinity

7 views (last 30 days)
I'm modelling a battery cell and while modelling the equation below:
Using the chain rule:
I, T_cell and OCV are known.
I modelled the equation like this:
While the cell temperature is a constant, the signal output is interrupted. I aim to interpolate those intervals. I tried to use Switch and Delay method, but it didn't work. Is this possible? If so, how can I do that?
  2 Comments
Mathieu NOE
Mathieu NOE on 25 Oct 2021
hello
you simply cannot do a division with zero at the denominator (when Tcell is constant)
Can
Can on 25 Oct 2021
Edited: Can on 25 Oct 2021
Hello Mathieu,
You're right, I disabled zero-crossing detection for that, and I'm trying to make the signal interpolate when T_cell is constant. Whatever can be done in this case is my question.
Maybe if I save the output to the workspace and use a lookup table.

Sign in to comment.

Accepted Answer

Can
Can on 25 Oct 2021
Edited: Can on 25 Oct 2021
Now, I realized that it naturally goes to infinity, not zero. I can't change the title to "Interpolating an Interval Where the Signal goes to Infinity", but I did it. In a very stupid way, but it works. Let me explain.
1. First I ran the code and the model.
2. Then I wrote a code using isinf (to find infinite values) and delsample(to remove them).
Sim_time = 300;
sim('model');
%% INTERPOLATION
% isfinite is to determine which array elements are infinite(true if infinite)
% To compare, I defined dOCV_dT_inf, a timespace with infinite values.
dOCV_dT_inf = dOCV_dT;
% I defined infarray, a logical array that contains 1 (true) whenever the
% elements of the array dOCV_dT.Data is infinite.
infarray = isinf(dOCV_dT.Data);
% Why does isinf take 97 of the data? How to change it?
% I ran the code below, number of infinite data went down everytime I ran
% it, after three times number of infinite values was zero.
x = 0;
while x < 3
for ii= 1:97
if infarray(ii) == 1
dOCV_dT= delsample(dOCV_dT,'Index',ii);
end
end
x = x + 1;
end
dOCV_dT_noinf = dOCV_dT;
sim('model');
3. I ran this section and created a look-up table in the model, using this timeseries.
4. The input of this lookup table is time, so I put a clock as the input.
5. I ran the code and from the scope, I found that it works.
I'm sure there's a much easier way to do this. If anyone wants to explain it, I'm willing to learn.
  2 Comments
Mathieu NOE
Mathieu NOE on 26 Oct 2021
hello again
I'm not familiar with battery models , but I wonder if we can simply switch between models based on when Tcell is constant or not
My 2 cents
Can
Can on 7 Nov 2021
Hello again Mathieu,
Thanks for the feedback. Code deletes inf values, if T_cell is not constant second model does nothing, thus there's no need to not run the second model.
Regards,
Can

Sign in to comment.

More Answers (0)

Categories

Find more on Test Model Components in Help Center and File Exchange

Tags

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!