Jump error or diverging simulations in for loop with sim command
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (2)
Kaustubha Govind
am 23 Jun. 2011
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 Kommentare
Walter Roberson
am 23 Jun. 2011
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 Kommentare
Siehe auch
Kategorien
Mehr zu Simulink Functions finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!