Thursday, October 9, 2025
HomeMatlabGetting essentially the most out of Fast Accelerator mode – Model R2023b...

Getting essentially the most out of Fast Accelerator mode – Model R2023b » Man on Simulink


Earlier this week, a consumer got here to me with a query associated to a weblog publish I wrote a very long time in the past: Getting essentially the most out of Fast Accelerator mode. This made me notice that since then, now we have made important usability enhancements to this workflow. This impressed me to rewrite this weblog publish utilizing the newest beneficial syntax as of MATLAB R2023b.

Fast Accelerator

As defined right here, the Fast Accelerator simulation mode can velocity up simulation by producing an executable to your mannequin. The speedup can fluctuate between fashions and for numerous causes. Personally, I’ve seen some fashions run greater than 10 instances quicker in Fast Accelerator mode.

RapidAcceleratorUpToDateCheck = off

Whenever you click on the play button in a mannequin or use the sim command, Simulink checks in case your mannequin has modified or not for the reason that final simulation. If the mannequin has not modified structurally, the Fast Accelerator executable shouldn’t be re-generated. Clearly, verifying if the mannequin has modified requires some work and may take a non-negligible period of time for big fashions.

To assist with that, Fast Accelerator has an choice to skip this examine and immediately use the already current executable, if one already exists.

Let’s have a look at how this may be accomplished utilizing a easy demo like sldemo_bounce. For this instance, we’ll fluctuate the coefficient of restitution, specified by variable ok utilized in a Achieve block.

Let’s outline a vector of coefficients we need to simulate for:

k_values = [-0.9:0.1:-0.1];

  • Simulate the mannequin in Fast Accelerator mode
  • Skip the up-to-date examine
  • Run one simulation per coefficient of restitution worth

in(1:size(k_values)) = Simulink.SimulationInput(mdl);

for i = 1:size(k_values)

in(i) = in(i).setModelParameter(‘SimulationMode’,‘Fast’);

in(i) = in(i).setModelParameter(‘RapidAcceleratorUpToDateCheck’,‘off’);

in(i) = in(i).setVariable(‘ok’,k_values(i));

And that is it, we are able to simulate the mannequin for all these values:

out = sim(in,‘ShowProgress’,‘off’);

(Be aware: In order for you the simulations to be executed in parallel, you’ll be able to merely change sim with parsim)
On the finish, an array of Simulink.SimulationOutput objects is generated, from which we are able to extract and plot the outcomes of every simulation.

plot(out(i).logsout.get(‘Place’).Values)

finish

What if I modified the mannequin?

I discussed it earlier than, however I need to emphasize it right here: With the RapidAcceleratorUpToDateCheck choice set to off, Simulink won’t examine in case your mannequin has modified. It is as much as you to inform Simulink to confirm if the mannequin has modified and to rebuild it if wanted utilizing Simulink.BlockDiagram.buildRapidAcceleratorTarget.

Simulink.BlockDiagram.buildRapidAcceleratorTarget(mdl);

Now it is your flip

Give {that a} attempt to tell us what you assume by leaving a remark under.



RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments