question

ana.pc2 avatar image
0 Likes"
ana.pc2 asked ana.pc2 edited

Routing Restriction based on 2 labels

Hello everybody,


I am trying to route a item from a queue to a specific combiner(I have 3 combiners - based on values on table). My problem is that the item can only go to the specific combiner if the item has the same labels (SB and B_Type) as the combiner (SB and B_P_Type), if the item is not posible to go to the combiner, the idea will be to skip the item and check another one in the queue until find a match and route that match.

I need both checks statements to move the item. If there is no match, it will stay there and try to find the match in the queue (if the match it is not still there, I guess it will keep checking everytime a new item arrives to the queue).

I am using the code in the queue "Almacen_UA" (on another queues too but once I fix it there, I can manage for the rest)


The code is:

/**Custom Code*/
Object item = param(1);
Object current = ownerobject(c);

// Define the "Routes" table.
Variant tableID = "Routes";
Table table = Table(tableID.as(string));

// Set the row and column of table row and column to read.
Variant row = item.SB_Type;
Variant col = 3;

// Set Destination variable from the table.
string Destination = table[row][col];

// Loop through the output ports of current
for(int x=1; x <= current.outObjects.length; x++)
{
// Set DestTo to the object that output port x goes to.
Object DestTo = current.outObjects[x];


// If they are the same, then return x (output port of processor).
if(Destination == getname(DestTo))
{
if (current.outObjects[x].SB_P_Type == item.SB_Type)
{
if (current.outObjects[x].B_P_Type == item.B_Type)
{
return x;
}
}

}
}

}


Right now, it is sending everything no matter the label of SB_Type and B_Type (the item label) with SB_P and B_P_Type (the combiner label) -.- so I don't know what I am missing...


I hope it makes sense my problem! Any help is appreciate :D

Thanks,

Ana.

FlexSim 20.1.1
queuecombinerflexsim 20.1.1routelabel logic
initial-bc.fsm (41.3 KiB)
· 4
5 |100000

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

Braydn T avatar image Braydn T commented ·

@Ana PC2

Could you push the items to a list, and query the list by the two labels?

0 Likes 0 ·
ana.pc2 avatar image ana.pc2 Braydn T commented ·

I have never used lists, but I tried something random...

On entry I push to list??

and on flow I pull??

Not really sure how it works...


0 Likes 0 ·
Braydn T avatar image Braydn T ana.pc2 commented ·

@Ana PC2 Yes, on entry you would push them to a list. when you need an item from a queue, pull from the list. You will use a query (SQL) to pull it out.

https://docs.flexsim.com/en/20.1/Reference/ProcessFlowObjects/SharedAssets/PullFromList/

0 Likes 0 ·
Show more comments

1 Answer

·
tannerp avatar image
1 Like"
tannerp answered ana.pc2 edited

@Ana PC2,

You can achieve everything from your custom code block using Process Flow, and it's significantly easier to control and visualize what's going on. I'd highly recommend learning Process Flow and practicing the use of lists. These things make up a majority of what experienced FlexSim users use to build models.

That said, I created a simple demo that uses Process Flow to pull items from a list based on two criteria. The first is that the Type of the item has to match the Type of the combiner. The second is that the "AnotherLabel" label on the item must match the combiner's label of the same name. This is highlighted in the image below. The "Puller" is the token, and the token receives the labels in the "Assign Labels" activity also shown in the image below.

pull from list using Process Flow.fsm


· 3
5 |100000

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

ana.pc2 avatar image ana.pc2 commented ·

Hi @tanner.p

I have been trying your idea, but it is getting stuck on the queue (It does not pull the item?).

I attach again my model, would it be possible to check what I am missing on the process flow? Thanks a lot!


Edit:

I think it is because the first pallet (which arrives to set the labels to the combiner) blocks the way, but it is after that when I need to pull the items from the queue (based on those first labels, they can change every time a pallet first load to the combiner)... mmmm

0 Likes 0 ·
tannerp avatar image tannerp ana.pc2 commented ·

Sorry, it looks like the model link is broken. Do you mind uploading the model again in a comment? This has been a problem with our Answers site, so it's not on your end.

It sounds like you're dynamically changing the labels on the combiner. So is each combiner dedicated to one item "type"? Or does the combiner use the incoming pallet's "type" to determine what other items it needs?

0 Likes 0 ·
ana.pc2 avatar image ana.pc2 tannerp commented ·

initial-bc-new.fsm

I hope this one works!

And, yes, the combiner uses the incoming pallet's "type" and from that reference pulls the item with those labels in the queue.


Thanks for your help!

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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