question

Jun Woo K avatar image
0 Likes"
Jun Woo K asked Mischa Spelt commented

Flowitem sort in OnEntry and OnExit triggers

Hello,

I am trying to build some models for analyzing various job dispatching rules in production systems.

To begin with, I decided to apply well-known SPT (shortest processing time) rule to a Queue object in simple simulation model, as shown below.

The flowitems within this model has a label called 'p_time', indicating processing time.

The processing times are exponentially distributed with mean 20 seconds, and they are determined by OnCreation trigger of Source object.

Moreover, the colors RED, YELLOW, GREEN and BLUE means 'Very Long processing time', 'Long processing time', 'SHORT processing time' and 'VERY SHORT processing time', respectively.

In order to apply SPT rule to Queue object, the flowitems at Queue should be sorted by processing time, 'p_time' label. Thus, I use 'Sort by Expression' option for triggers of Queue.

My problem is as follows:

1) When I apply 'Sort by Expression' option to OnEntry trigger of Queue, the SPT rule works successfully, as shown in Figure 1, where flowitems with same color (similar processing times) are contiguous.

2) On the contrary, when I apply 'Sort by Expression' option to OnExit trigger of Queue, the SPT rule does not work at all, as shown in Figure 2.

Could you explain why I can not implement the dispatching rule by using OnExit trigger?

Associated model files are attached.

Thanks.

(Figure 1. Applying Sort by Expression to OnEntry trigger - Sorted)

(Figure 2. Applying Sort by Expression to OnExit trigger - Not Sorted)

spt-sort-by-onentry-trigger.fsm

spt-sort-by-onexit-trigger.fsm

FlexSim 17.0.13
dispatching ruleflowitem sort
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

Steven Hamoen avatar image
0 Likes"
Steven Hamoen answered Mischa Spelt commented

@Jun Woo K Actually the sorting algorithm is only sorting the item that comes through the trigger. So if item X enters it finds the correct rank for that item. On the entry side this means that all items are nicely ranked. It does exactly the same on the onexit but actually it only ranks the item that is leaving the queue so the other items are not touched and everything stays the same.

I don't think this sorting works on the onexit and I wonder if this option should be on the onexit trigger @phil.bobo?

If you want to have more flexibility on this sorting I would definitely point you to a list. There you can use queries to determine the correct next product to leave which makes it much more flexible and powerfull

· 2
5 |100000

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

Jun Woo K avatar image Jun Woo K commented ·

Thanks, steven.

I understand the concept of sort functionality, applied to 'current' item, not to 'currently awaiting items within Queue object'.

Also, I think that List will be helpful for implementing various job dispatching rules.

0 Likes 0 ·
Mischa Spelt avatar image Mischa Spelt commented ·

Alternatively, if the functionality does work on entry, you can maybe have the receiving object pull the highest ranked item, instead of trying to push it.

0 Likes 0 ·