Simulating a factory

All topics on coding 4Dscript in Enterprise Dynamics.
15497
Posts: 9
Joined: Tuesday 15 October, 2019 - 15:48

Simulating a factory

Post by 15497 »

Dear support team,

I'm working on a simulation model for my thesis and I have some questions about it. I hope I explained myself clearly. Please let me know if there's something unclear.

1. Modeling setup.
A lot needs to be converted at the factory and every setup is often associated with a different time. I have put all the different setup times in an excel. When the foil serial number is changed, a setup must be made. At the first setup I use the following 4D script

if (label ([Previous serial number], c) = label ([serial number], first (c)), 0, excelactiveX90_table1 (2,6))

This works but the 2nd switch is located in cell (3.6). The third changeover time is in cell (4.6). Etc., etc. It is possible that I eventually have to switch up to 50 times per run. And when the machine has to setup it keeps using the setup time located in cell (2.6). How can I change this? I want it to use cell (3.6) for the first setup, cell (4.6) for the second setup, cell 5.6 for the third setup, etc, etc.

plus sometimes the setup function doesn't work. is there something i'm doing wrong?

2. Use of buffer
Currently, production is only made from the direct buffer. This means that the roles that are stored in the ground storage are not processed but remain in the ground storage without further actions. How is it possible to change this.
In addition, I want to prevent products that are both produced on the Tv1 from being mixed. Because all products go through the buffer, but the current product that is produced on the Tv must have a predisposition to any other product that is produced on the etxrusie 1. So if production takes place in advance, those roles should not yet go to the buffer. This buffer must then still be filled from the storage.

3. Push strategy on server

I want to be able to run the servers (Tv 1, Tv 2, Tv 3 and Tv 4) according to a fixed schedule, based on foil numbers and number of products, from Excel. The servers must therefore only run the foil number I have planned and stop when the quantities of end products I have planned have been reached. I would also like to see, while running the model, which product of the planning is currently running on the RDM1, RDM 2, RDM 3 or RDM 4. If the supply from the 'ground storage' is not enough, the machine should have downtime and a clock should time how long this takes. It should keep producing this product until the scheduled number is reached and it must also be visible which product a particular machine is waiting for. I want to get a message on the moment one of the TV machines is waiting on products.

4. Output channels ground storage
When I connect the output channels of the ground storage to the buffers of the RDM servers and run the model I get an error message. Am I doing something wrong here?

5. Lines in the model
I would like to use lines in the model to make the whole model a bit more clear. Is it possible to draw simple lines within the model just like you can insert textboxes?

6. 50 different colors of the product.
I would like to be able to display a different color for each sheet number in the form of a colored circle. Just like the circles with the different icons. I would prefer to transform them from the basic shape to the circleyellow, Circlegreen, etc. But then in 50 different colors instead of 12 different colors.

7. Using labels
I have a total of 4 different labels linked to products that are entering the model. These are linked to the product on both the source and the queue. Can I also do this all at once with the trigger on creation of the source by listing them all within a case statement or something like that?

8. Run control in model.

Is it possible to use the run model as a button in the model?

Thank you in advance for your answer.

Kind regards,

Sam
Attachments
ED versie 28 forum versie.mod
(396.44 KiB) Downloaded 400 times
MargaritaBagamanova
Posts: 3
Joined: Thursday 27 June, 2019 - 09:35

Re: Simulating a factory

Post by MargaritaBagamanova »

Good day Sam,

