AnyLogic
Expand
Font size

Reversible conveyor

Reversible conveyors

Conveyors that can change their movement directions on request have many applications in modeling. Here are just a few:

  • stations located off the main conveyor network, where branch conveyors can ferry the items between these stations and main production flow
  • buffer conveyors that accumulate items off the main conveyors and then put them back into the main production flow

Reversible conveyors are an integral part of the conveyor network. You can include them into routes defined in the Convey block just like common one-direction conveyors.

How to make a conveyor reversible

  1. Select the conveyor that you want to make reversible.
  2. In the properties of this conveyor select the Reversible check-box.

Reversible conveyors are marked with two arrows and a dot between them. In the graphical editor the highlighted arrow and the dot indicate the conveyor's initial direction. During model runtime the arrow that indicates the conveyor's current direction will be highlighted instead.

After conveyor changes direction

Let's take a closer look at what exactly happens when you tell the conveyor to change direction by calling either setDirection() or changeDirection().

  1. If deceleration speed is over 0, the conveyor begins gradual deceleration until its speed of movement reaches 0. If deceleration speed is 0, the conveyor stops at once.
  2. The conveyor's direction changes. The leading edge of every agent (material item) on the conveyor becomes is trailing edge.
  3. On direction changed action code is executed.
  4. AnyLogic cancels the movement tasks of the agents (material items) on this conveyor. The agents leave the corresponding Convey block via the outRedirect port. Here are just a few examples of where these agents can go:
    • another Convey block with a new destination
    • the same Convey block where the route is recalculated
    • ConveyorExit block which takes the agents off the conveyor for further processing elsewhere
  5. If acceleration speed of the conveyor is over 0, the conveyor begins gradual acceleration in the new direction until it reaches its maximum speed. If the acceleration speed is 0, the conveyor reaches the maximum movement speed at once.
  6. If the conveyor is currently stopped or broken, it changes the direction immediately. The leading edge of every agent (material item) on the conveyor becomes is trailing edge. On direction action code is executed. After the conveyor runs again or gets repaired, it starts moving in new direction.

Agent’s behavior

When agent (material item) enters the Convey block, it is placed on the specified conveyor. The placement depends on the conveyor’s direction.

Let's say the block places the agent on the conveyor which initially moves from left to right. The placement of the agent’s leading edge remains the same, while the trailing edge is located:

  • to the left of the leading edge — if the conveyor moves in its initial direction
  • to the right of the leading edge — if the movement is reversed
This will directly affect the output of such functions as getTrailingEdgeOffset() and getTrailingEdgePosition().

Let’s suppose that the item’s leading edge offset from the beginning of conveyor is 10 meters. The item itself is 2 meters long. It means the trailing edge offset is 10 - 2 = 8 meters. After direction reversal, the trailing edge offset will be 10 + 2 = 12 meters.

The orientation (FRONT or REAR) of the material item changes to the opposite one when conveyor changes direction.

If the direction of the conveyor where the agent (material item) must be placed is opposite to the agent's route, the agent waits in the previous block until the conveyor changes direction to acceptable. When the direction changes, the agent enters Convey.

Routing with reversible conveyors

As of now, Convey blocks can use reversible conveyors only in the automatic routing mode. Using reversible conveyors in the Sequence of conveyors routing mode is not supported.

Reversible conveyors in the network may affect the agent’s route. Let’s take a look at possible scenarios.

To calculate the route, the agent uses the current direction of all reversible conveyors in the network.
The route doesn't include the reversible conveyor explicitly
  • If the conveyor's direction fits into the shortest route to target, the agent includes this conveyor.
  • If the conveyor's direction extends the route or doesn't fit any possible route to target at all, the agent avoids this conveyor.
  • If the conveyor's current direction doesn't allow the agent to reach the target and the agent has no other options, the agent builds the route including this conveyor anyway. On arrival to this conveyor, the agent waits until the conveyor's direction changes.
The reversible conveyor is specified in the Include conveyors property of the Convey block
  • The agent ignores the conveyor's current direction and builds the route. On arrival to this conveyor, the agent waits until the conveyor's direction changes.
The source conveyor is reversible
  • The agent starts moving only if the conveyor's direction fits the route. Otherwise, it waits in the current block and doesn't enter the Convey block.
  • If the agent was placed on the reversible conveyor (for example, by the ConveyorEnter block), but the direction of this conveyor doesn’t fit the already-placed agent’s expected route, an error occurs.
The target conveyor is reversible
  • The target is the end of the conveyor: If the conveyor's direction doesn't fit the agent's route, the agent waits in front of this conveyor until the direction changes.
  • The target is an offset or a position on conveyor: The agent builds the shortest route based on the current direction of the conveyor.
If the direction of the conveyor changes after the agent has started moving, the route isn't recalculated automatically. To recalculate the route, use the agent's function conveyTo(). See the Material item API article for details.

Waiting location for agents

When agent has to wait until the direction of the reversible conveyor changes to fit the agent's route, the waiting location depends on two aspects:

  • which element connects the conveyors
  • location of the agent at the moment of the direction reversal

Turntable, Transfer Table, or Turn Station

  • if agent is located on another conveyor, it will wait before the connecting element
  • if the agent is located on the connecting element, it will wait on the element's inner conveyor

Conveyor Point Node

  • if agent is located on another conveyor, it will wait before the connecting element
  • if the agent is located on the connecting element, it means it is already on the reversible conveyor and will be handled accordingly
    When conveyor changes direction while the agent (material item) is located on the conveyor point node between a reversible conveyor and a one-direction conveyor, the agent changes its orientation to the opposite one. It means that the agent's leading edge becomes its trailing edge, and this leading edge is now on the conveyor whose direction is opposite to the agent's route. In this case an error message will appear.
    The same error message will appear if the agent is long enough that its leading edge and trailing edge are located on conveyors that start moving in opposite directions.

Conveyor Spur

  • if agent is at the branch conveyor, it will wait at the branch conveyor before the spur element
  • if the agent is at the main conveyor, it will wait at the main conveyor at the point where this conveyor connects to the spur element
  • if the agent is at the spur element, an error message will appear

Functions

Changing movement direction
Function Description
void changeDirection() Changes the current direction of conveyor. If at the moment of the function call the conveyor was decelerating to change the direction, the previous command to change the direction gets cancelled and the conveyor starts accelerating according to the current function call.
ConveyorDirection getDirection() Returns the current conveyor direction: either CONVEYOR_FORWARD or CONVEYOR_BACKWARD. If at the moment of the function call the conveyor is decelerating to change the direction, still returns its current direction. In case of a non-reversible conveyor, returns CONVEYOR_FORWARD.
void setDirection(ConveyorDirection direction) Defines the direction of conveyor movement by passing one of the following constants as the value of direction argument:
CONVEYOR_FORWARD — items move from the starting point of the conveyor to its end point
CONVEYOR_BACKWARD — items move from the end point of the conveyor to its starting point
If the value of direction argument corresponds to the conveyor’s current direction, there are two possible behaviors after the function call:
  • if the conveyor wasn’t decelerating to reverse its direction, nothing happens and the function is ignored
  • if the conveyor was decelerating to reverse its direction, then the previous command to reverse direction gets cancelled and the conveyor starts to accelerate in the given direction
boolean isChangingDirection() Returns true if the conveyor is decelerating to reverse the direction. Otherwise, returns false. Also returns false for non-reversible conveyors.

Example models

The following simple model demonstrates how the reversible conveyor feature can be used to create accumulation buffers within a conveyor network:

The following model demonstrates how to build custom logic to control an item flow at an intersection with a reversible conveyor:

How can we improve this article?