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

1 vue (au cours des 30 derniers jours)
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 commentaires
Kaustubha Govind
Kaustubha Govind le 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.
Rhonda Jordan
Rhonda Jordan le 28 Oct 2011
Thanks so much for your help! It works perfectly!

Connectez-vous pour commenter.

Réponses (1)

Fangjun Jiang
Fangjun Jiang le 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 commentaire
Rhonda Jordan
Rhonda Jordan le 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

Connectez-vous pour commenter.

Catégories

En savoir plus sur General Applications dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by