AnyLogic
Expand
Font size

Exit

Takes the incoming agents out of the process flow and lets the user specify what to do with them.

If all you want to do is to dispose the agents you should use the Sink block. Typically Exit is used either to transfer the agents to a part of model implemented in another modeling style (e.g. to a statechart, a function, etc.), or, in pair with Enter block, to implement custom routing of agents between different parts of the process model. The agent is accessible in onExit parameter.

Custom object. Suppose you want to develop a reusable object with functionality not covered by the Process Modeling Library and use it in the process flowchart. You may then create a new agent type, declare two regular ports (say, in and out), use Exit at the input and Enter at the output and use any modeling constructs in between, see the picture below. To forward the incoming agent to the “custom implementation” you should use the onExit parameter of Exit where the agent is accessible, and to output the outgoing agent you should call enter.take( agent ).

Custom routing. Suppose you wish to route agents in a custom way, say, depending on some global conditions (for example, you want to choose a service point with the shortest queue). This may be possible to do by using a number of SelectOutput objects, but it would not be elegant in case there are many routing points, and even impossible if the receiving block is replicated (by selecting the advanced Agent population option). The solution is to use the Exit object at the sending side and an Enter object — at each receiving side, and upon each agent arrival analyze the conditions and call the take( agent ) function of the chosen Enter object. Note that such custom routing can cross the agent boundaries: you may write something like receiver(i).enter.take( agent ) to forward the agent into the i-th instance of the receiver object.

Parameters

Actions

On exit
Code executed when the agent exits the block.
Local variable: agent — the agent.

Functions

Function Description
long count() Returns the number of agents passed through this block.

Ports

in
The input port.
How can we improve this article?