AnyLogic
Expand
Font size

PedGroupAssemble

AnyLogic: The PedGroupAssemble block

The PedGroupAssemble block assembles groups from a sequence of pedestrians at the input port. It allows defining multiple criteria for group creation — group size, form, group arrival rate, and pedestrians inter-arrival delay.

Reassembles groups disassembled by PedGroupDisassemble or programmatically: pedestrians wait in the given area and leave it in their original group when the whole group arrives. Groups are reassembled independently and simultaneously, and new groups can be organized from individual pedestrians at the same time.

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

Parameters

Node
The polygonal node or rectangular node where pedestrians will wait for group assembly.
Value type: AreaNode
Local variable: ped — the pedestrian
This block
Choose here whether this block creates groups, or assembles them by matching pedestrians and groups.
Syntax: PedConstants.AssemblingMode assemblingMode
Valid values:
PedConstants.AssemblingMode.BY_CONDITIONS
PedConstants.AssemblingMode.BY_MATCHING
New group is created
[Visible if This block creates groups]
Defines how groups are created: whether a group is created when the specified group size is reached (on size reached), or when the specified timeout expires (on timeout), or when delay between pedestrian arrivals exceeds the specified gap value (on time gap), or the user specifies conditions and add pedestrian to some specific group, for example, when pedestrian and group IDs match (when condition is true).
Syntax: PedConstants.GroupingMode groupingMode
Valid values:
PedConstants.GroupingMode.SIZE_REACHED
PedConstants.GroupingMode.TIMEOUT
PedConstants.GroupingMode.TIME_GAP
Group size
[Visible if New group is created on size reached]
Size of newly created group (number of pedestrians making up one group).
If you leave the default value here, groups containing 2 and 3 pedestrians will be created with equal probabilities.
Value type: int
Default value: uniform_discr( 2, 3 )
Local variable: T leader — the group leader
Timeout
[Visible if New group is created on timeout]
Time given for group creation. When this timeout elapses, the group creation is finished and next group starts forming.
Value type: double
Default value: exponential(300 / hour())
Maximum gap between members
[Visible if New group is created on time gap]
Maximum pedestrian interarrival time, for them to be collected in one group. In case pedestrian interarrival time exceeds this value, new group is created.
Value type: double
Default value: 2 * second()
Matching condition
[Visible if This block assembles groups by matching]
The specified here condition will be evaluated for all groups being currently assembled by this block. If the condition returns true for some group, the pedestrian will join this particular group. The condition may e.g. analyze and match IDs of group and pedestrian. If the condition returns false for all groups being currently selected, new group starts assembling.
Value type: boolean
Local variables:
T ped — the pedestrian
PedGroup group — the group being currently checked
T leader — the leader of the group being currently checked
Is assembly finished
[Visible if This block assembles groups by matching]
If the specified here condition returns true, the group assembly is finished (the current pedestrian will be the last member added to the group).
Value type: boolean
Local variables:
PedGroup group — the group of the current pedestrian
leader — the leader of the current pedestrian’s group
int size — the size of the current pedestrian’s group
Formation
Form of the group: swarm, front, or chain.
Get value: PedConstants.GroupFormation groupFormation
Set new value dynamically: set_groupFormation(new value)
Valid values:
PedConstants.GroupFormation.SWARM — swarm
PedConstants.GroupFormation.CHAIN — chain
PedConstants.GroupFormation.FRONT — front
Behavior in services
Here you can define how the groups of pedestrians created by this block behave while passing the services (if some other behavior is not defined by the service).
All group members are serviced individually — Each member of the group should be serviced individually. The example of such a service: turnstiles.
Only one group member is serviced, others wait in a queue — The example: a family buying cinema tickets at the counter. All the family members wait in a queue to choose the seats together, but only one of them — the head of the family pays and gets serviced. The service in this case should be Service with lines.
Only one group member is serviced, others wait in a waiting area — The example: a tourist group buying museum tickets. The tourists do not wait in the queue, they just wait for their tour guide to buy the tickets for the whole group. The service in this case should be Service with area.
Syntax: PedConstants.ServiceGroupBehaviorType serviceGroupBehavior
Set new value dynamically: set_serviceGroupBehavior(new value)
Valid values:
PedConstants.ServiceGroupBehaviorType.INDIVIDUAL_SERVING - All group members are serviced individually
PedConstants.ServiceGroupBehaviorType.ONE_MEMBER_SERVED_OTHERS_WAIT_IN_QUEUE - Only one member is serviced, others wait in a queue
PedConstants.ServiceGroupBehaviorType.ONE_MEMBER_IS_SERVED_OTHERS_WAIT_IN_AREA - Only one member is serviced, others wait in a waiting area

Actions

On enter
Code executed when a pedestrian enters the block.
Local variable: ped — the pedestrian
On begin grouping
Code is called when the current pedestrian arrived into this block is the leader of the new group (his arrival starts the new group assembly).
Local variables:
leader — the leader of the group
PedGroup group — the group being currently created
On end grouping
Code is called when the current pedestrian arrived into this block is the last member of this group (the next pedestrian will start forming a new group).
Local variables:
leader — the leader of the group.
PedGroup group — the group being currently created.
On exit
Code executed when a pedestrian exits the block in a normal way, via out port.
Local variable: ped — the pedestrian
On cancel
Code executed when a pedestrian exits the block via emergency 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.
long countGroups() Returns the number of created groups (including the group which is currently being created).
int size() Returns the number of pedestrians currently waiting for group assembly (including the pedestrians with disabled groups, if any, which wait for their groupmates).
void cancel(Agent ped) Interrupts command for the specified pedestrian and causes it to exit using ccl port. Setting parameter to null will cause all pedestrians to leave the block via ccl port. The cancelled pedestrian isn’t added to the group. On cancel callback is called for each pedestrian leaving the block.
void cancelAll() Interrupts command for all the pedestrians in this block and causes them to exit using ccl port. On cancel callback is called for each pedestrian leaving the block.

Ports

in

The input port.

out

The output port.

ccl

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

How can we improve this article?