question

Cody F avatar image
0 Likes"
Cody F asked Felix Möhlmann answered

How to randomly select a queue in process flow?

I am using process flow and connecting it to queues in a 3D model. My process involves AGVs taking a companion frame once it's full, and towing it through a packing process and returning empty frames to be reloaded at the vacated queue locations. I am trying to randomly select a queue, from a group of queues, each of the queues will be holding an empty frame. Once the queue is selected, I am thinking I'll be able to manipulate the empty frame in the queue and make it full, then can push to a list. How can I make this random selection? Or is there another way to accomplish this randomized selection of a member within a group?

Any suggestions are appreciated. Thanks.

FlexSim 21.2.4
process flowgroupsqueuesrandomize
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered

I assume you would want each queue to selected by only one token at a time, correct. For that I would suggest using a process flow resource that references the group of queues and use "ORDER BY RAND()" in the query field of the acquire activity. This will randomize the order in which the queues are acquired.

1638258241633.png

To reference a random member of a group, without regard for whether it has been acquired previously, cou can use the following code to return a reference to any random group member

Group("groupName")[duniform(1, Group("groupName").length, getstream(current)]
// The getstream(current) is optional

1638258241633.png (11.7 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.