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. if(CurrContent2 < 5){
  2.     token.item.destination = Model.find("Queue5");
  3. }
  4. else 
  5. {
  6.     if(CurrContent < MaxContent)
  7.  
  8.  
  9.     {
  10.         token.item.destination = Model.find("Queue4");
  11.     }
  12.     else
  13.     {
  14.     total += 50;
  15.         if (randomnum <= total)
  16.         {
  17.             token.item.destination = Model.find("Queue2");
  18.         }
  19.         else
  20.         {
  21.             token.item.destination = Model.find("Queue3");
  22.         }
  23.     }
  24. }
· 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.