I am performing an optimization, where in a Simulink Model (involving Matlab function blocks and discrete event blocks amongst other typical blocks) block parameters are changes by an optimization algorithm and the output of the simulation is used as the objective function value. Every time the optimization algorithm determines new design variable values the Simulink model gets the parameter values (using the set_param command), the simulation is started, run till the stop time is reached and then the end values are evaluated. After that, the iteration starts again. Therefore the simulink model is started many times (e.g. 3000 times). At the beginning, the startup and initialization of the model in every iteration takes just a split second, and the simulation itself about 5 seconds. The more often the model is evaluated the longer the initialization takes. After about 500 iterations, the initialization takes about 12 seconds and the simulation still 5 seconds. After 1000 iterations the initialization takes 22 seconds, and so on.

Did anyone encounter a similar problem and knows what the solution is to keep the initialization time low?

Thank you.

More Philipp Wolniak's questions See All
Similar questions and discussions