フィルターのクリア

Simulink Simevents save and reload current state/status

1 回表示 (過去 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
  1 件のコメント
xinran liang
xinran liang 2017 年 6 月 7 日
This is what i'm looking for. Thank you very much!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDiscrete-Event Simulation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by