question

Ahadr A avatar image
0 Likes"
Ahadr A asked Joerg Vogel commented

receive a fixed number of item for each queue based on decision point

issue.pngfinal-project-copy.fsm

Hi,

I need some help with my project.

my project should organize the items for a specific gate(queue), based on the image shown the system has 8 gate each gate should receive a fixed amount of items organized by item color each gate receive specific color.

gates will receive items from left to right as in the following cases:

1- gate 7 will receive 7 items the 8 one will continue through the big conveyor - marked with red-.

2- gate 5 will receive 5 items the 6 one will continue through the big conveyor.

3- gate 3 will receive 3 items the 4 one will continue through the big conveyor.

4- gate 2 will receive 2 items the 3 one will continue through the big conveyor.

5- gate 4 will receive 4 items the 5 one will continue through the big conveyor.

6- gate 6 will receive 6 items the 6 one will continue through the big conveyor.

7- the last two gates will receive only 1 item.

I am looking forward to some help.

many thanks.

FlexSim 19.1.2
conveyorqueuedecision points
issue.png (1010.3 KiB)
issue.png (1010.3 KiB)
· 1
5 |100000

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

Ahadr A avatar image Ahadr A commented ·

No answer until now :(

0 Likes 0 ·

1 Answer

Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Joerg Vogel commented

Ok, you did everything right, you assigned a Type and Color to your items. We need not to find a gate by color, just by Type. That is good. You will need to compare items entered your model with the number of items you need of a type. One way consists of counting the items by Type in a table. May I call this table "B". The first column will contain the number of needed items of a Type by output port of DP1. The second column will get the amount of items entered the DP1 by Type. You count an item Type by adding "1" to the current value of the table cell of the Type ( = row number of table):

int row = item.Type;
Table("B").cell(row,2).value += 1;

Unfortunately I didn't find a clever method to set the cell values of 2nd column back to null on reset. So I clone a table named "A", which has got 0 values in the second column OnReset to the table "B"

Table("A").cloneTo(Table("B");

As long as the difference of the table cell of column 1 and 2 of a row is not negative your current logic works well. If the difference gets negative the items must go to another branch in your conveyor system.

Therefor you change the Type to a value not existing as an output port number, but I recommend to copy the type to another label at the item, for example called "gate". Your "Send Item By Case" function will evaluate then the label "gate" instead of Type. Then you can set the gate label value for example to "10". Your cases doesn't have a case for 10. The default case will evaluated, the case does nothing.
You must change the value before the cases get evaluated.

int row = item.Type;
if(Table("B")[row][1]-Table("B")[row][2] < 0) 
    item.gate = 10;

You can divert items to stay in the red marked ring by conditional "Send Item" function OnArrival of a decision point by evaluating the gate label of the item.

item.gate > 9

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

Ahadr A avatar image Ahadr A commented ·

Thank you .. I tried the code but it didn't work ... I don't know the reason :(

may you help me please by edit on my project file

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Ahadr A commented ·

@Ahadr A, Can you explain, what does not work? I will help you. Regards Jörg

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Ahadr A commented ·

@Ahadr A, I won’t edit your project file. You can attach a file with the changes I recommended. And I can take look into the file.

0 Likes 0 ·