FlexTips: Send To Port By Label


In this video, we’re going to build on the
“Send to Port by Expression” tutorial, and show you how to route the flow of objects
by using labels. We’ll use the same model layout that we used
in the last tutorial, with a source, three conveyors and two sinks. Double-click to open
the source’s properties window, go to the “Triggers” tab, and use the red X to delete
the “OnCreation” trigger. In its place, let’s add an “OnCreation” trigger called “Create
and Initialize Label”. Change the label name to “Port”, and the duniform value to “(1,2)”,
which will randomly assign a label to each created item. The label will be titled “Port”
and will include a value of either 1 or 2. Let’s also add an “OnExit” trigger to color
our items; choose “Set Color” and for the value, select “getlabelnum” from the drop-down
list. Replace the word label within the quotation marks to the label name, which is “Port”.
Click OK to save and close the window. Double-click on the first conveyor now and
click on the “Flow” tab. Click the drop-down menu for Send To Port and choose “By Expression”.
The default option is “getitemtype(item)”, so we need to select “getlabelnum(item, “label”)”
from the drop-down menu, replacing the word “label” between the quotation marks to our
label name, Port. “By Expression” means that items are routed depending on their values,
in this case the value of the “Port” label: a value of 1 means the items will go the Port
1, and so forth. Click Reset and Run the model. You’ll notice
two items being created; red items are item type 1, and green items are item type 2. Red
items have label value 1, so they will be routed through Port 1, while green items are
routed only to the other conveyor. Thank you for watching. For more information
on FlexSim products or to view more tips and tricks for successful modeling, please visit
www.flexsim.com.

, , , , , , , , , , , , ,

Post navigation

One thought on “FlexTips: Send To Port By Label

Leave a Reply

Your email address will not be published. Required fields are marked *