Flexibly change simulation duration in Anylogic

486 views Asked by At

I have a system dynamics model with only one agent. I can set the duration of the simulation, one example value would be 120 months for my case. What do I do if I would like to experiment with different durations, like 24 or 240 months? Changing it in the "model time" properties of the experiment seems cumbersome cause you have to stop the experiment every time.

For other model inputs, I created sliders on the start screen and bound them to model parameters over variables. This way I can move the sliders, run the simulation with the play button, then go back to the start screen with the stop button and adjust the values. Is it possible to do this with the end time as well?

The model is converted from Vensim, where there was a variable called FINAL_TIME which you could change interactively via a slider in SyntheSim mode. This is what I am looking for, except that the SyntheSim capabilities are not available in Anylogic.

1

There are 1 answers

2
Felipe On BEST ANSWER

Two ways..

you can use the function getEngine().setStopTime(tstop); on your model initialization where tstop is your time parameter in which the simulation will stop

or you can use an event and set up the event to trigger in a flexible time and use finishSimulation() in the action. This allows you to even change the simulation time on runtime whenever you want.