You are here

equation evaluation order

Nigel Goddard wrote:

I've been looking a bit at the order of evaluation of equations in various System Dynamics software.  As far as I can tell the three systems I'm looking at (Simile, Vensim, Eccosim) are all different:

Vensim: Variables, then Flows, then Levels
Eccosim: Flows then Levels then Variables
Simile: Levels before Flows, with Variables I think mixed in depending on their dependencies

Vensim and Eccosim only differ in whether variable value displayed for a timestep is the value at the beginning of the timestep or the value at the end.  But Simile seems to compute levels before flows (at least judging by the Run table output).

I would be very grateful for any enlightenment you could provide.  Do I understand Simile's ordering correctly?  Does ordering matter?  If it does, is one of the above "correct" or are they all essentially equivalent?

Many thanks for any help you can give.

best regards,



I replied:

Simile calculates levels, then variables, then flows. The reason for this is I wanted the state of the model to look consistent at the end of each time step, and if you calculate levels after variables or flows, then the values for the latter will not be those that follow from the current levels.

The penalty for this is that if you change the execution settings, e.g., time step length, while the model is paused, the variables and flows may need to be calculated an extra time at the start of the following run, but Simile takes care of this and it is not a big penalty.

Simile also allows submodels to execute on different time steps, and extents this concept to allow variables that don't need to be evaluated every time step, not to be. The special time steps are -2 (set literal constants), -1 (load fixed parameters) and 0 (reset state variables). A variable is calculated at the greatest time step on which anything on which it depends is calculated.

Hope this helps