Simulates a conveyor. Moves the agents along a path at a given speed (same for all) preserving a minimum space between them. May be accumulating and not accumulating. Accumulating conveyors do not stop when the agent at the exit point cannot exit, and would continue moving other agents until the conveyor is filled with agents (with minimum space between them). Non-accumulating conveyor would stop if the first agent cannot move further, so spaces between agents do not change on such conveyor. The capacity of the Conveyor is therefore its length divided by space.
Conveyor can be used not only to model real conveyors (in manufacturing applications). But if you wish to model (and animate) independent movement of agents that can possibly overtake each other, you should use Delay object.
Please keep in mind that the behavior at the entry/exit points is a bit different from the real conveyors, which however may only affect the two conveyors connected to each other: Conveyor treats the agents as having zero size and would only keep space between them, whereas in reality agents may have non-zero dimensions and zero space. Therefore when an agent exits the conveyor and enters another conveyor, the first one completely forgets about it and would not notice e.g. if the agent has entered the second conveyor only halfway and then stopped, etc.
The conveyor speed and accumulating parameters may be changed dynamically, in particular you may force the conveyor to stop and launch it again. Please refer to our FAQ to see the implementation example of a conveyor with dynamically changing speed.
The conveyor will let a new agent in if it is moving and the previous agent has moved in at least the space away from the entry. Therefore you may need a buffering object in front of Conveyor, if there is a possibility for the two agents to arrive with the interval less or equal to space/speed.
boolean canEnter() - returns true if a new agent may enter the conveyor.
double distanceFromExit(int index) - returns the distance to the exit for the agent at a given position.
double distanceFromExit(agent) - returns the distance to the exit for the given agent.
T get(int index) - returns the agent at a given position (counted from 0, from the exit). Throws error in case of invalid (or out-of-bounds) index.
double getSpeed(int index) - returns the movement speed of the agent, in the units specified in the block's Speed parameter.
int indexOf(Agent agent) - returns the position index of the given agent (counted from 0, from the exit). Returns -1 if not found.
boolean isMoving() - returns true, if the conveyor is currently moving, false otherwise.
T remove(Agent agent) - removes a given agent from any position on the conveyor. If the agent is not on the conveyor, returns null, otherwise returns the removed agent.
T remove(int index) - removes an agent with the given index from the conveyor. Throws error in case of invalid (or out-of-bounds) index. Returns the removed agent.
void resume() - Resumes movement of conveyor.
void stop() - Stops conveyor.
int size() - returns the number of agents currently being conveyed.
double spaceAhead(int index) - returns space ahead of the agent at a given position (for the first agent this is the distance to the exit).
Iterator<T> iterator() - Returns the iterator over agents (ordering: the first is the nearest to the exit).