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

1 Ansicht (letzte 30 Tage)
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 Kommentare
Kaustubha Govind
Kaustubha Govind am 27 Okt. 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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Fangjun Jiang
Fangjun Jiang am 27 Okt. 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 Kommentar
Rhonda Jordan
Rhonda Jordan am 28 Okt. 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

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu General Applications finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by