Effacer les filtres
Effacer les filtres

How to restart the simulation from the last of the previous stopped time

15 vues (au cours des 30 derniers jours)
I would like to connect and proceed after the simulation is completely stopped. Is there a way to save the last state in memory when it is stopped and retrieve and connect that information to proceed?
In my situation, I run a model over 10 hours and then adjust some parameters and re-run the simulation from the time that I stopped. If I run the simulation from the start again, it would be a very wasteful time.

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 15 Fév 2023
Modifié(e) : MathWorks Support Team le 1 Fév 2023
You can use Simulink.op.ModelOperatingPoint to save model operating point in simulation as below.
fuelsys
set_param('fuelsys','SaveFinalState','on','FinalStateName',...
'myOperPoint','SaveOperatingPoint','on');
simOut = sim('fuelsys','StopTime','2')
myOperPoint = simOut.myOperPoint
Then, you can start the simulation at the stopped time of 2 seconds by specifying the initial state using the above saved Simluik.op.ModelOperatingPoint object as below.
set_param('fuelsys','LoadInitialState','on','InitialState',...
'myOperPoint');
myOperPoint = simOut.myOperPoint
Now you can see the simulation operate from that time as shown in the captured image below.
Note: The attached recording file(UI_Iteractive_way.mp4) is to show how to save and restore operating point through UI interactive.
 
You can find more information about using model operating point at the following links.
 
- Use Model Operating Point for Faster Simulation Workflow
 
- Simulink.op.ModelOperatingPoint
 
- Specify Initial State for Simulation

Plus de réponses (0)

Catégories

En savoir plus sur Modeling dans Help Center et File Exchange

Tags

Aucun tag saisi pour le moment.

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by