question

Praveen M avatar image
0 Likes"
Praveen M asked Jason Lightfoot commented

Divert flow items by condition

I want to divert to multiple port based on below conditions attached the model.

Conditions for DP1

1.items direct feed to processor.

2.If the flow items is blocked the items divert items to alternate DP3 or DP4.

3.If the flow is cleared items from rack feed to processor by FIFO basis.

4.flow items should follow FIFO and Batch FIFO.

divert items if conveyor full.fsm

FlexSim 18.2.3
FlexSim 18.0.10
photo eyedecisionpoint
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

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

I would remove what you have and instead put 3 photoeyes on the conveyors as outputs of the single decision point (these are ways of referencing - you're not going to close or open these ports).

1645802824166.png

Then in your decision point I would add a code snippet to the onArrival/Continue (your choice):

  1. Array pes=current.outObjects.toArray();
  2. Object pe;
  3. for (int n=1;n<=pes.length;n++){
  4.     pe=pes[n];
  5.     if (pe.stats.state().value!=PE_STATE_BLOCKED){
  6.         Conveyor.sendItem(item,pe);
  7.         break;
  8.     }
  9. }

This code scales so you could add more PEs and it will consider them in the order they are connected. If the PE is not blocked it will send the item there.


1645802824166.png (225.6 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.