AnyLogic
Expand
Font size

Elevator

Elevator in the graphical editor

Elevator is the space markup shape which visually defines the elevator in a pedestrian simulation model. You draw elevators in the graphical editor, and configure them (setting the movement speed, accessible levels, etc.) in the shape’s properties. To simulate how pedestrians are transported by elevators, you insert Pedestrian Library block PedElevator in the flowchart.

The location of the elevator door is indicated by an additional line drawn inside the elevator's shape (in the figure above the door is located at the bottom of the shape).

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).

Elevator at model runtime, in 3D animation

Drawing an elevator

We will show how to draw an elevator in the pedestrian simulation model of the new Van Gogh museum entrance in Amsterdam.

The layout of the new museum entrance looks as follows:

New entrance to Van Gogh museum

To draw an elevator

  1. If you are creating a pedestrian simulation model that uses the layout of the simulated building, prior to adding space markup shapes, check that the scale of the layout image in your model corresponds to the scale of the graphical diagram. After that, if the layout image is located in the right place, you may lock it to simplify drawing space markup shapes.
  2. Drag the  Elevator element from the  Space Markup section of the Pedestrian Library palette onto the graphical editor. Place the shape on top of the elevator placeholder in the layout.

  3. Open the Properties of the elevator shape. In the Doors configuration property, specify whether the elevator has doors only on one side (the front option), or on two sides (the front/rear option).
  4. Now check whether the door drawn inside the elevator shape is located at the same side as in the layout. In our case the door in the layout is located on the right side, while in our shape it is located at the bottom, so we should rotate the elevator shape to make them match. To rotate the shape, select the shape with a click, and then drag clockwise the round handle, displayed above the selected shape by default.

  5. Having adjusted the door location, make the shape exactly match the corresponding elevator placeholder in the layout. Zoom In  the graphical editor and turn the grid alignment off by pressing off the Enable/Disable Grid  toolbar button to simplify resizing the shape components that are shown rather small on the diagram in its default zoom. Then select the shape and resize it by dragging the required handles on the shape border. First,

  6. When you have finished adjusting the shape, you can continue configuring it using the shape’s properties. First, let’s define what levels are accessed by this elevator. If the elevator services all levels you have defined in your pedestrian model, leave the default Stops at: all levels option selected. However, if the elevator accesses only some specific levels (e.g. it does not serve the basement/parking level), you should select the Stops at: selected levels option and specify the levels this elevator serves in the Levels control below.
  7. Having finished the setup, you can add the logic of pedestrians transfer by the elevator into your process flowchart composed of Pedestrian Library blocks. For that, add PedElevator block(s) into the flowchart. If in the simulated process the elevator is used several times, add the corresponding number of PedElevator blocks.

Properties

General

Name — The name of the shape. The name is used to refer to this shape from PedElevator block properties, and access the elevator from code.

Ignore — If selected, the shape is excluded from the model.

Visible on upper agent — If selected, the shape is also visible on the upper agent where this agent lives.

Lock — If selected, the shape is locked. Locked shape does not react to mouse clicks — it is impossible to select it in the graphical editor until you unlock it.

Visible — Here you specify whether the shape is visible on animation at model runtime, or not. Using the control, choose yes or no.

Pedestrian type — The type of the pedestrian that is transported by this elevator. If you have created a custom pedestrian type, select its name here to enable easy access to the fields of this type in the actions of this shape. If there are no custom pedestrian types in your model, leave the default Agent value here.

Doors configuration — Defines how many doors the elevator has on each level. Choose one of two possible doors configurations: front (the default configuration, the elevator has one door), or front/rear (two doors located on opposite sides).

Capacity — The maximum number of pedestrians the elevator can transfer.

Movement is defined by — Here you can choose how you want to define the elevator movement speed: directly as speed, or by specifying time per level.

Speed — [Visible and applies if the option Movement is defined by: speed is selected] The movement speed of the elevator.

Time per level — [Visible and applies if the option Movement is defined by: time per level is selected] The time it takes for the elevator to move one level up/down.

Minimum stay time — Minimum time that the elevator must stay at the level when it stops there, before continuing its movement to the next level. If loading and/or unloading is not completed by that time, the elevator will continue to stay at the level until it completes.

