Jump error or diverging simulations in for loop with sim command

1 visualización (últimos 30 días)
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

Respuestas (2)

Kaustubha Govind
Kaustubha Govind el 23 de Jun. de 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 el 23 de Jun. de 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.

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by