AnyLogic
Expand
Font size

PedElevator

AnyLogic: The PedElevator block

The PedElevator block simulates pedestrians being transported by an elevator (lift). The elevator itself is drawn graphically using the special space markup shape: elevator.

The elevator typically transports pedestrians to another level. You do not need to add the PedChangeLevel block to simulate the “changing level” operation when pedestrians take the elevator, the PedElevator block automatically moves pedestrians to another level.

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

Behavior specifics

Behavior at failure

Pedestrians who have entered the block and are currently moving to the elevator will continue their movement and stop nearby it. Waiting can be interrupted by using the block’s cancel(), cancelAll(), or remove() function.

Pedestrians who are currently boarding the elevator will enter the elevator and wait inside. The wait can be interrupted by calling the remove() function, if the pedestrian has crossed the elevator border, or cancel() if not.

Pedestrians inside the elevator remain inside the elevator. They can be released with the remove() function.

Pedestrians who have reached the required level and are waiting for their turn to exit the elevator will exit the elevator and proceed according to their flowchart.

Automatic removal of pedestrians from the block upon the elevator failure is not supported.

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

Behavior at the repair moment

When repaired, an elevator will continue to move in the same direction it was moving before the failure, if any pedestrians in the elevator have requests to move in that direction. If the elevator has no requests and was between floors at the time of failure, it will travel to the nearest level.

Transferring pedestrian groups

If pedestrians waiting for an elevator to arrive are members of a pedestrian group, all group members must board the elevator. If an elevator has arrived and there is room for all members of a group, and some members of the group have already boarded the elevator, the elevator will remain on the floor until all the members have gathered in the waiting area and entered the elevator cabin.

Parameters

Elevator
Here you should choose the space markup shape Elevator that graphically defines the elevator which will be used by pedestrians. It should be set to serve the level where pedestrians are currently located.
Type of value: Elevator
Local variable: ped — the pedestrian
Pedestrian is transferred
Here you can choose the pedestrian transfer mode (how pedestrians will be transferred).
The options are:
automatically — the default option. Pedestrians will be transferred by an elevator automatically, you do not need to setup anything. A pedestrian will leave the elevator when the elevator will reach the target level specified in this block. We advise you to use this transfer mode if the default elevator control system suits you. using elevator API — in this transfer mode pedestrians enter the elevator, leave the elevator, and are transferred by the elevator as the result of calling specific functions of the space markup shape elevator. You may need to switch to the manual control mode only if you require implementing some custom elevator control system.
Possible values:
ElevatorTransferMode.TRANSFER_MODE_AUTOMATIC — automatically
ElevatorTransferMode.TRANSFER_MODE_MANUAL — using elevator API
Default value: ElevatorTransferMode.TRANSFER_MODE_AUTOMATIC — automatically
Local variable: ped — the pedestrian
Target level
[Visible and applies only if the Pedestrian is transferred option is set to automatically]
The level where a pedestrian should be transferred by an elevator. Elevator should be able to serve this level. If the user specifies here the same level where the pedestrian is currently located, the pedestrian will instantly go through the PedElevator block, and will neither call the elevator, nor move to the elevator’s waiting area.
Type of value: Level
Local variable: ped — the pedestrian
Enable exit on timeout
If the option is selected (true), pedestrian's waiting time is limited by the timeout specified in the Timeout property. When the timeout period, set for a pedestrian, elapses, the pedestrian stops waiting and leaves the block through the outTimeout port.
Syntax: boolean enableTimeout
Set new value at runtime: set_enableTimeout(new value)
Timeout
[Visible if the Enable exit on timeout option is enabled]
Expression evaluated to obtain the timeout for the pedestrian. After spending the specified time waiting for the elevator, the pedestrian leaves the block through the outTimeout port.
Type of value: double
Default value: 100 seconds
Local variable: ped — the pedestrian

Actions

On enter
Code executed when a pedestrian enters the block.
Local variable: ped — the pedestrian
On start waiting
Code executed when a pedestrian reaches the point where it will wait for the elevator. If the pedestrian does not stop, the code is not executed.
Local variable: ped — the pedestrian
On enter elevator
Code executed when a pedestrian enters the elevator.
Local variables: ped — the pedestrian
Level level — the level
On exit elevator
Code executed when a pedestrian exits the elevator on the target level.
Local variables: ped — the pedestrian
Level level — the level
On exit
Code executed when a pedestrian exits the block via out port (in the normal way).
Local variable: ped — the pedestrian
On exit (timeout)
[Visible and applies only if the Enable exit on timeout option is set] Code executed when a pedestrian exits the block via outTimeout port upon the specified waiting timeout expiration.
Local variable: ped — the pedestrian
On cancel
Called when the cancel() or cancelAll() function of the block was called, and a pedestrian exits the block via ccl port (in emergency case).
Local variable: ped — the pedestrian
On remove
Called when a pedestrian is intentionally removed from this block by calling the function remove(). This code is automatically executed after the remove() function call.
Local variable: ped — the pedestrian

Functions

Statistics
Function Description
int size() Returns the number of pedestrians inside the block.
int elevatorQueueSize() Returns the number of pedestrians waiting for the elevator inside the block.
long countPeds() Returns total number of pedestrians passed through this block.
long countPedsTimeout() Returns total number of pedestrians that left this block due to timeout expiration.
Pedestrians in the block
Function Description
Set<Agent> getPeds() Returns a non-modifiable collection of pedestrians currently located in this block.
boolean contains(Agent ped) Returns true if the specified pedestrian is currently inside the block, and false otherwise.
Canceling operation / removing pedestrians
Function Description
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 elevator yet, otherwise raises an error.
void cancelAll() Causes all pedestrians to leave the block immediately via ccl port. Applies only if the pedestrians have not entered the elevator yet, otherwise raises an error.
Agent remove(Agent agent) Removes the specified pedestrian from the block (regardless the current phase of the pedestrian's process) and also removes it from it’s current space (or elevator). Returns null if the pedestrian is not inside the block. The removed pedestrian could be added back to the flowchart with the PedEnter 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 the “cancel” event (caused by a call of either cancel() or cancelAll() function).

outT

The output port for pedestrians leaving the block because of timeout expiration.

How can we improve this article?