Invalid outputTimes while using Simulink Design Optimization

17 Ansichten (letzte 30 Tage)
Hello everyone
I am trying to implement an parameter estimation with the help of the simulink design optimization toolbox.
So far I managed to run the parameter estimation with the GUI succesfully. From there I just generated a script since I wanted to vary some variables from outside the GUI.
Here is were things are getting wrong. After generating the code I tried to run the function but it threw the following error. (there were no changes to model compared to the GUI estimation)
Error using sdo.optimize (line 115)
The function handle passed to the optimize command encountered an error when evaluated with a parameter vector.
Error in spe_fit_ThermoOnly_runOnly_170419 (line 87)
[pOpt,Info] = sdo.optimize(optimfcn,p,Options);
Caused by:
Error using sdo.SimulationTest/sim (line 613)
Invalid OutputTimes specified in the Configuration Parameters dialog for block diagram 'fit_ThermoOnly_runOnly_170419'
when i look at the configuration options i find these options:
SolverType = Variable-Step
OutputOptions = refine output
refine = 1
OutputTimes = []
How do in need to change the options to be able to run the code based estimation?
Thank you for your help in advance!
Best Regards, Stephan
PS I am using Matlab R2015b and the respective toolboxes and apparently also this matlab example works just fine with the same options:
https://de.mathworks.com/help/sldo/examples/estimate-model-parameter-values-code.html?searchHighlight=sdo&s_tid=doc_srchtitle

Akzeptierte Antwort

Stephan Heidrich
Stephan Heidrich am 12 Jun. 2017
I managed to work around this problem by analyzing the generated code in detail:
When generating the code there is a function generated as follows:
function Vals = [ModelName]_optFcn(P,Simulator,Exp)
[...]
Simulator = sim(Simulator,'OutputOption','SpecifiedOutputTimes','OutputTimes',strOT)
[...]
end
This means there is no link between the options adjusted in the Simulink model compared to what is used in the design optimization. the DO only uses the time steps of the Signal which is used for comparison (expressed by the string strOT).
When looking at the used outputTimes I figured that I had quite a high number of decimal digits.
For me rounding the input data time steps to 4 digits solved the issue.

Weitere Antworten (1)

Christoph Hahn
Christoph Hahn am 12 Jun. 2017
Hi Stephan,
could you please share everything that is needed to reproduce your problem as attachment to this article.
Thanks Christoph
  1 Kommentar
Stephan Heidrich
Stephan Heidrich am 12 Jun. 2017
Hi Christoph,
Thanks for you help but meanwhile I managed to work around my problem. I will provide the answer as a seperate answer.
Best Regards, Stephan

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Simulink Design Optimization finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by