Simulink model doesn't progress further after a few seconds. How to diagnose?
239 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi,
My model compiles without warnings, and proceeds to initialise and run quite quickly, say 3 seconds simulation time per 1 second real time. However, after 8 seconds(sim time) or so, it seems not to progress any further. Sometimes it happens at about 8 seconds, sometimes at 9. It depends on the end time I set. It does not freeze, it just doesn't proceed. I've waited half an hour, only to see it make one step of 0.1s further. When I try to stop the simulation, it freezes/crashes. It won't respond to anything and I have to kill MATLAB in Task Manager. I've enabled all warnings, and i've run the model Advisor, but it didn't help me further.
I'm using MATLAB 2018b on Windows 8.1 Pro 64-bit. I'm using the VariableStepAuto option for the solver. I've manually tried some solvers with the same result.
I'm using the Vehicle Network Toolbox for CAN communication and four CAN connections with 2 Vector CAN adapters. I'm not getting problems if I use virtual CAN adapters, problems only occur when I use real CAN adapters. I've updated all their drivers.
How can I diagnose what is making the simulation hang?
0 Commenti
Risposte (2)
Prajith Chilummula
il 10 Gen 2019
In general, when a simulation looks like it is hanging, it is because the time steps being taken by the solver are becoming very small. You need to make the solver stop taking small steps so that the simulation will progress faster. To do this, you can turn off zero crossings, increase the minimum step size, or increase the minimum tolerance. Information on how to do these and other techniques for speeding up your simulation are available in Chapter 4 of the Using Simulink Guide which can be found on our website at:
Also please check the following answer which might help:
https://www.mathworks.com/matlabcentral/answers/94052-how-can-i-speed-up-simulation-of-my-simulink-model
7 Commenti
Maximilian Winkelmann
il 16 Gen 2022
I have the same issue. My simulation time is very long and it stops at about 1411000 s evertime with no error. Matlab/Simulink just stops working, i cant even open m.-files for example. There is no memory issue or something like that, because it will happen with a start time of 1400000 as well. The solver profiler doesnt work as well as soon as the simulation stops, but the data that is recorded until this point seems to be ok. Based on the profiler there should not be any problem regarding the step size. Is there a solution to this?
yaoxin shen
il 18 Mar 2022
So, any solution now? I faced the same problem, I wait for nearly an hour but nothing continue. I also have to kill MATLAB in Task Manager.
1 Commento
Maximilian Winkelmann
il 18 Mar 2022
Modificato: Maximilian Winkelmann
il 18 Mar 2022
Hi, so my problem was a stuck for-loop that never finished running. I identified it by adding a "disp('<loop-name>');" to all my loops and than executing all m-files used in the model seperately. You should see the name of the function in the command windows afterwards. For some reason it did not work if simulink called the m-file functions by itself..
Vedere anche
Categorie
Scopri di più su Naming Conventions in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!