Search code examples
eventsanylogiccumulative-sumsystemdynamics

Anylogic: how to calculate the cumulative sum?


I would like to know how to calculate the cumulative sum in Anylogic. Specifically, I have a cyclic event that changes the value of a parameter every week. From this parameter I would like to calculate the cumulative sum of the values it received, how can I do that ?

The event is a Timeout with mode Cyclic. The action is:

"name_parameter"=round(max(normal(10,200),0));


Solution

  • Create a parameter with an initial value of 0. Call it sum. In the event action field use:

    name_parameter = round(max(normal(10,200),0));
    sum += name_parameter;