1. For setting up the machines you can create a global variable (good idea to do it in the atom Initialise) that will count the number of times the setup has been made and use this variable to refer to the cell in the table. The other way would be to assign the corresponding setup time on creation of the product to a label, say, “setuptime” and use this label on the setup of the server.
2. I don’t completely understand what is the way of using buffer and storage that you are trying to achieve. In general, you need to define which product must be send from the Storage and through which output channel (ctrl+r will display the channel connections). This is done in the Ground Storage GUI. I could help you more if you explain what you want to do here.
3. To stop the server you may want to use Condition Control atom, which will check if output(server) = N of products, and on TRUE close server input. Note, that this will work perfectly only if only 1 type of the product is processed on the server. To display the name of the product, you need to click on the original product icon (the one you connected to the source atom) and press Shift+F5. This will open product editor. Here on the tab 2D next to Name droplist you can select YES to display products name.
4. You get the error message because you didn’t specify the logic to select the product to be send out. When you specify it, the error should disappear.
5. There is no drawing option for the lines in Enterprise Dynamics. However, if you insert a “Node” from “Basic modelling” library and place one after the buffer for instance, and the second node before the server this buffer is connected to, these nodes will be automatically connected by an arrow. Make sure, that these nodes channels are only connected to each other to see the arrow.
6. You can generate a number of colours using discrete uniform distribution duniform(1,536870912). You could store the generated color in the corresponding row of your excel table and all following products with this sheet number can refer to it.
7. In general, when you have a lot of labels to be assigned to a product, it is useful to use atom “ArrivalList” (in library “Time”). This atom assigns label to created products based on the headers of its table. You could copy your excel table here, and then add the required labels on tab “Labels” of ArrivalList atom. These labels will automatically have names of the “Arrivals” tab table.
8. Such feature, unfortunately is not default in Enterprise Dynamics. If you have Developer package available in your version of Enterprise Dynamics, you could create an atom that will start the simulation when being clicked. For this you need to code such atom’s “Events” tab in the row “User” with the function called RUN.

Please, let me know, if you have further questions or something is not clear in my explanations.

Kind regards,
Margarita
15497
Posts: 9
Joined: Tuesday 15 October, 2019 - 15:48

Re: Simulating a factory

Post by 15497 »

Hello Margarita,

Thank you for your response, I am glad there is someone to help me, although your answers are not very clear to me. Could you be more specific in your answers?

1. Could you show me how the initialise atom works and help me with the code I need to use to make it use the correct cell for the correct setup time. so;
setup 1->cell 3.7
setup 2->cell 4.7
setup 3->cell 5.7
setup 4->cell 6.7
setup 5->cell 7.7
setup 6->cell 8.7

In addition, I am still experiencing problems with the setup. I do not really understand what you mean by ‘specifying the logic to select the product to be send out’. Sometimes the setup works but most of the time it skips the first setup. I also think I’m making a mistake with labeling the products. Only the sinks 1-10 work properly. The other sinks (11,12,13,14 and 15) don’t work.. How can I fix this?


2,3 and 4
As you can see in my model I make extrusie 1 check the buffer input channel. If the corresponding buffer is full I want it to use the ground storage. But in reality the buffer represents a square in front of the machine. In reality, if this buffer is empty, a forklift truck needs to pick a roll out of storage and place it in front of the machine in the buffer square. This means all products need to go through the buffer before they can be thermo formed.

The problem that occurs in this situtation is that when I run the model it gives multiple errors. Once you run it you'll know what i'm talking about.

When TV1 starts producing, let's say, foil serial number '750082503'. Only the roles with label [Folienummer]:= 750082503 should be placed inside this buffer. So if Extrusie 1 is producing, let’s say, '840073001', which is also scheduled to be produced on TV1, the products labeled '840073001' should be placed in ground storage. If the buffer TV1 is filled with products labeled '750082503' these products should also be placed in gorund storage. But when the server processed a roll the buffer should be filled up with the corrently needed foil roll. This means that the buffer should take one roll labeled: '750082503' out of the ground storage to fill up the buffer. If there are no rolls in ground storage labeled with this foil serial number, meaning the buffer will run empty, I want machine TV1 to be idle until the stated amount of products in a certain cell in column 2 are produced.

So I want the Server 'extrusie 1' to fill up the buffer in the first place. But if 'extrusie 1' isn't able to fill up this buffer i want ground storage to fill up the buffer. In both cases the buffer should only be filled with rolls with the correct foil serial number or, in case it's the last serial number of this kind in the batch, it should fill up the buffer with the next product.

