See how simulation improves material handling in our whitepaper!
A key part of the AnyLogic 8.6 update related to the Material Handling Library. Now the movement of transporters such as AGV can be restricted by area and access can be permitted conditionally: by transporter number, by schedule, by throughput, and more. For manufacturing and warehouse settings, this functionality can be applied in many ways, including for the modeling of gates, of restrictions when machinery is operating, such as cranes, and to avoid congestion in loading areas or at intersections.
This technical blog will guide you through how to use these restricted areas and demonstrates them with the help of a practical example model: Areas with Limited Access for Transporters.
This is mostly a technical post for those who are already familiar with the Material Handling Library and are confident using AnyLogic. You can skim through to get an idea of what is possible or dive into the details. If you have not worked with the Material Handling Library in AnyLogic before, check out these previous tutorials:
- How to model conveyors
- How to simulate the operation of transporters and AGV’s
- How to simulate the processing of objects on a conveyor
- How to model cranes
- How to use the Network Port
Ready? Then make sure that you have the latest version of AnyLogic installed, open the model and let’s go!
- Restricted areas
- Areas with a limited number of transporters
- Restricting scope by calling the close() function
- Conditionally restricted areas
- Areas restricted by schedule
- Areas with restricted throughput
The movement of mobile units such as AGV and forklifts is often regulated in warehouses and factories by dividing floor space into zones. Rules may determine how many vehicles can be in a zoned area at the same time or they might apply conditions of entry to intersections and the like.
In version 8.6 of AnyLogic, we have added new restricted area functionality to the Material Handling Library that allows AnyLogic simulation models to accommodate zoned constraints. In addition, the new functionality allows you to block traffic in certain areas and force AGV to wait for the area to open or to reroute.
To use the functionality of a restricted area, add a Rectangular Node or Polygonal Node to the canvas and in the Speed and Access Restrictions section, set the entry restriction by selecting the option Access Restriction, and/or speed limit by selecting the Speed Restriction option. Please note that the specified restrictions will apply only to the transporter type specified in the Restrictions apply to property; other types of transporter agents will ignore the specified restrictions. If it is necessary for restrictions to be applied to transporters of any type, then in the Restrictions apply to property, you must specify the general parent class of agents — Agent. To combine different constraints, multiple overlapping constrained areas can be set.
Below, using the Areas with Limited Access for Transporters example model, which is included in the standard AnyLogic examples, we will familiarize ourselves with the most common modes of operation for restricted areas, as set in the Access restricted by property. We will also look at how these areas can be applied practically and how they operate.
Areas with a limited number of transporters
In the top part of the model, several paths come together at a complex intersection. Unlike a standard intersection formed by connecting Paths and represented by a single Point Node, this intersection consists of many intersecting Paths and Point Nodes with a radius of zero. One way to look at it is as a group of several smaller intersections. As a result, it is difficult to manage entry to a complex intersection using the TransporterControl block and the Can enter node property.
To solve the problem of passing through an intersection, a Polygonal node complexIntersection is drawn on top of it with the Access restriction option selected. So that only one transporter can move through the intersection at a time, the capacity is selected as a restriction (using the Access restricted by property, and the Capacity option), and in the Capacity property, the number of transporters allowed is set to 1. Now, when approaching the area, a transporter will check if another transporter is inside it. If the area is occupied, the transporter will stop at the border and will wait until it is free.
The same setting can be used when simulating work areas with a limited number of transporters. However, it should be noted that when this option is selected, a transporter will always take a path through the area if it lies on the shortest path. And, even if the start and end points of the path are outside the restricted area, the transporter will have to wait at the edge of the area until space becomes available (that is until the number of transporters inside the area becomes less than the set limit).
If it is necessary to change the capacity of the area while the model is running, use the node.restrictByCapacity() function, where node is the name of the specified node (here and in other examples). In the example, it is called every time you use the slider above the area.
Restricting scope by calling the close() function
To completely deny transporters access to an area for the type specified in the Speed and access restrictions property, the user can select from the option menu the restriction ‘call the close() function’ (property Access restricted by). This option allows you to temporarily block sections of a path, such as when doors or gates are closed. Or, to temporarily close certain areas, if, for example, equipment is operating. In order to make the area available for transporters again, you need to call the node.open() function. In the demo model, such areas are used to model the gate at the entrance to the adjacent workshop (rectangular nodes doorNode1 and doorNode2) and to model the crane working area (Rectangular Node craneOperationArea).
In the first case, pressing the button located next to the "gates" closes them — this causes the section of the transport network located in the closed area to become inaccessible. In this case, the Area is avoided if closed option is selected for the area, so as soon as the area is closed, transporters, whose path lay through it, try to reroute. Please note that if a transporter is moving along the specified paths and has already entered the segment of the path that crosses the area, it cannot turn around and will wait at the border of the area. In other cases (including when the border of an area crosses an intersection) a transporter will turn around and bypass the region. After the area has been unblocked by pressing the button again, transporters will recalculate their path and can travel along paths that have become accessible.
If a simulation includes a crane's working area, the area over which the crane can carry a heavy load is determined by craneOperationArea. When a crane receives a load (the On loading action of the bridgeCrane markup element), a call can be made to the craneOperationArea.close() function to close the area to transporters. Similarly, a call to the craneOperationArea.open() function, such as when a load is released from a crane (the On unloading action), restores permission for transporters to transit the associated area. In this case, the Area is avoided if closed option remains disabled, so transporters approaching the closed area will stop at its border and wait until the area is unblocked.
Conditionally restricted areas
The most flexible settings for access to an area are set using Condition option (in the Access restricted by property). Any expression that returns true or false can be indicated in the Condition field. For example, this expression could be the state of a transporter. If the expression returns true, the transporter will not be allowed into the region. In this case, the Area is avoided if closed property determines whether a transporter will try to create a route that will avoid an area when it initially creates a route or is rerouting. If the option is selected, then before moving, the transporter will find a route that bypasses the area closed to it. If this is not possible, the transporter will use the route through the area and stop when it reaches its border.
To get a better idea, let’s first look at a simple case where the condition is associated with a transporter itself and does not change during the transporter’s movement.
In the model we are considering, the agvTypeArea permits entry to a loading area for a certain type of transporter. To model this, the Restrictions apply to property specifies which types of transporter are not allowed in the restricted area (AGV), and the Condition field is set to true. The option Area is avoided if closed is enabled, so AGV transporters will need to find a route that does not cross the restricted area.
At the same time, other types of transporters, here HeavyLoadAGV, can freely pass through the area since the restrictions do not apply to them. Similarly, you can restrict the movement of transporters in other ways, such as those belonging to a certain group (TransporterFleet), those engaged in the delivery of a specific type of cargo, or those with a specific status.
For example, if loaded transporters must not enter an area, all that is needed is to set a restriction for that area and to check the status of transporters. To check a transporter’s status use its Condition field with the agent.getState() == TransporterState.DELIVERING function.
In difficult cases, where entry restrictions may change over time, the following features should be considered. Conditions are calculated when finding a route, as well as when reaching the border of a region. Therefore, if an agent stops at a closed areas border because the Area is avoided if closed option is disabled, it is necessary to call the function node.recalculateAccessibility() so that when the condition that caused it to stop changes, the transporter will continue on its way. When the function is triggered, the Conditions of the transporters waiting at the border of the closed area are rechecked and may continue if permitted.
The option Area is avoided if closed in this case is only considered at the time of calculating a route. Therefore, if the transporter has found a route through an open area, and at the moment of its movement, the condition parameters have changed and the area is blocked, the transporter will continue on the original route and stop at the border of the area. However, if moving transporters should recalculate their route when a region closes, use the transporter.recalculateRoute() function of the transporter, or the node.recalculateAccessibility() function of the area. This way, the routes of all transporters that are on a route through the area are recalculated.
So, let's consider how a conditionally restricted area whose parameters can change over time works using the example areas loadArea1, loadArea2, loadArea3. These areas restrict the movement of conveyors at the loading points and at the adjacent intersections. In order to avoid possible collisions at the loading areas, the following rules are adopted:
- if there is an AGV loading inside the area, or an AGV is moving to a loading point, then other transporters that load at the same point are not allowed into the area;
- if the loading point of an AGV does not lie within an area, then the transporter can drive through the area if there is no transporter waiting at the border of the area (thus, there may be more than one transporter inside the area);
- if a transporter has stopped at the border of the region, waiting for permission to enter, then the rest of the AGVs try to find a way to bypass the region.
How to enforce these rules using restricted areas? Let's consider a solution using the loadArea3 area example. We will use the Access restricted by property and Condition option with Area is avoided if closed enabled.
As a condition, the user-defined function accessDenied() is used, which, if there is an AGV inside the zone, checks for the presence of transporters waiting at the border, and if they are absent, checks whether the loading point of an approaching transporter does not coincide with the loading point of the transporter inside the area. If one of the conditions is met, then the function will return true and access to the zone will be denied.
At the start of the model, the area is free, so all transporters will choose the shortest route through it. Suppose the first transporter travels to loading point loadPoint3, which is inside the loadArea3 node. Since the area ahead is free, it is free to drive inside.
However, if the next AGV also wants to go to loading point loadPoint3, the entry condition specified by the accessDenied() function will stop it at the border of the area. At this moment, the factors that affect the conditions of passage through the region for the rest of the transporters change (because of the presence of AGVs inside the region and at its borders). Therefore, in the On enter denied action, which is triggered when a transporter that has reached the border is denied entry, the recalculateAccessibility() function is called and if possible the remaining transporters recalculate their paths in order to bypass the area that has become inaccessible.
Note that the action On enter denied is performed once for an AGV that has stopped at the border. If a transporter at the border is again refused access during subsequent accessibility checks, the action is not repeated. When the transporter inside the area is loaded and finally exits, the On exit action is automatically triggered. Since this action again affects the area’s ability to let in other AGVs, the On exit action calls the recalcualteAccessibility() function again.
Using the Avoid area if load point is occupied checkbox located above the loading areas, the user can disable the Avoid area if closed option for all areas with restrictions and make sure that transporters will start to queue at the first node without trying to bypass the AGV at the border.
In addition to the modes of operation used in the model, there are two more that can be used to limit by schedule and by throughput.
Areas restricted by schedule
If an area is closed according to a schedule, the behavior can be set using the Schedule mode in the Access restricted by property. Using the Schedule property, users can bind area behavior to Schedules that exist in a model. To operate correctly, the schedule must be set to Type on / off. Switching the mode to on signals that the zone is being closed and switching it to off signals that it is opening. Otherwise, the behavior of the zone and the transporters moving through it is the same as if the node.close() function were called when the schedule was switched to the on mode, and when the schedule was switched to the off state , calling the node.open() function.
Areas with restricted throughput
This mode limits an area's throughput by setting the maximum number of transporters that can pass through it in a given unit of time (Access restricted by property, Throughput option). This mode can be used when it is necessary to set time restrictions on the next group of transporters to enter the area.
In the above model, the technique of using restricted areas is shown only for the case of path-guided transporters; however, in the case of simulating free-space transporters, their behavior will be similar.
Now you know how to simulate restricted areas in AnyLogic and integrate them in your material handling models. The main things to remember:
- Restricted areas can limit access or define speed limits for transporters.
- Access restrictions can be set in five ways: by the number of transporters, by calling the close() function, by condition, by schedule and by throughput.
- When an area is opened or closed by calling the open() and close() functions, the Area is avoided if closed option will cause transporters to change route.
- When an area’s availability is set by condition, and a transporter is recalculating its route (at the start of movement or when the recalculate() function is called) the value of the Area is avoided if closed option is observed.
- Calling the recalculateAccessibility() function for a conditionally restricted area makes all the transporters whose routes go through this area recheck if they can enter the area and update their route if entry is not allowed.