Borrar filtros
Borrar filtros

how to use run-time object in simulink model?

3 visualizaciones (últimos 30 días)
Yandy Ma
Yandy Ma el 25 de Jul. de 2017
Comentada: Yandy Ma el 25 de Jul. de 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?

Respuestas (1)

jpai
jpai el 25 de Jul. de 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 comentario
Yandy Ma
Yandy Ma el 25 de Jul. de 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!

Iniciar sesión para comentar.

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by