AGV simulation of part routings in AnyLogic

In this article I present a simple AGV simulation model. It is meant as an example on how to simulate part routings in a factory. I implemented the simulation in AnyLogic.

I have provided some other basic introductions to AnyLogic already. More specifically, I have e.g. previously introduced some basic conveyor models in a series of YT videos. Here is a list of some basic introductions to AnyLogic simulation modeling:

I illustrated a conceptual layout of the AGV simulation in the figure further below in the next paragraph.

Using AnyLogic for AGV simulation with routings

In previous posts on this blog I have already introduced various discrete-event simulation software options. I list some examples below. Clearly, I am a fan of free and open simulation tools and frameworks (see e.g. “simmer”). However, AnyLogic is a commercial tool.

Throughout various simulation projects I have worked with various discrete-event simulation tools, not just the ones listed above. However, for AGV simulations embedded into material flow studies, I find AnyLogic and Simio to be among the best discrete-event simulation tools. I have also seen the capabilities of FlexSim and Plant Simulation with regards to AGV simulation and you could these as well. However, in term of being able to customize I prefer AnyLogic. Mainly due its structure, documentation and transparency – and the fact that AnyLogic is coded i JAVA.

Simulation studies require a procedure model

A common mistake that I often observe when supply chain analysts get into simulation is that they jump right to modeling. However, a good simulation model can only be developed once the objective of the simulation study is clearly defined. Moreover, this is usually only possible once the underlying system or problem has been fully understood by all parties involved. I recommend using a procedure model for any simulation study. The figure below illustrates my procedure model.

Discrete-event simulation procedure model for AGV simulation.

In fact, the procedure model applied by me has been published on this blog in previous posts. Here are two relevant related articles:

Consequently, in the early stages of the simulation study it important to fully understand the situation. Appropriate terms for this step are e.g. situation analysis, gap analysis, and problem definition. Data collection is part of this step. Afterwards, I usually explicitly define what is and what is not part of the simulation model to be developed. For example, I once simulated a tram operations and tram schedules in Zürich (Switzerland). I decidediIn that project that pedestrian flow blocking the tram rails will not be implemented in detail. Instead, I described rail blockage frequency and duration with a random distribution curve.

Eventually, the simulation study proceeds by developing a layout and a conceptual model. Conceptual modeling involves e.g. flow charting as well as definition of state transition diagrams for relevant equipment. This makes actual simulation modeling implementation much easier and ensures well structured code.

I sketched a simple layout of the AGV simulation

Depending on the project I work on I will usually draw a rough layout myself. Alternatively, I will rely on a AutoCAD drawing (or similar) delivered to me by the clients engineering team.

Simple layout draft of AGV simulation model.

Above figure depicts a central receival area that forwards received input material via roller conveyors. Cranes or robots place parts onto AGVs at the end of the conveyor.

The AGVs facilitate material flow from initial receival

The AGVs, representing the core of this AGV simulation in AnyLogic, route parts to work areas. This routing process may require decision making, possibly on a very complex level.

For example, I might want to assign the nearest AGV to the task, or the AGV with the lowest utilization. I might also face a situation in which I want to model actual routing decision. That is, one AGV takes route A and another AGV takes route B through the AGV lane network.

Implementing the AGV simulation in AnyLogic

I implemented this AGV simulation in AnyLogic. A screenshot of the model can be seen below.

AGV simulation model in AnyLogic.

Essentially, the model is comprised of a source that generates part arrivals. These part arrivals are forwarded to the conveyor. Once parts arrive at the defined end position of the conveyor, a transport task is released. Actually, this task dispatch process is a default AnyLogic process. However, I could have implemented a custom task dispatch logic using JAVA.

Once one of the AGVs has been assigned to the transport, using default AnyLogic logic as described above, the model decides which work area to transport the part to. For this I implemented a custom yet simple decision logic for demonstration purposes. I describe this customized logic in the following chapter below.

This being a simple example I did not implement the work areas in any detail. Furthermore, I also did not implement in any detail the pick and place operation of a robot or crane at the conveyor exit. Referring to my procedure model, this is totally fine. I am “allowed” to implement these process steps on a higher abstraction level, as long as the study objective and problem definition do not indicate that I need to implement these process steps in specified detail. The pick and place operation can e.g. be modelled with a time delay. This time delay can be randomly distributed, if appropriate for the chosen material handling equipment.

In fact, another abstraction is that I did not visualize the work areas and did not implement any custom object to represent them. Instead I simply used a default node object from AnyLogic. The currently active target node, i.e. the currently relevant work area, is referenced by the station variable. This variable is updated by a custom routing algorithm. I will explain this further down in this article.

AGV simulation work areas references by station in the form of AnyLogic nodes

Once parts have arrived at the work area the part dwells in the work area for a specified default time. Eventually, the part enters the sink. The sink deletes the part and thereby removes it from the model.

Implementing custom routing decision with JAVA

When implementing AGV simulations one thing that I would like to influence is the routing decisions. Clearly, this is because routings facilitate any material flow. In this case, if I assume each part arriving from receival represents the same input material, e.g. raw parts for milling or other processing, I cannot just route based on the material type. I might instead want to route based on work center utilization, or some other criteria. The point is, routing decision must be easily customizable. I wrote this blog post to provide a simple example on how one could go about this in AnyLogic.

In this simple AGV simulation model I facilitate custom routing with 4 variables and 1 function:

  • output_01 to output_03 measure the total number of parts delivered to the respective work area
  • station references the part destination work area (AnyLogic node object)
  • set_route is a function that facilitates bespoken custom routing decision

Below screenshot displays the content of the set_route function.

Custom routing logic implemented into AGV simulation in AnyLogic

The set_route function simply implements cyclic routing. That is, the first part goes to station_a, the second part goes to station_b, and so on. However, I could specify additional functions and variables, and other types of decision making, if required. In the end, the logic to implement depends on the specific situation.

The set_route function is called whenever an agent is entering the moveTo_a block in below chain of logic blocks.

Logic blocks for calling custom routing in AGV simulation

This chain of logic blocks implements the following flow:

  • src generates parts with randomly distributed interval times
  • convey conveys the part from start to end position of the conveyor markup
  • get_transport requests an AGV to pick up the part from conveyor exit
  • moveTo_a calls set_route and transports part to the node references in station
  • delay makes the part dwell in the node (representing the work area) for some time
  • sink removes the part from the model

I can specify the function call in the OnEnter section of the moveTo_a block. See the screenshot below.

move block calls routing logic

Conclusion and related content

In this simple AGV simulation example I demonstrated how you can go about customizing part routings in AnyLogic. The routing criteria and routing logic used in this example was very simple. A real routing algorithm would often be more sophisticated and tailored towards the requirements of the factory that it operates in. Such routing algorithms will quickly become complex and can be challenging.

Throughout this article I have already provided a wide variety of links to related content. Nevertheless, here are some additional articles that I would like to share with the interested reader:

You May Also Like

Leave a Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.