Effacer les filtres
Effacer les filtres

Pause and play simulink in programming

6 vues (au cours des 30 derniers jours)
Pouya Jamali
Pouya Jamali le 22 Nov 2012
Is it possible to pause and play again Simulink block diagram through programming? For more clarification I have to say that I want to pause (not stop) my Simulink which is run with sim command in a script file. Is it possible and if so how?
  2 commentaires
MatlabPro
MatlabPro le 22 Nov 2012
are you allowed to use a GUI?
Pouya Jamali
Pouya Jamali le 22 Nov 2012
No I just have to use programming commands!

Connectez-vous pour commenter.

Réponse acceptée

Kaustubha Govind
Kaustubha Govind le 26 Nov 2012
See this page for information on using the SET_PARAM command to do what you need. In particular:
set_param('modename','SimulationCommand','start')
set_param('modename','SimulationCommand','pause')
set_param('modename','SimulationCommand','continue')
set_param('modename','SimulationCommand','stop')
  10 commentaires
Kaustubha Govind
Kaustubha Govind le 27 Déc 2012
Sorry, I was away on vacation. Before you run the SIM command, could you run get_param(Name, 'StopTime') and make sure that the time returned is larger than the Pause block setting?
Pouya Jamali
Pouya Jamali le 2 Fév 2013
Ow thanks for your answer. I haven't got any notification email about your comment so I saw it really late. In order to answer your question I have to say yes, it is. It seems like a bug. If you agree with me please let me know how can I report it to mathworks respondents?
I've been struggling on interfacing programming environment and simulink block diagram for controller design objective but I haven't got a good solution. the only way which works properly is to run the simulink block diagram using sim command in each loop and export the system states. then use the last states as the initial states for the new time span and run it again by using sim command. this method is not satisfactory because the Initialization phase cause to rise run time. As I use the whole system in a objective function for a evolutionary optimization algorithm the run time is really important for me. It tooks for example 3 month to run the algorithm for small sample times like 0.005(s)(small sample times cause a lot of initialization). If I compass the Initialization phase the run time will be decreased to 3 days. Which is a significant value.
You are the only person who can help me Kaustubha. My master thesis has been stopped due to this problem. I would be more grateful if you communicate with me through email. Because this forum doesn't send notification email for comments.
Thanks in advance

Connectez-vous pour commenter.

Plus de réponses (1)

Nadir BOUTASSETA
Nadir BOUTASSETA le 10 Fév 2013
I think that the problem you are facing can be solved by using S-Functions such that at each iteration you change reference values and compute your cost function.
  1 commentaire
Kaustubha Govind
Kaustubha Govind le 14 Fév 2013
I agree with Nadir.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Introduction to Installation and Licensing dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by