I have equipped my agent with a parameter barcode. Input is an Excel with different barcodes as arrival in the source.
There are four different types of parts in my model. Part 1 is multiplied in the model by a split block w times, part 2 x times, part 3 y times and part 4 z times.
The parts run different paths through my model. That means they have different times and therefore do not arrive back in the sink at the same time. Because I want all parts to end up in the sink at the same time, I want to work with a wait block.
When the parts are multiplied, they keep their unique barcode.
Example: Part 3 is multiplied y times. So there are y many part 1 with the same barcode. So in the wait block I want all agents (parts) to wait until ALL multiplied parts of this part arrive in the wait block just before the sink.
My approach is: a switch case within the wait block after Part 1, Part 2 ect.
And then inside the case a code like: if w agents with the same barcode are inside the wait block, free them
. But not all other agents. So you could say that this wait block is like a sorting station.
I would approach this differently. Instead of Wait
block, I would keep it as Queue
. Then join it to a Pickup
block. Inside Pickup
, select While condition is true
and type below the condition (assuming your total number should be 7) (agent.barcode==container.barcode) && (count(queue, q-> q.barcode==agent.barcode)==7 )
.
Whenever a new barcode enters the system, create a dummy agent with agent.barcode
set to that value and send the dummy agent to enter1
with code like enter1.take(agent)
. Then this dummy agent will wait in queue2
, once the count is reached, it will pick up exactly that number of agents and depart to sink. If you want, you can put a Dropoff
block and then Sink
.