AnyLogic simulates the model as a sequence of time steps and event steps.
During a time step:
During an event step:
AnyLogic engine events are events that occur at runtime. Please do
not confuse them with static/dynamic events that are a part of AnyLogic
modeling language. There are several types of engine events:
Engine events reside in the engine event queue. Any event present in the engine event queue may be associated with:
In addition, current events may be associated with something that has just happened as a result of other event execution:
If there are no current events, AnyLogic makes a time step to the nearest event (or events) in the queue, i.e., advances its clock. During a time step a condition event may occur. The discrete part of AnyLogic engine does not know when a condition event associated with a transition occurs: it depends on the equation set being solved numerically by a continuous part of the engine. Once this happens, the clock is advanced to the time reported by the continuous-time equation solver, and the event step is executed.
Several events may be scheduled to occur at the same moment of time. If there are several current events, AnyLogic chooses one and executes it. This is repeated until there are no current events. Thus, several event steps may be made in succession, whereas a time step is always followed by an event step. Simultaneous events may depend on each other or be truly concurrent. The serialization of concurrent events is called interleaving a model.
The execution of a timer event is actually the execution of the timer’s action code. The execution of a transition event is the execution of a set of actions associated with the transition. As a result of the event execution, the discrete state of the model may change: statecharts may change their states, other transitions may begin waiting, and other timers may be activated. Thus, some events may be deleted from the event queue and other events may be added to it.
The example of AnyLogic event queue processing is shown in the figure below.