Take the 2-minute tour ×

I would like to create a simulation of a factory floor, and I am looking for ideas on how to do this. My thoughts so far are:

• A factory is a made up of a bunch of processes, some of these processes are in series and some are in parallel. Each process would communicate with it's upstream and downstream and parallel neighbors to let them know of it’s through put

• Each process would it's own basic attributes like maximum throughput, cost of maintenance as a result of through put

Obviously I have not fully thought this out, but I was hoping somebody might be able to give me a few ideas or perhaps a link to an on line resource

update: This project is only for my own entertainment, and perhaps learn a little bit alnong the way. I am not employed as a programmer, programming is just a hobby for me. I have decided to write it in C#.

share|improve this question
+1 interesting question. It sounds like you want is a mathematical modeling so you can optimize certain variables (cost, capacity, etc). I'm not sure you really want a "simulation". –  dss539 Jan 29 '10 at 19:22
I work is a factory and at times we increase the through put. This increase has several negative impacts to other departmental budgets like increased electrical costs, increased maintenance costs and lessening of the lifetime of equipment. I though it would be fun to try and simulate the changes in throughput and it’s costs. I am not a professional programmer but I do dabble a bit and I thought this would be a fun project. –  fishhead Jan 29 '10 at 19:30
Your comment reinforces my view that you want a mathematical model. I agree, this sounds like a fun project. It will become even more fun when you start to optimize for certain parameters. ;) You can model a lot of this variables by simply using a spreadsheet... of course writing a program to do it could be more fun. –  dss539 Jan 29 '10 at 20:18
In addition to my answer below, I'll say this: Simulating a real factory, or even a small part of a real factory is very hard, because the approximations we make in modeling real processes are often not very realistic. I don't expect that you'll find from your real data that real assembly points are distributed normally, or even exponentially, but you might get lucky. –  Scottie T Jan 29 '10 at 20:47
add comment

5 Answers

up vote 3 down vote accepted

Simulating an entire factory accurately is a big job.

Firstly you need to figure out: why are you making the simulation? Who is it for? What value will it give them? What parts of the simulation are interesting? How accurate does it need to be? What parts of the process don't need to be simulated accurately?

To figure out the answers to these questions, you will need to talk to whoever it is that wants the simulation written.

Once you have figured out what to simulate, then you need to figure out how to simulate it. You need some models and some parameters for those models. You can maybe get some actual figures from real production and try to derive models from the figures. The models could be a simple linear relationship between an input and an output, a more complex relationship, and perhaps even a stochastic (random) effect. If you don't have access to real data, then you'll have to make guesses in your model, but this will never be as good so try to get real data wherever possible.

You might also want to consider to probabilities of components breaking down, and what affect that might have. What about the workers going on strike? Unavailability of raw materials? Wear and tear on the machinery causing progressively lower output over time? Again you might not want to consider these details, it depends on what the customer wants.

If your simulation involves random events, you might want to run it many times and get an average outcome, for example using a Monte Carlo simulation.

To give a better answer, we need to know more about what you need to simulate and what you want to achieve.

share|improve this answer
I don't work as a programmer. It just sounds like a fun project, and perhaps learn a little bit more about programming. I don't expect that the application would be of any interest to anyone but myself. –  fishhead Jan 29 '10 at 19:18
This type of application definitely is interesting to a lot people who manage production process, and a lot of time and money goes into developing such applications. It's not an easy project, but it pays very well if you can use your simulation to optimize their processes, reduce failure rates, etc. If you just want to learn how to program, this probably isn't an ideal project for learning as it is complex and you probably won't have any real data to work with. –  Mark Byers Jan 29 '10 at 19:22
ho I have real data - direct connection to all the industrial SQL servers and all the last 4 years of data. I also have connections to the maintenance database and it's costs including labour, contractors and parts –  fishhead Jan 29 '10 at 19:33
@fishhead: You could certainly try then. I'd advise starting with some simplified model of only one small part of the process, and adding more detail once you have it working. As you will be simulating over a period of time, you need to keep track of the virtual time in your simulation and for each time step update the state of all the components you are simulating. You will probably find it easier to keep motivated on the project if you have some specific achievable aim that you can work towards. –  Mark Byers Jan 29 '10 at 19:59
add comment

Since your customer is yourself, you'll need to decide the answer to all of the questions that Mark Byers asked. However, I'll give you some suggestions and hopefully they'll give you a start.