To do so I think the buffer should check the total amount of products that left the buffer labeled:
Label([order], i) := ExcelActiveX90_table1(2,2). Let's say the amount of products, labeled: label [order]:= 1, that entered queue: 'Buffer' = 10

Then it should check the value stated in cell ExcelActiveX90_table1(2,3). This is the total amount of a given order that needs to be produced. Let's say the value in this cell is 20. Meaning 10 more products should should go in the buffer before TV1 is done producing order 1.

This means that if the amount of products that entered the Buffer labeled Label([order], i) := ExcelActiveX90_table1(2,2) equals the amount of products in cell ExcelActiveX90_table1(2,3) there are no more rolls with this order number left in storage to produce.

This means the buffer from now on should start comparing the amount of products that entered the Buffer labeled Label([order], i) := ExcelActiveX90_table1(3,2) with the amount of products in cell ExcelActiveX90_table1(3,3). Once these 2 amounts are equal it should move on to order 3.

From now on the Buffer should start comparing the amount of products that entered the Buffer labeled Label([order], i) := ExcelActiveX90_table1(4,2) with the amount of products in cell ExcelActiveX90_table1(4,3). Once these 2 amounts are equal it should move on to order 4.

From now on the Buffer should start comparing the amount of products that entered the Buffer labeled Label([order], i) := ExcelActiveX90_table1(5,2) with the amount of products in cell ExcelActiveX90_table1(5,3). Once these 2 amounts are equal it should move on to order 5.

Could you help me to simulate this?
And so on.

5.
My question regarding the possibility to draw lines is about my desire to make the model visually as clear as possible. With lines I can create certain groups within my model.

6.
I still don't really understand how these colors should be implemented in my model. Also a bug appears everytime I try to implement your answer to my third question. you told me:

To display the name of the product, you need to click on the original product icon (the one you connected to the source atom) and press Shift+F5. This will open product editor. Here on the tab 2D next to Name droplist you can select YES to display products name.

But everytime I try to switch no to yes and press apply I receive a message with the text 'acces violation'. This results in me having to restart my whole computer.



I hope I explained my questions/problems clear enough. Please let me know if there's anything not clear in my questions.

Thank you in advance.


Kind regards,

Sam
User avatar
HarryBunnik
Posts: 362
Joined: Monday 07 February, 2011 - 11:22

Re: Simulating a factory

Post by HarryBunnik »

Ha Sam,

I’ve looked into your questions as well and perhaps I have a few ideas for you.

1)

So if I understand correctly you want this to happen at the Extrusie1 process, where at any time the FolieNummer is changing, you want to use the Setup located in cell(2,6).

However, top on, you also want to use the times that are located in the other cells (3-53?, 6). This is no entirely clear to me. You want to use the value from cell(2, 6) and add the other value (cell(3-53, 6)? Or what do you have in mind here?

There are a few things I would consider here:
  • You have to add an Initialize atom to the model (Library => Tools => Initialize)
  • Here you have to add a global variable Dim([valCurrentFolie], vbValue). This variable can be used everywhere in your code throughout the model.
  • Then on the server Extrusie1 every time you change from FolieNummer, you can increment the valCurrentFolie with one and use this to refer to the correct cell. That is, is the products are also processed in this order.

    Code: Select all

    ExcelActiveX90_table1(valCurrentFolie, 6)
However, personally I would use an arrival list (as Margarita also suggested), instead of several sources. That makes it easier to set it all up and is more flexible. This is handy when the order list get an extra 10 product types.
  • Make sure that one of the labels you assign to your product, is the row in your table representing this product, so that you can make from every point in the model an easy reference to the cells in your table to get the required information. This can be done relatively easy with an arrival list.
  • At that point you can also consider to have batches processed in different orders, since you can use the label to read out the setup time.
    Also the code on the “Queue - Opslag gereed product”is that reduced to a single line:

    Code: Select all

    ExcelActiveX90_table1(Label([ProductRowNumber], First(c)), 1)
And I think there are some more points where this would make life easier. 😊

2 - 4)

