Conveyor


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.

Parameters

Length is
Defines how the conveyor length is evaluated: either Specified explicitly or equals the specified path length (Defined by path).
Syntax: boolean lengthDefinedByPath
Default value: false (Specified explicitly)
Length
[Visible only if Length is Specifed explicitly] Length of the conveyor.
Syntax: double length
Default value: 10 m.
Speed
Speed at which the conveyor moves.
Syntax: double speed
Default value: 1 m/s
Accumulating
If false, the conveyor completely stops if the first agent cannot exit it, otherwise it will move other agents until there is no space available.
Syntax: boolean accumulating
Default value:
true
Agent location
path animating this conveyor.
Syntax: Path entityLocation
Advanced
Grab agent from prev. conveyor
Select here the required behaviour: Smoothly, matching speed with preceding conveyor, Instantly, on enter: preceding conveyor releases agent once it is at enter of this one, or Instantly, on full enter: exit of preceding conveyor is frozen until agent fully enters this one.
Get value: grabBehaviour
Default value: Smoothly, matching speed (Conveyor.GRAB_SMOOTHLY)
Change agent length
Select this option if you want to change the legth of the agent.
Syntax:
boolean changeLengthOfEntity
Default value: false
Agent length [dynamic]
[Visible if Change agent length is selected] The legth of the agent.
Value type: double
Default value:
1 m.
Local variable: agent - the agent
Restore agent location on exit
If the option is selected, after being animated in the Agent location shape, the agents will return to their original location (node or path) where they were before entering this block.
Syntax: boolean restoreEntityLocationOnExit
Default value: false
Actions
On enter [code]
Code executed when the agent starts entering the conveyor.
Local variable: agent - the agent
On full enter [code]
Code executed when the agent enters the conveyor completely.
Local variable: agent - the agent
On at exit [code]
Code executed when the agent arrives at the exit of the conveyor (which does not mean it will immediately exit as the object(s) behind the conveyor may be not ready).
Local variable: agent - the agent
On exit [code]
Code executed when the agent starts exiting the conveyor.
Local variable: agent - the agent
On full exit [code]
Code executed when the agent exits the conveyor completely.
Local variable: agent - the agent
On remove [code]
Code executed when the agent is intentionally removed from this block by calling the agent's  function remove(). This code is automatically executed after the remove() function call.
Local variable: agent - the agent

Functions

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

Ports

in
The input port.
out
The output port.