AnyLogic
Expand
Font size

Enter

The Enter block inserts the already existing agents into a specific location in the flowchart.

Demo model: Enter and Exit Open the model page in AnyLogic Cloud. There you can run the model or download it (by clicking Model source files).

This block is typically used either to transfer the agents created by a statechart, an event, and the like into the process flow, or, in conjunction with the Exit block, to implement custom routing in the process model.

To insert the agent via this block, call its take(agent) function.

Parameters

Agent type
The type of the agents entering the flowchart via this block. Referred below as T.
Default value: Agent
New location
Defines the new location for the agents entering the flowchart via this block. There are six alternative options:
Not specified — You do not specify the new location for the agents, they stay where they are currently.
Network / GIS node — Agents are placed in the given network node, GIS point, or GIS region.
Attractor — Agents are placed in the specified attractor.
(x, y, z) — Agents are placed in the point with the specified coordinates X, Y, Z.
(latitude, longitude) — Agents are placed in the given point on the GIS map with the specified Latitude and Longitude.
Geographic place — Agents are placed in the particular location on the GIS map. You define this place using the Name of place parameter below.
Get value: locationType
Valid values: Enter.LOCATION_NOT_SPECIFIED
Enter.LOCATION_NODE
Enter.LOCATION_ATTRACTOR
Enter.LOCATION_XYZ
Enter.LOCATION_LATLON Enter.LOCATION_GEO_PLACE
Node
[Visible if New location is Network / GIS node]
Network node, GIS point, or GIS region where the agents that entered this block are put.
Value type: INode
Local variable: T agent — the agent
Attractor
[Visible if New location is Attractor]
Attractor where the agents that entered this block are put.
Value type: Attractor
Local variable: T agent — the agent
X, Y, Z
[Visible if New location is (x, y, z)]
X,Y,Z coordinates of the point where the agents will be put.
Value type: double
Local variable: T agent — the agent
... located in
[Visible and applies only if the New location option is set to (x, y, z)]
Specifies where the agent will be added to upon entering this block: either Level or Network.
Syntax: boolean destinationInNetwork
Default value: Level (false)
Level
[Visible and applies only if the ...located in Level option is selected]
The level the agent will be added to once it enters the block.
Value type: Level
Local variable: T agent — the agent
Network
[Visible and applies only if the ...located in Network option is selected]
The network the agent will be added to once it enters the block.
Value type: INetwork
Local variable: T agent — the agent
Latitude, Longitude
[Visible if New location is (latitude, longitude)]
Latitude and longitude of the point on the GIS map where the agents will be placed.
Value type: double
Local variable: T agent — the agent
Name of place
[Visible if New location is Geographic place]
The name of the particular location on the GIS map, where the agents will be placed. You specify the name as text put in quotes, e.g. "London". GIS map will search for a location with such name. The first location from the list of GIS search results will be used.
Value type: String
Local variable: T agent — the agent
Speed
[Visible if New location is specified]
The speed of the agents that are entering the flowchart via this block.
Value type: double
Default value: 10 meters per second
Local variable: T agent — the agent

Agent

Change dimensions
If the option is selected (true), you will be able to change the dimensions of the agents entering the flowchart via this block by specifying the new Length, Width and Height values below.
Value type: boolean
Local variable: T agent — the agent
Length
[Visible if the Change dimensions option is selected]
The new length of the agent.
Value type: double
Default value: 1 meter
Local variable: T agent — the agent
Width
[Visible if the Change dimensions option is selected]
The new width of the agent.
Value type: double
Default value: 1 meter
Local variable: T agent — the agent
Height
[Visible if the Change dimensions option is selected]
The new height of the agent.
Value type: double
Default value: 1 meter
Local variable: T agent — the agent

Advanced

Add newborns to
Here you specify where the agents created by this block will be stored: in the default population of the top-level agent of the model or in a custom population (specified below in the Population property). Please note that this applies only to those agents that were just created with new() constructor and have not been present in the model yet. The default population (Java collection of type AgentList) contained in the top-level agent can be accessed with the function getDefaultPopulation().
Syntax: boolean addToCustomPopulation
Population
[Visible if Add newborns to: custom population]
The name of the agent population where the agents created by this block will be stored.
Value type: AgentList
Local variable: T agent — the agent
Forced pushing
If the option is selected (true), when agents finish processing at the block, they are instantly pushed further regardless the state of the succeeding block.
If the option is not selected, agents are not pushed, but pulled: only when the succeeding block is ready to accept one more agent, it requests the agent from this block, and only then this agent passes further.
Syntax: boolean pushProtocol
Default value: true

Actions

On enter
Code executed when the agent enters the block.
Local variable: T agent — the agent
On remove
Code executed when the agent is intentionally removed from this block by calling the agent’s function remove(). This code is automatically executed after the remove() function call.
Local variable: T agent — the agent
On at enter
Here you can type Java code that will be executed when the agent decides that it most likely will go through this block.
Local variable: T agent — the agent

Functions

Function Description
void take(T agent) Inserts the specified agent into the process flow by sending it to output from the out port.

agent — The agent to insert.
long count() Returns the number of agents inserted into the flowchart by this Enter block. This function doesn’t count agents waiting to be inserted. They are counted by the size() function.
int size() Returns the number of agents waiting to be inserted in this block: the agents that haven’t yet been accepted by subsequent flowchart blocks.
boolean cancel(Agent agent) Cancels the insertion of the specified agent, if it has not yet been accepted by subsequent flowchart blocks.
Returns true if the agent has been successfully removed from this block, and false if the agent has already been inserted into the flowchart by this block, or if the specified agent hasn’t been taken by this block using the take() function.

agent — The agent to cancel, use null to cancel all the agents pending transfer in this block.
int cancelAll() Cancels all the agents currently pending transfer in this block: the agents that haven’t yet been accepted by subsequent flowchart blocks. Returns the number of canceled agents.
T remove(Agent agent) Removes the agent from the block and returns it. If the agent was not in the block, returns null.

agent — The agent to remove.
Iterator<T> iterator() Returns the iterator over agents currently awaiting transmission in this block (which have not yet been accepted by subsequent flowchart blocks) — in their take() order. Note that returned agents may be consumed by subsequent blocks at any time later, unless the cancel() function is called. For example, some Delay block may become free, or the Hold block may be unblocked.

Ports

out
The output port.
How can we improve this article?