Jump error or diverging simulations in for loop with sim command

조회 수: 1 (최근 30일)
Javier Guiterrez
Javier Guiterrez 2011년 6월 23일
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

답변 (2개)

Kaustubha Govind
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.

Walter Roberson
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.

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by