user2520051
user2520051

Reputation:

Writing a Stop condition in Anylogic

I am new in anylogic, and I want to write a stop condition for the simulation and then save the final values: I have some stocks and flows and I want that when one of my stock values reaches a specific value, the simulation stop and then saves all the values;

  1. where should I write the condition?
  2. what is the statement for stopping simulation in this case?
  3. how can I save the values?

Thanks :)

Upvotes: 0

Views: 3177

Answers (1)

Benjamin
Benjamin

Reputation: 12720

  1. Several places are possible. Easiest is probably a recurring event on the Main that checks the condition every suitable time unit.
  2. try this:

if (myStock > myMaxValue) { getEngine().stop(); // you can also use .finish(), see help to decide which is better for you }

  1. again, several options. Probably easiest to store them into the build-in database (which you can ask to be written to an external Excel at the end of the model). Suggest you read around it in the help, it is quite easy to setup and store data there.

cheers

Upvotes: 1

Related Questions