top of page

Comparing two manufacturing layouts using state-based behavior inside a simulation

Updated: Jul 5, 2023

This is a guest post from Tellef Solberg. He is an analyst at a leading Norwegian aquaculture company. His interest lies in improving processes using simulation and optimization.


One useful application of simulation modeling is to compare two competing systems. In this post, we will look at a model where we compare two manufacturing layouts using state charts and organizing the components of the system as agents.

To show this, we will focus on the following problem taken from Averill Law, Simulation Modeling & Analysis 5th edition (McGraw Hill Education), p. 174:

In a workshop facility, we have 6 lathes. These lathes are quite prone to downtime and therefore need to undergo service every now and then, and during the service, maintenance personnel needs to make use of toolkits. However, we need to determine the most efficient layout for the toolkit travels. There are two layouts we can consider:

Option 1: A “loop design” where the toolkits travel from a tool crib at the very left in a loop around the lathes

Option 2: A “centralized design” where the toolkits are placed in the middle and travels back and forth from the center to the lathes.

Why is this type of problem important to solve?

Purchasing, installing and operating 6 lathes is an expensive task, and getting it right the first time is critical to ensure optimal use and availability of the lathes. Also, changing your mind and re-installing the layout the other way around at a later stage is expensive.

Why is simulation preferable to solve this type of problem?

Simulation is a good method for this problem because we get to experiment and see the behaviors of the two systems in a risk-free environment. We do not need to worry about any client service level agreements being violated, any late delivery penalties or general issues that might occur in the plant if we were to test these two designs.

Simulation is a way to get fast feedback on the impact of changes on the system as a whole. If we were to test these two layouts, it might take weeks to figure out which is the best. Using simulation, we can simulate months in just a few minutes and get feedback on which is the best.

Simulation is also less costly than making the changes in real life. Changing the layout of the lathes and the toolkits would possibly take a few hours in the simulation, but in reality, this might be days of manpower and be much more expensive.

The simulation also offers a unique way of getting customer and stakeholder buy-in on the final result. When adding animation to the underlying simulation, we can also see the systems in action and get comfortable with how the systems operate. If a picture is worth a thousand words, an animation is worth a thousand pictures.

The Model

The model is organized into four agents (besides Main):

> Lathes (loop design)

> Toolkits (loop design)

> Lathes (centralized design)

> Toolkits (centralized design)

To trigger downtime we use an Event for each lathe that affects both designs simultaneously. This is to make sure that e.g. lathe[0] in the loop design hits downtime at the same time as lathe[0] in the centralized design.

In addition to that, we have two LinkedLists called repairRequests and availableToolkits. These keep track of lathes needing repairs and the toolkits available to service them respectively.

Lathes has the following states:

Toolkits have the following states:

A lathe that enters downtime will trigger the first available toolkit to provide service.

Since a picture says more than 1000 words, and an animation says more than 1000 pictures, let's run the simulation and see the animations:

Let's look at their downtime to measure how well the systems perform relative to each other. We measure it as downtime divided by total simulation time and run it for 24 hours (that is 1440 minutes). We'll wrap it nicely in a lambda expression like so:

sum( lathes, o->o.totalDowntime) / (1440 * lathes.size())

When running the simulation a single time, the output gives us a better performance on the centralized design by around 17 percentage points. More simulations should be run to solidify that the centralized design performs better.

You can download the example model from the AnyLogic cloud here, or the link below.

Alternative lathe shop configurations.alp
Download ZIP • 16KB

Potential improvements to the model

Some improvements we can make are:

The maintenance and failures are usually dependent on the time a machine runs, so if one machine runs less time due to the toolkits taking longer to get to the machine, the next maintenance event should take longer to be triggered. Currently, they are all triggered at exactly the same time for all machines. As the different layouts have different run times, it might be the case that the events are not triggered simultaneously if you change the design, as the machines will have different run times.

We also need to do more simulation runs with different random seeds to improve the statistical accuracy of the model.

Some additions that could benefit the model

  1. Add the hourly cost of downtime

  2. Add upfront investments for toolkits and vary the amount of them

  3. Add data visualizations showing downtime for each individual lathe


A simulation is a great tool for getting detailed answers in a relatively short period of time, at a lower cost than making the same changes in the real world and with zero risk. AnyLogic is a great tool for creating simulations in a time-effective manner using statecharts, standard Java code and easy-to-create animations and standard modeling blocks.

Thanks for reading this post! Happy modeling :)

Tellef Solberg


Tellef is a simulation specialist and guest writer for The AnyLogic Modeler. Contact him on LinkedIn to get in touch.

What next?

If you liked this post, you could read more posts by following the links above. Why not subscribe to our blog or follow us on any of the social media accounts for future updates? The links are in the Menu bar at the top, or the footer at the bottom. You can also join the mobile app here!

If you really want to make a difference in supporting us please consider joining our Patreon community here

If you want to contact us for some advice, maybe a potential partnership or project or just to say "Hi!", feel free to get in touch here, and we will get back to you soon!

185 views0 comments


Post: Blog2_Post
bottom of page