AnyLogic
Expand
Font size

PedGroupAssemble

Organizes groups from sequence of pedestrians on input port. Allows defining multiple criteria for groups creation — group size, form, groups arrival rate and pedestrians interarrival delay.

Reassembles groups which have been split 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 also at the same time new groups may be organized from single pedestrians.

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
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.
Get value: assemblingMode
Valid values:
pedGroupAssemble.ASSEMBLING_MODE_BY_CONDITIONS
pedGroupAssemble.ASSEMBLING_MODE_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 e.g. when pedestrian and group IDs match (when condition is true).
Get value: groupingMode
Valid values:
pedGroupAssemble.GROUPING_MODE_SIZE_REACHED
pedGroupAssemble.GROUPING_MODE_TIMEOUT
pedGroupAssemble.GROUPING_MODE_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:
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: groupFormation
Set new value dynamically: set_groupFormation(new value)
Valid values:
pedGroupAssemble.GROUP_FORMATION_SWARM — swarm
pedGroupAssemble.GROUP_FORMATION_CHAIN — chain
pedGroupAssemble.GROUP_FORMATION_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.
Get value: serviceGroupBehavior
Set new value dynamically: set_serviceGroupBehavior(new value)
Valid values:
pedGroupAssemble.SGB_INDIVIDUAL_SERVING
pedGroupAssemble.SGB_ONE_MEMBER_IS_SERVED_OTHERS_WAIT_IN_QUEUE
pedGroupAssemble.SGB_ONE_MEMBER_IS_SERVED_OTHERS_WAIT_IN_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?