question

guoyi avatar image
0 Likes"
guoyi asked Carter Walch answered

How to select unloading objects according to the sorting within the group

I will put queue into a group. When selecting unloading objects for crane, I want them to be selected according to the order within the group. For example, the first unloading object is queue1, the second is queue2, and the third is queue1.

1685023845685.png

FlexSim 23.1.2
crane
1685023845685.png (11.0 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.

1 Answer

Carter Walch avatar image
1 Like"
Carter Walch answered Carter Walch edited

Hi @guoyi ,


If you have a resource that points to a group of queues, you can acquire that resource onto your token (token.resource) to get an individual queue. Then FlexSim automatically takes the first object to Queue1, the second to Queue2, and so on. This is demonstrated here:

1685031388228.png

crane1.gif

craneexample.fsm

You can also accomplish this by adding a variable which changes with each token. The first token will be 1 and send it to the first queue in the group. The second token will set the variable to 2 and go to the second queue. This gives you more control over what the code is doing to decide the destination.

1685031845847.png

1685031864485.pngcrane2.gif

UnloadTSinGroup.fsm

Note: this custom code changes between 3 queues (1 sets to 2, 2 sets to 3, and 3 sets back to 1). You will have to change it according to your model


Finally, if you are simply wanting to reference the objects within the queue and choose which queue to be your unloading object. Use this syntax:

Group("Queues")[1]

This selects the first member of the group titled "Queues"


Hopefully this helps!



1685031388228.png (28.0 KiB)
crane1.gif (2.0 MiB)
1685031845847.png (24.7 KiB)
1685031864485.png (17.1 KiB)
crane2.gif (1.5 MiB)
craneexample.fsm (45.0 KiB)
unloadtsingroup.fsm (40.2 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.