Loading SimState and modification to the model file

Hi,
I recently discovered this new SimState Matlab feature and am trying to get it working for my model file. This model file involves an S-function. Until today, I had been using the old "save states to workspace" to restart my simulation at any point I wanted. This had been working fine, except that the data stored in the delays was not recovered. To be complete, I should mention that I save and restore the state of my S-function manually.
Now, it seems that I can't use SimState correctly, and I suspect that I did something wrong - but I can't figure out what. The problem comes as follows:
1. I launch a simulation up to, say, t=10s.
2. Without making any modification to the model file, I generate the necessary data to restart my S-function at t=10s (basically write some data that was generated at the last time step into a file that'll be read by my S-function).
3. I modify the Stop time to, say t=20s, but don't change the Start time.
4. I tick the "Initial State" box in the configuration parameter dialog and provide the SimState as an input.
5. I re-launch my simulation and get the following error message: "Simulink cannot load the initial SimState because the model, 'my_model', was changed after the SimState was saved. Run the simulation again and resave the SimState."
I checked this page http://www.mathworks.com/help/toolbox/simulink/ug/brc69t5-1.html and I don't believe I am making any changes that would cause the rebuild of the model. I should also mention that I don't use any fancy feature like accelerators or fancy solvers (I'm using Euler).
Do you have any insight of what may be going wrong?
Cheers, Karim

2 Comments

1) Have you written your S-function to support SimState? (see http://www.mathworks.com/help/toolbox/simulink/sfg/brza339.html)
2) If you remove your S-function and perform these steps with the modified model, are you able to successfully restore state and start simulation? (In other words, can you isolate the issue to the S-function block)
Hi,
Unfortunately, I am not the one that wrote the S-function (and don't have access to the source), so that is why it took so long to answer - sorry about it. I'll let you know as soon as I know more.

Sign in to comment.

Answers (0)

Categories

Find more on Simulink in Help Center and File Exchange

Asked:

on 10 Mar 2011

Community Treasure Hunt

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

Start Hunting!