AnyLogic
Expand
Font size

Conveyor

Conveyor is the space markup shape that graphically defines a conveyor. To simulate how conveyors transport material items, use the AnyLogic Material Handling Library blocks Convey, ConveyorEnter, and ConveyorExit.

A single conveyor automatically composes a conveyor network that you can extend by connecting more conveyors together. In the conveyor network, material items always move along the shortest route from the origin to the destination.

Conveyor starts moving with the defined initial speed and accelerates to the defined maximum speed. This maximum speed is sustained until conveyor stops.

Conveyors can serve as obstacles on the way of pedestrians and transporters moving in free space navigation mode.

Conveyor knows about all material items that it transports, and you can obtain them using the conveyor API.

Movement direction

By default, conveyor transports material items from its starting point its end point. The starting point is the point of the conveyor you draw first.

The direction of the conveyor is indicated by arrows displayed on the conveyor shape.

AnyLogic: The reversible conveyor in the graphical editorHighlighted arrows indicate the conveyor’s direction

To change the direction of the conveyor

  1. Right-click the conveyor in the graphical diagram and choose Change Direction from the context menu. You will see that the arrows on the conveyor changed their directions.
You can change the conveyor's movement dynamically during model run, using the corresponding API. For details on how this works, refer to the Reversible conveyor article.

Conveyor types

By default, the conveyors in AnyLogic are roller conveyors, but if necessary you can set it to be of any available type:

  • Roller — It is an accumulating type of a conveyor. If an item stops on it, the rollers will keep on rolling, bringing all the preceding items to the one that stopped. This way a line of items forms on the conveyor. The Gap parameter defines how close the material items can get to each other. If the Gap is set to 0, collisions are inevitable.
  • Belt — It is a non-accumulating type of a conveyor. If an agent is stopped, the whole conveyor stops to prevent collision of material items. The distance between the items is defined by the Gap parameter.
  • Fixed cell — It is not an accumulating type of a conveyor. The conveyor is a succession of cells of specified size. Material item is placed inside the conveyor cell. One conveyor cell can contain only one material item. The Gap parameter defines the distance between the conveyor cells. If an agent is stopped, the whole conveyor stops.
Demo model: Cross Belt Conveyor Open the model page in AnyLogic Cloud. There you can run the model or download it (by clicking Model source files).

Drawing a conveyor

To draw a conveyor

  1. Double-click the  Conveyor element in the  Space Markup palette. The icon of the element should turn into . It means that the drawing mode is activated and now you can draw conveyor in the graphical editor point by point.
  2. Click in the graphical editor to draw the first point of the conveyor. Do more clicks to add more points.
  3. To draw a curved segment, press the left mouse button at the conveyor’s next turning point, move the mouse with the left mouse button being pressed until you get the segment of the required shape. Release the mouse button when finished adjusting the form of the conveyor segment.
  4. Put the final point of the conveyor with the double-click.

Conveyor may contain any number of linear and/or curved segments. You can continue drawing the conveyor after you finished it with the double-click, and edit the conveyor by making segments linear or curved.

To connect two conveyors

  1. Draw the first conveyor by double-clicking  Conveyor in the  Space Markup palette, then adding the starting point of the conveyor with a mouse click, and finally placing the final point of the conveyor with a double-click.
  2. In the same way start drawing the second conveyor. Place its starting point in the empty spot of the graphical editor nearby the first conveyor.
  3. Drag your mouse over the first conveyor. When moving the mouse over the certain points of conveyor, you will see cyan points indicating that connection is possible.
  4. Put the final point of the conveyor with the double-click. The two conveyors will connect and a new markup element will be created in the point of connection. The type of a new element depends on the type of connection you made:
    • Conveyor spur — demands connection at any angle.
    • Point node — demands connection of two conveyors, forming a straight line.

Properties

General

Name — The name of the conveyor. The name is used to identify and access the conveyor from code and flowchart blocks properties.

Ignore — If selected, the conveyor is excluded from the model.

Visible on upper agent — If selected, the conveyor is also visible on the upper agent where this agent lives.

Lock — If selected, the conveyor is locked. Locked shapes do not react to mouse clicks — it is impossible to select them in the graphical editor until you unlock them.

Visible — Here you specify whether the shape is visible on animation at model runtime, or not. Using the control, choose yes or no.

Material item type — The type of the material item that is transferred by this conveyor. Do not change the material item type at any type of stations, turntable, or turn station, since the conveyor expects items of the same type after these markup elements.

Is obstacle — If selected, this conveyor will be considered an obstacle for pedestrians and transporters moving in free space mode.

Type — The type of the conveyor: Roller, Belt or Fixed cell.

Reversible — Select this check-box if you want this conveyor to change direction of its movement in response to specific functions call.

