pause simulation and do calculation

1 vue (au cours des 30 derniers jours)
Golden
Golden le 23 Avr 2020
Commenté : Sunil Subedi le 11 Sep 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

Réponse acceptée

Ameer Hamza
Ameer Hamza le 23 Avr 2020
  21 commentaires
Ameer Hamza
Ameer Hamza le 27 Avr 2020
I am glad that this method was helpful.
Sunil Subedi
Sunil Subedi le 11 Sep 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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Schedule Model Components 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