question

Kuilin S avatar image
0 Likes"
Kuilin S asked Felix Möhlmann answered

Why does TaskSequence.priority doesn't work as expected?

Hello, everyone,

Now I have built a simple model. There are three sources, one dispatcher with a transporter and one destination(queue). I set three different priority value in the source. When the three task generated in the same time, I want the task with higher priority began first. But my model doesn't work as expected. Please help me, thanks in advance.

test.fsm


FlexSim 22.0.4
dispatchertasksequencepriorityqueue strategy
test.fsm (32.0 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.

Joerg Vogel avatar image Joerg Vogel commented ·
You are assuming a logic will wait, until some tasks are ready to be executed. That is definitely wrong. If a task has been dispatched and nothing else has been waiting for execution, then this task is executed independently from any priority values. Only if tasks are queued and a dispatching object is able to choose, then a priority value gets evaluated for sorting the available queued tasks. If you want to build up a queue of tasks then you have to give a task executer something to do for while, until all tasks are dispatched. You can achieve this with a delay task dispatched On Reset Event. Even if you create tasks in model runtime 0, you need a delay which lasts until all your tasks, which you want to get sorted, are dispatched. This delay can last very short, but a bit longer then just 0 runtime units.
0 Likes 0 ·

1 Answer

·
Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered

There are no (truly) parallel processes in FlexSim. What is happening here is that the source that is highest in the model tree generates a task sequence and passes it to the dispatcher. The dispatcher then passes it on before the other sources create their task sequences, preventing the priority to have any effect for the first dispatch.

I see two ways to fix this:

Allow the task sequences to preempt others. That way it doesn't matter which one is created/dispatched first. However if there are other tasks that the task executers should not be preempted away from, these would have to be assigned a higher priority.

test_preemption.fsm

You first push the task sequences to a list. Lists have the feature to allow multiple pushes before evaluating back orders.

1658819380909.png

A token can then pull the sequences in the right order off the list in a process flow and dispatch it back to the dispatcher in this priority-adjusted order.

1658819491923.png

test_ts_list.fsm


1658819380909.png (8.6 KiB)
1658819491923.png (9.4 KiB)
test-preemption.fsm (31.1 KiB)
test-ts-list.fsm (108.7 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.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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