question

Thillai avatar image
0 Likes"
Thillai asked Jason Lightfoot answered

How to send items to Queue based on item type

I am a beginner, and I am practicing the Flexsim model.

As a part of my regular practice, using Separator, I am trying to split the incoming item into two items ( Item 1 and Item 2 ) and set the label and color. Then, based on the item type, I would like to send the item Type 1 to Queue 1 and to Queue 2 for Item Type 2


image-5.png


image-1.png


image-3.png


image-4.png


I am having difficulty setting the trigger at the exit; what "value" do I need to select, or am I missing something? I have added my port settings and trigger info for your reference.

Appreciate your help

Regards,
Thillaiarasu
FlexSim 22.2.4
sending item based on item type to queue
image-1.png (70.3 KiB)
image-3.png (6.2 KiB)
image-4.png (11.8 KiB)
image-5.png (31.2 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.

Jason Lightfoot avatar image Jason Lightfoot ♦ commented ·
Please re-upload your images - we see nothing other than blank white space.
0 Likes 0 ·
Thillai avatar image Thillai Jason Lightfoot ♦ commented ·
Uploaded the image for your reference
0 Likes 0 ·
Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered

If it's always 50/50 then you can just use round robin for the send to port and set the color and type on exit trigger based on the port. Example model attached.

SplitIntoTwoWithColor.fsm


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
0 Likes"
Joerg Vogel answered Joerg Vogel commented

There are two events that can evaluate that there are more items by split mode:

  1. Send to Port
  2. On Exit

if you want to divert items an On Exit event is to late. You have to do it in function "Send To Port" in Output Properties pane.

Unfortunately there aren't any templates that allows you to manipulate labels. You have to write a source code script to assign label values right behind the header of this function source code.

AND you have to choose before you add this code your template, otherwise selecting a new template destroys any previously entered code.

AND this function gets executed for each leaving item once. This means after a first item has left this object any code will evaluate all staying items again. This said there are two scenarios in relation of counted item as staying inside of this object. Items are exiting instantly or items are waiting inside of object because they are transported or are blocked by next object entrance allowance.

forobjecttreeunder(current){ // recursively look for each object subnode at start node
a.Type = a.cnt; // "a" is found object of step 
a.cnt +=1; // intermediate count label at item, can be destroyed on exit
}
item.color = Color.byNumber(item.Type); 

cnt label at item must be initialized on Entry with value of 1.

code to destroy label "cnt on exit:

item.attrs.labels.subnodes["cnt"].destroy();
· 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.

Thillai avatar image Thillai commented ·
Thanks for the info and answer; I will check this. I am a beginner; can it be done in object mode without code?
0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Thillai commented ·
@Thillai, split mode in a separator object creates items. Then there are only a few events. And only function "send to port" is able to fetch created items first and tell instantly FlexSim where they must go.

You can set a separator to send items in round robin fashion. And you can set a label value by local variable called "port" on Exit. And you can set by this variable name also colors of leaving objects. This is a functionality where you do not need to write source code. But this is not what you requested to achieve. This result is similar. But it is a more like creating two items from one. You send one to output port one and a second to output port two. When they are leaving you tell them to record the output port number in a label and chooose by this output port number a color. It is more a passiv observation then really actively doing something.

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.