AnyLogic
Expand
Font size

MoveTo

AnyLogic: The MoveTo block

The MoveTo block moves the agent to a new location. If any resources are attached to the agent, they will move with it. The speed is the agent’s speed, regardless of the speed of the attached resources. The time the agent spends in this block is equal to the length of the shortest path from the agent’s current location to the destination divided by the agent’s speed.

To change the speed, enable the Set agent's speed option and specify its speed in the corresponding Speed parameter)

The agent is animated as it moves along the route.

Parameters

Agent
Select whether the agent instantly jumps to the new location (is placed (jumps) to), or moves there (moves to).
Syntax: MoveTo.Mode mode
Valid values:
MoveTo.MODE_MOVE_TO — moves to
MoveTo.MODE_PLACE_TO — is placed (jumps) to
Destination
Defines how the destination is defined:
Network / GIS node — The agent moves to the specified network node, GIS point, or GIS region.
Attractor — The agent moves to the specified attractor.
Seized resource unit — The agent moves to the current location of the seized resource (specified below in the Resource field).
Home of seized unit — The agent moves to the home location of the seized resource (specified below in the Resource field).
Agent / unit — The agent moves to the location of the specified agent.
(x,y,z) — The agent moves to the point with the specified coordinates.
Node (x,y,z) — The agent moves to the specified node and then moves to the point with the specified X,Y,Z coordinates. Use this mode when you need to move agents to the particular location inside the mode. Note that you define absolute coordinates, see the X, Y, Z parameter description below.
(latitude, longitude) — The agent moves to the given point on the GIS map with the specified Latitude and Longitude.
Geographic place — The agent moves to the particular location on the GIS map. You define this place using the Name of place parameter below.

The next three destinations are for resources [res.] used in the preparation and wrap-up flowcharts.

[res.] Agent which possesses me — the resource moves to the agent that possesses it.
[res.] Other unit seized by my agent — the resource moves to some other resource unit.
[res.] Other unit's home — the resource moves to another unit’s home location.
Syntax: MoveTo.DestinationType destinationType
Valid values:
MoveTo.DEST_NODE — Network / GIS node
MoveTo.DEST_ATTRACTOR — Attractor
MoveTo.DEST_RESOURCE — Seized resource unit
MoveTo.DEST_RESOURCE_HOME — Home of seized unit
MoveTo.DEST_AGENT — Agent / unit
MoveTo.DEST_XYZ(x,y,z)
MoveTo.DEST_NODE_XYZ — Node (x,y,z)
MoveTo.DEST_LATLON — (latitude, longitude)
MoveTo.DEST_GEO_PLACE — Geographic place
MoveTo.DEST_POSSESSING_ENTITY — [res.] Agent which possesses me
MoveTo.DEST_OTHER_RESOURCE — [res.] Other unit seized by my agent
MoveTo.DEST_OTHER_RESOURCE_HOME — [res.] Other unit's home
Node
[Visible if Destination is Network / GIS node]
Network node, GIS point, or GIS region where the agent will move.
Value type: INode
Local variable: agent — the agent.
Attractor
[Visible if Destination is Attractor]
The attractor where the agent will move.
Value type: Attractor
Local variable: agent — the agent.
Resource
[Visible if Destination is Seized resource unit, or Home of seized resource]
The name of the ResourcePool block that defines the set of resource units. The agent will move to the current location (or home location, depending on the Destination parameter value) of the seized resource unit of this type. If several units of the same pool are seized, the first in the list will be chosen.
Value type: ResourcePool
Local variable: agent — the agent.
Agent
[Visible if Destination is Agent / unit]
The agent to move to (it may be e.g. a particular resource unit of some other agent).
Value type: Agent
Local variable: agent — the agent.
X, Y, Z
[Visible if Destination is (x, y, z) or Node (x,y,z)]
X,Y,Z coordinates of the point where agents will move after reaching the specified node. Note that you define absolute coordinates, so you should make the point coordinates correspond to the node coordinates, otherwise agents will move to the point residing outside the node.
Value type: double Local variable: agent — the agent.
Latitude, Longitude
[Visible if Destination is(latitude, longitude)]
Latitude and longitude of the point on the GIS map where the agents will move.
Value type: double
Local variable: agent — the agent.
Name of place
[Visible if Destination is Geographic place]
The name of the particular location on the GIS map, where the agents will move. You specify the name as text put in quotes, e.g. "London". The 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.
Set rotation upon arrival
[Visible if Destination is (x, y, z), Node (x,y,z), (latitude, longitude) or geographic place]
Defines the agent rotation when it arrives at destination.
Syntax: boolean destinationUseRotation
Rotation
[Visible if Set rotation upon arrival is enabled]
Defines the agent horizontal rotation when it arrives at destination.
Value type: double
Local variable: agent — the agent.
Vertical rotation
[Visible if Set rotation upon arrival is enabled]
Defines the agent vertical rotation when it arrives at destination.
Value type: double
Local variable: agent — the agent.
... With offset
[Visible if Destination is set to Network node, Attractor, Seized resource unit, Home of seized unit, Agent/unit and [res.] options]
Select if you want to define offset from the destination point.
Syntax: boolean useOffsets
Default value: false
X, Y, Z offset
[Visible if ... With offset is selected]
Defines the offset from the destination point as values along the corresponding axis.
Value type: double
Local variable: agent — the agent.
Default value: 0
... in the network
[Visible if Agent: is placed (jumps)to: (x,y,z), (latitude, longitude), and geographic place]
Select this option if you want to use a point with the given coordinates or a place that is in the network.
Syntax: boolean destinationInNetwork Default value: false
Network
[Visible if ...in the network is selected]
Select the network that contains the defined point or place.
Value type: INetwork
Local variable: agent — the agent.
Level
[Visible if Destination is (x, y, z)]
Select the level that contains the defined point.
Value type: Level
Local variable: agent — the agent.
Straight movement
Select this option if you do not want the agent to be included in the network and move along a straight line (the shortest route between locations).
Syntax: boolean straightMovement
Default value: false
Movement is defined by
[Visible if Agent is set to Moves to]
Choose how movement is defined: by Distance / speed or by Trip time.
Value type: MoveTo.MovementType
Local variable: agent — the agent.
Set agent's speed
[Visible if Movement is defined by: Distance / speed]
Select if you want to define the speed of the agent.
Value type: boolean
Local variable: agent — the agent.
Default value: false
Speed
[Visible if Set agent's speed is selected]
Expression evaluated to obtain the speed of the agent.
Value type: double
Local variable: agent — the agent.
Trip time
[Visible if Movement is defined by: Trip time]
Value type: double
Local variable: agent — the agent.
Restore speed on arrival
[Visible if Movement is defined by: Trip time]
When agent movement is defined by trip time, the agent changes its speed. This parameter allows to restore the original speed.
Syntax: boolean restoreSpeedOnArrival
Default value: false

Actions

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

Functions

Function Description
int size() Returns the number of agents moving in this block.
Agent remove(Agent agent) Removes the specified agent from the block and returns it. Returns null if the agent doesn’t belong to this block.

agent — The agent to remove.
Iterator<Agent> iterator() Returns the iterator over agents (order: the first is at the exit, the last has the most time left in block).

Ports

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