AnyLogic
Expand
Font size

PedSource

Generates pedestrians. Is usually used as a starting point of the pedestrian flow. Can produce pedestrians of a custom pedestrian type with arbitrary flow intensity.

This block also can be used to generate groups of pedestrians. Allows defining multiple criteria for groups creation — group size, form, groups arrival rate, pedestrian interarrival delay, etc.

There are multiple of ways to define when and how many pedestrians (or groups of pedestrians) should be generated. You can use:

  • arrival rate (and change it dynamically by calling set_rate())
  • interarrival time
  • rate defined by a schedule
  • schedule of exact arrival times and quantities
  • inject() method of this block

For example, a Poisson steam of arrivals can be implemented by choosing arrivals with a certain rate, or by specifying the exponentially distributed interarrival time.

You can also set the number of pedestrians in each arrival and limit the total number of arrivals.

If interarrival time is used and it occasionally evaluates to infinity, the PedSource stops generating pedestrians and will never resume. If rate is used and it becomes 0, no next arrival will be scheduled until the rate changes to a positive value.

To generate pedestrians with custom animation or attributes, create a new pedestrian type and select it in the New pedestrian parameter.

Parameters

Appears at
Here you choose whether you define the place where pedestrians appear with a line, point (x,y), or node.
Get value: locationType
Valid values:
PedSource.LOCATION_LINE — Target line
PedSource.LOCATION_POINT — Point with the given coordinates in the modeled environment
PedSource.LOCATION_NODE — Rectangular node or Polygonal node
Target line
[Visible if Appears at line]
Target line, where pedestrians appear.
Value type: TargetLine
Local variable: ped — the pedestrian
Level
[Visible if Appears at point (x,y)]
Level, where pedestrians appear.
Value type: Level
Local variable: ped — the pedestrian
X, Y
[Visible if Target is point (x,y)]
X (Y) coordinate of the point where pedestrians appear.
Value type: double
Local variable: ped — the pedestrian
Node
[Visible if Appears at node]
Rectangular node or polygonal node where pedestrians appear.
Value type: AreaNode
Local variable: ped — the pedestrian
Arrive according to
Specifies the mode of pedestrians (or groups of pedestrians, if the Create groups option is selected) generation. The available modes are:
Rate — pedestrians are generated at the specified arrival rate (which is equivalent to exponentially distributed interarrival time with mean = 1/rate).
Interarrival time — the time between two subsequent ped arrivals is defined by the specified expression (use this option to generate pedestrians with e.g. regular intervals or with non-exponential interarrival times).
Rate schedule — pedestrians are generated using rate schedule — a schedule defining how the arrival rate changes with time.
Arrival schedule — pedestrians are generated using arrival schedule — a schedule defining how many pedestrians should be generated at particular moments of time.
Calls of inject() function — pedestrians are not generated automatically and are only generated on calls of inject() method.
Get value: arrivalType
Set new value dynamically: set_arrivalType()
Default value: PedSource.RATE
Valid values:
PedSource.RATE
PedSource.INTERARRIVAL_SCHEDULE
PedSource.RATE_SCHEDULE
PedSource.ARRIVAL_SCHEDULE
PedSource.MANUAL
Arrival rate
[Visible if Arrive according to: Rate]
Rate of pedestrian (or groups of pedestrians, if the Create groups option is selected) arrivals in terms of pedestrians (groups) per selected time unit.
Syntax: double rate
Default value: 1000 per hour
Interarrival time
[Visible if Arrive according to: Interarrival time]
Expression used to evaluate the interarrival time for each pedestrian (or a group of pedestrians, if the Create groups option is selected) in distribution based generation mode.
Value type: double
Rate schedule
[Visible if Arrive according to: Rate schedule]
The name of the schedule defining how the arrival rate of pedestrians (or groups of pedestrians, if the Create groups option is selected) changes with time.
Syntax: Schedule rateSchedule
Modify rate
[Visible if Arrive according to: Rate schedule]
If selected, you can modify the rate value from the rate schedule with the expression specified in the field below Rate expression.
Syntax: boolean modifyRate
Rate expression
[Visible, if Modify rate is enabled]
Here you can specify the expression to modify rate. The current rate schedule value is available as baseRate.
Value type: baseRate
Local variable: double baseRate — rate schedule value
Arrival schedule
[Visible if Arrive according to: Arrival schedule]
The name of the schedule defining how many pedestrians (or groups of pedestrians, if the Create groups option is selected) should be generated at particular moments of time.
Syntax: Schedule<Integer> arrivalSchedule
Limited number of arrivals
If the checkbox is selected (true), the number of pedestrians (or groups of pedestrians, if the Create groups option is selected) generated by this block is limited with the Maximum number of arrivals.
Syntax: boolean limitArrivals
Maximum number of arrivals
[Visible if Limited number of arrivals is selected]
The maximum number of pedestrian (or groups of pedestrians) arrivals.
Syntax: int maxArrivals

