ElevatorBank.Elevator
Inherits from Object
Description
A class that represents an elevator member of an ElevatorBank.
Properties
bank | A reference to the ElevatorBank associated with this elevator. |
capacity | The total capacity. This value is entered by the user in the elevator bank properties. |
isGoingDown | A boolean telling if the elevator is currently going down. |
isGoingUp | A boolean telling if the elevator is currently going up. |
lastFloorZ | The z location of the floor that the elevator most recently stopped at. |
nextFloorZ | The z location of the floor that the elevator was most recently dispatched to. |
travelDirection | An integer signifying the elevator's current travel direction. 1 means going up, -1 means going down. 0 means the elevator is idle. |
usedCapacity | The currently used capacity, i.e. the sum of the capacity usages of each traveler currently on the elevator. |
Methods
canStop | Returns true if the elevator can stop at the target z location and desired travel direction, given the elevator's current location and travel direction. |
moveToFloor | Tells the elevator to move to the target floor. |
Details
ElevatorBank.Elevator.bank
readonly ElevatorBank bank
Description
A reference to the ElevatorBank associated with this elevator.
ElevatorBank.Elevator.capacity
readonly double capacity
Description
The total capacity. This value is entered by the user in the elevator bank properties.
ElevatorBank.Elevator.isGoingDown
readonly int isGoingDown
Description
A boolean telling if the elevator is currently going down.
ElevatorBank.Elevator.isGoingUp
readonly int isGoingUp
Description
A boolean telling if the elevator is currently going up.
ElevatorBank.Elevator.lastFloorZ
readonly double lastFloorZ
Description
The z location of the floor that the elevator most recently stopped at.
ElevatorBank.Elevator.nextFloorZ
readonly double nextFloorZ
Description
The z location of the floor that the elevator was most recently dispatched to.
ElevatorBank.Elevator.travelDirection
readonly int travelDirection
Description
An integer signifying the elevator's current travel direction. 1 means going up, -1 means going down. 0 means the elevator is idle.
ElevatorBank.Elevator.usedCapacity
readonly double usedCapacity
Description
The currently used capacity, i.e. the sum of the capacity usages of each traveler currently on the elevator.
ElevatorBank.Elevator.canStop()
int canStop( double floorZ , int travelDirection ) |
Parameters
floorZ | The desired z location to stop at. |
travelDirection | The desired travel direction for a request. 1 means going up, -1 means going down, 0 means to ignore desired travel direction. |
Returns
int | 1 if the elevator can stop at the location, 0 otherwise. |
Description
Returns true if the elevator can stop at the target z location and desired travel direction, given the elevator's current location and travel direction.
This method uses several factors to determine whether the elevator can stop at a given location, as follows:
- If the elevator is currently idle, it will always return true.
- If the elevator is not idle, then the desired travel direction must match the elevator's travel direction, and the target z must be "ahead of it" given the elevator's current travel direction. In other words, if the elevator is currently going down, then the target z must be below the elevator's current location. If the elevator is going up, the target z must be above the elevator's current location.
- If the elevator is currently moving, then the target z location must be far enough ahead of the elevator so that the elevator can stop at the target z (given its current speed and deceleration) without going past it.
ElevatorBank.Elevator.moveToFloor()
void moveToFloor( double floorZ ) |
Parameters
floorZ | The desired z location to move to. |
Returns
void | True if the elevator can stop at the location. |
Description
Tells the elevator to move to the target floor.
Since the elevator implements automatic logic for moving between floors, generally you will only use this method in the following situations.
- When the elevator becomes idle (the OnIdle event), you may want to send the elevator to a home location.
- If you want to preempt the elevator's normal behavior, because of some abnormal occurrence.