Unfortunately there are some connections missing in the model when I load it in ED, which makes it a bit guessing what the objective is.
  • The first thing that might cause some problems, is the SendTo statement on the Extrusie1. Here you have a code checking for the content:

    Code: Select all

    if(content(out(1,c)),5,1)
    ,

    The problem with this code is that it will only work when the capacity of the Queue behind it is set to 1. Only in that case content(out(#, c))is returning 1. When the content is 2, this piece of code is returning 2, so the statement is not 1 (true) ergo, it is false. So you have to compare the content with the capacity of the queue. And that capacity can be found in an Attribute of that Queue.:

    Code: Select all

    if(content(out(1,c)) = Att([Capacity], out(1, c)),5,1)
  • I think that due to the non-available connections, I don’t get the errors that you’re referring to. Perhaps you can implement the changes I suggested and update the model in this thread, so I can look what/if further anythings goes wrong.
5)

I normally recommend the use of composition containers (Library => Tools => Composition containers) to create groups in models.

Lines you either have to create some code for (On the On2Ddraw event you can write the animation code using DrawLine(0, 0, 10, 10, ColorNavy, 5)
For more information I refer at this moment to the help file.

However, another fast “workaround” (besides the use of networknodes) can be using a conveyor that you give a width of only 0.1 m or less and the required length and color.

6)

First your original question. I see that you also have several square products. These are nice in that respect that you can easily change the color of them on code:

Code: Select all

(Color(i) := RgbColor(#,#,#)
to a color of your wish.

The other objects (circles) are images that are loaded into ED (look in the Ribbon Tools, Resource manager). So you can make more of these outside ED (using paint for instance and add them in the directory where also you model is standing). You can then add them to ED in the Resource manager. Once that is done, you can link them to the product using the visualization tab.

Or you have to create some code on the 2D animation of the product. If that is really what you want, I can help you there.

As far as the access violations go:

I tried what you described:
To display the name of the product, you need to click on the original product icon (the one you connected to the source atom) and press Shift+F5. This will open product editor. Here on the tab 2D next to Name droplist you can select YES to display products name
For me that works without any problem, so that leaves me a bit puzzled. Perhaps that is a computer specific problem. Of course a crash is very annoying and time-consuming. So I would like to try find what is causing it. So I hope you can help me with this. Therefore, I have a few questions:
  • Do you know if the drivers of the video card are updated to the latest version?
  • Can you give some information on what type of machine you’re running ED?
  • And under what environment (Windows version, virtual machine and so on)?
I hope this helps you a bit further. If not, let me know, than we can have a look at how to make your model work.

Regards and success,

Harry
15497
Posts: 9
Joined: Tuesday 15 October, 2019 - 15:48

Re: Simulating a factory

Post by 15497 »

Hey Harry,

Thanks for your quick response, over the past few weeks i have been trying to realize the changes you advised. A lot of things are solved and a lot of other subjects have been resolved by working around the problem.

But in order to run my simulation there are still some loose ends which i really want to resolve. Most of the problems occur because of the push strategy that ED uses. I want to be able to produce foil rolls and place them in stock without telling where they need to be produced. I want the products to stay in the ground storage until either RDM1, RDM2, RDM3 or RDM4 needs them. So i want the RDM's to take products from the ground storage instead of the ground storage sending the products to the corresponding RDM. At the moment i still need to evaluate the send to statement and the queue discipline forces me to define a followed server.

Thereby I'm having a hard time making the servers directly after the ground storage produce simultaneously. RIght now they only produce one at a time because of the queue discipline in the ground storage.

I'm using a table in which i am able to define the needs of each RDM. These tables are named RDM1vraag, RDM2vraag, RDM3vraag and RDM4vraag.

in these tables the first column refers to the product which needs to be picked from the warehouse. These products are all labeled by there own product label named: 'foliegetal'.

the second column refers to the amount of products labeled that 'foliegetal' needs to be picked from the warehouse before it continues to the next order in the next row.

Can you please help me to make the simulation work?

I will send you my most updated model in a direct message.


Thanks for how much you've helped me so far.

Regards,

Sam
User avatar
Gerben
Posts: 9
Joined: Monday 30 April, 2018 - 09:48

Re: Simulating a factory

Post by Gerben »

Hi Sam,

I would suggest the following:
- Add an extra attribute to each RDM, refering to the current RowIndex in RDMVraag which is being processed right now. Decrement the needed quantity of items in the row for every item you start processing in the RDM.
- Keep track of the current accepted itemType in the buffers, based on the RowIndex of the corresponding RDM.

In order to make sure that the buffer won't get the wrong itemType, choose 'Product To Send' in the Ground Storage such that it has the same itemType as defined in the chosen buffer.
In order to make sure that the buffer won't accept to much items of the type, use the counter in the RDMvraag table and the content of the buffer to either close the input-channel or increment the RowIndex in the RDM. (whatever fits your situation best)

It might be worthwhile to create a function GroundStorage_ItemTypeExists, which checks whether any item with the given itemtype is present in the Ground Storage. You can use this to open or close the channels to the buffers when the requested products are (not) available (anymore) for the RDM behind it.

It's all about sharing information between RDM, buffers and the Ground Storage and acting upon it when events (entering/exiting) occur.
I hope that my suggestions give you enough information to get a step further in creating your model.

Good luck,
Gerben
15497
Posts: 9
Joined: Tuesday 15 October, 2019 - 15:48

Re: Simulating a factory

Post by 15497 »

Hello Gerben,

Thank you for your quick response. I don't really understand what the actions are for me to make it work. Could you maybe help me some more? It's most important for me that the ground storage functions as I want it to. That means it should supply all the servers simultaneously without stacking the products in the same column as the previous product. So I'm looking for the right queue discipline and product to send.

Thank you for your help

Kind Regards,

Sam
15497
Posts: 9
Joined: Tuesday 15 October, 2019 - 15:48

Re: Simulating a factory

Post by 15497 »

This is the file i'm currently using
Attachments
ED DESCH versie 64 forum.mod
(891.84 KiB) Downloaded 340 times
15497
Posts: 9
Joined: Tuesday 15 October, 2019 - 15:48

Re: Simulating a factory

Post by 15497 »

I figured out how to produce simultaneously but i still can't figure out how to produce with a pull strategy. Is there anyone who is able to help me?
User avatar
HarryBunnik
Posts: 362
Joined: Monday 07 February, 2011 - 11:22

Re: Simulating a factory

Post by HarryBunnik »

Hi Sam,

I'm not entirely sure how you want to operate it. However, the tips that Gerben has provided sounds like good ideas to me.
To me it also sounds as if you want to do something with the "Product to send" option in the Ground storage. Here you have to write some code which loops over the content of your ground storage, searching for the best option and selecting that product as the product that next leaves the ground storage. Otherwise, your storage will be blocked by products trying to get to a different production line.
And to place that code in a separate function (Function-atom under library => Tools => Function editor).

Also, the idea to create a function checking if a valid product is available in the ground storage, sounds like a good idea.

Additionally, I would control the opening and closing of the ground storage using the functions. This than has to be handled by the servers, since that is where you want to place the controls:

- CloseOutput(refGroundStorage)
- OpenOutput(refGroundStorage)

You only have to be thinking about how you want to let this first start controlling after the process is running.

You can make a global variable on an initialize-atom (connect the outgoing channel # with the information/central of the ground storage) to easily reference to it.:

-Dim([refGroundStorage], vbAtom, out(#, c))

I hope these ideas help you a further.

Regards,

Harry
Post Reply