Effacer les filtres
Effacer les filtres

Simulink Simevents save and reload current state/status

1 vue (au cours des 30 derniers jours)
xinran liang
xinran liang le 6 Juin 2017
Commenté : xinran liang le 7 Juin 2017
I'm running some Simulink Simevents models. Every time I need to start from certain initial condition, such as certain number of entities in different queues and certain resource/server states. What I do currently is to let the model run for some time until the initial condition is researched, stop it, then test different parameters. Is there a way to save and rerun from certain initial condition, so every time I can run from the same state?

Réponses (1)

Kevin Chien
Kevin Chien le 6 Juin 2017
If you are using 2016a or later versions of SimEvents, it shall support SimState feature. I just give it a shot in SimEvents and list my steps below:
(1) open your model, and open the model configuration panel; select [Data Import/Export] tab from the left panel
(2) in [Final states] option with default value 'xFinal', check the option [Save complete SimState in final state] and press [OK] button
(3) now use [Step Forward] button to reach the time point that you want to test different parameters, say t = 2.0 sec; press "Stop" button, and in Matlab work space there shall be a variable named 'xFinal'
(4) in [Data Import/Export] tab, check the option [Initial state] with variable name 'xInitial' and press [OK] button; switch to Matlab and type 'xInitial = xFinal;'
(5) now when you restart the model, it will load the SimState from 'xInitial', and start the simulation right there (which is t = 2.0s in this example)
Hope this resolve your issue.
Cheers!
Please also see: https://www.mathworks.com/help/simulink/ug/saving-and-restoring-the-simulation-state-as-the-simstate.html
  1 commentaire
xinran liang
xinran liang le 7 Juin 2017
This is what i'm looking for. Thank you very much!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Discrete-Event Simulation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by