
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, a rectangular 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). Demo model: Pedestrian AttractorsOpen the model in your AnyLogic desktop installation.- Waiting location
-
Here you choose whether you define the place where pedestrians wait with a node, target line, or a point (x, y) with specified coordinates.
Name: locationType
Type: PedConstants.LocationType
Set new value at runtime: set_locationType(new value)
Valid values:
PedWait.LOCATION_NODE — node
PedWait.LOCATION_LINE — line
PedWait.LOCATION_POINT — point (x, y) -
[Visible if Waiting location is node]
Polygonal node or rectangular node, where pedestrians will wait.Type: AreaNode
Local variable: T ped — the pedestrian -
[Visible if Waiting location is line]
Target line, where pedestrians will wait.Type: TargetLine
Local variable: T ped — the pedestrian -
[Visible if Waiting location is point (x, y)]
X-coordinate of the point where pedestrians will wait.Type: double
Local variable: T ped — the pedestrian -
[Visible if Waiting location is point (x, y)]
Y-coordinate of the point where pedestrians will wait.Type: double
Local variable: T ped — the pedestrian - Attractor choice
-
[Visible if Waiting location is node]
Here you can select the attractor that pedestrians will go to while waiting inside the area: None, Random, Free, or Custom. If you select the Free option, pedestrians will first choose free attractors. If you select Custom attractor, you can specify it in the Attractor property below.Name: attractorChoice
Type: PedConstants.AttractorChoice
Set new value at runtime: set_attractorChoice(new value)
Valid values:
PedWait.ATTRACTOR_CHOICE_NONE — None
PedWait.ATTRACTOR_CHOICE_RANDOM — Random
PedWait.ATTRACTOR_CHOICE_FREE — Free
PedWait.ATTRACTOR_CHOICE_CUSTOM — Custom -
[Visible if Attractor choice is Custom]
Attractor — location, which will attract pedestrians while they will wait inside the node area.Type: Attractor
Local variables:
T ped — the pedestrian
AreaNode areaNode — the node - 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).
Name: delayType
Type: PedConstants.DelayType
Valid values:
PedWait.DELAY_TIMEOUT — On delay time expiry
PedWait.DELAY_MANUAL — On free() function call -
[Visible if Delay ends On delay time expiry]
Expression evaluated to obtain the waiting time for the pedestrian.Type: double
Local variable: T ped — the pedestrian - Group members leave together
-
[Visible if Delay ends: On delay time expiry]
If selected (true), 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.Name: waitForGroup
Type: boolean
Set new value at runtime: set_waitForGroup(new value) - Delay starts when
-
[Visible if Type is set to Delay]
Defines, when waiting time starts. The following options are available:Pedestrian enters the object — waiting time starts when pedestrian enters the PedWait block;
Pedestrian 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.Name: delayStartsWhen
Type: PedConstants.DelayStartsWhen
Valid values:
PedWait.DELAY_STARTS_SINCE_ENTER_BLOCK — Pedestrian enters the object
PedWait.DELAY_STARTS_SINCE_BEGIN_WAIT — Pedestrian stops at the point
PedWait.DELAY_STARTS_SINCE_MANUAL_CALL — User calls activate() function - Maximum capacity
-
If the checkbox is selected (true), you can limit the number of pedestrians waiting inside the block at the same time.
Name: maximumCapacity
Type: boolean
Set new value at runtime: set_maximumCapacity(new value) - Capacity
-
[Visible if Maximum capacity is not selected]
The maximum number of pedestrians that can wait inside the block at the same time.Name: capacity
Type: int
Set new value at runtime: set_capacity(new value)
Default value: 1
- 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.
Name: targetReachTolerance
Type: double
Set new value at runtime: set_targetReachTolerance(new value)
Default value: 0.25 meters
- On enter
-
Java code executed when the pedestrian enters the block.
Local variable: T ped — the pedestrian
- On begin wait
-
Java code executed when the pedestrian starts waiting.
Local variable: T ped — the pedestrian
- On at exit
-
Java code executed when the pedestrian is ready to exit the block via out port (in the normal way).
Local variable: T ped — the pedestrian
- On exit
-
Java code executed when the pedestrian exits the block via out port (in the normal way).
Local variable: T ped — the pedestrian
- On cancel
-
Java code executed when the pedestrian exits the block via ccl port.
Local variable: T ped — the pedestrian
- On remove
-
Java code executed when a pedestrian is intentionally removed from this block by calling the block's function remove().
Local variable: T ped — the pedestrian
| Function | Description |
|---|---|
| long countPeds() | Returns the 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. |
- 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?
-