Consistency in output between a 10 year simulation and two 5 year simulation runs of the same model

1 view (last 30 days)
Dear Matlab community,
I'd like to run an extremely simple simulink model
(a) for 10 years straight
(b) for 5 years (called run A), record data of run A, and then run it the next 5 years using the final state of run A as input to run B; then record state data for run B
I'd like to obtain the same output for (b) as I do in (a), however I have been unsuccessful. (Run A output always matches the output of the first 5 years of (a); but run B data doesn't match years 5-10 of (a)). The block whose state doesn't match is the integrator block. I'm currently using the ode4(Runge-Kutta) solver.
Does anyone know how to get consistent output?
Thank you for your help! RJ
  2 Comments
Kaustubha Govind
Kaustubha Govind on 27 Oct 2011
What version of MATLAB are you using? Are you using the SimState save/restore functionality in (b)? If yes, do you think you could whittle down your model to reproduce this issue with a simple source and the integrator block? It might be worth reporting this to MathWorks Tech Support to see if it's a bug.

Sign in to comment.

Answers (1)

Fangjun Jiang
Fangjun Jiang on 27 Oct 2011
Do you have anything (inputs, parameters etc.) that is time dependent? When you run (b), you need to set the start time as 5, instead of 0. See the answer for this question.
  1 Comment
Rhonda Jordan
Rhonda Jordan on 28 Oct 2011
Thanks! This is ultimately what Saving and Restoring the Complete SimState does (as suggested by Govind above). Thank you for your help!
Best,
RJ

Sign in to comment.

Categories

Find more on General Applications in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!