pause simulation and do calculation

4 visualizaciones (últimos 30 días)
Golden
Golden el 23 de Abr. de 2020
Comentada: Sunil Subedi el 11 de Sept. de 2020
Hi,
I have a unique need to pause simulation at known time points and do calculation with the obtained workspace data to that point, plot it, then resume simulation. What is the best way of setting it up with a subsystem and its InitFcn, or other callback functions?
Thanks

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 23 de Abr. de 2020
  21 comentarios
Ameer Hamza
Ameer Hamza el 27 de Abr. de 2020
I am glad that this method was helpful.
Sunil Subedi
Sunil Subedi el 11 de Sept. de 2020
Dear Ameer Hamza and Golden,
I have been working on similar purpose simulation and encountered similar problem.
First, I want to explain what I want to do.
Lets say I have two models : Model A and Model B. I want to run the models and pause the simulation and send some data tbetween the Models and run the Models and so on.
During Pause I want to run the script file telling that exchange the data.
After exchanging continue the simulation.
I was using same function inside assertion block.(matlab 2019b)
set_param('Test_Simulink_Model','SimulationCommand','pause');
run('myscript.m');
set_param('Test_Simulink_Model','SimulationCommand','continue')
But what I found was it is oly updating the constant blocks at the starting of the simulation but not during the simulation or each time after the simulation is pause.
I am also curious how to pause the simulation in each time step and update the simulation and continue.
Thank You

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Schedule Model Components 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