question

Felipe V3 avatar image
0 Likes"
Felipe V3 asked Joseph Gillespie commented

How to use looping? / Como trabalhar com contador de looping?

É possível eu programar para um item passar pelo "processor1" e após para o "processor2", mas depois repetir o processo três vezes para só então ir para a saída? E essa quantidade de looping variando para diferentes tipos de itens?

Can I program an item to be processed by "processor", and then "processor2", but then repeat this same process for tree times to just then go out to the sink? And this looping quantity varying for different item types?

FlexSim 19.1.1
loopcounting
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

Joseph Gillespie avatar image
1 Like"
Joseph Gillespie answered Joseph Gillespie commented
@Felipe V3

Here's a model I made where items loop over two processors a number of times based on item type:

loopbytype.fsm

It works by setting items to one of 5 types at the beginning and then sending them to a queue. When they arrive at this queue, they get a label called "Index" that starts at 1. They then loop over the queues, with Index increasing by 1 each time they loop. Once Index reaches the number of times they should loop, they are sent to the sink instead of back into the loop.

I used a Global Table called "Loops" to keep track of how many times each item type should loop. Here is the code to decide if an item is done looping or not:

token.Index >= Table("Loops")[token.Item.Type][1]

I also gave looping items priority over items that haven't entered the loop yet, though you could change that if you'd like.

Let me know if you have any questions on this!


loopbytype.fsm (27.5 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.

Felipe V3 avatar image Felipe V3 commented ·

Thank you again, @Joseph Gillespie!

0 Likes 0 ·