question

kongxincaier avatar image
0 Likes"
kongxincaier asked Jason Lightfoot commented

How to choose a queue?

Hello, my friends. Now I want to implement a logic. In the model, the AGV prefers to move the goods to the group Q, but when the group Q is full, the AGV moves the goods to groupQ1. when there is an empty position in the group Q, the AGV moves the goods to the groupQ1 again.


Thanks for your help!

MODEL.fsm

FlexSim 22.2.0
agvmoveobjectchoose que
model.fsm (47.9 KiB)
· 1
5 |100000

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

Jason Lightfoot avatar image Jason Lightfoot ♦ commented ·

Hi @kongxincaier, was Kavika F's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Kavika F avatar image
0 Likes"
Kavika F answered

Hey @Kongxincaier, in the model you've provided, the queues in Group Q never get full. Your logic makes it so the AGV picks up a box then decides whether or not to put it in a random Queue. If that queue is full, then it simply picks up another box and never places that new box anywhere. You'll need to instead pick a different location to move the box to in the group to even get Group Q to fill up.

1711382256760.png

If you want to see if there's room in the Group, you can setup a function to check all the space in the Group Q. For example:

/**Custom Code*/
Group q = Group("Q");
for (int i = 1; i <= q.length; i++) {
  Object curQ = q[i];
  int maxContent = curQ.getProperty("MaxContent");
  int curContent = curQ.subnodes.length;
  if (curContent < maxContent) {
    return 1;
  }
}
return 0;

This will return 1 if there's still room in the Group Q; otherwise, return 0. So, you can have a decide activity check to see if there's more room in the Group, and if there isn't, then have it deliver to the Q1 group.


1711382256760.png (23.1 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.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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