Maximum speed — The maximum speed of the conveyor. The value must be non-negative. If both the maximum speed and the initial speed are equal to zero, the conveyor will not start movement. Conveyor will only start accelerating when positive maximum speed is assigned to it by calling the setMaxSpeed(double speed, SpeedUnits units) method.

Initial speed — The initial speed of the conveyor. It must be >=0. If initial speed is less than maximum speed, the conveyor will start accelerating to its maximum speed.

Acceleration — The acceleration of the conveyor.

Deceleration — The deceleration of the conveyor.

Cell size — [Visible and applies only if Type is set to Fixed cell] The size of the cell on the fixed cell conveyor.

Gap — The minimum required gap between the material items on this conveyor (or cells if it is the Fixed cell conveyor type).

Priorities

Maximum priority — If selected, this conveyor has the highest priority over any conveyors connected to it.

Priority — [Visible and applies only if the Maximum priority property is not selected] Sets the priority of this conveyor on the current connection. The priority does not apply to the whole conveyor network. If required, priority should be defined for each connection.
If the connection is executed with the help of a transfer table or a turntable, the conveyor with a greater value specified in this parameter has a higher priority over other conveyors with specified Priorities.

Actions

In most of these actions you can access the current material item as the local variable agent.

The agents variable refers to all items that are located on conveyor at the moment when it changes direction.

On leading edge enter — Here you can type Java code that will be executed when the leading edge of the material item enters the conveyor.

runsForward — true, if the conveyor moves in default direction (from starting point to end point). Otherwise, false.

On trailing edge enter — Here you can type Java code that will be executed when the trailing edge of the material item enters the conveyor.

runsForward — true, if the conveyor moves in default direction (from starting point to end point). Otherwise, false.

On leading edge exit — Here you can type Java code to be executed at the moment the leading edge of the material item exits the conveyor.

runsForward — true, if the conveyor moves in default direction (from starting point to end point). Otherwise, false.

On trailing edge exit — Java code to be executed when the trailing edge of the material item exits the conveyor.

runsForward — true, if the conveyor moves in default direction (from starting point to end point). Otherwise, false.

On started — Here you can type Java code that will be executed when the conveyor starts movement as the result of either the conveyor’s run() function call or conveyor repair.

On stopped — Here you can type Java code that will be executed when the conveyor either stops as the result of either the conveyor’s stop() function call or the conveyor failure.

On failed — Here you can type Java code that will be executed at the moment of the conveyor failure.

On repaired — Here you can type Java code that will be executed at the moment of the conveyor repair.

On direction changed — Here you can type Java code that will be executed at the moment when the conveyor changes direction.

Appearance

Line color — The conveyor color.

Draw stands — If selected, conveyor stands will be drawn in 3D mode. Stands are drawn to the conveyor from the absolute Z-coordinate of the level where the conveyor is located or from level’s Z.

... from level’s Z — [Visible and applies only if the Draw stands property is selected] Defines the Z level from which the stands will be drawn, where 0 is the absolute Z-coordinate of the level where this conveyor is located.

Position and size

X — X-coordinate of the conveyor’s start point.

Y — Y-coordinate of the conveyor’s start point.

Z — [Enabled if Show in: 2D and 3D or 3D only options are selected] Z-coordinate of the conveyor’s start point. On connecting to another conveyor with already specified Z-height, this value will automatically match the Z-coordinate value of that conveyor.

Width — The width of the conveyor. The new value will affect the shape of the markup elements located on this conveyor.

Points

The table located in the Points property section enables users to view and adjust coordinates of the conveyor turning points.

Here you define relative coordinates, not the absolute ones. The first point always has coordinates (0, 0, 0) that cannot be changed.

Other rows of the table define relative coordinates of the successive points. Coordinates of each point are actually offsets of the corresponding point from the start point along X, Y (and optionally Z) axes correspondingly.

Advanced

Show in — Here you can choose whether you want the shape to be shown both in 2D and 3D animation, or in 2D only, or in 3D only.

Show name — If selected, the shape name is displayed on the graphical diagram.

Functions

You can dynamically modify the conveyor properties at model runtime using the following API.

Control, speed
Function Description
boolean isStopped() Returns true if the conveyor is currently stopped, false otherwise.
void stop() Stops the conveyor.
void run() Launches the conveyor.
double getCurrentSpeed(SpeedUnits units) Returns the current speed of the conveyor in the specified speed units.

units — a constant defining the speed units.
double getMaxSpeed(SpeedUnits units) Returns the maximum speed of the conveyor in the specified speed units.

units — one of the speed unit constants.
double setMaxSpeed(double speed, SpeedUnits units) Sets the new maximum speed of the conveyor in the specified speed units.

