Filter löschen
Filter löschen

Simulink Simevents save and reload current state/status

1 Ansicht (letzte 30 Tage)
xinran liang
xinran liang am 6 Jun. 2017
Kommentiert: xinran liang am 7 Jun. 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?

Antworten (1)

Kevin Chien
Kevin Chien am 6 Jun. 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

Kategorien

Mehr zu Discrete-Event Simulation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by