Network port: Learning to use the Material Handling Library (Part 5)

Network port: Learning to use the Material Handling Library

See how simulation improves material handling in our whitepaper!

Part five of our series on AnyLogic’s Material Handling Library, a library specifically designed to help model the work of factories, warehouses, and other facilities where goods are moved, processed, and sorted.

Previous blogs dived into how to simulate conveyor operations, automated guided vehicles (AGV), workstations and industrial cranes. This blog demonstrates how to connect individual conveyors, and any processing stations on them, into a single conveyor network using the Network Port element.

Experienced users of AnyLogic can dive right in but if you're just starting out with the Material Handling Library, you can benefit from these earlier posts as well as this step-by-step online guide on the basic functions of the library.

All set? Then let's go!


Have you seen conveyor networks with multiple identical elements? For example, in processing and fulfillment centers, you can find order assembly lines with dozens of parallel or sequential stations united by a common conveyor network. Often these stations are identical: they have the same number of storage places, the same processes, the same number of operators and so on.

In AnyLogic 8.5, to simplify the creation of such conveyor networks, we have a new element — Network port. With it, you can easily connect individual networks with each other. It will work even if the connecting elements are in different agents, at different levels in the model, or far from each other.

Here's how this approach helps speed up modeling:

  • To create a group of identical stations, you only need to draw and customize one of them. Then, at the launch of a model, AnyLogic will generate and connect the required number of identical stations. So, there is no need to duplicate large sections of a conveyor network.
  • Models of conveyor stations and networks that are used regularly can now be combined into custom libraries and, with the Network Port, used to build models of continuous conveyor and transport networks storage and production facilities. Like building blocks that simplify and speed up modeling.

This article will be easier to understand if you know how to create custom blocks in AnyLogic and how to replicate objects. If you've never created a custom block, watch this short how-to video.

Model of Order Picking Line

Stations on the conveyor belt

Stations on the conveyor belt

Let's open the Order Picking Line model from the training model section of AnyLogic.

Composite parts of space markup in the Order Picking Line model

Composite parts of space markup in the Order Picking Line model

The PickingZone agent has a conveyor network. It consists of the main conveyor that passes through all the assembly stations and also an auxiliary pickingConveyor line that is attached to it. The main conveyor is divided into the segments conveyor1, conveyor2, and takeawayConveyor. These segments are connected by transfer stations which can transfer boxes from the main conveyor to the auxiliary conveyor and vice versa. On the auxiliary conveyor, a box scanner is marked with a dot.

Next to the conveyor is a goods rack named palletRack. This markup element must be inside a network, so a path is drawn to define a route. The pallet rack operator workstation is defined by the pickerWorkplace dot node. This node is also the base location of the picker resource (ResourcePool block).

How to combine space markup in different agents using the Network Port element

The final conveyor network will consist of several identical agents. To make this conveyor system work, you need to connect the different conveyor sections and agents together to make one network.

First, let's look at a simple case where we link parts of a conveyor that are located in two agents.

To do this, at the end of the infeedingConveyor conveyor located on Main, we have added a network port (in the model — infeedingConveyorPort). Another network port (in the model — inputPort) is added to the agent PickingZone at the beginning of conveyor1. To connect ports and join conveyors, it is enough to just specify a link to the second port in the Pair with port property of one of the network ports. Moreover, if the parts of the conveyor are located within one agent, you can just specify the name of the second port in this property. If the parts of conveyors are located in different agents (like in our example), you will need to define an agent that contains the second port. In this case, the link to a port will look like the following: <agent name>.<port name>

Part of the conveyor on Main

Part of the conveyor on Main

Part of the conveyor in the PickingZone agent

Part of the conveyor in the PickingZone agent

Port binding in different agents

Linking ports in different agents (this is an intermediate stage, so the view of the port reference on the screen and in the final model are different)

For the animation to display correctly, we overlaid pickingZone_presentation from the PickingZone agent onto the Main conveyor so that the network ports match. Now, although the conveyors are located in different agents (Main and PickingZone), a box moving through the system will reach the end point without any problems.

Once the conveyor parts are connected, the Convey block can work with the combined conveyors as if they were a single network.

How to combine identical processing stations using the Network port element

A more complex option involves connecting more than two agents (in our example, identical stations in a chain). On Main, the PickingZone agent is represented as a population of agents (active property Agent population). In it, the nZones parameter sets the required number of stations that the model will generate at start (the Population is property, the Contains the specified number of agents option, the Initial number of agents value).

At the start of the model, by default, all PickingZone stations are drawn at the same point. To make the stations form a line, you need to configure the agent presentation (the pickingZones_presentation object). To do this, use a dynamic value for the X and Y coordinates and select the property Draw agent with with offset to this position; this is how we set the offset of the displayed agents at runtime relative to the location of the animation, which is visible during editing. The vertical position of the stations does not change, therefore Y = 0, horizontally the stations are adjacent to each other, so their location is given by the formula 180 * index (180 is the width in pixels of the station graphic, index is the number of a station within the population).

