Effacer les filtres
Effacer les filtres

how to use run-time object in simulink model?

8 vues (au cours des 30 derniers jours)
Yandy Ma
Yandy Ma le 25 Juil 2017
Commenté : Yandy Ma le 25 Juil 2017
I would like to control my simulink model from a matlab script by using set_param. And I would like to have some pause time in between. If I use pause(), the pausing time will be a real time. However, I would like to pause it according to simulation. For example: I would to set_param at simulation time = 5. And someone recommend me to use a 'run-time object'. And I have no idea how can I use it. Can someone give me an example of using the run-time object?

Réponses (1)

jpai
jpai le 25 Juil 2017
By the looks of it you want to be able to pause a running simulation through a command. It may not be necessary for you to use a run-time object at all in order to achieve the operation that you desire. As a matter of fact, you can continue using set_param to control your simulation.
For your specific case, you can use:
set_param('mymodel','SimulationCommand','pause')
This will pause the currently running model mymodel (or whatever your running model's name is).
To continue running the model, you can simply use:
set_param('mymodel', 'SimulationCommand','continue')
As the third parameter suggests, this will resume the paused model.
For more information on SimulationCommands, please refer to the following link:
https://www.mathworks.com/help/releases/R2017a/simulink/slref/model-parameters.html (Search for "SimulationCommand" in the Model Parameters table)
Hope this helps!
  1 commentaire
Yandy Ma
Yandy Ma le 25 Juil 2017
Thanks for answering my question! However, I would like to keep the model running, while using the set_param for every 5sec of simulation time. Coz I would like to observe the transience of the model if I change the parameter within the model for every few seconds of simulation time while the model should be kept running. Do you have any recommendation for me? Really thanks a lot!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Simulink Functions dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by