How to stop simulation in particular time?¶
To stop simulation, in particular time point, add event at the beginning of the simulation to the end time point (in simulated time) and in the event callback call EventProcessor.clearQueue() of the simulation event queue. If the event queue is empty, simulation ends.
How to set up simulation duration?¶
To set duration of simulation, it is possible to use constructor of the Simulation class. There is also possible, to set duration time in milliseconds. Constructor without parameter sets duration to infinity.
Logic behind - An event is added into the simulation queue. The event is fired at the end of simulation (by the set duration). In handling of this event, it calls method for clearing the queue.