Stops at — [Visible and applies if the option Define slope as: angle is selected] — Here you can choose, whether the elevator stops at all levels, or only at selected levels. By default the all levels option is selected, enabling the elevator to stop at all levels defined in this agent type. This option is the most frequently used since usually elevators serve all levels (floors) in the simulated building. However, sometimes some elevator may not serve some specific levels (e.g. parking levels). In this case you you should use the selected levels option and select the levels that are served, in the Levels control below.

Levels — [Visible and applies if the option Stops at: selected levels is selected] — Here you can select the levels that are served by the elevator. Usually all levels exist in the same agent, and you simply select the required levels in the list. However, in some rare cases your model may be decomposed so that levels are defined as separate agents. The following demo model shows how to define levels in such case.

Demo model: Elevator Connecting Floors Defined by Different Agents Open the model page in AnyLogic Cloud. There you can run the model or download it (by clicking Model source files).
Actions

On level arrival — Here you can specify Java code that will be executed each time the elevator stops on a level.
Local variables:
Level level — the level the elevator has arrived to.
List<Agent> waitingAgents — the collection of agents waiting on the level to enter the elevator.

On level departure — Here you can specify Java code that will be executed each time the elevator departs from a level where it had stopped.
Local variable:
Level level — the level the elevator is departing from.

On failed — Here you can specify Java code that will be executed in case of the elevator failure.

On repaired —  Here you can specify Java code that will be executed upon the elevator repair.

On state changed —  Here you can specify Java code that will be executed after the elevator’s state has changed.
Local variable:
ElevatorState newState — the new state of the elevator.
Valid values:
ElevatorState.ELEVATOR_STATE_IDLE
ElevatorState.ELEVATOR_STATE_LOADING
ElevatorState.ELEVATOR_STATE_MOVING
ElevatorState.ELEVATOR_STATE_FAILED

Appearance

Platform color — Color of the elevator’s platform (cabin floor). Choose No fill, if you do not want the platform to be filled with a color.

