Jump error or diverging simulations in for loop with sim command

2 Ansichten (letzte 30 Tage)
Javier Guiterrez
Javier Guiterrez am 23 Jun. 2011
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

Antworten (2)

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

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

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!

Translated by