Jump error or diverging simulations in for loop with sim command
2 ビュー (過去 30 日間)
古いコメントを表示
Starting from previous question http://www.mathworks.com/matlabcentral/answers/9945-export-data-from-simulink-to-workspace-when-using-sim-command,
Now I have further problems, I explain myself. I am running 50 simulations automatically in a for loop with a simulink simulation in each one, as described before (with sim command).
My problem is when simulation number 42 (for example) does not work properly and it takes much longer time than the rest of simulations because it diverges (5 minutes vs 1 hour when I stopped). So I want to program how to stop 1 simulation and continue with the next loop if one simulation takes more than a predefined time (previously specified by the user) and not stop the whole proccess. Or if one of the simulations fails? It would stop the whole process, so It would be wonderful to anticipate also this possible case.
Thank you in advance
0 件のコメント
回答 (2 件)
Kaustubha Govind
2011 年 6 月 23 日
You might find the Stop block useful. The example titled "Usage with the Relational Operator Block" addresses your first use-case.
Your second use-case states "if one of the simulation fails" - what is the symptom of such a failure? If you mean a Simulink error, you could just have a try-catch statement around the SIM statement to catch the error and continue with the rest of your simulations.
0 件のコメント
Walter Roberson
2011 年 6 月 23 日
Perhaps you could set up a timer just before you start the sim() command, and when the timer goes off, have the timer callback command the simulation to stop ?
I do not know when Simulink checks to see if it has been asked to stop.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Simulink Functions についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!