Slower simulation than usual

35 views (last 30 days)
Jonas
Jonas on 22 Feb 2021
Commented: Jonas on 23 Feb 2021
Hi all
I am running a simulation in Simulink. Usually the simulation takes about 15 minutes in real-time for 60 seconds of simulation time. But sometimes, the simulation takes a really long time for no apparent reason. Then it takes 7 minutes to simulate only 0.100 seconds...
When it is simulating so slowly, the MATLAB Simulink task uses very little CPU:
I have run the Profiler, and it says the simulation took 53.52 seconds:
However, the simulation in fact took 7 minutes for 0.100s simulation time, observable by the Diagnostic Viewer:
When the simulation runs at regular speed, the processor uses much more power:
So I was wondering why Simulink simulates so slowly, uses so little CPU, and even the Simulink Profiler seems to be mistaken about the simulation time? I was not able to find a root cause to make the model run at normal speed again... I have tried rebooting MATLAB or the computer, I have closed all Scope windows, forced a new model compile, ...
Thanks much,
Jonas
  2 Comments
Walter iacomacci
Walter iacomacci on 22 Feb 2021
Hey there Jonas, I hope you are having a nice day. I read the problem you are having but sometimes this could happen depending on the model you are simulating. Actually most of the cases when things like this happen is not fault of the software but of the model you are trying to simulate or even the settings of your simulation, so if you could post more information about the model you are simulating and also the solver configuration you are using in your settings we could figure out the solution for your problem.
Jonas
Jonas on 23 Feb 2021
Hi Walter, thank you for your suggestions. My experience was that sometimes the model would simulate faster without changing any significant components.
However, per your suggestion I am investigating a section which reads and writes pretty long buffers each sample time. They have worked properly before, but maybe they are misbehaving for some reason.
Also, I am using version 2019a and considered upgrading to 2020b. Running the model in 2020b triggered errors which were not present when running it in 2019a. When fixing those, the model runs fast as I am used to in 2020b.
So I believe there may be some hidden errors which are not found by the 2019a compiler (but still allows it to simulate) but severely affect performance.
Thank you Walter!
Jonas

Sign in to comment.

Answers (0)

Categories

Find more on Configure and View Diagnostics in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!