Currently I'm trying to include dynamic B.O.M with my assembler, in short what i'm trying to do is:
I have a fixed size container to which I pack many different sized product, I do the calculation of how many of each product can fit into 1 container.
At the moment I do 2 checks,
1. If there is an atom inside of the container in the assembler,
2. If the name of atom that entered queue before assembler has the same name as the last atom in the container
Depending on the result I modify the B.O.M list. for example if product 1 can fit 200 atoms into the container but only 50 arrive before another product comes along, I want to update B.O.M and ship the container with 50 atoms and open up slot for another product.
From my understanding the below code should work just fine, but afaik there might be problem with when Events occur in simulation and the B.O.M table sometimes doesn't update correctly, especially after reset and often the assembler becomes "stuck" and doesn't send a ready product with container forward.
Any help would be appreciated.
Code: Select all
Do(
CloseOutput(c),
Case (
WhichIsTrue(
AtomExists(First(First(AtomByName([Assembler9],Model)))) = false,
CompareText(Name(i),Name(First(First(AtomByName([Assembler9],Model))))) = true,
CompareText(Name(i),Name(First(First(AtomByName([Assembler9],Model))))) = false),
Do(
SetCell(2,2,Label([Pak], i), AtomByName([Assembler9],Model)),
OpenOutput(c)
),
Do(
SetCell(2,2,Label([Pak], i), AtomByName([Assembler9],Model)),
OpenOutput(c)
),
Do(
{ClearRow(2,AtomByName([Assembler9],Model)), }
SetCell(2,2,Content(First(AtomByName([Assembler9],Model))), AtomByName([Assembler9],Model)),
SetCell(2,2,Label([Pak], i), AtomByName([Assembler9],Model)),
ExecEvent(OnEvent,AtomByName([Assembler9],Model)),
OpenOutput(c)
)
)
)