question

Robert B3 avatar image
0 Likes"
Robert B3 asked Robert B3 commented

How to divide a product in a separator into 5 pieces assigning to queue by color

In my simulation i want to divide 225 products by 5, into 900 in one color in the above queue and 225 in different color into the bottom queue-> rack. Methodology used in my project didn't work. Does anyone have ideas?

separator.png

FlexSim 17.2.5
separator
separator.png (208.2 KiB)
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

·
Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Robert B3 commented

Modulus operator in combination with color by case in the OnExit trigger and port by case in the send to port function.
You use the output statistic value of the separator with a modulus operator integer division. The division returns in this operation the rest. This value chooses the case for color and port. For example values of 0 to 3 are going to output port 1 and value of 4 goes to port 2.

Equal to this method you set the colors.

split-item-color-and-port-by-case.fsm


· 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.

Joerg Vogel avatar image Joerg Vogel commented ·

If someone want to argue, that it isn't necessary to add so much cases. That is right. You need only the default case and the case for the secondary return action.

0 Likes 0 ·
Robert B3 avatar image Robert B3 commented ·

Thank you very much for your answer. It works. I would like to understand how does the function works. What is the logic of it?

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Robert B3 commented ·

I think you found the split option in separator object properties. The split value is static expression of 5.
The send to port function on the Flow tab expects a return value for each item being released. The return value is connected directly to output port numbers rank of objects. There are special return values.

  • A return value greater than the rank number of last output port holds the item in the object.
  • A return value of -1 holds the item, too.
  • A return value of 0 sends the item to first available output number.

A mod division is an integer division returning the integer rest of the division. On a sequence of values like A={0,1,2,3,4,5,6,7} returns in mod division by 4 A%4={0,1,2,3,0,1,2,3}.
You need a sequence of values in the send to port function to use a port by case function. This can be a statistic value or a label value that you increment by events like OnEntry, OnExit, OnProcessFinish.

The statistic values are properties in the attributes [tree] of objects. This means you can find informations on the classes in FlexSim source code in the manual FlexScript Class Reference (this reference contains more classes than being available in FlexSim version 17). The available classes are documented in the program manual of the version you use.

 obj.stats.output.value

where obj is a reference or pointer in FlexSim. Some pointers are predefined in the source code header of functions or triggers. Please take a look into the source code editor to find them under the parchment roll icon. You have not to write there directly code in the beginning. Just read the header and close the editor. These Pointers are:

  • current = object of the event or action
  • item = involved flow item (if there is one involved)
  • port = in sending or receiving events or actions

The function fields in the properties can hold small source code snippets directly, which returns a value if they get evaluated, or just static values.

The relevant sequence of activities are, but there are much more.

  • item enters the separator.
  • The item gets processed.
  • The separation mode split divides the entered item into 5 items. That means 4 additional copies are made.
  • The items are ready for releasing.
  • They leave one after another.
  • The OnExit trigger gets fired and the object statistic values are updated on each event.
0 Likes 0 ·
Robert B3 avatar image Robert B3 Joerg Vogel commented ·

Now i get it. Thank you very much again.

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.