Simulink Simevents save and reload current state/status

조회 수: 4 (최근 30일)
xinran liang
xinran liang 2017년 6월 6일
댓글: xinran liang 2017년 6월 7일
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?

답변 (1개)

Kevin Chien
Kevin Chien 2017년 6월 6일
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

카테고리

Help CenterFile Exchange에서 Discrete-Event Simulation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by