MATLAB: Can Accelerator work on model with algebraic loop

acceleratoralgebraic loopsimulink

I am using a legacy Simulink mdl file that I am pretty sure contains an algebraic loop. The model is slow to execute so I turned on the Accelerator. Each time I run the simulation, it reports 'Successfully built the Accelerator target for model', so the Accelerator can run even if a model contains an algebraic loop, right? But, if it is rebuilding each time the model runs, am I better off with Normal execution?

Best Answer

This is strange - if you are not making any changes to your model between runs, then the Accelerator target should not rebuild. Perhaps you should report this as a bug to MathWorks Tech Support.
Regarding your question about whether you might be better off with Normal Mode simulation - it depends. Yes, there is an initial overhead for generating and building code in Accelerator mode, but if your simulation is very long and expensive, then that initial overhead may be relatively cheap. The best way to figure out is to time your simulation. Using the tic-toc commands:
>> tic; sim(bdroot); toc
in both simulation modes and see which works out faster.
Related Question