AnyLogic 9
Expand
Font size

PedGoTo

Causes pedestrians to go to the specified location.

Location can be defined by a target line, rectangular node or polygonal node, or a point with given coordinates. The pedestrian has to reach a given point, or any point of the specified line, or node. Pedestrians find path to the specified destination within current level.

There are two path choice modes: Reach target and Follow route. In Reach target mode the path is automatically calculated by the library. Use this mode when you do not want draw a route by yourself. However, if your environment either has numerous walls and borders, or if they make up a maze, it will take plenty of time for the algorithm to calculate the shortest path. In these cases we recommend to define paths manually using the Follow route path choice mode.

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

Parameters

Mode
Here you can choose the movement mode (Reach target or Follow route). In the first case you specify the destination with a target line, or node, or by specifying the coordinates of the target point. In the second case pedestrians will follow along the specified pathway up to its end.
Get value: mode
Set new value dynamically: set_mode(new value)
Valid values:
pedGoTo.MODE_REACH_TARGET — Reach target
pedGoTo.MODE_FOLLOW_ROUTE — Follow route
Target
Here you can choose whether the movement destination is defined by line, node, or point (x,y).
Name: locationType
Change value: set_locationType(new value)
Valid values:
pedGoTo.LOCATION_LINE — target line
pedGoTo.LOCATION_POINT — point in the environment with the given coordinates
pedGoTo.LOCATION_NODE — polygonal node or rectangular node
Target line
[Visible if Target is line]
Target line that defines the movement destination for the pedestrians.
Value type: TargetLine
Local variable: ped — the pedestrian
Node
[Visible if Target is node]
Rectangular node or Polygonal node that defines the movement destination for the pedestrians.
Value type: AreaNode
Local variable: ped — the pedestrian
X, Y
[Visible if Target is point (x,y)]
X (Y) coordinate of the target point.
Value type: double
Local variable: ped — the pedestrian
Route
[Visible if Mode is Follow route]
Pathway that pedestrians should follow.
Value type: Pathway
Local variable: ped — the pedestrian
Walk in reverse direction
If this option is selected (or value is equal to true), pedestrians pass through this service in reverse direction (and the reverse queues are used in this case).
Value type: boolean
Local variable: ped — the pedestrian

Advanced

Reach tolerance, m.
Defines range (in meters), at which pedestrian should enclose to its destination for command to complete. In cases of target line distance to any point of this line is assumed.
Syntax: double reachTolerance
Default value: 0.25

Actions

On enter
Code executed when a pedestrian enters the block.
Local variable: ped — the pedestrian
On exit
Code executed when a pedestrian exits the block via out port (in the normal way).
Local variable: ped — the pedestrian
On cancel
Called when a pedestrian exits the block via ccl port.
Local variable: ped — the pedestrian
On remove
Code executed when a pedestrian is intentionally removed from this block after calling the block's remove() function.
Local variable: ped — the pedestrian

Functions

Function Description
long countPeds() Returns total number of pedestrians passed through this block.
int size() Returns the number of pedestrians inside the block.
void cancel(Agent ped) Causes the specified pedestrian to leave the block immediately via ccl port.
void cancelAll() Causes all pedestrians to leave the block immediately via ccl port.
boolean contains(Agent ped) Returns true if the specified pedestrian is currently inside the block, and false otherwise.
Set<T> getPeds() Returns a non-modifiable collection of pedestrians currently located in this block.

Ports

in

The input port.

out

The output port for pedestrians leaving the block “normally” after the successful completion of the command.

ccl

The output port for pedestrians leaving the block because of “cancel” event (caused by a call of either cancel() or cancelAll() function).

How can we improve this article?