Longest queue time.

165 views
Skip to first unread message

Damon LI

unread,
Aug 8, 2016, 9:15:14 AM8/8/16
to Jaamsim Users Discussion Group
Hi Harry,

in my simulation model, I have two waiting queues for next machine. And when the conditions meet, the machine will take the items in the queues following FIFO.

My idea is to find out the item with the longest queue time. And I notice that in the output of queue, there is an output called QueueTimes. However, I cannot figure out how to return the longest queue time. 

Could you help me with this problem? Or if you have better idea to achieve the goal-

Tons of thanks.

Damon

Harry King

unread,
Aug 8, 2016, 6:45:07 PM8/8/16
to Jaamsim Users Discussion Group
Damon,

The expression system allows you to reference an entry in an array. For example, the longest queue time is [Queue1].QueueTimes(1). For example, you can choose between two queues in a Branch object using the input 'indexOfMax([Queue1].QueueTimes(1), [Queue2].QueueTimes(1))'. Note that [Queue1].QueueTimes(1)returns zero if the queue is empty.

However, a Server can only select entities from a single queue, so is not possible to use this information.

In any case, it would probably be better to use a single queue instead of two queues. You can use attributes to distinguish between different types of entities. Use the Match keyword for the Queue and the Server if there are situations where you need to select a specific type of entity. Is there a reason why you need to use two queues?

Harry

Damon LI

unread,
Aug 9, 2016, 2:44:01 AM8/9/16
to Jaamsim Users Discussion Group
Harry, 

Thank you very much for your reply.

You've already solved my problem very well. 

The reason why there are two queues in my model is that there are two storage locations in reality, and I used two gates with queue to simulate this.

What I will do is to write an expression to select the gate with longest queue time and then release one item and then compare the longest queue time again.

Thank you again for your help.

Damon

Reply all
Reply to author
Forward
0 new messages