Pedestrian

New pedestrian
Type of pedestrian to generate. If you want to generate pedestrians with custom animation or attributes, create a custom pedestrian type, and set this PedSource generate pedestrians of this type by selecting the pedestrian type name from this list.
Default value: Agent
Comfortable speed
Speed which is comfortable for the pedestrian. In the absence of external factors pedestrian will move with this speed.
Value type: double
Default value: uniform(0.5, 1) meters per second
Local variable: ped — the pedestrian
Initial speed
Initial speed of the pedestrian in meters/second.
Value type: double
Default value: uniform(0.3, 0.7) meters per second
Local variable: ped — the pedestrian
Diameter
Diameter of the pedestrian. Defines how wide are people generated by the block. The value defines the diameter of the default pedestrian’s animation shape (which is shown if you have not specified any custom pedestrian type with custom animation in the New pedestrian property).
In pedestrian movement algorithm calculations, this value represents the width of the pedestrian. The default value (40-50 centimeters) corresponds to the average shoulder width, so we strongly recommend you avoid changing it. If you set a significantly higher value, the pedestrians will be unable to fit into doors, serpentine queues, and so on, and the model will quit with an error.
Value type: double
Default value: uniform(0.4, 0.5) meter
Local variable: ped — the pedestrian

Groups

Create groups
If the checkbox is selected, this block will create groups of pedestrians.
Syntax: boolean createGroups
Group size
[Visible if Create groups is selected]
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
Interarrival time of group members
[Visible if Create groups is selected]
Interarrival time between pedestrians making up one group.
Value type: double
Group formation
[Visible if Create groups is selected]
Formation of the group: swarm, front, or chain.
Get value: groupFormation
Set new value dynamically: set_groupFormation(new value)
Valid values:
pedSource.GROUP_FORMATION_SWARM — swarm
pedSource.GROUP_FORMATION_CHAIN — chain
pedSource.GROUP_FORMATION_FRONT — front
Group behavior in services
Visible if Create groups is selected]
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 Service with lines shape).
All group members are serviced individually — Each member of the group should be serviced individually. The example of such a service: turnstiles.
Only one 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.
Only one 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.
Get value: serviceGroupBehavior
Set new value dynamically: set_serviceGroupBehavior(new value)
Valid values:
pedSource.SGB_INDIVIDUAL_SERVING - All group members are serviced individually
pedSource.SGB_ONE_MEMBER_SERVED_OTHERS_WAIT_IN_QUEUE - Only one member is serviced, others wait in a queue
pedSource.SGB_ONE_MEMBER_IS_SERVED_OTHER_WAIT_IN_AREA - Only one member is serviced, others wait in a waiting area
Cancelling a pedestrian cancels the group
[Visible if Create groups is selected]
If the checkbox is selected (true), canceling command for one pedestrian will cancel it for all pedestrians from his group.
Syntax: boolean solidCancelling

Advanced

Add pedestrian to
Here you specify where the pedestrians created by this block will be stored: in the default population of root agent, or in some custom population (specified below in the Population property). The default population (Java collection of type AgentList<Agent> ) contained in the top-level agent can be accessed with the function getDefaultPopulation().
Syntax: boolean addToCustomPopulation
Population
[Visible if Add pedestrian to: custom population]
The name of the population to add pedestrians to.
Local variable: ped — the pedestrian

Actions

On exit
You can type here code to be executed when a pedestrian exits the block.
Local variable: ped — the pedestrian
On begin grouping
You can type here code executed when the first member of a new group enters the block.
Local variables:
PedGroup group — the pedestrian group
leader — the leader of the group
On end grouping
You can type here code executed when the group assembly is finished.
Local variables:
PedGroup group — the pedestrian group
leader — the leader of the group

Functions

Function Description
void inject() Inserts a single pedestrian/group (depending on the mode of this block) into simulated environment. Is applicable only when Calls of inject() function generation mode is chosen.
void inject(int count) Inserts the specified number (n) of pedestrians/groups (depending on the mode of this block) into simulated environment. Is applicable only when Calls of inject() function generation mode is chosen.
long countPeds() Returns total number of pedestrian arrivals.
long countGroups() Returns the number of created groups (including the group which is currently being created).
int size() Returns the number of pedestrians in this block.

Ports

out

The output port.

How can we improve this article?