speed — a new maximum speed value.
units — a constant defining the speed units.
double getInitialSpeed(SpeedUnits units) Returns the initial speed of the conveyor in the specified speed units.

units — a constant defining the speed units.
Acceleration, deceleration
Function Description
double getAcceleration(AccelerationUnits units) Returns the acceleration of the conveyor in the specified acceleration units.

units — one of the acceleration unit constants.
double setAcceleration (double acceleration, AccelerationUnits units) Sets the new acceleration for the conveyor in the specified acceleration units.

acceleration — the new acceleration value.
units — one of the acceleration unit constants.
double getDeceleration(AccelerationUnits units) Returns the deceleration of the conveyor in the specified acceleration units.

units — one of the acceleration unit constants.
double setDeceleration(double deceleration, AccelerationUnits units) Sets the new deceleration for the conveyor in the specified acceleration units.

deceleration — the new deceleration value.
units — one of the acceleration unit constants.
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 was not 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.
Level
Function Description
Level getLevel() Returns the level on which this conveyor is located.
Obstacle
Function Description
boolean isObstacle() Returns true if this conveyor is considered an obstacle by pedestrians and transporters moving in free space mode. Otherwise, returns false.
void setObstacle(boolean isObstacle) Sets this conveyor as an obstacle for pedestrians and transporters moving in free space mode.

isObstacle — if true, the conveyor is set as an obstacle. Otherwise, not.
Conveyor and network
Function Description
ConveyorType getType() Returns the type of this conveyor.

Valid values:
CONVEYOR_TYPE_ROLLER
CONVEYOR_TYPE_BELT
CONVEYOR_TYPE_CELL
boolean isAccumulating() Returns true if the conveyor can accumulate objects, false otherwise.
boolean isMaximumPriority() Returns true if the conveyor has the maximum priority.
ConveyorNode getSource() Returns the source node of the conveyor. The source node is the beginning of the conveyor.
ConveyorNode getTarget() Returns the target node of the conveyor. The target node is the end of the conveyor.
ConveyorNode getOtherNode() Returns the second (other) node of the conveyor.
ConveyorNetwork getNetwork() Returns the network the conveyor belongs to.
Network ports
Function Description
NetworkPort createPort(PathEndType endType) Creates a network port at the starting or the ending point of the conveyor, depending on the argument value.

endType — Specifies whether the port should be created at the conveyor’s starting or ending point. Possible values: PathEndType.BEGIN, PathEndType.END.
NetworkPort createPort(PathEndType endType, NetworkPort pairedPort) Creates a network port at the starting or the ending point of the conveyor, depending on the argument value. The resulting port will be paired with the specified port in another network.

endType — Specifies whether the port should be created at the conveyor’s starting or ending point. Possible values: PathEndType.BEGIN, PathEndType.END.
pairedPort — A network port that belongs to another network.
When a network port is created programmatically, it can only be paired with ports created the same way. To create a connection between ports you’ve created in the graphical editor, use their properties.

Gaps
Function Description
double getGap(LengthUnits units) Returns the minimum required gap between material items of this conveyor (in the specified length units).

units — one of the length unit constants.
Agents
Function Description
int size() Returns the number of agents currently being conveyed.
List<T> getAgents() Returns the list of agents (material items) that are currently conveyed, returns null if none.
boolean contains(Agent agent) Returns true if the conveyor currently contains the specified agent, false otherwise.

