フィルターのクリア

SimState error

3 ビュー (過去 30 日間)
Fabio
Fabio 2012 年 5 月 12 日
コメント済み: Abdullah Mohiuddin 2017 年 10 月 4 日
Hello, i'm working with Simulink and I have a problem: I start a simulation and every 'T' time I need to stop it, save the state of the system as Simstate, and then restore the system state by changing a few variables. For example, I am working with the base model 'Inverted Pendulum with Animation' (penddemo.mdl), and when I restore the state I must change the mass of the pendulum, here's some code:
set_param('penddemo','LoadInitialState','on','InitialState','init_state'); % load the initial state
set_param('penddemo','SaveFinalState','on','FinalStateName', 'xFinal','SaveCompleteFinalSimState', 'on'); % save the complete simstate
set_param('penddemo/Pendulum','Mcart','0.600'); % change the mass
sim('penddemo',time); %starting the simulation
The problem is that I get this error:
can not load the Simulink SimState Because The initial model, 'penddemo', was changed after the SimState was saved. Run the simulation again and resave the SimState.
I know that there are limitations in the use of Simstate:
You cannot make any structural changes to the model between the time at which you save the SimState and the time at which you restore the simulation using the SimState. For example, you cannot add or remove a block after saving the SimState without repeating the simulation and saving the new SimState.
but I do not think changing a single variable is a structural change and Mcart is a tunable parameter. Maybe someone knows another way to change some variables before the recovery of Simstate.
  1 件のコメント
Abdullah Mohiuddin
Abdullah Mohiuddin 2017 年 10 月 4 日
Hi,
I came across a similar problem, I also wish to change some parameters before resuming the simulation. Did you find a workaround? Is there any other way we can change some variables and resume the simulation?

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

採用された回答

Kaustubha Govind
Kaustubha Govind 2012 年 5 月 24 日
The parameter 'Mcart' on the block 'penddemo/Pendulum' is used under the mask in a Fcn block in the "Expression" parameter, which is non-tunable (ie. cannot change between a SimState save and restore). So you cannot change the value of 'Mcart' because it counts as a structural change.
  4 件のコメント
Robert Garnett
Robert Garnett 2014 年 2 月 9 日
Hi,
Yes I would agree however in my view the absolute time starting point is simply an initial condition so what's the problem? If you select "Structure With Time" you have the end time anyway
We have a power plant simulator that models a boiler and turbine including combustion from first principles. There are ten's of thousands of states in this model. This model has absolute time and we can save states for use as plant initial conditions and then reload them without any issues.
We cannot of course use initial conditions generated with a different model structure, however we can make gain changes and whilst this will cause an initial disturbance at start-up usually the model will still converge and run normally.
The problem with using the initial final states as initial conditions in simulink is that the very act of checking the "Initial State" Load from Workspace checkbox in the Config Pars dialog seems to make the model "dirty" which stops it from using the xFinal states variable in the workspace.
I hope this explanation is of assistance.
Regards
Rob
Abdullah Mohiuddin
Abdullah Mohiuddin 2017 年 10 月 4 日
Hi, so is there anything we can change before resuming the state and how?

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGeneral Applications についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by