Simulink model doesn't progress further after a few seconds. How to diagnose?
조회 수: 248 (최근 30일)
이전 댓글 표시
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
답변 (2개)
Prajith Chilummula
2019년 1월 10일
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
Maximilian Winkelmann
2022년 1월 16일
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
2022년 3월 18일
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
Maximilian Winkelmann
2022년 3월 18일
편집: Maximilian Winkelmann
2022년 3월 18일
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..
참고 항목
카테고리
Help Center 및 File Exchange에서 Naming Conventions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!