I don' know why simulink parameter estimation failed. Please help me

I want to know battery’s internal parameter (internal resistance, diffusion reisister, tau) when i modelling a battery to ECM using a simscape battey.
For parameter estimation, I use hppc profile for input
i make a new experience in parameter estimation app and choose parameter i want to know. Then Run estimating
Simulated Output cannot follow the experienced output.. Cost is also too high.
For Result parameter is not converged..
what’s wrong.. is it important parameter’s initial value, min, max?
Is Input signal too complicated to estimate parameters?
Please give me some tips. Expert of simulink members..
[Below, Text in report translated in English ]
' Optimization started on 2024-Nov-11, 10:50:02.
Estimation converged on 2024-Nov-11, 11:24:53.
One error occurred in the solver during estimation. For more details on the error, check 'EvalErrors_2' in the results workspace.
'ingyu' has been updated with the estimated parameter values.
The estimated parameter values are recorded in 'EstimatedParams'.
The estimated experiment values are recorded in 'Exp'.
Solver output for estimation:
A local minimum may exist.
lsqnonlin stopped because the final change in the sum of squares relative to the initial value was smaller than the function tolerance.
<Details of the stopping criterion>
Optimization stopped because the relative change in the sum of squares (r) was smaller than options.FunctionTolerance = 1.000000e-03.'

3 Comments

What shows up in 'EvalErrors_2' in the results workspace ?
.
EvalErrors_2 is same as EvalErrors.
when i used fast reload option, Error occured.
not using fast option error didn't occured and parameter estimation was completed. But it was not correct.
Sorry, I am unable to change how Simulink FastRestart works so that it will permit changing those parameters. You could file an enhancement request to permit parameters to be changed for FastRestart.

Sign in to comment.

 Accepted Answer

Looks like the error message is trying to tell you that the Parameter Estimater cannot change the parameters it tries to estimate. This is because the "compile-time" parameters in Simscape (to be explained later) can't be modified from simulation to simulation when the Fast Restart is turned on. The solution is simple:
(1) NOT recommended: turn off fast restart. This will allow the parameters to be modified, but also add compile time to the start of each simulation.
(2) Do this instead: for the parameters you try to estimate, at every place it's used, make them "run-time". This way, Simscape will keep a placeholder for them and allow the values to be modified from run to run in Fast Restart mode.
See these two documentation pages for more details:
The 2nd page talks about runing run-time parameters with fast restart. It's a common practice when doing parameter estimation.

6 Comments

Yifeng Tang , Thank you for your kind response.
As you suggested, setting the parameters at runtime resolved the errors. However, I still have a few issues. The main reason I wanted to use the fast restart option was to speed up the simulation.
Currently, I am using the Parameter Estimator to estimate the internal parameters of a battery, but the time domain of the input current profile obtained from the experiment is a bit long. The simulation time seems to be around 300,000.
Is there any way to further reduce the time required when using the Parameter Estimator for estimation?
I thought using the fast restart option would significantly reduce the simulation time for parameter estimation, but it didn’t. Could you let me know if there’s any other way?
It would indeed be nicer if the simulation runs fast during a parameter estimation exercise because the model has to run many times. Fast Restart feature only reduces the "compile" time but has no impact on the simulation time.
There can be a LOT of reasons that may affect your simulation speed. I can't give more specific help without seeing the actual model. Is that something you can share?
Sure, it's just simple model for battery charge/discharge.
Because the Real battery experiment time is long, model's simulation time is also long.
Real battery experiment's total measurement time i 72:05:50s. And measurement time interval is once a 0.1s
Hello @인규,
A screenshot won't allow me to diagnose what is going on. Solver settings, signal attributes, etc. can all affect simulation speed. If possible, please attach the .slx file and the input .mat file. If the .mat file is too large, you may crop and only share the first 1 hour worth of data. Hopefully that's enough for diagnostic purpose. Please also make a note on how long it takes to run such a simulation by itself (not with parameter estimator), so I can compare to what I see.
Hello Yifeng
I will attach the ingyu.slx, For_question.mat file.
There is a battery charge/discharge model and input, output data and battery parameters(R0, R1, tau1, OCV - V0).
I attached the TS_input_Current data, which is about 1/6.5 the size of the actual experimental data.
If the actual experimental data is used for simulation, it typically takes about 3 minutes on average.
So, when conducting parameter estimation using the Parameter Estimator, it seemed to take about two days with the actual data.
Additionally, I configured the solver settings, setting the maximum step size to max(diff(out.tout)).
For the additional output settings, I included AddtOutTimes. The value of AddtOutTimes is TS_input_Current.Time.
A few things that seem to help with the simulation speed.
1. resample the input data to a lower frequency. The original 0.1 sample time appears unneccessarily small. The current data contains lots of noise as a result. I tried:
load For_question.mat
ts = 1; % sample time
TS_input_ResampleCurrent = resample(TS_input_Current,[1:ts:TS_input_Current.Time(end)]);
figure(101); clf
plot(TS_input_Current)
hold on
plot(TS_input_ResampleCurrent)
and the resulting downsampled input signal appears very close to the original. You may then also allow the max time step to be larger.
2. The additional output really slows things down. Is that necessary for the parameter estimation purpose? I removed it (so using the default "Refine output" with factor 1), and the simulation finishes within a few seconds.
You may use your understanding of the system to decide whether downsampling is acceptable (are the parameters you are estimating related to the fast dynamics and noise at 0.1 sec rate?).
Also consider down sample the reference data for the parameter estimator so it won't try to gather that much data from simulation for comparison.
Doing these will at least get you very close to the optimal values of the parameters you are trying to estimate. If you have to, you can then use the full data set, but start with a much better guess and range. This will require much less iterations to get another estimate.

Sign in to comment.

More Answers (0)

Asked:

on 11 Nov 2024

Commented:

on 27 Nov 2024

Community Treasure Hunt

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

Start Hunting!