工厂车间模拟
我想创建一个工厂车间的模拟,并且我正在寻找如何做到这一点的想法。到目前为止我的想法是:
• 工厂是由一堆流程组成的,其中有些流程是串联的,有些流程是并行的。每个进程都会与它的上游、下游和并行邻居进行通信,让他们知道它的吞吐量
。每个进程都有自己的基本属性,例如最大吞吐量、吞吐量造成的维护成本
显然我还没有完全考虑到这一点,但我希望有人能给我一些想法或者在线资源
更新的链接: 这个项目只是为了我自己的娱乐,或许还能学到一点东西。我不是一名程序员,编程对我来说只是一种爱好。我决定用 C# 编写它。
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#.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
准确地模拟整个工厂是一项艰巨的工作。
首先你需要弄清楚:为什么要进行模拟?它是给谁用的?会给他们带来什么价值?模拟的哪些部分有趣?它需要有多准确?流程的哪些部分不需要精确模拟?
要找出这些问题的答案,您需要与想要编写模拟的人交谈。
一旦你弄清楚要模拟什么,那么你需要弄清楚如何模拟它。您需要一些模型和这些模型的一些参数。您也许可以从实际生产中获得一些实际数据,并尝试从这些数据中推导出模型。这些模型可以是输入和输出之间的简单线性关系,也可以是更复杂的关系,甚至可能是随机(随机)效应。如果您无法访问真实数据,那么您将不得不在模型中进行猜测,但这永远不会那么好,因此请尽可能尝试获取真实数据。
您可能还需要考虑组件发生故障的概率以及可能产生的影响。工人罢工怎么办?原材料供应不足?随着时间的推移,机器的磨损会导致产量逐渐降低吗?同样,您可能不想考虑这些细节,这取决于客户的需求。
如果您的模拟涉及随机事件,您可能希望多次运行并获得平均结果,例如使用 蒙特卡罗模拟。
为了给出更好的答案,我们需要更多地了解您需要模拟什么以及您想要实现什么。
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.
由于您的客户就是您自己,因此您需要确定 Mark Byers 提出的所有问题的答案问道。不过,我会给你一些建议,希望它们能给你一个开始。
假设您的工厂采用几个不同的零件并将它们组装成一件成品。组装过程的流程图可能如下所示:
工厂流程图 http://img62.imageshack .us/img62/863/factoryflowchart.jpg
对于第一个菱形,其中组装了小部件 A 和 B,假设完成此步骤平均需要 30 秒。我们假设组装两个小部件所需的实际时间是通常分布的,其中均值 30 秒,方差 5 秒。对于第二个菱形,假设平均也需要 30 秒,但大多数时候不会花费那么长的时间,而其他时候则需要更长的时间。这可以通过指数分布很好地近似,其中 30 s 作为速率参数,通常表示为lambda 方程。
对于第一个过程,计算组装小部件 A 和 B 的时间如下:
对于第二个过程,计算将小部件 C 添加到组装的时间如下:
现在每个 iGadget 的总组装时间将为 timeA + timeB +等待时间。在每个组装点,存储等待组装的小部件队列。如果第二个集合点是瓶颈,那么它的队列就会被填满。您可以为其队列强制设定最大大小,并在达到该最大大小时将数据保留在上游。如果某个项目位于队列中,则装配线中位于其前面的所有 iGadget 都会增加其装配时间。我将让您自行弄清楚如何编写代码,并且您可以进行大量试验来查看平均总组装时间是多少。最终的分布是什么样的?
“增添趣味”的方法:
您可以通过这个简单的模拟做很多事情。下一步是概括您的代码,以便您可以拥有任意数量的小部件和组装步骤。这并不那么容易。有一个完整的应用数学领域称为运筹学,致力于这种类型的模拟和分析。
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 http://img62.imageshack.us/img62/863/factoryflowchart.jpg
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:
For the second process, compute the time to add widget C to the assembly as:
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":
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.
您所描述的是离散事件模拟解决的经典问题。已经开发了各种通用和专用仿真语言来对此类问题进行建模。虽然我不建议从头开始编写任何“真实”问题的代码,但为一个小排队问题编写自己的代码可能是一个很好的练习,这样您就可以理解事件调度、随机数生成、跟踪日历等完成此操作后,通用模拟语言将为您完成所有这些工作,以便您可以专注于大局。
一个很好的参考是 Law &凯尔顿。 ARENA 是一个标准包。它被广泛使用,并且恕我直言,对于此类模拟来说非常全面。 ARENA 书也是一本不错的模拟书,它附带了可以应用于小问题的软件。要模拟更大的问题,您需要获得许可证。您应该可以在此处下载 ARENA 的试用版。
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.
它可能比您正在寻找的更多,但 视觉组件 是一个很好的工业模拟工具。
需要明确的是,我不为他们工作,我工作的公司目前也没有使用它们,但我们已经研究过它们。
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.
Automod 是必经之路。
http://www.appliedmaterials.com/products/automod_2.html
有一个要学的东西很多,而且价格不会便宜。
ASI 的 Automod 从事工厂模拟业务已有约 30 年的历史。它现在归应用材料公司所有。在仓库中进行物料搬运的大型企业都使用 Automod,因为它是久经考验的领导者。
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.