question

Gabriela Buestan Yanez avatar image
0 Likes"
Gabriela Buestan Yanez asked Joerg Vogel edited

Capacity of racks

Good morning, I have a problem with the code, it is already assigned to each bay but in the first bays it is randomly stored and exceeds the capacity. Please, if you can help me with the program. Thank you

modelo-mm-copia.fsm

  1. /**Custom Code*/
  2.  
  3.  
  4. treenode item = param(1);
  5. treenode current = ownerobject(c);
  6. int cellcap = 2;
  7. int baynum;
  8.  
  9.  
  10. if (getitemtype(item)==1)
  11. {
  12. baynum=duniform(1,10);
  13. break;
  14. }
  15. if (getitemtype(item)==2)
  16. {
  17. baynum=duniform(11,18);
  18. }
  19. if (getitemtype(item)==3)
  20. {
  21. baynum=duniform(19,30);
  22.  
  23.  
  24. }
  25. if (getitemtype(item)==4)
  26. {
  27. baynum=duniform(31,50);
  28.  
  29.  
  30. }
  31.  
  32.  
  33. int flag = 2;
  34. int bays = 2;
  35. while(flag<=2) // loop limit
  36. {
  37. if(rackgetbaycontent(current,baynum) < cellcap*rackgetnroflevels(current,baynum))// enough capacity
  38. {
  39. return baynum;
  40. }
  41. else
  42. {
  43. flag++;
  44. baynum = fmod(baynum,bays)+1 + (getitemtype(item) - 1)*bays ;//find next bay
  45. }
  46. break;
  47. }
  48. return (getitemtype(item) - 1)*bays + 1; //no right bay will goto first bay of specified itemtype
  49.  
rackscapacitybayplace in bay
modelo-mm-copia.fsm (100.5 KiB)
· 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

Jeff Nordgren avatar image
1 Like"
Jeff Nordgren answered

@Gabriela Buestan Yanez,

In your code you do not have any cell (bay/level) maximum specified. You are just picking a random bay and putting it into a level on that by without any concern for limits.

In your modified model (modelo-mm-copia-jn1.fsm) I changed the single rack to be four separate racks with their own max content and a bay content limit. I do a Pull from each of these racks to get just the flowitem types matching their criteria. I also put a dwell time on each of the racks so that flowitems would eventually exit and not stop model execution. I connected the racks to the far left queue and that queue to the sink. This way, the model continues to run.

Take a look at the model and see if it is doing what you were wanting it to do. If you have any questions, please let us know.


5 |100000

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