This algorithm manages the system of a elevator.