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 a number 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, and you also can programmatically call the inject() method of this object. 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.


Appears at
Here you choose whether you define the place where pedestrians appear with a line, point (x,y), or area.
Get value: locationType
Set new value dynamically: set_locationType()
Valid values: PedSource.LOCATION_LINE
Target line [dynamic]
[ Visible if Appears at line ] Target line, where pedestrians appear.
Value type: TargetLine
Local variable: ped - the pedestrian
Ground [dynamic]
[ Visible if Appears at point (x,y) ] Ground, where pedestrians appear.
Value type: Ground
Local variable: ped - the pedestrian.
X, Y [dynamic]
[ Visible if Target is point (x,y) ] X (Y) coordinate of the point where pedestrians appear. 
Value type: double
Local variable: ped - the pedestrian
Area [dynamic]
[ Visible if Appears at area ] Area 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 valuearrivalType
Set new value dynamically: set_arrivalType()
Default value: PedSource.RATE
Valid values:  PedSource.RATE
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 [dynamic]
[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 [dynamic]
[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 object 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
New pedestrian [dynamic]
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 [dynamic]
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 [dynamic]
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 [dynamic]
Diameter of the pedestrian.
Value type: double
Default value: uniform(0.4, 0.5) meter
Local variable: ped - the pedestrian.
Create groups
If the checkbox is selected, this block will create groups of pedestrians.
Syntax: boolean createGroups
Group size [dynamic]
[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 [dynamic]
[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  Change value: set_groupFormation(new value)
Valid values: 
Group behavior in services
[Visible if Create groups is selected]  Here you can define how the groups of pedestrians created by this object 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. The waiting area in this case is defined with PedArea object.
Get value: serviceGroupBehavior  Change value: set_serviceGroupBehavior(new value)
Valid values: PedSource.SGB_INDIVIDUAL_SERVING
Cancelling a ped 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
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 [dynamic]
[Visible if Add pedestrian to: custom population] The name of the population to add pedestians to.
Local variable: ped - the pedestrian.
On exit [code]
You can type here code to be executed when a pedestrian exits the block.
Local variable: ped - the pedestrian.
On begin grouping [code]
You can type here code executed when the first member of a new group enters the object.
Local variables: PedGroup group - the ped group
- the leader of the group
On end grouping [code]
You can type here code executed when the group assembly is finished.
Local variables: PedGroup group - the ped group
- the leader of the group


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 inject() function calls generation mode is chosen.

long countPeds() - Returns total number of pedestrian arrivals.

long countGroups() - Returns number of created groups (including the group which is currently being created).

int size() - Returns the number of pedestrians in this block. 


The output port.