question

JP117 avatar image
0 Likes"
JP117 asked Jeanette F commented

Preempt Task Sequence

I have a simple process flow that I want to use in a larger model, and it seems like the preempt, abort all option is not working unless I use priorities. I thought that this would kill all tasks and allow me to create a new travel sequence. Why do you still need to use priorities with this option. This code is going to be part of a loop and there could be several of these redirects so assigning priorities will be difficult

In the model a person walks to a target location once he is within 20 meters of the target he is redirected somewhere else


Preempt Example.fsm

FlexSim 24.2.2
tasksequencespreempting
preempt-example.fsm (36.6 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.

Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @JP117, was Felix Möhlmann's 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 comment back to reopen your question.

0 Likes 0 ·

1 Answer

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

Task sequences are split into two groups: non-preempting and preempting. A preempting task sequence can interrupt/abort a non-preempting task sequence regardless of priority. However to preempt another preempting TS the priority needs to be higher.

To always have priority you can read the priority value of the currently active task sequence and use a priority value that is 1 higher when creating the new sequence.

token.Operator.as(TaskExecuter).activeTaskSequence.priority

Or you do the opposite and reduce the priority and/or preempt setting of the current task sequence before dispatching a new one.

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

JP117 avatar image JP117 commented ·
Thanks, how do I check to see if the operator has an active task sequence first?
0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann JP117 commented ·
I'd use objectexists(teReference .activeTaskSequence ). If you are not setting them manually then checking the state (idle or not) can also work.
0 Likes 0 ·