Let's assume your factory takes a few different parts and assembles them into just one finished product. A flowchart of the assembly process might look like this:

Factory Flowchart

For the first diamond, where widgets A and B are assembled, assume it takes on average 30 seconds to complete this step. We'll assume the actual time it takes the two widgets to be assembled is distributed normally, with mean 30 s and variance 5 s. For the second diamond, assume it also takes on average 30 seconds, but most of the time it doesn't take nearly that long, and other times it takes a lot longer. This is well approximated by an exponential distribution, with 30 s as the rate parameter, often represented in equations by a lambda.

For the first process, compute the time to assemble widgets A and B as:

timeA = randn(mean, sqrt(variance)); // Assuming C# has a function for a normally
                                     // distributed random number with mean and 
                                     // sigma as inputs

For the second process, compute the time to add widget C to the assembly as:

timeB = rand()/lambda;  // Assuming C# has a function for a uniformly distributed
                        // random number

Now your total assembly time for each iGadget will be timeA + timeB + waitingTime. At each assembly point, store a queue of widgets waiting to be assembled. If the second assembly point is a bottleneck, it's queue will fill up. You can enforce a maximum size for its queue, and hold things further up stream when that max size is reached. If an item is in a queue, it's assembly time is increased by all of the iGadgets ahead of it in the assembly line. I'll leave it up to you to figure out how to code that up, and you can run lots of trials to see what the total assembly time will be, on average. What does the resultant distribution look like?

Ways to "spice this up":

  • Require 3 B widgets for every A widget. Play around with inventory. Replenish inventory at random intervals.
  • Add a quality assurance check (exponential distribution is good to use here), and reject some of the finished iGadgets. I suggest using a low rejection rate.
  • Try using different probability distributions than those I've suggested. See how they affect your simulation. Always try to figure out how the input parameters to the probability distributions would map into real world values.

You can do a lot with this simple simulation. The next step would be to generalize your code so that you can have an arbitrary number of widgets and assembly steps. This is not quite so easy. There is an entire field of applied math called operations research that is dedicated to this type of simulation and analysis.

share|improve this answer
+1 nice example –  dss539 Jan 29 '10 at 20:58
add comment

What you're describing is a classical problem addressed by discrete event simulation. A variety of both general purpose and special purpose simulation languages have been developed to model these kinds of problems. While I wouldn't recommend programming anything from scratch for a "real" problem, it may be a good exercise to write your own code for a small queueing problem so you can understand event scheduling, random number generation, keeping track of calendars, etc. Once you've done that, a general purpose simulation language will do all that stuff for you so you can concentrate on the big picture.

A good reference is Law & Kelton. ARENA is a standard package. It is widely used and, IMHO, is very comprehensive for these kind of simulations. The ARENA book is also a decent book on simulation and it comes with the software that can be applied to small problems. To model bigger problems, you'll need to get a license. You should be able to download a trial version of ARENA here.

share|improve this answer
add comment

It maybe more then what you are looking for but visual components is a good industrial simulation tool.

To be clear I do not work for them nor does the company I work for currently use them, but we have looked at them.

share|improve this answer
add comment

Automod is the way to go. http://www.appliedmaterials.com/products/automod_2.html

There is a lot to learn, and it won't be cheap.

ASI's Automod has been in the factory simulation business for about 30 years. It is now owned by Applied Materials. The big players who work with material handling in a warehouse use Automod because it is the proven leader.

share|improve this answer
Why was this downvoted? I don't know anything about automod, but could someone please explain the downvote? –  dss539 Jan 29 '10 at 20:20
I downvoted because it doesn't give any support for why automod should be used, and in general doesn't give any advice on how to simulate a factory. –  Scottie T Jan 29 '10 at 20:43
@Scottie Fair enough, but this answer seems similar to Jim C's answer. –  dss539 Jan 29 '10 at 20:56
The O.P. did not explain what he was after until a much later edit. He just wanted some info on some tools, and I gave him one. My answer is better than Jim C's answer. Jim C's alleged product is vaporware that is "coming soon". I don't work for ASI or Applied, but I've used Automod. –  aaaa bbbb Jan 29 '10 at 21:54
I'm not intending to hurt feelings here, I just don't think your answer is very helpful. What's the OP going to learn from, "There is a lot to learn, and it won't be cheap?" If you can give some advice on how to use automod to do something simple, I might change my mind. –  Scottie T Jan 29 '10 at 22:14
add comment

Your Answer


