AnyLogic
Expand
Font size

Class Elevator<A extends Agent>

All Implemented Interfaces:
AggregatableAnimationElement, HasLevel, IMarkupLibraryDescriptor, LevelElement, LevelMarkup, IElevatorDescriptor<A>, SVGElement, Serializable

public class Elevator<A extends Agent>
extends AbstractLevelMarkup
implements IElevatorDescriptor<A>
See Also:
Serialized Form

Nested Class Summary

Modifier and TypeClassDescription
static interface Elevator.Call<T extends Agent>
Class describing elevator call at certain level

Constructor Summary

ConstructorDescription
Elevator() 
Elevator(Agent owner, ShapeDrawMode drawMode, boolean isPublic, double x, double y, double widthInMeters, double depthInMeters, double cabinHeightInMeters, double lineWidth, double rotation, Paint lineColor, Paint fillColor, boolean drawShaft, ElevatorDoorsConfiguration doorsConfiguration, IElevatorDescriptor<A> descriptor)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. It is public due to technical reasons.

Method Summary

Modifier and TypeMethodDescription
Level[]accessibleLevels()
Returns array of levels, which can be served by elevator
voidaddAccessibleLevels(Level... levels)
Adds levels that can be served by elevator.
voidaddToLevels()
Used when elevator markup is created by code - adds elevator to all its levels as an obstacle and adds shafts.
booleancontains(double px, double py)
Test if the shape contains the point with the given coordinates (relative to this shape's container, i.e.
voiddeleteCallsOnLevel(Level level)
Removes all pickup tasks from the level.
voiddisableDoor(Level level, ElevatorDoor door)
Disables elevator door on the level.
voiddropOffPeds(Collection<? extends Agent> peds)
Starts drop off for the pedestrians in the list.
voidenableDoor(Level level, ElevatorDoor door)
Enables elevator door on the level.
voidfail()
Initiates the elevator's failure.
BoundingRectanglegetBoundingRectangle() 
doublegetCabinHeight(LengthUnits units)
Returns elevator cabin height
doublegetCabinZ() 
List<? extends Elevator.Call<A>>getCalls()
Returns list of elevator calls
intgetCapacity()
Returns the number of pedestrian elevator can transfer at once
ElevatorDirectiongetCurrentDirection()
Returns current movement direction of the elevator.
LevelgetCurrentLevel()
Returns elevator current level.
doublegetDepth()
Returns the depth of the markup shape, in meters.
doublegetDepth(LengthUnits units)
Returns the depth of the markup shape.
ElevatorDoorsConfigurationgetDoorsConfiguration()
Returns elevator doors configuration.
PaintgetFillPaint() 
IElevatorDescriptor<A>getLibraryDescriptor() 
PaintgetLinePaint() 
doublegetLineWidth()
Returns elevator line width (in pixels)
Elevator<A>getMarkup() 
ElevatorMovementModegetMovementMode()
Returns elevator movement mode.
LevelgetNearestLevel()
Returns nearest level level - current level if elevator is not between levels, next level along direction if elevator is moving and closest otherwise.
Set<A>getPeds()
Returns the list of pedestrians that are currently inside elevator
LevelgetPedTargetLevel(Agent ped)
Returns target level of a pedestrian, specified in PedElevator block.
ColorgetPlatformColor()
Returns the platform color of the elevator markup, or null if markup element has no platform color or has textured platform (in this case getPlatformTexture() should be used instead)
TexturegetPlatformTexture()
Returns the platform texture of the elevator markup, or null if markup element has no platform texture (in this case getPlatformColor() should be used instead)
doublegetRotation()
Returns the rotation of the shape.
List<Level>getRoute()
Returns the list of levels which the elevator is going to visit according to current tasks.
List<ElevatorShaft>getShafts() 
doublegetSpeed()
Returns elevator speed.
doublegetSpeed(SpeedUnits units)
Returns elevator speed
ElevatorStategetState()
Returns current elevator state
LevelgetTargetLevel()
Returns target level when the elevator is in manual mode and moving, null otherwise.
doublegetTimePerLevel()
Returns time to move between two neighboring levels
doublegetTimePerLevel(TimeUnits units)
Returns time to move between two neighboring levels
Set<A>getWaitingPeds()
Returns set of pedestrians waiting for elevator on all levels
Set<A>getWaitingPeds(Level level)
Returns set of pedestrians waiting for elevator on the level
ColorgetWallColor()
Returns the wall color of the elevator markup, or null if markup element has no wall color or has textured wall (in this case getWallTexture() should be used instead)
TexturegetWallTexture()
Returns the wall texture of the elevator markup, or null if markup element has no wall texture (in this case getWallColor() should be used instead)
doublegetWidth()
Returns the width of the markup shape, in meters.
doublegetWidth(LengthUnits units)
Returns the width of the markup shape.
doublegetX()
Returns the x coordinate of the markup element.
PointgetXYZ()
Returns coordinates of the markup element.
doublegetY()
Returns the y coordinate of the markup element.
booleanisAllLevels()
Returns true if elevator supposed to serve all levels in owner agent, false otherwise
booleanisDoorEnabled(Level level, ElevatorDoor door)
Returns true if the door on the level is enabled, false otherwise.
booleanisDrawShaft()
Returns true if the elevator's shaft is drawn, otherwise returns false.
booleanisFailed()
Returns true if the elevator failed (broke down) and is not operating, otherwise returns false.
booleanisManualMode()
Returns true if the elevator is in manual mode, false otherwise.
booleanisShaftsInitialized_xjal() 
doublemeanWaitingTime()
Returns mean time (in model time units) pedestrian spent waiting for elevator on all levels
doublemeanWaitingTime(Level level)
Returns mean time (in model time units) pedestrian spent waiting for elevator on specified level
doublemeanWaitingTime(Level level, TimeUnits units)
Returns mean time (in units) pedestrian spent waiting for elevator on specified level
doublemeanWaitingTime(TimeUnits units)
Returns mean time (in units) pedestrian spent waiting for elevator on all levels
doubleminStayTime()
Returns minimum time elevator will spend on the level before moving further.
doubleminStayTime(TimeUnits units)
Returns minimum time elevator will spend on the level before moving further.
voidmoveTo(Level level)
Sends the elevator to specified level.
voidmoveTo(Level level, boolean stayInManualMode)
Sends the elevator to specified level.
intnDroppedOffPeds(Level level)
Returns number of pedestrians elevator dropped off at specified level
intnPickedUpPeds(Level level)
Returns number of pedestrians elevator picked up at specified level
intnTransportedPeds()
Returns number of pedestrians transported by the elevator
voidonArrival(Level level, List<A> waitingPeds)
Calls onArrival() code of the elevator
voidonDeparture(Level level)
Calls onDeparture() code of the elevator
voidonFailed()
Calls onFailed() code of the elevator
voidonRepaired()
Calls onRepaired() code of the elevator
voidonStateChanged(ElevatorState newState)
Calls onStateChanged() code of the elevator.
voidpickUpPeds(Collection<? extends Agent> peds)
Starts pickup for the pedestrians in the list.
voidrepair()
Repairs the elevator.
voidresetStats()
Resets all elevator statistics.
voidsetAllLevels(boolean allLevels)
Sets whether elevator should serve all levels in owner agent
voidsetCabinHeight(double cabinHeight, LengthUnits units)
Sets elevator cabin height
voidsetCapacity(int capacity)
Sets elevator capacity
voidsetDepth(double depth)
Sets the depth of the markup shape.
voidsetDepth(double depth, LengthUnits units)
Sets the depth of the markup shape.
voidsetDoorsConfiguration(ElevatorDoorsConfiguration doorsConfiguration)
Sets elevator doors configuration.
voidsetDrawShaft(boolean drawShaft)
Sets whether elevator's shaft should be drawn.
voidsetLineWidth(double lineWidth)
Sets elevator line width (in pixels)
voidsetManualMode(boolean on)
Changes current mode of the elevator.
voidsetMarkup(Elevator<A> markup) 
voidsetMovementMode(ElevatorMovementMode movementMode)
Sets elevator movement mode.
voidsetPlatformColor(Paint platformColor)
Sets the platform color (or Texture) of the elevator markup.
voidsetRotation(double rotation)
Sets the rotation of the shape.
voidsetSpeed(double speed)
Sets elevator speed.
voidsetSpeed(double speed, SpeedUnits units)
Sets elevator speed.
voidsetTimePerLevel(double timePerLevel)
Sets elevator time per level.
voidsetTimePerLevel(double timePerLevel, TimeUnits units)
Sets time per level.
voidsetWallColor(Paint wallColor)
Sets the wall color (or Texture) of the elevator markup.
voidsetWidth(double width)
Sets the width of the markup shape.
voidsetWidth(double width, LengthUnits units)
Sets the width of the markup shape.
voidsetX(double x)
Sets the x coordinate of the markup element.
voidsetXYZ(double x, double y, double z)
Sets coordinates of the markup element.
voidsetY(double y)
Sets the y coordinate of the markup element.
doubletimeInState(ElevatorState state)
Returns time (in model time units) elevator spent in specified state since model start or since last resetStats() call
doubletimeInState(ElevatorState state, TimeUnits units)
Returns time (in units) elevator spent in specified state since model start or since last resetStats() call
doubletotalTravelTime()
Returns total time (in model time units) elevator was moving since model start or since last resetStats() call
doubletotalTravelTime(TimeUnits units)
Returns total time (in units) elevator was moving since model start or since last resetStats() call
doubleutilization()
Returns the elevator utilization: the fraction of time the elevator was operating.

Methods inherited from class com.anylogic.engine.markup.AbstractLevelMarkup

getDrawMode, getLevel, setLevel

Methods inherited from class com.anylogic.engine.markup.MarkupShape

error, getFullName, getOutsideLevelZ, getPresentable, getSpace, initialize, isClickHandled, isPublic, onClick, remove, setDrawMode, setOwner

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods inherited from interface com.anylogic.engine.markup.AggregatableAnimationElement

initializeInternal, onAggregatorVisibilityChanged, postInitialize

Methods inherited from interface com.anylogic.engine.markup.pedestrian.IElevatorDescriptor

setOwner

Constructor Details

Elevator

public Elevator()

Elevator

@AnyLogicInternalCodegenAPI
public Elevator(Agent owner,
 ShapeDrawMode drawMode,
 boolean isPublic,
 double x,
 double y,
 double widthInMeters,
 double depthInMeters,
 double cabinHeightInMeters,
 double lineWidth,
 double rotation,
 Paint lineColor,
 Paint fillColor,
 boolean drawShaft,
 ElevatorDoorsConfiguration doorsConfiguration,
 IElevatorDescriptor<A> descriptor)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. It is public due to technical reasons.

Method Details

getX

public double getX()
Returns the x coordinate of the markup element.
Returns:
the x coordinate of the markup element

setX

public void setX(double x)
Sets the x coordinate of the markup element.
Parameters:
x - the new value of x coordinate

getY

public double getY()
Returns the y coordinate of the markup element.
Returns:
the y coordinate of the markup element

setY

public void setY(double y)
Sets the y coordinate of the markup element.
Parameters:
y - the new value of y coordinate

getXYZ

public Point getXYZ()
Returns coordinates of the markup element.
Returns:
coordinates of the markup element

setXYZ

public void setXYZ(double x,
 double y,
 double z)
Sets coordinates of the markup element.
Parameters:
x - the new value of x coordinate
y - the new value of y coordinate
z - the new value of z coordinate

getCabinZ

public double getCabinZ()
Specified by:
getCabinZ in interface IElevatorDescriptor<A extends Agent>

getWidth

public double getWidth(LengthUnits units)
Returns the width of the markup shape.
Returns:
the width of the markup shape

getWidth

public double getWidth()
Returns the width of the markup shape, in meters.
Returns:
the width of the markup shape, in meters

setWidth

public void setWidth(double width,
 LengthUnits units)
Sets the width of the markup shape.
Parameters:
width - the new width of the markup shape
units - the units of length

setWidth

public void setWidth(double width)
Sets the width of the markup shape.
Parameters:
width - the new width of the markup shape, in meters

getDepth

public double getDepth(LengthUnits units)
Returns the depth of the markup shape.
Returns:
the depth of the markup shape

getDepth

public double getDepth()
Returns the depth of the markup shape, in meters.
Returns:
the depth of the markup shape, in meters

setDepth

public void setDepth(double depth,
 LengthUnits units)
Sets the depth of the markup shape.
Parameters:
depth - the new depth of the markup shape
units - the units of length

setDepth

public void setDepth(double depth)
Sets the depth of the markup shape.
Parameters:
depth - the new depth of the markup shape, in meters

getRotation

public double getRotation()
Returns the rotation of the shape.
Returns:
the rotation of the shape in radians, clockwise

setRotation

public void setRotation(double rotation)
Sets the rotation of the shape.
Parameters:
r - the new value of rotation in radians

setWallColor

public void setWallColor(Paint wallColor)
Sets the wall color (or Texture) of the elevator markup.
Parameters:
wallColor - the new wall color, null = do not draw the elevator walls

getWallColor

public Color getWallColor()
Returns the wall color of the elevator markup, or null if markup element has no wall color or has textured wall (in this case getWallTexture() should be used instead)
Returns:
the wall color of the elevator markup

getWallTexture

public Texture getWallTexture()
Returns the wall texture of the elevator markup, or null if markup element has no wall texture (in this case getWallColor() should be used instead)
Returns:
the wall texture of the elevator markup

setPlatformColor

public void setPlatformColor(Paint platformColor)
Sets the platform color (or Texture) of the elevator markup.
Parameters:
platformColor - the new platform color, null = do not draw the platform of the elevator markup.

getPlatformColor

public Color getPlatformColor()
Returns the platform color of the elevator markup, or null if markup element has no platform color or has textured platform (in this case getPlatformTexture() should be used instead)
Returns:
the platform color of the elevator markup

getPlatformTexture

public Texture getPlatformTexture()
Returns the platform texture of the elevator markup, or null if markup element has no platform texture (in this case getPlatformColor() should be used instead)
Returns:
the platform texture of the elevator markup

getLinePaint

@AnyLogicInternalAPI
public Paint getLinePaint()

getFillPaint

@AnyLogicInternalAPI
public Paint getFillPaint()

getCapacity

public int getCapacity()
Returns the number of pedestrian elevator can transfer at once
Specified by:
getCapacity in interface IElevatorDescriptor<A extends Agent>
Returns:
the number of pedestrian elevator can transfer at once

accessibleLevels

public Level[] accessibleLevels()
Returns array of levels, which can be served by elevator
Specified by:
accessibleLevels in interface IElevatorDescriptor<A extends Agent>
Returns:
array of levels, which can be served by elevator

getDoorsConfiguration

public ElevatorDoorsConfiguration getDoorsConfiguration()
Returns elevator doors configuration.
Returns:
elevator doors configuration. Valid values are:
  • ELEVATOR_DOORS_FRONT
  • ELEVATOR_DOORS_FRONT_REAR

addAccessibleLevels

public void addAccessibleLevels(Level... levels)
Adds levels that can be served by elevator. Previously added levels will not be removed. Automatically changes "Stops at" to "selected levels"
Specified by:
addAccessibleLevels in interface IElevatorDescriptor<A extends Agent>
Parameters:
levels - - array of levels to add

getLibraryDescriptor

@AnyLogicInternalAPI
public IElevatorDescriptor<A> getLibraryDescriptor()

addToLevels

public void addToLevels()
Used when elevator markup is created by code - adds elevator to all its levels as an obstacle and adds shafts. Should be used after all elevator parameters are set.

getShafts

@AnyLogicInternalAPI
public List<ElevatorShaft> getShafts()

setMarkup

@AnyLogicInternalAPI
public void setMarkup(Elevator<A> markup)
Specified by:
setMarkup in interface IElevatorDescriptor<A extends Agent>

getMarkup

@AnyLogicInternalAPI
public Elevator<A> getMarkup()

contains

public boolean contains(double px,
 double py)
Description copied from class: MarkupShape
Test if the shape contains the point with the given coordinates (relative to this shape's container, i.e. in the same system with the coordinates of this shape, x and y)
Specified by:
contains in class MarkupShape
Parameters:
px - the x coordinate relative to this shape's container
py - the y coordinate relative to this shape's container
Returns:
true if the shape contains the point with the given coordinates

getBoundingRectangle

@AnyLogicInternalAPI
public BoundingRectangle getBoundingRectangle()

getMovementMode

public ElevatorMovementMode getMovementMode()
Returns elevator movement mode.
Specified by:
getMovementMode in interface IElevatorDescriptor<A extends Agent>
Returns:
movement mode. Valid values are:
  • ELEVATOR_MOVEMENT_BY_SPEED
  • ELEVATOR_MOVEMENT_BY_TIME_PER_LEVEL

getSpeed

public double getSpeed()
Returns elevator speed.
Specified by:
getSpeed in interface IElevatorDescriptor<A extends Agent>
Returns:
elevator speed, in meters per second

getSpeed

public double getSpeed(SpeedUnits units)
Returns elevator speed
Parameters:
units - - speed units for returned value
Returns:
elevator speed, in provided units

getTimePerLevel

public double getTimePerLevel()
Returns time to move between two neighboring levels
Specified by:
getTimePerLevel in interface IElevatorDescriptor<A extends Agent>
Returns:
time to move between two neighboring levels, in seconds

getTimePerLevel

public double getTimePerLevel(TimeUnits units)
Returns time to move between two neighboring levels
Parameters:
units - - time units for returned value
Returns:
time to move between two neighboring levels, in units

getCabinHeight

public double getCabinHeight(LengthUnits units)
Returns elevator cabin height
Parameters:
units - the units of cabin height
Returns:
elevator cabin height

setCabinHeight

public void setCabinHeight(double cabinHeight,
 LengthUnits units)
Sets elevator cabin height
Parameters:
cabinHeight - the new elevator cabin height
units - the units of cabin height

getLineWidth

public double getLineWidth()
Returns elevator line width (in pixels)
Returns:
elevator line width (in pixels)

setLineWidth

public void setLineWidth(double lineWidth)
Sets elevator line width (in pixels)
Parameters:
lineWidth - - new elevator line width (in pixels)

setDoorsConfiguration

public void setDoorsConfiguration(ElevatorDoorsConfiguration doorsConfiguration)
Sets elevator doors configuration.
Parameters:
doorsConfiguration - - doors configuration. Valid values are:
  • ELEVATOR_DOORS_FRONT
  • ELEVATOR_DOORS_FRONT_REAR

minStayTime

public double minStayTime()
Returns minimum time elevator will spend on the level before moving further. If loading is not finished after this time, elevator will depart immediately after the loading finished.
Specified by:
minStayTime in interface IElevatorDescriptor<A extends Agent>
Returns:
minimum stay time, in seconds

minStayTime

public double minStayTime(TimeUnits units)
Returns minimum time elevator will spend on the level before moving further. If loading is not finished after this time, elevator will depart immediately after the loading finished.
Parameters:
units - - time units for returned value
Returns:
minimum stay time, in units

isAllLevels

public boolean isAllLevels()
Returns true if elevator supposed to serve all levels in owner agent, false otherwise
Specified by:
isAllLevels in interface IElevatorDescriptor<A extends Agent>
Returns:
true if elevator supposed to serve all levels in owner agent, false otherwise

setCapacity

public void setCapacity(int capacity)
Sets elevator capacity
Specified by:
setCapacity in interface IElevatorDescriptor<A extends Agent>
Parameters:
capacity - - number of pedestrian elevator can transfer at once

setMovementMode

public void setMovementMode(ElevatorMovementMode movementMode)
Sets elevator movement mode.
Specified by:
setMovementMode in interface IElevatorDescriptor<A extends Agent>
Parameters:
movementMode - . Valid values are:
  • ELEVATOR_MOVEMENT_BY_SPEED
  • ELEVATOR_MOVEMENT_BY_TIME_PER_LEVEL

setSpeed

public void setSpeed(double speed)
Sets elevator speed.
Specified by:
setSpeed in interface IElevatorDescriptor<A extends Agent>
Parameters:
speed - - new elevator speed, in meters per second

setSpeed

public void setSpeed(double speed,
 SpeedUnits units)
Sets elevator speed.
Parameters:
speed - - new elevator speed, in units
units - - the units of speed

setTimePerLevel

public void setTimePerLevel(double timePerLevel)
Sets elevator time per level.
Specified by:
setTimePerLevel in interface IElevatorDescriptor<A extends Agent>
Parameters:
timePerLevel - - new time per level, in seconds

setTimePerLevel

public void setTimePerLevel(double timePerLevel,
 TimeUnits units)
Sets time per level.
Parameters:
speed - - new time per level, in units
units - - time units

setAllLevels

public void setAllLevels(boolean allLevels)
Sets whether elevator should serve all levels in owner agent
Specified by:
setAllLevels in interface IElevatorDescriptor<A extends Agent>
Parameters:
allLevels - - true if elevator supposed to serve all levels in owner agent, false if levels specified manually by addAccessibleLevels() method

isDrawShaft

public boolean isDrawShaft()
Returns true if the elevator's shaft is drawn, otherwise returns false.
Returns:
true if the elevator's shaft is drawn, otherwise returns false.

setDrawShaft

public void setDrawShaft(boolean drawShaft)
Sets whether elevator's shaft should be drawn.
Parameters:
drawShaft - - true if elevator's shaft should be drawn, false otherwise

getState

public ElevatorState getState()
Returns current elevator state
Specified by:
getState in interface IElevatorDescriptor<A extends Agent>
Returns:
current elevator state. Valid values are:
  • ELEVATOR_STATE_IDLE
  • ELEVATOR_STATE_LOADING
  • ELEVATOR_STATE_MOVING
  • ELEVATOR_STATE_FAILED

getPeds

public Set<A> getPeds()
Returns the list of pedestrians that are currently inside elevator
Specified by:
getPeds in interface IElevatorDescriptor<A extends Agent>
Returns:
the list of pedestrians that are currently inside elevator

getCurrentDirection

public ElevatorDirection getCurrentDirection()
Returns current movement direction of the elevator. If elevator is not moving, but has movement tasks (to pickup or drop off passengers), return direction of the next task. If there are no tasks for elevator, returns ELEVATOR_DIRECTION_NONE
Specified by:
getCurrentDirection in interface IElevatorDescriptor<A extends Agent>
Returns:
current movement direction of the elevator. Valid values are:
  • ELEVATOR_DIRECTION_UP
  • ELEVATOR_DIRECTION_DOWN
  • ELEVATOR_DIRECTION_NONE

getCurrentLevel

public Level getCurrentLevel()
Returns elevator current level. If elevator is between levels, returns lower level.
Specified by:
getCurrentLevel in interface IElevatorDescriptor<A extends Agent>
Returns:
elevator current level. If elevator is between levels, returns lower level.

getCalls

public List<? extends Elevator.Call<A>> getCalls()
Returns list of elevator calls
Specified by:
getCalls in interface IElevatorDescriptor<A extends Agent>
Returns:
List<Call> - list of elevator calls

getRoute

public List<Level> getRoute()
Returns the list of levels which the elevator is going to visit according to current tasks. Levels are ordered according to elevator order of visits.
Specified by:
getRoute in interface IElevatorDescriptor<A extends Agent>
Returns:
the list of levels which the elevator is going to visit

getWaitingPeds

public Set<A> getWaitingPeds(Level level)
Returns set of pedestrians waiting for elevator on the level
Specified by:
getWaitingPeds in interface IElevatorDescriptor<A extends Agent>
Returns:
Set<Agent> waiting for elevator on the level

getWaitingPeds

public Set<A> getWaitingPeds()
Returns set of pedestrians waiting for elevator on all levels
Specified by:
getWaitingPeds in interface IElevatorDescriptor<A extends Agent>
Returns:
Set<Agent> waiting for elevator on all levels

disableDoor

public void disableDoor(Level level,
 ElevatorDoor door)
Disables elevator door on the level. Overrides initial doors configuration.
Specified by:
disableDoor in interface IElevatorDescriptor<A extends Agent>
Parameters:
level - the level where door should be disabled
door - the door which should be disabled. valid values are:
  • ELEVATOR_DOOR_FRONT
  • ELEVATOR_DOOR_REAR

enableDoor

public void enableDoor(Level level,
 ElevatorDoor door)
Enables elevator door on the level. Overrides initial doors configuration.
Specified by:
enableDoor in interface IElevatorDescriptor<A extends Agent>
Parameters:
level - the level where door should be enabled
door - the door which should be enabled. Valid values are:
  • ELEVATOR_DOOR_FRONT
  • ELEVATOR_DOOR_REAR

isDoorEnabled

public boolean isDoorEnabled(Level level,
 ElevatorDoor door)
Returns true if the door on the level is enabled, false otherwise. Door state is defined by initial doors configuration and by enableDoor(com.anylogic.engine.markup.Level,com.anylogic.engine.markup.ElevatorDoor), disableDoor(com.anylogic.engine.markup.Level,com.anylogic.engine.markup.ElevatorDoor) functions
Specified by:
isDoorEnabled in interface IElevatorDescriptor<A extends Agent>
Parameters:
level - the level
door - the door to check. Valid values are:
  • ELEVATOR_DOOR_FRONT
  • ELEVATOR_DOOR_REAR

fail

public void fail()
Initiates the elevator's failure. The elevator stops working.
Specified by:
fail in interface IElevatorDescriptor<A extends Agent>

repair

public void repair()
Repairs the elevator. The elevator becomes available again.
Specified by:
repair in interface IElevatorDescriptor<A extends Agent>

isFailed

public boolean isFailed()
Returns true if the elevator failed (broke down) and is not operating, otherwise returns false.
Specified by:
isFailed in interface IElevatorDescriptor<A extends Agent>
Returns:
true if the elevator failed and false otherwise

onArrival

public void onArrival(Level level,
 List<A> waitingPeds)
Calls onArrival() code of the elevator
Specified by:
onArrival in interface IElevatorDescriptor<A extends Agent>
Parameters:
level - - arrival level
waitingPeds - - pedestrians waiting for pickup on arrival level

onDeparture

public void onDeparture(Level level)
Calls onDeparture() code of the elevator
Specified by:
onDeparture in interface IElevatorDescriptor<A extends Agent>
Parameters:
level - - current level of the elevator

onFailed

public void onFailed()
Calls onFailed() code of the elevator
Specified by:
onFailed in interface IElevatorDescriptor<A extends Agent>

onRepaired

public void onRepaired()
Calls onRepaired() code of the elevator
Specified by:
onRepaired in interface IElevatorDescriptor<A extends Agent>

resetStats

public void resetStats()
Resets all elevator statistics.
Specified by:
resetStats in interface IElevatorDescriptor<A extends Agent>

timeInState

public double timeInState(ElevatorState state,
 TimeUnits units)
Returns time (in units) elevator spent in specified state since model start or since last resetStats() call
Specified by:
timeInState in interface IElevatorDescriptor<A extends Agent>
Parameters:
state - - elevator state. Valid values are:
  • ELEVATOR_STATE_IDLE
  • ELEVATOR_STATE_LOADING
  • ELEVATOR_STATE_MOVING
  • ELEVATOR_STATE_FAILED
units - - time units for returned value
Returns:
time elevator spent in specified state

timeInState

public double timeInState(ElevatorState state)
Returns time (in model time units) elevator spent in specified state since model start or since last resetStats() call
Specified by:
timeInState in interface IElevatorDescriptor<A extends Agent>
Parameters:
state - - elevator state. Valid values are:
  • ELEVATOR_STATE_IDLE
  • ELEVATOR_STATE_LOADING
  • ELEVATOR_STATE_MOVING
  • ELEVATOR_STATE_FAILED
Returns:
time elevator spent in specified state, in model time units

utilization

public 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].
Specified by:
utilization in interface IElevatorDescriptor<A extends Agent>

totalTravelTime

public double totalTravelTime(TimeUnits units)
Returns total time (in units) elevator was moving since model start or since last resetStats() call
Specified by:
totalTravelTime in interface IElevatorDescriptor<A extends Agent>
Parameters:
units - - time units for returned value
Returns:
total movement time

totalTravelTime

public double totalTravelTime()
Returns total time (in model time units) elevator was moving since model start or since last resetStats() call
Specified by:
totalTravelTime in interface IElevatorDescriptor<A extends Agent>
Returns:
total movement time, in model time units

meanWaitingTime

public double meanWaitingTime(TimeUnits units)
Returns mean time (in units) pedestrian spent waiting for elevator on all levels
Specified by:
meanWaitingTime in interface IElevatorDescriptor<A extends Agent>
Parameters:
units - - time units for returned value
Returns:
mean time (in units) pedestrian spent waiting for elevator on all levels

meanWaitingTime

public double meanWaitingTime()
Returns mean time (in model time units) pedestrian spent waiting for elevator on all levels
Specified by:
meanWaitingTime in interface IElevatorDescriptor<A extends Agent>
Returns:
mean time pedestrian spent waiting for elevator on all levels, in model time units

meanWaitingTime

public double meanWaitingTime(Level level,
 TimeUnits units)
Returns mean time (in units) pedestrian spent waiting for elevator on specified level
Specified by:
meanWaitingTime in interface IElevatorDescriptor<A extends Agent>
Parameters:
units - - time units for returned value
Returns:
mean time (in units) pedestrian spent waiting for elevator on specified level

meanWaitingTime

public double meanWaitingTime(Level level)
Returns mean time (in model time units) pedestrian spent waiting for elevator on specified level
Specified by:
meanWaitingTime in interface IElevatorDescriptor<A extends Agent>
Returns:
mean time pedestrian spent waiting for elevator on specified level, in model time units

nPickedUpPeds

public int nPickedUpPeds(Level level)
Returns number of pedestrians elevator picked up at specified level
Specified by:
nPickedUpPeds in interface IElevatorDescriptor<A extends Agent>
Parameters:
level - - level served by the elevator
Returns:
number of pedestrians elevator picked up at specified level

nDroppedOffPeds

public int nDroppedOffPeds(Level level)
Returns number of pedestrians elevator dropped off at specified level
Specified by:
nDroppedOffPeds in interface IElevatorDescriptor<A extends Agent>
Parameters:
level - - level served by the elevator
Returns:
number of pedestrians elevator dropped off at specified level

nTransportedPeds

public int nTransportedPeds()
Returns number of pedestrians transported by the elevator
Specified by:
nTransportedPeds in interface IElevatorDescriptor<A extends Agent>
Returns:
number of pedestrians transported by the elevator

setManualMode

public void setManualMode(boolean on)
Changes current mode of the elevator. When manual mode is on, elevator will move, pickup and dropoff pedestrians only according to moveTo(), dropOffPeds() calls.
Specified by:
setManualMode in interface IElevatorDescriptor<A extends Agent>
Parameters:
on - - true for turn manual mode on, false otherwise

isManualMode

public boolean isManualMode()
Returns true if the elevator is in manual mode, false otherwise.
Specified by:
isManualMode in interface IElevatorDescriptor<A extends Agent>
Returns:
true if the elevator is in manual mode, false otherwise.

moveTo

public void moveTo(Level level,
 boolean stayInManualMode)
Sends the elevator to specified level. If elevator is in loading state, all pedestrians planned for pick up or drop off will be processed first. Automatically turns on manual mode.
Specified by:
moveTo in interface IElevatorDescriptor<A extends Agent>
Parameters:
level - - target level
stayInManualMode - - if true, elevator will stay in manual mode after reaching targte level. If false, elevator will switch to auto mode on arrival, and will continue to operate.

moveTo

public void moveTo(Level level)
Sends the elevator to specified level. If elevator is in loading state, all pedestrians planned for pick up or drop off will be processed first. Automatically turns on manual mode. On arrival to target level will stay in manual mode.
Parameters:
level - - target level

pickUpPeds

public void pickUpPeds(Collection<? extends Agent> peds)
Starts pickup for the pedestrians in the list. Works only in manual mode. All pedestrians should be on the same level where elevator currently is. Throws error if the elevator is between levels or a pedestrian is not on the same level with the elevator.
Specified by:
pickUpPeds in interface IElevatorDescriptor<A extends Agent>

dropOffPeds

public void dropOffPeds(Collection<? extends Agent> peds)
Starts drop off for the pedestrians in the list. Works only in manual mode. All pedestrians should be inside the elevator. Pedestrians will appear on the level where the elevator is located.
Specified by:
dropOffPeds in interface IElevatorDescriptor<A extends Agent>

getTargetLevel

public Level getTargetLevel()
Returns target level when the elevator is in manual mode and moving, null otherwise.
Specified by:
getTargetLevel in interface IElevatorDescriptor<A extends Agent>
Returns:
target level when the elevator is in manual mode and moving, null otherwise.

deleteCallsOnLevel

public void deleteCallsOnLevel(Level level)
Removes all pickup tasks from the level. Pedestrian will be still waiting for the elevator, use cancel() or remove() to handle them.
Specified by:
deleteCallsOnLevel in interface IElevatorDescriptor<A extends Agent>
Parameters:
level - - level on which all pickup tasks will be removed.

onStateChanged

public void onStateChanged(ElevatorState newState)
Calls onStateChanged() code of the elevator.
Specified by:
onStateChanged in interface IElevatorDescriptor<A extends Agent>

getPedTargetLevel

public Level getPedTargetLevel(Agent ped)
Returns target level of a pedestrian, specified in PedElevator block. If not defined, returns null
Specified by:
getPedTargetLevel in interface IElevatorDescriptor<A extends Agent>
Parameters:
ped - - pedestrian for which target level will be returned.
Returns:
target level of a pedestrian, specified in PedElevator block. If not defined, returns null

getNearestLevel

public Level getNearestLevel()
Returns nearest level level - current level if elevator is not between levels, next level along direction if elevator is moving and closest otherwise.
Specified by:
getNearestLevel in interface IElevatorDescriptor<A extends Agent>

isShaftsInitialized_xjal

@AnyLogicInternalAPI
public boolean isShaftsInitialized_xjal()