pause simulation and do calculation

4 Ansichten (letzte 30 Tage)
Golden
Golden am 23 Apr. 2020
Kommentiert: Sunil Subedi am 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

Akzeptierte Antwort

Ameer Hamza
Ameer Hamza am 23 Apr. 2020
  21 Kommentare
Ameer Hamza
Ameer Hamza am 27 Apr. 2020
I am glad that this method was helpful.
Sunil Subedi
Sunil Subedi am 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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Schedule Model Components finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by