Initfcn callback wont update during the sensitivity analysis of my model

17 次查看(过去 30 天)
Hello everyone,
I've come across a strange problem concerning the sensitivity analysis tool and the initialization callback of my Simulink model. The initfcn callback uses some of the parameters in the parameter set of the sensitivity analysis session. When I run the sensitivity analysis the callback doesn't see that the parameters are changing, it uses the same values (the default values in the base workspace) for each iteration.
OCVmine, OCVmaxe, lrStarte, lrEnde, me, pOCVmide are the variables in the base workspace that are being varied in the sensitivity analysis and this is my initfcn callback:
[SoCe, Vse] = pwp(OCVmine, OCVmaxe, lrStarte, lrEnde, me, pOCVmide);
set_param([gcs '/Battery/Cell 1'], 'SoC', 'SoCe', 'OCV', 'Vse');
[~, ix] = min(abs(SoCe - lrEnde/100));
Vinitiale = Vse(ix);
The variables are actually changing because the blocks in my model that use them see that they are changing, it's only the callback that doesn't seem to notice.
The top window shows the various samples of the sensitivity analysis session being evaluated, while the bottom window shows the baseworkspace.
Screenshot 2019-06-28 at 20.00.26.png
Does anyone have any clue what may be causing this problem?
Thank you and enjoy your day.

回答(1 个)

Githin George
Githin George 2024-10-1,12:43
Hi Angelo,
The issue seems to be reproducible only for variables in a model/block/mask callback and I was unable to find any limitations being mentioned in the documentation for the Simulink Design Optimization product.
I would suggest raising a bug request with the MathWorks Technical Support team using the following link to proceed further on the issue:
A possible workaround now would be to not use the Simulink Design Optimization toolbox and to simply create a parameter sweep for example with a for-loop on your own for performing the sensitivity analysis. But this task could be complex depending on your requirements.

类别

Help CenterFile Exchange 中查找有关 Naming Conventions 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by