AnyLogic 8.3 brought with it the Material Handling Library and, to teach you how to work with it, we launched a series of feature articles on the blog. They describe, with examples from real production, the main functions of the library and its components – the blocks and space markup elements.
Following part 1, which focused on conveyors, this blog is about other ways to move goods — transporters. These include forklifts, as well as robotic and mechanical carts – automated guided vehicles (AGV).
In AnyLogic, the Material Handling Library helps model transport operations in facilities. This is done with the help of the TransporterFleet, MoveByTransporter, SeizeTransporter, and ReleaseTransporter blocks, as well as space markup elements. The example models in AnyLogic demonstrate how these blocks and elements work, and they can be found on the AnyLogic ‘Welcome Page’ in the ‘How-to Models’ section.
For the most up-to-date versions of the models, make sure you have the latest version of AnyLogic: 8.3.3. Okay, let’s get started!
In the MoveByTransporter model, AGVs retrieve boxes arriving on three conveyors and transfer them to color coded conveyors. In this case, the color of the box corresponds to the color of the destination conveyor.
Transporters can be guided by tracks, such as a network of special magnetic tapes. These tracks and networks are modeled in AnyLogic using space markup elements. To do this, select the Path element from the Space Markup section in the Material Handling Library palette and draw the network on the Main canvas. Note: if you connect one track to another at any point other than the end, a Point Node element is created. In AnyLogic 8.3, these have evolved into intersections. Now, AnyLogic automatically draws all the turn paths required to link all paths. If an element's radius is increased, the paths within the intersection will change accordingly. The size of the area occupied by the intersection also depends on the radius of the element.
In addition to visualizing trajectories, intersections perform another important task — they regulate the separation of transporters, preventing them from running over each other. If you do not wish to use this functionality, intersections can be compressed into usual point nodes.
Note that all paths used by transporters must end with one of the elements: Point Node, Rectangular Node, or Polygonal node. These enable transporters to turn around and go in the opposite direction. In this case, two rectangular nodes serve as the base locations for the AGVs. Attractor elements indicate the position and direction of each transporter and, in all areas where transporters are located, there must be an equal or greater number than the total number of transporters.
After all the paths are built, we need to create a new type of agent that models the behavior of AGVs. Use the Transporter Type element to create the agent and configure it using the built-in assistant. In this case, only the AGV animation is configured (Automated Guided Vehicle in the Warehouses and Container Terminals section).
To create a single transporter or a group of identical transporters (identical in their dimensions and speed), the TransporterFleet block is used. The Transporter agent is selected as the type of agent performing the role of the transporter (select Transporter in the New Transporter list in the properties of the block). In this group, 12 transporters will be used: put the corresponding value in the property Capacity. Their base location will be the two RectangularNode elements shown in the space markup. You can also use the regular Point Node element as a base location for a transporter.
Dimensions and speed parameters are set in block settings:
- The length of a transporter is considered by AnyLogic when calculating the distance to an obstacle or another transporter in its path.
- The height determines the position of a transported load: by default, in 3D, the load is located at the center of the coordinates of the conveyor agent and raised to the height of the transporter. If the load must be shifted from the center, you can use the custom function setCargoPosition, which allows you to accurately specify its location relative to the transporter. By the way, the dimensions of a transporter can also be set in the Transporter Type. Go to the Dimensions and movement properties of the Transporter agent.
Next, create the agent type Item, for boxes that can be moved around the model using AGV and conveyors — a process that is described in the flowchart (see below). The color of the box is randomly set using the API function, and the dimensions are specified in numbers.
To determine the start and end conveyors, 2 variables are created in the Item agent — sourceConveyor and targetConveyor. When exiting the Source block, they are given the value of the start and end conveyors using the custom functions getSourceConveyor and getTargetConveyor: as if a barcode is glued to each box with an indication of the start and end conveyors.
Finally, the rest of the flowchart is created, it is responsible for moving agents along the conveyor system and AGV routes.
The Source block (with the Item Agent type selected as the New agent) generates boxes. The convey and convey1 blocks are responsible for moving boxes along conveyors. In this case, the box agent moves along the conveyor specified in its variable (sourceConveyor). Learn more about the Convey block settings in the post about modeling conveyors.
Now for the new block, moveByTransporter. When the loading and unloading of cargo from AGVs can be simulated by a simple delay, all the transporter tasks can be performed by this unit. In the Seize section of Seize transporter, the Fleet property contains the transporterFleet (TransporterFleet) transporters group, these transport agents (boxes) through the moveByTransporter block. Set Loading time to 5 seconds. The agent pickup place for the transporters, Pickup location is, can be set as:
- the agent that called the transporter;
- node — space marking point;
- any path with a specified offset from its beginning or end;
- conveyor with a specified offset from its beginning or end;
- position on conveyor;
- conveyor station;
- coordinates of a point in the graphical editor.
When the loading point is not on a transporter’s path, AnyLogic automatically determines the point on the path closest to it and sends the transporter there. In our model, the Agent option is selected in the Pickup location is property.
Having determined where the AGV has to pick up the agent that calls it, the destination point must be set. This process is similar to how the loading place is chosen. Choose the beginning of the conveyor that receives this type of goods as the destination. To do this, select Conveyor in the Destination is property, and in the Conveyor field, enter the code agent.targetConveyor – this allows you to send each load to the conveyor of the same color. By default, transporters determine the shortest route on the network themselves and try to prevent collisions with other transporters.
If it is not possible to avoid crossing paths, transporters pass each other after 10 seconds. This delay is used to simulate a complex AGV junction, which are usually remotely controlled by an operator or an automatic system. More detailed AGV routing will appear in the future versions of the program.
Next, the process of unloading a transporter. This is set in the section Release transporter. In the Unloading time property, specify the unloading time as 15 seconds. The released transporter can:
- Returns to home location each time;
- Returns to home location if no other tasks;
- Stays where it is.
In this case, the AGV starts loading and moving the agent as soon as it gets to the pickup point. Likewise, the release of the AGV occurs immediately after the agent has reached the destination and has been unloaded.
When AGVs pick up loads from conveyors, they get as close as possible using the available paths. Transporters also determine the closest points to the destination conveyors, even when there are no specified points on the path nearest a conveyor.
SeizeTransporter and ReleaseTransporter
In models where the tasks of loading and unloading are as simple as possible, and the transporter only delivers the load to an end point without making intermediate stops (for example, at stations), all the logic can be described by the MoveByTransporter block. When loading and unloading processes also play a significant role, it is more convenient to use the SeizeTransporter and ReleaseTransporter blocks.
Consider the model SeizeTransporter and ReleaseTransporter. In this model, specialized AGVs are used to transport heavy loads — coated paper rolls. The loading and unloading of these rolls is performed by cranes (their logic is described using the Process Modeling Library).
In the model, the Path, the Point Node and the Rectangular Node are depicted by the transporter network and the base stations. The Transporter Type agent type creates the new agent — AGV. An agvFleet block (type TransporterFleet) is also added, and the properties are set for the roll carrying transporter group. The group includes three AGVs (Capacity — 3, property New Transporter — AGV). AGV dimensions are configured by checking the Set dimensions property and filling in the Length field — 2.5 meters.
The Source block generates objects (rolls in this case) and places them in the area under the crane (node1). The crane collects a roll when an AGV arrives at the loading point. While the crane collects the roll, the transporter must wait on the spot. To model this behavior in the model, the seizeAGV (SeizeTransporter) block is used as follows.
In the Fleet property, the AGV group is specified — agvFleet. The destination for an AGV approaching a roll is set to Agent. This makes the AGVs go to the point on the AGV paths closest to the agent that captured them.
The Priority section is used to set the order of tasks for the AGV group.
- The Task Priority parameter is a numeric value that reflects the significance of the request.
- Task may preempt reflects the possibility of an AGV being intercepted by a higher priority agent.
- The Task preemption policy determines what to do with tasks that are superseded — wait for the resource that was captured initially or to use a free transporter.
In the next section, Advanced, you can select the carrier to move the agent. The parameter, Customize transport choice, allows you to set your own AGV selection policy in the dynamic field, Transporter choice condition. Many transporters might be suitable for a user-defined condition (especially if the selection condition is not specified, as we still have a full AGV fleet). Therefore, the Dispatching policy of the transporter selection property allows you to specify which transporter will be selected from the group:
- closest matching condition
- based on a pair-wise comparison given by a function in a dynamic field
- with the largest value of the property specified by the function in the dynamic field
- random, the first matching condition (the option Off (chooses some matching transporter))
In our model, all these properties are set by default.
Note that an agent is in the seizeAGV block until its transporter reaches the loading point. Only after that does an agent continue moving along the flowchart, while its seized AGV waits for it at the specified point.
After, a paper-roll agent enters the following blocks:
- seizeLoadCrane (type Seize), where an agent captures a crane for loading;
- craneLoading (type Delay), responsible for lifting;
- toAGV (type MoveTo), moves an agent to AGVs;
- agvLoading (type Delay), responsible for loading onto a waiting AGV.
After this, in the CraneToHome block (type resourceSendTo), the crane is sent to its original position in order not to interfere with the AGV passage and is released by the agent who captured it in the releaseLoadCrane block (Release).
Now the roll that has been placed on the AGV can be sent to another part of the workshop, where it will be removed by another crane and placed on the conveyor. Move using the familiar block moveByAGV (MoveByTransporter). The property Seize Transporter is not selected in the properties of the block, because the AGV being used has already arrived at the place of loading and accepted the cargo. The Destination is property should be set to where the paper roll should be delivered — Conveyor.
If the Release transporter property is selected, the AGV will drop the load after a short delay when it reaches the position closest to the conveyor. However, in the case of unloading using a crane, this is not the behavior we expect. Therefore, the Release transporter property should be unchecked. When the AGV reaches its destination point, it remains associated with the agent (paper roll).
Moving to the next block seizeUnloadCrane (Seize), the agent captures the crane responsible for loading onto the conveyor and is removed from the AGV using the agvUnloading (Delay) block. After that, the agent releases the AGV with the releaseAGV (ReleaseTransporter) block. A setting is specified in the block that returns the AGV to its base location with no other tasks. If this didn’t happen, it would remain and block other AGVs.
After release, the paper roll agent goes to the toConveyor (MoveTo) block, where it moves with the crane to the beginning of the conveyor line. The paper roll is then placed on the conveyor using the craneUnloading (Delay) block and releases the crane with the releaseUnloadCrane (Release) block. Finally, the roll leaves the transport system, passing through the Convey block.
Now you know how to model the movement of goods with the help of the Material Handling Library.
Here are the key points to remember:
- With the help of the Point Node element, you can now visually represent all the roads involved in an intersection.
- If loading and unloading can be modeled with a simple delay, and the transport does not make intermediate stops on the way to the target, select the MoveByTransporter block. When loading and unloading processes play an important role, it is better to use the SeizeTransporter and ReleaseTransporter blocks in addition.
- Transporters in AnyLogic can only be controlled by an agent that needs to be delivered. This means you cannot send a transporter that is not carrying anything to a specific point, unless there is a load waiting for delivery. This may sound unusual, but you soon find it makes sense when you a start to work with it.
- If the location of an Agent to be delivered is outside the Transporter network, a Transporter can load the Agent at the network point that is closest to the Agent. The option Destination is (SeizeTransporter block) or Pickup location is (MoveByTransporter block) should be used for this behavior.
- Be careful when modeling the work of a transporter. Decide in advance what it should do when released. Transporter actions can be controlled using the settings of the MoveByTransporter block.
The next blog in the series is more complex, with top tips on how to use the different type of blocks — Part 3. Do not forget to read the post about conveyor modeling: this will help you get on easily in our other posts.
⭐ If you have already built a model using the new library, upload it to AnyLogiс Cloud and leave the link in the comments. We will evaluate, choose the best one and send the author an AnyLogic T-shirt :)