Simulink model doesn't progress further after a few seconds. How to diagnose?
187 ビュー (過去 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 で Configure Simulation Conditions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!