Combining multiple flow items based on label

Combining multiple flow items based on label

Vns
Not applicable
200 Views
7 Replies
Message 1 of 8

Combining multiple flow items based on label

Vns
Not applicable

[ FlexSim 23.2.0 ]

test1.fsm

Hi all - I need some help with combining multiple flow items(totes) ; with the label (pallet_id) to the similar base pallet . However it seem that the combiner is not pulling the items from either queue (Split_1 /Queue 9). I there something I missed or overlooked


1693927591822.png


I based my model on a related thread : HERE

Thanks in advance.

0 Likes
Accepted solutions (1)
201 Views
7 Replies
Replies (7)
Message 2 of 8

Jeanette_Fullmer
Community Manager
Community Manager
Accepted solution

Hello @Vns,

The only thing you are missing with implementing what you found is you need to change your MatchedOrder and Order to be integer variables instead of strings and use 0 instead of a blank string.

/**Custom Code*/
treenode current = ownerobject(c);
treenode item = param(1);
int port =  param(2);
int MatchedOrder = current.MatchedOrder;

if (MatchedOrder != 0) {
    //We previously matched an item so pull the matching order from the other queue
    if (item.pallet_id == MatchedOrder) {
        current.MatchedOrder = 0;
        return 1;
    }
    return 0;
}
 
int Order = item.pallet_id;
//Search the opposite queue for the same order
int otherPort = port % 2 + 1; //Grab the other port rank so we look at the other queue
treenode queue = current.as(Object).inObjects[otherPort];
for (int i = 1; i <= queue.subnodes.length; i++) {
    if (queue.subnodes.pallet_id == Order) {
        //Found a matching order, save the order on a label
        current.MatchedOrder = Order;
        //Now pull the item that just entered the original queue
        return 1;
    }
   
}
//No matches, pull nothing
return 0;

test1_1.fsm

0 Likes
Message 3 of 8

Vns
Not applicable
Hi @Jeanette F thanks so much for pointing that out.

However, i do have other totes still on the queue under the same pallet id which need to be pull to the combiner.

Is there a way i could read the number of relevant tote on the queue to set the target quantity on the combiner ?

0 Likes
Message 4 of 8

Jeanette_Fullmer
Community Manager
Community Manager

Hello @Vns,

I think it would be best to have a label on the pallet that says how many totes it is expecting and that label is what then determines how many to pull. Is that reasonable for your application?

Or do you just need to set the value to 7 in the combiner since it is 7 in the first combiner and I do not see you altering it?

0 Likes
Message 5 of 8

Vns
Not applicable
Hi @Jeanette F - i do have a randomize split on SEP_1 therefore the number of tote will only be determine on queue 9.

I'm assuming the combiner target must be dynamic to register the new qty after the split.

0 Likes
Message 6 of 8

Jeanette_Fullmer
Community Manager
Community Manager

Hello @Vns

I see that now. In this case you will want to add an On Entry trigger to the combiner. Start with the picklist option Update Combiner Component List with Labels.

1694119266156.png

This option has you update the component list from a global table. We will edit it to look like the following.

Object current = ownerobject(c);
Object item = param(1);
int port = param(2);
{ // ************* PickOption Start ************* //
/***popup:CombinerComponentListLabel*/
/**Update Combiner Component List*/
string tablename = /** \nTable: *//***tag:table*//**/"tablename"/**/;
string labelname = /** \nLabel: *//***tag:label*//**/"nooftote"/**/;
/** \n\nNote:
This option should only be used on Combiners.*/
/**\n*/
if (port == 1) {  
   //The trigger on entry code fires each time a flow item enters the combiner.
   //For this reason we check to make sure that the port entered is equal to 1
   //because only the container will enter through port 1.

  //The component list in a combiner is set up as a table.  This allows us to use the cell commands to obtain the node that contains
  //the number of items to retrieve from each port.  Once you know what node contains the information you can use the setnodenum
  //command to set the component list number based on the global table.

  Table thelist = getvarnode(current, "componentlist");
  treenode thesum = getvarnode(current, "targetcomponentsum");
  thesum.value = 0;

  thelist[1][1] = item.labels[labelname].value;
  inc(thesum, item.labels[labelname].value);
 
}
} // ******* PickOption End ******* //

I also changed the pull requirement to wait to change the Matched Order label till all the totes required had been pulled.

/**Custom Code*/
treenode current = ownerobject(c);
treenode item = param(1);
int port =  param(2);
int MatchedOrder = current.MatchedOrder;


if (MatchedOrder != 0) {
    //We previously matched an item so pull the matching order from the other queue
    if (item.pallet_id == MatchedOrder) {
        //see if capacity has been met
        if((getvarnum(current, "currentcomponentsum")+1) == getvarnum(current, "targetcomponentsum")){
current.MatchedOrder = 0;
}
        return 1;
    }
    return 0;
}
 
int Order = item.pallet_id;
//Search the opposite queue for the same order
int otherPort = port % 2 + 1; //Grab the other port rank so we look at the other queue
treenode queue = current.as(Object).inObjects[otherPort];
for (int i = 1; i <= queue.subnodes.length; i++) {
    if (queue.subnodes.pallet_id == Order) {
        //Found a matching order, save the order on a label
        current.MatchedOrder = Order;
        //Now pull the item that just entered the original queue
        return 1;
    }
   
}
//No matches, pull nothing
return 0;

test1_2.fsm

0 Likes
Message 7 of 8

Vns
Not applicable

Thanks @Jeanette F - will you be able to re-upload the model. The current doesn't seem to be downloadable.

0 Likes
Message 8 of 8

Jeanette_Fullmer
Community Manager
Community Manager
Hello @Vns,

I reuploaded it

0 Likes