PedEscalator


Simulates how pedestrians are transported by an escalator, or a travelator. The escalator/travelator itself is drawn graphically with the specific space markup shape escalator group.

Escalator typically transports pedestrians to another level. You do not need to add PedChangeGround block to simulate the "changing ground" operation when pedestrians take escalators, PedEscalator block moves pedestrians to other ground automatically.

Demo model: Escalator

Parameters

Escalators
Here you should choose the space markup shape Escalator Group that graphically defines the escalator(s).
Syntax: EscalatorGroup escalators
Change value
: set_escalators(new value)
Direction [dynamic]
Choose whether the pedestrians take the escalator to go Up, or Down. You can select the option using the radio buttons, or switch to dynamic value editor, and specify the expression that will return one of two valid values depending on some external conditions, or pedestrian attributes.
Local variable: ped - the pedestrian
Valid values: 
       PedEscalator.MOVEMENT_DIRECTION_UP
       PedEscalator.MOVEMENT_DIRECTION_DOWN
Escalator choice policy
Here you can choose whether pedestrians should choose the Closest escalator from the specified escalator group, or there is some Custom rule.
Name: escalatorChoicePolicy
Change value
: set_escalatorChoicePolicy(new value)
Valid values: 
       PedEscalator.CHOICE_CLOSEST
       PedEscalator.CHOICE_CUSTOM
Escalator [dynamic]
[Visible if Escalator choice policy is Custom] Here you can specify expression returning a specific escalator (from the specified Escalators group) the pedestrians will take. The expression will be dynamically reevaluated for each pedestrian. It can return different escalators depending on some external conditions, or pedestrian attributes.
Value type: Escalator
Local variable: ped - the pedestrian
Actions
On enter [code]
Code executed when a pedestrian enters the block.
Local variable: ped - the pedestrian
On exit [code]
Code executed when a pedestrian exits the block via out port (in the normal way).
Local variable: ped - the pedestrian
On cancel [code]
Called when a pedestrian exits the block via ccl port (in emergency case).
Local variable: ped - the pedestrian

Functions

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

long countPeds() - Returns total number of pedestrians passed through this block.

void cancel(Agent ped) - Causes the specified pedestrian to leave the block immediately via ccl port. Applies only if the pedestrian has not entered the escalator yet.

void cancelAll() - Causes all pedestrians who have not entered the escalator to leave the block immediately via ccl port.

boolean contains(Agent ped) - Returns true if the specified pedestrian is currently inside the block, and false otherwise.

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 block "normally" (being successfully transported by escalator).
ccl
The output port for pedestrians leaving the block because of "cancel" event (caused by a call of either cancel or cancelAll function).