AnyLogic
Expand
Font size

Enter

Inserts the (already existing) agents into a particular point of the process model.

This block is typically used either to transfer the agents created by e.g. a statechart, an event, etc. to the process flow, or, in pair with the Exit block — to implement custom routing in the process model. To insert the agent via this block you call its take( agent ) function.

Parameters

Agent type
The type of the agents entering the flowchart via this block.
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.
Local variable: 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: 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: 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.
Value type: boolean destinationInNetwork
Default value: 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: 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: 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 m/s
Local variable: 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: agent — the agent.
Length
[Visible if the Change dimensions option is selected]
The new length of the agent.
Value type: double
Local variable: agent — the agent.
Width
[Visible if the Change dimensions option is selected]
The new width of the agent.
Value type: double
Local variable: agent — the agent.
Height
[Visible if the Change dimensions option is selected]
The new height of the agent.
Value type: double
Local variable: agent — the agent.

Advanced

Add newborns to
Here you specify where the agents that were created by this block will be stored: in the default, or in some 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.
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: 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: false

Actions

On enter
Code executed when the agent enters the block.
Local variable: 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: 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: agent — the agent.

Functions

Function Description
void take(agent) Inserts the given agent in the process flow by sending it to output from the out port.
long count() Returns the number of agents entered flowchart by this Enter block. This function doesn't count agents pending transmission (which are counted by size() method).
int size() Returns the number of agents currently pending transmission in this block (which haven't yet been consumed by subsequent flowchart blocks).
boolean cancel(Agent agent) Cancels taking of the given agent — if it hasn’t yet been consumed by subsequent flowchart blocks.

agent — agent to cancel, use null to cancel all the agents pending transmission in this block.
Returns true if agent was successfully removed from this block, and false in case the agent has already been transmitted to the flowchart following this block or when the given agent wasn’t taken by this block using take() method.
int cancelAll() Cancels all the agents currently pending transmission in this block (which haven't yet been consumed by subsequent flowchart blocks). Returns the number of canceled agents.
Iterator<T> iterator() Returns the iterator over agents currently pending transmission in this block (which has not yet been consumed by subsequent flowchart blocks) — in their take() order. Note that returned agents may be consumed by subsequent block at any time later (e.g. some Delay gets free, or Hold unblocks) — unless cancel() function is called.

Ports

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