agent — the agent.
T getAgent(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.

index — the index of the agent.
T getAgent(double offset, LengthUnits units) Returns the agent that is located at a given offset distance (in specified length units) from the conveyor’s starting point.

offset — offset (non-negative value, should be less or equal to the conveyor length).
units — a constant defining the length units.
List<T> getAgents(double offset, double length, LengthUnits units) Returns agents that are located on specified segment of the conveyor. This segment starts at the given offset distance (in specified length units) from the conveyor’s starting point.

offset — offset (non-negative value, should be less or equal to the conveyor length).
length — length of the conveyor’s segment.
units — a constant defining the length units.
boolean removeAgent(Agent agent) Removes the given agent from the conveyor. The agent will be removed only if it is currently located on the conveyor.
If the agent was removed successfully, returns true, otherwise returns false.

agent — the agent (material item) to be removed from the conveyor.
Failure and repair
Function Description
boolean isFailed() Returns true if the conveyor is currently failed, returns false otherwise.
boolean fail() Initiates conveyor failure. The conveyor stops processing.
boolean repair() Repairs conveyor, makes it available again. Resumes its processing.
Size
Function Description
double length() Returns the length of the conveyor (in pixels) calculated in 3D space.
double getWidth(LengthUnits units) Returns the width of the conveyor (in the specified length units) calculated in 3D space.

units — a constant defining the length units.
double getCellSize(LengthUnits units) Returns the length of the conveyor’s cell in the specified length measurement units.

units — a constant defining the length units.
Points
Function Description
Point getStartPoint() Returns the Point object with coordinates of the conveyor’s starting point.
Point getEndPoint() Returns the Point object with coordinates of the conveyor’s ending point.
Point randomPointInside() Returns conveyor’s random Point object for agent placement.
Position getStartPosition() Returns the Position object with coordinates and orientation of the conveyor’s starting point.
Position getEndPosition() Returns the Position object with coordinates and orientation of the conveyor’s ending point.
boolean containsSq(double px, double py, double squareDistance) Returns true if the conveyor contains the point with the given coordinates using the given square distance tolerance; returns false otherwise.

px — the X-coordinate of the point.
py — the Y-coordinate of the point.
squareDistance — the square of distance tolerance to determine whether the given point lies within the markup element line proximity.
Position getPositionAtOffset(double offset, Position out) Returns the Position object with coordinates and orientation of the point that is located at the given offset distance (in pixels) from the conveyor’s starting point.

offset — offset, non-negative value, should be less or equal to the full length.
out — output object to write to, may be null.
Position getPositionAtOffset(double offset, LengthUnits units, Position out) Returns the Position object with coordinates and orientation of the point that is located at the given offset distance from the conveyor’s starting point.

offset — offset, non-negative value, should be less or equal to the full length.
units — one of the chosen length units.
out — output object to write to, may be null.
List getPositionsOnConveyor() Returns the list of Position objects of this conveyor, returns null if none.
Segments
Function Description
int getSegmentCount() Returns the number of the conveyor’s segments.
MarkupSegment getSegment(int index) Returns the segment by the provided index.

index — the segment index, starting from zero up until the number of segments - 1.
Visibility
Function Description
boolean isVisible() Returns true if the conveyor is visible; returns false otherwise.
void setVisible(boolean v) Sets the visibility of the conveyor.

v — visibility. If v is true — the conveyor is set to be visible, if it is false — not visible.
Color and texture
Function Description
Color getLineColor() Returns the color of the conveyor, or null if the conveyor has no color or uses a texture (in this case use getLineTexture() to get the conveyor’s texture).
Texture getLineTexture() Returns the texture of the conveyor or null if the conveyor has no texture but uses a color (in this case use getColor() to get the conveyor’s color).
void setLineColor(Color color) Sets the color of the conveyor.

color — the new color.
void setLineColor(Paint color) Sets the color (or texture) of the conveyor.

color — the new texture.
Appearance
Function Description
double getLineWidth() Returns the width of the conveyor (in pixels).
double getLineWidth(LengthUnits units) Returns the width of the conveyor (in the specified length units).

units — one of the chosen length units.
void setLineWidth(double width) Sets the width of the conveyor outline; 0 means the thinnest possible outline.

width — the new width of the conveyor outline (in pixels).
void setLineWidth(double width, LengthUnits units) Sets the width of the conveyor outline; 0 means the thinnest possible outline.

width — the new width of the conveyor.
units — one of the chosen length units.
Advanced
Function Description
List getStations() Returns the list of all stations of this conveyor, returns null if none.
Removal
Function Description
void remove() Removes the conveyor from the presentation. If the conveyor is not a part of presentation, the function does nothing.
Removal from the presentation does not necessarily mean removing from the model logic, since logical networks and routes may have been created before the removal and survive it.

Linear and curved conveyor segments

We made a video to show you how to draw the conveyor with linear and curved segments. While the video studies the curved walls drawing in AnyLogic, the process is exactly the same for conveyors.

To add a linear segment while drawing a conveyor

  1. Just make a click.

To add a curved segment while drawing a conveyor

  1. Press the left mouse button and do not release it. Move the mouse with the button being pressed.
  2. Release the left mouse button when you got the segment of the required form.

To add a segment to the conveyor

  1. Right-click the conveyor you have drawn and select Append line from the context menu. You can append a line to any end point of the conveyor by clicking this point.
  2. You are now in the drawing mode. You can add as many new segments as you need, both linear and curved.
  3. Put the final point of the conveyor with the double-click.

To make a curved segment linear

  1. Click a conveyor in the graphical editor to select it.
  2. Press Ctrl button on your keyboard and hold it. At the same time drag end point of the curved segment.
  3. Release the buttons when the segment has the required shape.

To make a linear segment curved

  1. Right-click the conveyor and select Edit Using Guiding Lines from the context menu. The guiding lines will appear for editing points. Left-click an editing line point and drag it around without releasing the left mouse button.
  2. Right-click the conveyor and clear Edit Using Guiding Lines from the context menu to switch off this editing mode.
How can we improve this article?