Presentation of the PickingZone agent

Presentation of the PickingZone agent.

Now we will logically link together the parts of the conveyors located in different agents. Please note that agents are initialized one by one, so when the first station is created, the second one does not yet exist, and it is impossible to communicate with it via the network port. Therefore, we associate the input port inputPort of each subsequent station with the outgoing outputPort of the previous station (the second with the first, third with the second, etc.). For the first station, for inputPort, we specify the port on MaininfeedingConveyorPort. This logic is described in the getInfeedingPort function. The code returns the desired port as a parameter, which is used by the pickingZone agent in the inputPort properties.

Properties of getInfeedingPort

Properties of getInfeedingPort.

Properties of the pickingZones population of agents

Properties of the pickingZones population of agents.

Now all parts of the conveyors located in different stations are connected. By changing the value of the setting that determines the number of stations (in the model this is the nZones option, or the Initial number of agents in the population of pickingZones), you can increase or decrease the number of stations created. So, there is no need to work on creating the conveyor network manually.

How to model the logic of a single station (PickingZone agent)

The box (Box agent) is passed to the station through the enter block and goes to the pickup block, where the ordered item is waiting. In the last block, using the Exact amount option (if not, wait) of the Pickup property, we make the box wait until it contains the number of agents specified in the Number property (in our case, 1).

All goods available at a station (agent type Item) are created in the source block using the command source.inject(100). It is executed at the start of the model in the PickingZone agent in the On startup action. In the rackStore block, the goods are placed in the palletRack, and in the wait block, they wait for commands to move further along the process. In our model, the process of assembling an order at a station — a product in a box — looks like this:

Order build process

Order build process.

When a box on the conveyor crosses the leading edge of the scanner (markup element Point on conveyor), the function (palletRack.randomAgent ()); in the On leading edge enter property, releases a random agent from the wait block and transfers it to the rackPick block, which is responsible for removing the agent from the rack. It specifies:

  • The resource (in our case — picker), with which the product will be removed from the rack: set in the property Resource Sets, which appears when choosing the option Use resources to move in the Resources section.
  • Duration of withdrawal of goods (in our case - from 2.5 to 5 seconds): set in the Delay time property.
  • The place where the goods will be transferred (in the model, this is the place where the order is assembled — the pickerWorkplace point node): selected in the Node property, which appears when the Network node option is selected in the Destination is property.

The service block simulates the operations performed by an operator when placing an item in a box (for example, reading a barcode). After that, the agent is put into the box by the pickup block.

Once an agent is inside a box, it leaves the build station through the outPort. All the logic of the box movement along the conveyor is moved to Main, outside the scope of the PickingZone agent.

How to connect station processes with the movement of an object on a conveyor

In order for the stations and the conveyor to work together, you need to connect them in the model.

In the Source block on Main, boxes (Box agents) are created and these boxes will then move along the conveyor network. At the moment of creation, the station to which the box will go, and its color are randomly determined; these values are stored in the Box agent (pickingZoneNumber and boxColor parameters).

After creation, a box goes into the conveyToPickingZone block (block type Convey), which is responsible for moving it along the conveyor network. The conveyor on Main is specified as the starting point (Start conveyor property, infeedingConveyor value), and the destination (Target conveyor property) is the auxiliary conveyor at the station, the target for the box is pickingZones. get(agent.pickingZoneNumber). pickingConveyor. As soon as the box reaches its destination, it goes to the exit block, where the function pickingZones. get(agent.pickingZoneNumber). enter.take(agent); sends it to the input of the process diagram described in the PickingZone agent.

After going through the process at the station (for more details on collecting the order, see above), the box, leaving the outputPort of the process diagram, returns to the Main level and goes to the conveyFromPickingLine block (Convey type). It continues to move from the current position (property Convey from, option Current position) to the end of the main conveyor. The last conveyor, like the others, is created dynamically during model start, so the end of the main conveyor is set by pickingZones.get (nZones - 1).takeawayConveyor in the Target conveyor property. Since all parts of the conveyor are connected to each other by ports, the Convey block on Main can move an order across the entire network without requiring any additional blocks.

That's it! Thank you for finishing it, well done!


Here are the key points to remember:

  • A network port can interconnect conveyor or transporter networks. And, at the same time, networks can be located in different agents or on different levels of multilevel models.
  • If you need to connect parts of the network within one agent, it is enough to just specify the name of one of network port inside properties of another port. If the parts of the pipeline are located in different agents, then first you need to refer to the agent in which the second port is located; the link will look like this: <agent name>.<port name>.
  • When linking replicated objects, remember that when the first object is created, the second does not yet exist. Therefore, each of the agents must be associated with the previous one.

You can learn more about the use of replicated space markup using the Fulfillment Center Conveyor System model; it is available in the AnyLogic samples and in the AnyLogic Cloud. The model was created using the AnyLogic Material Handling Library. Learn more in our other materials:

What else would you like to know from our tutorials? Tell us in the comments below and subscribe to our monthly newsletter to not miss new materials.

Related posts