Triggering a Transition

When a statechart enters a simple state, the triggers of all outgoing transitions (including the transitions outgoing all composite states containing the simple state) are collected and the statechart begins to wait for any of them to occur. When a trigger event occurs, the guard of the corresponding transition is evaluated. If the guard is true, then the transition may be taken (we say "may be" because there may be alternative simultaneous events at AnyLogic simulation engine, which may reset the trigger). This algorithm of guard evaluation is called "guards-after-triggers".

If several triggers are signaled at the same time, and the corresponding guards are true, the transition to be taken can be chosen randomly or deterministically.

Transition can be triggered as a result of various types of events occurred, listed in the table below. You specify the trigger type in the Triggered by property of a transition.

Trigger type

Primary use

Transition fires


Timeout: change state if other awaited events do not occur within the specified time interval.

Delay: stay in a state for a given time, then leave.

After a specified time interval counted from the moment the statechart enters the direct "source" state of the transition (i.e. the state on whose boundary the transition start point is located). The timeout expression is calculated one time when the statechart enters that state. The expression can be stochastic as well as deterministic.


Sporadic state change with a known mean time. In agent based models used to represent sporadic decisions made by an agent under a certain, possibly variable, influence (purchase decisions, adoption of ideas, etc.).

Same as timeout, but the time interval is drawn from an exponential distribution parameterized with the given rate. For example, if the rate is 0.2 the timeouts will have mean values of 1/0.2 = 5 time units.

If a change occurs in the agent while the rate transition is active (namely, if onChange() function is called), the rate expression is re-evaluated and, if it gives a new result, the transition is rescheduled using a new exponential distribution.


Monitor a condition and react when it becomes true. For example: buy if the stock price falls below a certain threshold; launch a missile if the aircraft is closer than 5 miles, etc.

Once a given condition becomes true. The condition is an arbitrary boolean expression and may depend on the states of any agents in the whole model with continuous as well as discrete dynamics. In most cases you can assume the condition is constantly monitored while the transition is active.


React to messages received by the statechart or by the agent from outside. The messages can model communication between people or organizations, commands given to a machine, physical products, electronic messages, etc.

The ways of sending a message to a statechart are described here.

Upon reception of a message that matches the template specified in the transition properties.

Agent arrival

React to arrival. Can be used in moving agents.

The ways of initiating an agent movement are described here.

When the agent arrives at the destination point (assuming its movement was initiated by calling moveTo() function).

Related topics