question

jeremie petrens avatar image
0 Likes"
jeremie petrens asked jeremie petrens answered

How to refill a queue after a certain time?

Hi, I am new to Flexsim and i have this problem: I have 2 queues, one should hold 22 items, the other one 14. If one of the queues is emptied it should always take 52.4 seconds untill it is filled again, so how can I do this? (there is probably an easy solution but i can't seem to find it)

Thanks in advance.

test10000.fsm

queue
test10000.fsm (27.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.

Logan Gold avatar image
1 Like"
Logan Gold answered

Process Flow is probably the most straightforward way like Sam mentions. But you can also do it another way using delayed messages and closing the input ports of the Queues if that is preferred. In the attached model (test10000.fsm), you'll see how to do this in the Queues' OnEntry, OnExit, and OnMessage triggers.

In the OnEntry trigger, along with the Set Object Color logic that was already there, I added the Close and Open Ports picklist option to close the input ports of the Queue when it has reached capacity. This is done by checking to see when the contents of the Queue match its Maximum Content value. Since the Queues are doing batching and are using the "Flush contents between batches" option, closing the input ports at this time is redundant, but this way can still be used when batching and flushing aren't being used. Regardless, the input ports still need to be closed before the last item leaves the Queue and this works just as well as doing it at that time in the OnExit trigger.

Then, in the OnExit trigger, I send a delayed message when the last item is leaving the Queue. This is done by checking to see when the content of the Queue is 1, indicating it is the last item in the Queue that is leaving the Queue. The delay time is 52.4 as indicated in your requirements.

Finally, in the OnMessage trigger, I use the Close and Open Ports option again to open the Queue's input ports. I didn't worry about setting a condition since the only time the Queue will receive a message is 52.4 seconds after the last item leaves the Queue.


test10000.fsm (99.4 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.

jeremie petrens avatar image
0 Likes"
jeremie petrens answered

Thank you for thye quick respons, both answers work perfectly :).

5 |100000

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

Sam Stubbs avatar image
0 Likes"
Sam Stubbs answered

I think the best way to handle the logic of this would be using Process Flow. Otherwise you have to use a lot of delayed messages to stop and resume the output of the sources.

If you utilize Process Flow to create and control the logic of this first part of the model you can model this relatively easily. I've modified your example to show you how I would approach this situation.

5745-test10000-1.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.