question

Andre T6 avatar image
0 Likes"
Andre T6 asked Ryan Clark commented

Need assistance in my custom code

Hi,
I want to move my item in queue 2 or 3 (item that arrive first) into queue 5 when the content in queue 6 is less than 5 and moving item from queue 1 to queue 2/3/4 (in fifo order). But when i try to do that, the crane just moving the item from queue 1 to queue 5 when the content in queue 6 is less than 5.
How do i fix this?

FIFO Model1.fsm

FlexSim 21.2.2
process flowcustom codecrane
fifo-model1.fsm (89.6 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

David Chan avatar image
0 Likes"
David Chan answered Ryan Clark commented
  1. @Andre T6 Not sure this is what you are looking for. Your logic in the if statement need to bracket properly.
  1.  
  2. if(CurrContent2 < 5){
  3.     token.item.destination = Model.find("Queue5");
  4. }
  5. else 
  6. {
  7.     if(CurrContent < MaxContent)
  8.  
  9.  
  10.     {
  11.         token.item.destination = Model.find("Queue4");
  12.     }
  13.     else
  14.     {
  15.     total += 50;
  16.         if (randomnum <= total)
  17.         {
  18.             token.item.destination = Model.find("Queue2");
  19.         }
  20.         else
  21.         {
  22.             token.item.destination = Model.find("Queue3");
  23.         }
  24.     }
  25. }
· 16
5 |100000

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