Search code examples
modelicadymola

Looking for a principle to determine how to choose the number of intervals in Dymola


There is an option to set the "Number of intervals" during the simulation in Dymola, but I am not sure how to choose the intervals in a real model. So I did some tests, Here are my conclusions and questions:

  1. The number of intervals shouldn't be too small, cause when it is too small, the simulation result could deviate from the real value.
  2. So I set the number of intervals above 500 always, it seems working fine right now, but I am not sure if I should increase it.
  3. When using a larger number of intervals, the simulation time could be longer, so maybe I could decrease it. In short, I am looking for a principle to determine how to choose the number of intervals.

enter image description here


Solution

  • The intervals are just the ones for the plot window not for the simulation.

    If you chose 500 you will get 500 points plotted with linear interpolation. The actual stepsize for simulation is chosen by the DASSL-Integerator to ensure stability. The tolerance option can influence that behaviour. If you choose another solver you can even set fixed number of iterator steps, but i would strongly recommend leaving that decision to the solvers.