Wall color — Color of the elevator’s cabin (and if the elevator's shaft is drawn, the shaft color also). The default color is semi-transparent. Choose No fill, if you do not want the elevator’s wall to be filled with a color.

Line width — Width of the line defining the elevator wall (and if the elevator's shaft is drawn, the shaft wall also), in pixels.

Cabin height — Height of the elevator’s cabin. The default value is 3 meters.

Draw shaft — If selected, the elevator’s shaft is drawn. The shaft is drawn in the color specified in the Wall color property.

Position and size

Level — The level where the elevator’s shape belongs to.

X — X-coordinate of the shape.

Y — Y-coordinate of the shape.

Width — Width of the elevator’s shape, in pixels.

Depth — Depth of the elevator’s shape, in pixels.

Rotation — Orientation of the shape.

Advanced

Show in — Here you can choose whether you want the shape to be shown both 2D and 3D animation, or in 2D only, or in 3D only.

Show name — If selected, the shape name is displayed on the graphical diagram.

Elevator control system

The standard control system is implemented, called Selective Collective Operation. It follows two rules:

  • Elevator goes in one direction, and serves all requests on its way, while there are any requests for movement in this direction (either from pedestrians who are already inside the elevator's cabin, and those, who wait for the elevator on levels).
  • When the requests for elevator's movement in its current direction are fulfilled, if there are any requests to move in the opposite direction, the elevator changes its direction and starts movement. If there are no requests, the elevator stops and waits for them.

If a request is placed into the elevator's queue, it will be definitely fulfilled, i.e. the elevator will stop at the level and stay there at least for the specified minimum stay time even if the pedestrian that originated the request is not there (has already left the PedElevator block via the ccl port, or could not enter the block, since the elevator was full).

If a pedestrian failed to enter the elevator since it was full, the request to transfer a pedestrian from this level stays in the elevator's queue.

If you need to implement other control system algorithm, you can switch your elevator to the manual control mode by calling the elevator's and control it using the moveTo(), pickUpPeds() and dropOffPeds() functions. These functions have higher priority than the automatic mode commands to enable user to handle emergency situations.

To switch an elevator to the manual control mode, call its setManualMode() function

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

Defining different door locations on different levels

Usually an elevator has one door. Sometimes (usually in facilities with huge pedestrian throughput, such as airports, stations, etc.) an elevator may have two doors, located on the opposite sides of the elevator cabin. In both cases you can easily set up an elevator in your model by adjusting the Door configuration property of the Elevator element.

However, there is a rare case when different elevator doors open on different levels. In this case you should "tune" your elevator by calling the corresponding functions of the Elevator shape: disableDoor() and enableDoor(). In the Door configuration property, choose the front/rear option and then place the elevator's disableDoor() function call(s), disabling the required doors on the required levels, in the On startup action code of the top-level agent of your model (usually it is Main agent type).

Failure and repair

If required, you can simulate elevator’s failures and repairs.

If required, you can simulate elevator breakdowns and repairs using the corresponding elevator functions failure() and repair() (see the first section of elevator functions below). In the corresponding properties of the elevator in the Actions section, you can specify Java code that should be executed when a breakdown occurs and when the elevator is repaired.

You can explore the approach using the given sample model.

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).

Functions

Failure/repair
Function Description
boolean fail() Initiates elevator failure. The elevator stops working. New pedestrians cannot enter the elevator and the pedestrians that were inside the elevator at the moment of failure remain inside until the elevator is repaired. The function call initiates the On failed action callback.
boolean repair() Repairs the elevator. The elevator becomes available again. Resumes elevator processing (continues to fulfil the queued movement requests in the automatic mode). The function call initiates the On repaired action callback.
boolean isFailed() Returns true if the elevator failed (broke down) and is not operating, returns false otherwise.
Current state and route
Function Description
ElevatorState getState() Returns current elevator state.
Valid values:
ElevatorState.ELEVATOR_STATE_IDLE
ElevatorState.ELEVATOR_STATE_LOADING
ElevatorState.ELEVATOR_STATE_MOVING
ElevatorState.ELEVATOR_STATE_FAILED
ElevatorDirection getCurrentDirection() Returns current movement direction of the elevator. If the elevator is not moving and waits for the pedestrians to leave/enter the elevator, returns direction the elevator will be moving in. If there is no task for the elevator, returns ELEVATOR_DIRECTION_NONE.

Possible return values:
ElevatorDirection.ELEVATOR_DIRECTION_UP
ElevatorDirection.ELEVATOR_DIRECTION_DOWN
ElevatorDirection.ELEVATOR_DIRECTION_NONE
Level getCurrentLevel() Returns the current level of the elevator. If the elevator is located between two levels, the function returns the lower level.
List<Elevator.Call> getCalls() Returns a list of elevator calls in the elevator's queue. Each call stores information about the level, which has sent this request, the requested movement direction (ElevatorDirection.ELEVATOR_DIRECTION_UP or ElevatorDirection.ELEVATOR_DIRECTION_DOWN) and the order of this request in the elevator's queue. The calls are sorted by levels that sent them, from the lowest to the highest level.
List<Level> getRoute() Returns the list of levels the elevator will visit and stop at. The list is formed based on the existing calls: the calls from the levels where pedestrians wait for the elevator, and the calls originated by the pedestrians who are currently inside the elevator and need to move to some specific level. The levels in the list are sorted according to the order in which the elevator will stop at those levels (the first level to stop at is the first item in the list). In the manual control mode, the list contains only one level where the elevator is currently moving to.
Pedestrians
Function Description
Set<Agent> getPeds() Returns the list of pedestrians that are currently inside the elevator.
Set<Agent> getWaitingPeds(Level level) Returns the list of pedestrians waiting for the elevator on the specified level.
Set<Agent> getWaitingPeds() Returns the list of pedestrians waiting for the elevator on all levels.
Level getPedTargetLevel(Agent ped) Returns the target level of a pedestrian, specified in the PedElevator block. If the target level is not specified in the block properties, returns null.

ped — pedestrian, whose target level will be returned
Statistics
Function Description
int nTransportedPeds() Returns the total number of pedestrians transported by the elevator.
double utilization() Returns the elevator utilization: the fraction of time the elevator was operating. The returned elevator utilization value lies in the range [0..1].
double timeInState(ElevatorState state) Returns time (in seconds) the elevator spent in the specified state since the model start or since the last resetStats() function call.

state — the state of the elevator
Valid values:
ElevatorState.ELEVATOR_STATE_IDLE
ElevatorState.ELEVATOR_STATE_LOADING
ElevatorState.ELEVATOR_STATE_MOVING
ElevatorState.ELEVATOR_STATE_FAILED
double timeInState(ElevatorState state, TimeUnits units) Returns time (in specified time units) the elevator spent in the specified state since the model start or since the last resetStats() function call.

state — the state of the elevator
Valid values:
ElevatorState.ELEVATOR_STATE_IDLE
ElevatorState.ELEVATOR_STATE_LOADING
ElevatorState.ELEVATOR_STATE_MOVING
ElevatorState.ELEVATOR_STATE_FAILED
units — a constant defining the time units.
double totalTravelTime() Returns the total time (in seconds) the elevator was moving since the model start (or since the last resetStats() function call).
double totalTravelTime(TimeUnits units) Returns the total time (in specified time units) the elevator was moving since the model start (or since the last resetStats() function call).

units — a constant defining the time units.
double meanWaitingTime() Returns mean time (in seconds) pedestrians spent waiting for the elevator on all levels.
double meanWaitingTime(TimeUnits units) Returns mean time (in specified time units) pedestrians spent waiting for the elevator on all levels.

units — a constant defining the time units.
double meanWaitingTime(Level level) Returns mean time (in seconds) pedestrians spent waiting for elevator on the specified level.

level — the level
double meanWaitingTime(Level level, TimeUnits units) Returns mean time (in specified time units) pedestrians spent waiting for the elevator on the specified level.

level — the level
units — a constant defining the time units.
int nPickedUpPeds(Level level) Returns the total number of pedestrians picked up at the specified level.
int nDroppedOffPeds(Level level) Returns the total number of pedestrians dropped off at the specified level.
void resetStats() Resets all statistics collected for the elevator.
Capacity
Function Description
int getCapacity() Returns the maximum number of pedestrians elevator can transfer at once.
void setCapacity(int capacity) Sets the maximum number of pedestrians elevator can transfer at once.

capacity — new capacity value
Speed, time per level
Function Description
double getSpeed() Returns the speed of the elevator (in meters per second).
double getSpeed(SpeedUnits units) Returns the speed of the elevator (in the units passed via the units argument).

units — one of the AnyLogic speed constants
void setSpeed(double speed) Sets the speed (in meters per second) for the elevator.

speed — new speed value
void setSpeed(double speed, SpeedUnits units) Sets the speed for the elevator (in the units passed via the units argument).

speed — the elevator’s speed
units — one of the AnyLogic speed constants
double getTimePerLevel() Returns time to move between two neighboring levels (in seconds).
double getTimePerLevel(TimeUnits units) Returns time to move between two neighboring levels (in specified units).

units — a constant defining the time units.
void setTimePerLevel(double timePerLevel) Sets the elevator’s time per level - the time the elevator takes to get to the next level (in seconds).

timePerLevel — time elevator takes to get to the next level
void setTimePerLevel(double timePerLevel, TimeUnits units) Sets the elevator’s time per level - the time the elevator takes to get to the next level (in specified time units).

timePerLevel — time elevator takes to get to the next level
units — a constant defining the time units.
Minimum stay time
Function Description
double minStayTime() Returns minimum time (in seconds) the elevator will spend on the level before moving further. If loading is not finished after this time, the elevator will depart immediately when the loading finishes.
double minStayTime(TimeUnits units) Returns minimum time (in specified time units) the elevator will spend on the level before moving further. If loading is not finished after this time, the elevator will depart immediately when the loading finishes.

units — a constant defining the time units.
Manual control mode
Function Description
boolean isManualMode() Returns true, if the elevator is in manual control mode, and false if it is controlled automatically.
void setManualMode(boolean on) Changes the current control mode of the elevator. When the manual mode is on, elevator will move, pickup and dropoff pedestrians only according to moveTo(), pickUpPeds() and dropOffPeds() calls.

on — if true, the manual control mode is set, if false - the automatic
void moveTo(Level level) Sends the elevator to the specified level. Automatically switches the elevator operation mode to the manual mode. If the elevator is currently in the loading state, all pedestrians planned for pick up or drop off will be processed first, and the elevator will start its movement afterwards. On arrival to the target level the elevator will stay in the manual control mode.

level — the target level
void moveTo(Level level, boolean stayInManualMode) Sends the elevator to the specified level. Automatically switches the elevator operation mode to the manual mode. If the elevator is currently in the loading state, all pedestrians planned for pick up or drop off will be processed first, and the elevator will start its movement afterwards. The elevator control mode after the movement completion is set by the user.

level — the target level
stayInManualMode — if true, after the movement, the elevator will stay in the manual control mode, if false - it will switch to the automatic mode
void pickUpPeds(List<Agent> peds) Is used only when the user controls the elevator operation in the manual mode. Starts picking up the pedestrians from the specified list. All the pedestrians in the list should be located on the same level where the elevator currently is at the function call moment. Throws an error if some pedestrian from the specified list is located on a different level, or if the elevator is located between levels.
void dropOffPeds(List<Agent> peds) Is used only when the user controls the elevator operation in the manual mode. Starts drop off for pedestrians in the specified list (makes the pedestrians leave the block via the standard output port out). All the pedestrians in the list should be inside the elevator at the function call moment. On leaving the block, pedestrians are placed on the level where the elevator is currently located.
Level getCurrentLevel() Returns the level where the elevator is currently located. If the elevator is located between levels, returns the lower level.
Level getTargetLevel() Returns the target level where the elevator is currently moving. If the elevator is not moving and does not have any tasks to complete, returns null.
Level getNearestLevel() Returns the nearest level served by the elevator. If the elevator is moving up, returns the next level. If it is going down, returns the current level.
void deleteCallsOnLevel(Level level) Removes all pickup tasks from the level. Pedestrian(s) will still be waiting for the elevator, use cancel() or remove() functions to manage them.

level — the level to remove all pickup tasks for
Doors
Function Description
void disableDoor(Level level, ElevatorDoor door) Disables the specified door at the specified level.

level — the level
door — constant, defining the door to disable: ELEVATOR_DOOR_FRONT, or ELEVATOR_DOOR_REAR
void enableDoor(Level level, ElevatorDoor door) Enables the specified door at the specified level.

level — the level
door — constant, defining the door to enable: ELEVATOR_DOOR_FRONT, or ELEVATOR_DOOR_REAR
boolean isDoorEnabled(Level level, ElevatorDoor door) Checks, whether the specified door at the specified level is enabled or disabled. Returns true, if the door is enabled, and false if the door is disabled.

level — the level
door — constant, defining the door to check: ELEVATOR_DOOR_FRONT, or ELEVATOR_DOOR_REAR
ElevatorDoorsConfiguration getDoorsConfiguration() Returns elevator doors configuration.

Possible return values:
ElevatorDoorsConfiguration.ELEVATOR_DOORS_FRONT
ElevatorDoorsConfiguration.ELEVATOR_DOORS_FRONT_REAR
void setDoorsConfiguration(ElevatorDoorsConfiguration doorsConfiguration) Sets elevator doors configuration.

doorsConfiguration — new doors configuration
Valid values:
ElevatorDoorsConfiguration.ELEVATOR_DOORS_FRONT
ElevatorDoorsConfiguration.ELEVATOR_DOORS_FRONT_REAR
Levels
Function Description
Level getLevel() Returns the level, where this shape is located.
boolean isAllLevels() Returns true if the elevator is set to serve all levels, false otherwise.
void setAllLevels(boolean allLevels) Defines whether the elevator should serve all levels.

allLevels — if true, the elevator is set to serve all levels, if false — only the selected levels
Level[] accessibleLevels() Returns the array of levels that can be served by elevator. The levels stored in the array are sorted according their Z-coordinate. If the elevator serves all levels, the array also contains all levels.
void addAccessibleLevels(Level[] levels) Sets levels that can be served by the elevator. Can be called only before the elevator initialization. When called, switches the elevator to the mode when it serves only the selected levels (isAllLevels() will return false).

levels — array of levels to be served by the elevator
Dimensions
Function Description
double getWidth(LengthUnits units) Returns the elevator cabin width in the specified units.

units — a constant defining the length units.
void setWidth(double width, LengthUnits units) Sets the elevator cabin width in the specified units.

width — a new width value.
units — a constant defining the length units.
double getDepth(LengthUnits units) Returns the elevator cabin depth in the specified units.

units — a constant defining the length units.
void setDepth(double depth, LengthUnits units) Sets the elevator cabin depth in the specified units.

depth — a new depth value.
units — a constant defining the length units.
double getCabinHeight(LengthUnits units) Returns the height of the elevator’s cabin (in specified length units).

units — a constant defining the length units.
void setCabinHeight(double cabinHeight, LengthUnits units) Sets the height of the elevator’s cabin (in specified length units).

width — new height of the cabin.
units — a constant defining the length units.
Position
Function Description
double getX() Returns the X coordinate of the shape.
void setX(double x) Sets the X coordinate of the shape.

x — a new X coordinate.
double getY() Returns the Y coordinate of the shape.
void setY(double y) Sets the Y coordinate of the shape.

y — a new Y coordinate.
Point getXYZ() Returns the (X, Y, Z) coordinates of the elevator.
void setXYZ(double x, double y, double z) Sets the (X, Y, Z) coordinates of the elevator.

x — a new X coordinate.
y — a new Y coordinate.
z — a new Z coordinate.
Rotation
Function Description
double getRotation() Returns the rotation of the shape in radians.
void setRotation(double rotation) Sets the rotation of the shape in radians.

rotation — a new rotation value.
Appearance
Function Description
Color getWallColor() Returns the wall color of the elevator, or null if the elevator has no color or uses a texture (in this case use getWallTexture() to get the elevator’s texture).
Texture getWallTexture() Returns the wall texture of the elevator or null if the elevator has no texture but uses a color (in this case use getWallColor() to get the elevator’s color).
void setWallColor(Paint wallColor) Sets the wall color (or texture) of the elevator.

wallColor — the new wall color
Color getPlatformColor() Returns the fill color of the elevator's platform, or null if the platform has no fill color or has textured fill (in this case getPlatformTexture() should be used instead).
Texture getPlatformTexture() Returns the fill texture of the elevator's platform if it has fill texture, or null if the elevator's platform has no texture but uses a color (in this case use getPlatformColor() to get the platform’s color).
void setPlatformColor(Paint platformColor) Sets the fill color (or Texture) of the elevator's platform.

platformColor — the new fill color, if null, the platform is not filled.
boolean isDrawShaft() Returns true if the elevator’s shaft is drawn, otherwise returns false.
void setDrawShaft(boolean drawShaft) Sets whether elevator’s shaft should be drawn.

drawShaft — visibility of the shaft. If true, the shaft is visible, if false — not visible.
double getLineWidth() Returns the elevator’s line width (in pixels).
void setLineWidth(double width) Sets the elevator’s line width (in pixels).
Visibility
Function Description
void setVisible(boolean v) Sets the visibility of the shape.

v — visibility of the shape. If true, the shape is visible, if false — not visible.
boolean isVisible() Returns the visibility of the shape. If it returns true, the shape is visible, if false — not visible.
Draw mode (2D / 3D)
Function Description
ShapeDrawMode getDrawMode() Returns the drawing mode of the shape (it defines where this shape is drawn: in 2D, 3D or 2D+3D animation).

Valid values:
SHAPE_DRAW_2D3D — show in 2D and 3D animation
SHAPE_DRAW_2D — show in 2D animation only
SHAPE_DRAW_3D — show in 3D animation only
void setDrawMode(ShapeDrawMode drawMode) Sets the drawing mode of the shape (where to draw this shape: 2D, 3D or 2D+3D animation).
This method may be called only once and only for the shape created using the constructor without arguments. The call, which changes the set draw mode, will throw the error.
drawMode — the new draw mode of the shape.
Valid values:
SHAPE_DRAW_2D3D — show in 2D and 3D animation
SHAPE_DRAW_2D — show in 2D animation only
SHAPE_DRAW_3D — show in 3D animation only
Removal
Function Description
void remove() Removes the elevator from the presentation. If the shape is not a part of presentation, the function does nothing.
Removal from the presentation does not necessarily mean removing from the model logic, since logical networks and routes may have been created before the removal and survive it.
How can we improve this article?