question

Brayan Leonardo Gil Guevara avatar image
0 Likes"
Brayan Leonardo Gil Guevara asked Brayan Leonardo Gil Guevara edited

Leave Queue if stats_staytime>specific.time

Hi,

I need some help, I guess some code is required in order for me to do what I want. An item arrives to Queue1, there's a processor as next stop, but the process time follows an specific distribution. So, items in Queue1 can and will stay there for some x time.units. I created a label, and I want to set the stats_staytime in that label for every flowitem, but I also want to use said time to make some decisions. If stats_staytime>300(timeunits) the item must leave Queue1.

How can I do this in FlexSim?

Thank you in advanced for your reply.

FlexSim 7.7.4
queuetimestaytimestats
5 |100000

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

Ben Wilson avatar image
1 Like"
Ben Wilson answered Brayan Leonardo Gil Guevara edited

Please see the attached sample model.

In this model, the first queue has several triggers defined:

  • On Entry - a message is sent from the item to the queue in 300 seconds
  • On Message - if the sender (the item) is still inside the queue, release it out port two to the 2nd queue
  • On Exit - save the item's stay time in the first queue to the item's qStayTime label to use this data for something else later on

I think these 3 triggers will do everything you're asking for.

There is no other custom behavior set on any of the other objects.


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

Brayan Leonardo Gil Guevara avatar image Brayan Leonardo Gil Guevara commented ·

Thank you so much for this answer @Ben Wilson. Is just what I am looking for.!! but there's something i'd like to try now... The "Send to port:" is set to 1, in the Queue1, but, what if I have more than 1 Processor conneted, and i'd like to send the item to a random available port from an specific list, ignoring queue2.

0 Likes 0 ·
jing.c avatar image
1 Like"
jing.c answered Brayan Leonardo Gil Guevara commented

Hi Brayan

I tried to use List Tool to solve your question, and please see the attached model, you can do it by follow steps:

1. Add a new Item List in ToolBox (you can find it in Global List)

2. Add a Time Interval in Back order Reevaluation Events in Back Order Tab, and set the Time Interval to 1 or less based on how strict the staytime analysis.

3. Choose UseList > push to item list in Queue3's sendtoport trigger option

4. Check Pull in Processor4 and choose UseList > pull from item list in Pull Strategy and Query should set ORDER BY age DESC

5. Check Pull in Queue5 and choose UseList > pull from item list in Pull Strategy and Query should set WHERE age > 50 (50 is the specific time example you can change it by your request)

leavlqueuebyspecifictime-chjv16.fsm


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

Brayan Leonardo Gil Guevara avatar image Brayan Leonardo Gil Guevara commented ·

Thank you for your answer. @jing.chen. It works great.

0 Likes 0 ·