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, area or a point with given coordinates. If the location is area, 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 waiting point, entering the area, or even manually), or until the user manual calls the block function free().

Demo model: Pedestrian Attractors

Parameters

Waiting location
Here you choose whether you define the place where pedestrians wait with a line, point, or area.
Get value: locationType
Change value: set_locationType(new value)
Valid values: PedWait.LOCATION_AREA
           PedWait.LOCATION_LINE
           PedWait.LOCATION_POINT
Area [dynamic]
[ Visible if Waiting location is area ] Area where pedestrians will wait.
Value type: AreaNode
Local variable: ped - the pedestrian
Target line [dynamic]
[ Visible if Waiting location is line ] Target line, where pedestrians will wait.
Value type: TargetLine
Local variable: ped - the pedestrian
X, Y [dynamic]
[ 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 area ] 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
Change value: set_attractorChoice()
Valid values: PedWait.ATTRACTOR_CHOICE_NONE
           PedWait.ATTRACTOR_CHOICE_RANDOM
           PedWait.ATTRACTOR_CHOICE_FREE
           PedWait.ATTRACTOR_CHOICE_CUSTOM
Attractor [dynamic]
[Visible if Use attractors is selectedAttractor - 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  
Change value dynamically:
set_delayType(new value)
Valid values: DELAY_TIMEOUTOn delay time expiry
           DELAY_MANUAL  - On free() function call
Delay time [dynamic]
[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 object - 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   
Change value dynamically:
set_delayStartsWhen(new value)
Valid values: PedWait.DELAY_STARTS_SINCE_ENTER_BLOCK
           PedWait.DELAY_STARTS_SINCE_BEGIN_WAIT
                     PedWait.DELAY_STARTS_SINCE_MANUAL_CALL
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
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
Advanced
Reach tolerance
Defines range, at which ped should enclose to the waiting location to begin waiting.
Syntax: double targetReachTolerance
Default value: 0.25 meters
Actions
On enter [code]
Code executed when the pedestrian enters the object.
Local variable: ped - the pedestrian
On begin wait [code]
Code executed when the pedestrian starts waiting.
Local variable: ped - the pedestrian
On exit [code]
Code executed when the pedestrian exits the object via out port (in the normal way).
Local variable: ped - the pedestrian
On cancel [code]
Code executed when the pedestrian exits the object via ccl port.
Local variable: ped - the pedestrian
On remove [code]
Code executed when a pedestrian is intentionally removed from this block by calling the pedestrian's function remove(). This code is automatically executed after the remove() function call.
Local variable:
ped - the pedestrian

Functions

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 using OUT port. "On exit" callback is called for each pedestrian leaving the block.

void freeAll()- Interrupts command for all pedestrians and causes them to exit using 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 using 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 using 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 object. 

boolean contains(Agent ped) - Returns true if pedestrian is inside the object. 

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 object "normally" after the successful completion of the command.
ccl
The output port for pedestrians leaving the object because of "cancel" event (caused by a call of either cancel or cancelAll function).