question

SerenaCR avatar image
0 Likes"
SerenaCR asked Jeanette F commented

Help custom code

Hi, I'm having problems with the following custom code:


1671202259216.png

Object current = param(1);
treenode activity = param(2);
Token token = param(3);
treenode processFlow = ownerobject(activity);


Array racks_LU = [Model.find("Libre_1"),Model.find("Libre_2"),Model.find("Libre_3"),Model.find("Libre_4"),Model.find("Libre_5")];


if(racks_LU[1].subnodes.length < Model.parameters.cap_rack_LUg){
  
    token.donde2 = Model.find("Libre_1");
}
else {
  
    for (i=1;i<=5;i++){
  
        if(racks_LU[i].subnodes.length < Model.parameters.cap_rack_LU){
  
            token.donde2 = racks_LU[i];
            break;
        }
    }
}



The idea is to set a storage location with the label "donde2".

The array contains the different racks in the model in ascending order. The purpose is to store in one rack at a time, once the rack is full proceed with the next one.


Thank you!.

FlexSim 22.2.4
using code
1671202259216.png (34.4 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.

Joerg Vogel avatar image Joerg Vogel commented ·
Fill racks in order of connection for example by a queue you need not to write source code. You set in output pane of such a queue for Send To function just “first available”. In each rack you choose a template to fill rack by bay, level, slot with a restriction of how many items are allowed in a slot. A restriction can be a number of items or a method like hasSpace.
0 Likes 0 ·
Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @SerenaCR, was Jason Lightfoot'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 unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Jason Lightfoot edited

You probably should be using the storage system to find the slots for you. In that case you could order the slots by slot.AisleID and set the AisleID to increment for each of the racks in your array.

Without seeing your model there are a few areas that might cause a problem with your method - one being transport time from the point you decide on the rack and arriving at the rack. The time in between is not value to use your code, since subnodes length does not yet reflect the part enRoute. If you're using regular 3D send/receive logic with transport then there is another variable "nroftransportsin" which you could use to try and estimate the capacity correctly, but all of this is handles for you if you use the storage system methods to findSlot, findItem etc..

5 |100000

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