{"data":{"markdownRemark":{"html":"<h2 id=\"overview\"><a href=\"#overview\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Overview</h2>\n<p><a href=\"https://www.linkedin.com/in/benjaminschumann/\">Benjamin Schumann, PhD</a> developed a factory simulation using the Simudyne SDK.</p>\n<p>Dr. Schumann wrote two blog posts on the Simudyne SDK, and the model that he implemented in the software that can be found here for more context:</p>\n<ol>\n<li>Blog Post 1 - <a href=\"https://www.linkedin.com/posts/benjaminschumann_simulation-manufacturing-activity-6891996333302235137-jMyA\">Experience using Simudyne SDK</a></li>\n<li>Blog Post 2 - <a href=\"https://www.linkedin.com/posts/benjaminschumann_you-always-wanted-to-beat-me-here-is-your-activity-6897066224992227328-Rwal\">Model implementation and competition</a></li>\n<li>Blog Post 3 (by Cesc Canet) - <a href=\"https://www.linkedin.com/pulse/cracking-simudynes-2022-hunger-games-cesc-canet\">Competition Winner's Solution</a></li>\n</ol>\n<a href=\"https://simudynecontent.blob.core.windows.net/$web/2.5.0/factory_simulator_2.5.0.zip\" class=\"ui button primary\" download>\n\tDownload Model Files\n</a>\n<p>The model consists of several agent classes that interact. In essence, it is a linear sequence of conveyors and machines with products flowing through them along the red arrows:</p>\n<p>\n  <span\n    class=\"gatsby-resp-image-wrapper\"\n    style=\"position: relative; display: block; padding: 20px; max-width: 690px; margin-left: auto; margin-right: auto;\"\n  >\n    <span\n      class=\"gatsby-resp-image-background-image\"\n      style=\"padding-bottom: 38.75448028673835%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAYAAAD5nd/tAAAACXBIWXMAAAsSAAALEgHS3X78AAABk0lEQVQoz4WSyy8DURTGZyNEPNp53rl3Zjo02kYlgo1FVReVNKipMQ+hbeKxIcRCLLBgactSIv4BKyv/3ed0+kAiLL7ckzP3/ub7zr2SLZpQWBmKUQV36hBWHabtQbe3ofMtaObf0nkDwvFhiAad8yEJ84xArQTCnQaYFYDZEYyOrP+lk1SSJqjmASSLH9CHDWisBpWki+CHjF9qzQoJFPZ6O8iZdbgWJcruQ2J6jLRewoRcprVKcNrU30y1zneg0Z876kME98Go30mSyZDcGEH1CFOFFiTO9ghUxqRSgfwNaDoRxhUPh8cPeH/7wMvzG/L5JhzTw0LGS6LOz4ZwXR/DLILjRkkCSZVDpLQVpAiY1nrAXjRV3cJyIcZa5QTh5gWUbBvFuSaWFttgM21cXT7h+uYZ3vYtZMNPjEhKOsCkWiKHqwmwO6MI2ewugnILbGqP3IYo5mPIVveyNIorKOrp+SNu714RxPf0UgbAsAeskFN6Ojbd8jRBci3kcruDuSnml/P+jEfG1zE0WsNYuj7ofQIuGPzchG6GdgAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n    >\n      <picture>\n        <source\n          srcset=\"/static/factory_flow_explain-5a8f96d89356676fdc0a7a165a5822b2-8e416.webp 173w,\n/static/factory_flow_explain-5a8f96d89356676fdc0a7a165a5822b2-0b506.webp 345w,\n/static/factory_flow_explain-5a8f96d89356676fdc0a7a165a5822b2-58be5.webp 690w,\n/static/factory_flow_explain-5a8f96d89356676fdc0a7a165a5822b2-59b8d.webp 1035w,\n/static/factory_flow_explain-5a8f96d89356676fdc0a7a165a5822b2-4a474.webp 1380w,\n/static/factory_flow_explain-5a8f96d89356676fdc0a7a165a5822b2-bc809.webp 2070w,\n/static/factory_flow_explain-5a8f96d89356676fdc0a7a165a5822b2-ccc7d.webp 2232w\"\n          sizes=\"(max-width: 690px) 100vw, 690px\"\n          type=\"image/webp\"\n        />\n        <source\n          srcset=\"/static/factory_flow_explain-5a8f96d89356676fdc0a7a165a5822b2-7e3fa.png 173w,\n/static/factory_flow_explain-5a8f96d89356676fdc0a7a165a5822b2-7f1d4.png 345w,\n/static/factory_flow_explain-5a8f96d89356676fdc0a7a165a5822b2-13856.png 690w,\n/static/factory_flow_explain-5a8f96d89356676fdc0a7a165a5822b2-045bb.png 1035w,\n/static/factory_flow_explain-5a8f96d89356676fdc0a7a165a5822b2-f46ab.png 1380w,\n/static/factory_flow_explain-5a8f96d89356676fdc0a7a165a5822b2-ea5f6.png 2070w,\n/static/factory_flow_explain-5a8f96d89356676fdc0a7a165a5822b2-e6c1d.png 2232w\"\n          sizes=\"(max-width: 690px) 100vw, 690px\"\n          type=\"image/png\"\n        />\n        <img\n          class=\"gatsby-resp-image-image\"\n          style=\"width: 100%; height: 100%; margin: 0; vertical-align: middle; position: absolute; top: 0; left: 0; box-shadow: inset 0px 0px 0px 400px white;\"\n          src=\"/static/factory_flow_explain-5a8f96d89356676fdc0a7a165a5822b2-13856.png\"\n          alt=\"factory flow explain\"\n          title=\"\"\n          src=\"/static/factory_flow_explain-5a8f96d89356676fdc0a7a165a5822b2-13856.png\"\n        />\n      </picture>\n      </span>\n  </span>\n  </p>\n<p>All agents \"live\" in the Factory</p>\n<h2 id=\"the-factory\"><a href=\"#the-factory\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The Factory</h2>\n<p>This is the main model file. It loads the input data (which conveyors to connect to which machines), initializes all agents and puts initial products into conveyors and machines. This is also where Simudyne steps through model ticks (i.e. advances time).</p>\n<p>As shown below, the main part executes the Simudyne agent paradigm by:</p>\n<ol>\n<li>Checking if machines finished products </li>\n<li>Pushing them into conveyors as well as push out products to downstream machines </li>\n<li>Machines receiving products from their upstream conveyor.</li>\n</ol>\n<p>\n  <span\n    class=\"gatsby-resp-image-wrapper\"\n    style=\"position: relative; display: block; padding: 20px; max-width: 690px; margin-left: auto; margin-right: auto;\"\n  >\n    <span\n      class=\"gatsby-resp-image-background-image\"\n      style=\"padding-bottom: 35.00979751796211%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAHCAYAAAAIy204AAAACXBIWXMAAAsSAAALEgHS3X78AAAAv0lEQVQoz3VRWxKDMAj0OmoSyEOtj/b+t6KAkonO+LEuIcsCsRvHkRCRAIC89xRCYHgC5UDOORKN8RvsvrMgBKBcJirTrJjm5YxL0WYCaSDNEaHmLG+shn3fsyjSuu207Yfi+P6Ul89KKaVbsW0i3KIaCgKLU85cnJVlWgBkoasF7drDMNxg+U4+IpbuZmbcTlNjON+1NWlRDfV9YqTI68XIKyLWyd4mevJp6NxlCGwmqxae7vwR7rp7Fj3PbfwHdkbW8ECHe7kAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n    >\n      <picture>\n        <source\n          srcset=\"/static/factory_step-fd96ae5af0f8692787189e3136ed2761-8e416.webp 173w,\n/static/factory_step-fd96ae5af0f8692787189e3136ed2761-0b506.webp 345w,\n/static/factory_step-fd96ae5af0f8692787189e3136ed2761-58be5.webp 690w,\n/static/factory_step-fd96ae5af0f8692787189e3136ed2761-59b8d.webp 1035w,\n/static/factory_step-fd96ae5af0f8692787189e3136ed2761-4a474.webp 1380w,\n/static/factory_step-fd96ae5af0f8692787189e3136ed2761-1f300.webp 1531w\"\n          sizes=\"(max-width: 690px) 100vw, 690px\"\n          type=\"image/webp\"\n        />\n        <source\n          srcset=\"/static/factory_step-fd96ae5af0f8692787189e3136ed2761-7e3fa.png 173w,\n/static/factory_step-fd96ae5af0f8692787189e3136ed2761-7f1d4.png 345w,\n/static/factory_step-fd96ae5af0f8692787189e3136ed2761-13856.png 690w,\n/static/factory_step-fd96ae5af0f8692787189e3136ed2761-045bb.png 1035w,\n/static/factory_step-fd96ae5af0f8692787189e3136ed2761-f46ab.png 1380w,\n/static/factory_step-fd96ae5af0f8692787189e3136ed2761-39e25.png 1531w\"\n          sizes=\"(max-width: 690px) 100vw, 690px\"\n          type=\"image/png\"\n        />\n        <img\n          class=\"gatsby-resp-image-image\"\n          style=\"width: 100%; height: 100%; margin: 0; vertical-align: middle; position: absolute; top: 0; left: 0; box-shadow: inset 0px 0px 0px 400px white;\"\n          src=\"/static/factory_step-fd96ae5af0f8692787189e3136ed2761-13856.png\"\n          alt=\"factory step\"\n          title=\"\"\n          src=\"/static/factory_step-fd96ae5af0f8692787189e3136ed2761-13856.png\"\n        />\n      </picture>\n      </span>\n  </span>\n  </p>\n<p>We also regularly add new products into the very first conveyor at a rate of 1000 products per minute.</p>\n<h2 id=\"the-conveyors\"><a href=\"#the-conveyors\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The Conveyors</h2>\n<p>We have 6 conveyors, each with a length of 9000 meters (it is a big factory) and a speed of 2.223 meters per second. </p>\n<p>These are stored in the Conveyor class. Conveyors can do various things:</p>\n<ol>\n<li>initializeProducts(int numProducts) is called at the start to fill conveyors with 1000 products</li>\n<li>addNewProducts() is only called for the first conveyor in the sequence and tries to squeeze in new products into the factory (using the global rate of 1000 products per minute)</li>\n<li>receiveProductAndPushOutOldest() is called when the upstream machine of this conveyor finished a product and wants to add it to this conveyor</li>\n</ol>\n<p>There are a few more functions that mimic conveyor \"physics\", such that it is an accumulating conveyor where products need to travel along the length of it before being able to queue or exit.</p>\n<h2 id=\"the-machines\"><a href=\"#the-machines\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The Machines</h2>\n<p>Each machine can always only work on 1 product. It has no built-in queue (that is the purpose of the conveyors). Machines can do 3 things:</p>\n<ol>\n<li>isProductFinished() is called each tick to check if the current product finished its assigned cycle time</li>\n<li>pushDownstreamAndFlagUpstream() is called if a product is done. It is sent to the downstream conveyor (or logs that a product finished the factory journey if it is the last machine). It also tells the upstream conveyor that it can now accept a new product</li>\n<li>receiveProductForWork() will add a product to this machine that was sent from an upstream conveyor</li>\n</ol>\n<h2 id=\"the-products\"><a href=\"#the-products\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>The Products</h2>\n<p>Each product is an agent with a fixed length of 0.1m (so we determine how many can be stored on conveyors). Each product also tracks how long it already spent on a machine (to trigger exiting a machine after the cycle time is done) as well as its (physical) position on a conveyor until it reaches the exit edge.</p>\n<h3 id=\"required-parameters\"><a href=\"#required-parameters\" aria-hidden=\"true\" class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Required parameters</h3>\n<p>You must make sure that your model applies these parameters:</p>\n<ol>\n<li>6 conveyors and 6 machines, sequentially linked (so the flow starts at conveyor 1 and ends after machine 6).</li>\n<li>Each conveyor is filled with 1000 products at the start</li>\n<li>Each machine is filled with 1 product at the start</li>\n<li>The first conveyor receives an additional 1000 products per minute</li>\n<li>Product cycle times are uniformly distributed between 10 and 80 milli-seconds.</li>\n<li>Products are 0.1m long</li>\n<li>Conveyors are 9000 m long and move at 2.223 m/s</li>\n</ol>","headings":[{"value":"Overview","depth":2},{"value":"The Factory","depth":2},{"value":"The Conveyors","depth":2},{"value":"The Machines","depth":2},{"value":"The Products","depth":2},{"value":"Required parameters","depth":3}],"frontmatter":{"title":"Factory Simulator","toc":true,"experimental":null}},"site":{"siteMetadata":{"title":"Simudyne Docs","latestVersion":"2.6"}}},"pageContext":{"absolutePath":"/home/vsts/work/1/s/content/2.5/docs/models/factory_simulator.md","versioned":true,"version":"2.5","kind":"docs","pagePath":"/models/factory_simulator","chronology":{"prev":{"name":"Mark 0 Simple Economy Model","path":"/models/mark0"},"next":{"name":"Consultancy Model","path":"/models/consultancy_simulator"}},"lastUpdated":"2026-04-21T13:56:54.856Z"}}