AnyLogic
Expand
Font size

PedWait

Causes pedestrians to go to the specified location and wait there for a specified period of time.

Location can be defined by a target line, a polygonal node, arectangular node, or a point with given coordinates. If the location is a node, you can specify exact waiting points inside it using attractors. Attractors are locations within the area, which will attract pedestrians during their stay.

Pedestrians can wait for some specified amount of time, calculated from different events (e.g. reaching the waiting point, entering the area, or even manually), or until the user manual calls the block function free().

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

Parameters

Waiting location
Here you choose whether you define the place where pedestrians wait with a line, point, or node.
Get value: locationType
Valid values:
PedWait.LOCATION_NODE
PedWait.LOCATION_LINE
PedWait.LOCATION_POINT
Node
[Visible if Waiting location is node]
Polygonal node or rectangular node, where pedestrians will wait.
Value type: AreaNode
Local variable: ped — the pedestrian
Target line
[Visible if Waiting location is line]
Target line, where pedestrians will wait.
Value type: TargetLine
Local variable: ped — the pedestrian
X, Y
[Visible if Waiting location is point (x,y)]
X (Y) coordinate of the point where pedestrians will wait.
Value type: double
Local variable: ped — the pedestrian
Attractor choice
[Visible if Waiting location is node]
Here you can select the attractor the pedestrians will go to while waiting inside the area: none, random, free. If you select custom attractor, you can specify it in the Attractor parameter below.
Get value: attractorChoice
Valid values:
PedWait.ATTRACTOR_CHOICE_NONE
PedWait.ATTRACTOR_CHOICE_RANDOM
PedWait.ATTRACTOR_CHOICE_FREE
PedWait.ATTRACTOR_CHOICE_CUSTOM
Attractor
[Visible if Use attractors is selected]
Attractor — location, which will attract pedestrians while they will wait inside the area.
Value type: Attractor
Local variables:
ped — the pedestrian
AreaNode areaNode — the area
Delay ends
Defines whether pedestrians will wait in area for some specified amount of time (On delay time expiry option), or they will wait until the user calls free() function (On free() function call option).
Get value: delayType
Valid values:
DELAY_TIMEOUT — On delay time expiry
DELAY_MANUAL — On free() function call
Delay time
[Visible if Delay ends On delay time expiry]
Expression evaluated to obtain the waiting time for the pedestrian.
Value type: double
Local variable: ped — the pedestrian
Delay starts when
[Visible if Type is set to Delay]
Defines, when waiting time starts. The following options are available:
Ped enters the block — waiting time starts when pedestrian enters the PedWait block;
Ped stops at the point — waiting time starts when pedestrian stops at the point of the specified waiting location;
User calls activate() function — waiting time starts when user calls activate() function.
Get value: delayStartsWhen
Valid values:
PedWait.DELAY_STARTS_SINCE_ENTER_BLOCK
PedWait.DELAY_STARTS_SINCE_BEGIN_WAIT
PedWait.DELAY_STARTS_SINCE_MANUAL_CALL
Group members leave together
[Visible if Delay endsOn delay time expiry]
If selected, then upon finishing the waiting the pedestrian will remain in the waiting area until the rest of his group is free and they will leave the block together. Otherwise, the pedestrian will leave the block alone. You can also initiate the pedestrian leaving the block alone in any case by the call of the free() function.
Syntax: boolean waitForGroup
Set new value at runtime: set_waitForGroup(new value)
Maximum capacity
If the checkbox is selected (true), you can limit the number of pedestrians waiting inside the block at the same time.
Syntax: boolean maximumCapacity
Set new value at runtime: set_maximumCapacity(new value)
Capacity
[Visible if Maximum capacity is selected]
The maximum number of pedestrians that can wait inside the block at the same time.
Syntax: int capacity
Set new value at runtime: set_capacity(new value)

Advanced

Reach tolerance
Defines range, at which pedestrian should enclose to the waiting location to begin waiting. In case of groups, this applies only to the leader of the group.
Syntax: double targetReachTolerance
Set new value at runtime: 0,25 meters

Actions

On enter
Code executed when the pedestrian enters the block.
Local variable: ped — the pedestrian
On begin wait
Code executed when the pedestrian starts waiting.
Local variable: ped — the pedestrian
On exit
Code executed when the pedestrian exits the block via out port (in the normal way).
Local variable: ped — the pedestrian
On cancel
Code executed when the 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 by calling the block's function remove().
Local variable: ped — the pedestrian

Functions

Function Description
long countPeds() Returns total number of pedestrians passed through this block.
Attractor getRandomAttractor(AreaNode areaNode) Returns the random attractor inside the specified area.
Attractor getFreeAttractor(AreaNode areaNode) Returns the free attractor inside the specified area.
void free(Agent ped) Interrupts command for the specified pedestrian and causes it to exit through the out port.
On exit callback is called for each pedestrian leaving the block.
void freeAll() Interrupts command for all pedestrians in the block and causes them to exit through the out port.
On exit callback is called for each pedestrian leaving the block.
void freeAllWaitingPeds() In case of individual pedestrians, this function interrupts command for pedestrians who have already reached the specified area and are currently in the state of waiting. In case of groups, the command called for a single member of the group will be applied to all other members of the group even if they haven’t reached the specified area yet. The pedestrians exit through the out port.
On exit callback is called for each pedestrian leaving the block.
void cancel(Agent ped) Interrupts command for the specified pedestrian and causes it to exit through the ccl port.
On cancel callback is called for each pedestrian leaving the block.
void cancelAll() Interrupts command for all pedestrians and causes them to exit through the ccl port.
On cancel callback is called for each pedestrian leaving the block.
void activate(Agent ped) Causes delay timer to start for the specified pedestrian. Available only if Delay starts when: User calls activate() function.
int size() Returns the number of pedestrians in this block.
boolean contains(Agent ped) Returns true if pedestrian is inside the block.
Set<Agent> 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?