question

Chua X2 avatar image
0 Likes"
Chua X2 asked Felix Möhlmann commented

Queue logic

Hi all,

FYI, the red and green item will go through 3 phases: green processor -> pink processor -> yellow processor. At most of the "out queues" (blue), the priority of the port connection is always the "in queue" within the same tower. If no queues are available, the robots will send the item to "BF for PMIC" queue.

The blue item will go through only 2 phases: green processor -> yellow processor. If no "in queues" are available, send the item to "BF for RF" queue.


My current model right now is sending first available for the el and pmic out queues ( see the code at those queues). I want to modify code at those out queues to be sent to the shortest queues if available queue but I am not sure how. Right now I am just doing the port rankings based on distance and I am not sure if it is also performing the same way as the shortest queue if available.


Finalised Current state model.fsm

FlexSim 20.1.3
queuesimulationmodelflow itemsshortest queue if available
· 2
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 Felix Möhlmann commented

"Shortest Queue" sends the item to the queue with the least currently in it. Since all of your queues have a maximum capacity of 1 this setting wouldn't actually do anything, since the queues with an item in them aren't available anyway.

To send the items to the closest queue (by distance) ordering the ranks of the connections should be enough to achieve that with the current logic.

If the positions of the queues might change often, you can use code like the following to send to the closest available regardless of ranking.

  1. int bestindex = 0;
  2. double closest_dist = 999999;
  3. for(int index = 1; index <= current.outObjects.length; index++)
  4. {
  5. if(opavailable(current, index))
  6. {
  7. Vec3 dist_vec = current.outObjects[index].getLocation(0.5, 0.5, 0) - current.getLocation(0.5, 0.5, 0);
  8. double dist = dist_vec.magnitude;
  9. if(dist < closest_dist)
  10. {
  11. closest_dist = dist;
  12. bestindex = index;
  13. }
  14. }
  15. }
  16.  
  17. // Return closest available queue
  18. return bestindex;
· 7
5 |100000

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