Problems with preemption

Problems with preemption

cetim_c
Not applicable
145 Views
8 Replies
Message 1 of 9

Problems with preemption

cetim_c
Not applicable

[ FlexSim 22.1.2 ]

Hello,
I want that the operator travel to queue2 and have 40 second delay, but he will be interrupted every 10 seconds so he has to go to queue1 and come back. On return, I want the delay to be at the same point, and that is the proble, that every time he returns, the counter is reset. It is as if the save context is not running.
Attach the model.
Thanks in advance
InterruptionV2.fsm

0 Likes
Accepted solutions (1)
146 Views
8 Replies
Replies (8)
Message 2 of 9

jason_lightfoot_adsk
Autodesk
Autodesk
Accepted solution

You should not preempt tokens that are waiting for a task to complete - instead you should preempt the task executer by using a higher priority task sequence with prempt set to PREEMPT_ONLY. When that sequence is complete the task executer will resume the preempted task and fire the callback at the correct time. If you need to, insert milestone tasks in order that you repeat things like travel if needed.


0 Likes
Message 3 of 9

cetim_c
Not applicable
Thank you for your reply but, sorry, I didn´t understand what you explained. I don´t understand what should I change
0 Likes
Message 4 of 9

jason_lightfoot_adsk
Autodesk
Autodesk

Here's the modified model.

Note that by using a milestone the preempting set of tasks doesn't need to know anything about which task is was interrupting - so does not include the travel task back to queue2. I added a small delay to indicate something is done at queue1.

Also note that the range of the milestone task is not 2, but 4 - this is to include the callback task for each task activity.

interruptionv2_jl.fsm

0 Likes
Message 5 of 9

cetim_c
Not applicable

Thanks for the clarification, but the problem still exists. It is like an infinite loop. Main delay progress has not been saved

0 Likes
Message 6 of 9

moehlmann_fe
Advocate
Advocate

You can forego the milestone task and have the operator go back to the delay task directly. Note that visually the delay will still happen for the token while the operator is preempted, but the activity will only finish once the delay time has elapsed for the operator.

interruptionv2-jl-fm.fsm

You can also use your previous approach, but you would have to use a 'normal' delay activity to store the context correctly. The operator's state would then have to be set manually.

interruptionv2_fm.fsm

0 Likes
Message 7 of 9

jason_lightfoot_adsk
Autodesk
Autodesk

The delay progress is saved but the problem is that the milestone task is creating new tasks for Travel to queue2 and Delay2 every time it's interrupted. This seems like a bug - we'll investigate further.


For now the attached model should work for you.

interruptionv2_jl2.fsm

Don't worry about the icon filled progress indicator - look at the event times - you'll see that 40 seconds is spent in Delay2 at queue2

0 Likes
Message 8 of 9

jason_lightfoot_adsk
Autodesk
Autodesk

In this model I create the task sequence without waiting for the tasks to complete and then dispatch it afterwards, which seems to fix the issue - since the token no longer revisits the task activities - but the sequence is being done in the background. The exit time from the Dispatch TS task is now correct.

interruptionv2_jl3.fsm

0 Likes
Message 9 of 9

jason_lightfoot_adsk
Autodesk
Autodesk

Hi @Cetim C, was our answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes