ATTENTION

This FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices.


flexsim.com

Go Back   FlexSim Community Forum > FlexSim Software > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 05-07-2008
Alexandre Ouellet Alexandre Ouellet is offline
Flexsim User
 
Join Date: Mar 2008
Posts: 9
Downloads: 1
Uploads: 0
Thanks: 2
Thanked 0 Times in 0 Posts
Rep Power: 0
Alexandre Ouellet is on a distinguished road
Default Queueing preempting task

Hello,

I am facing a case and I am not sure about what should be the normal behavior of a TaskExecutor (TE).

Sequence of events:

t1: tasksequence#1 priority=0 PREEMPT_NOT
t2: tasksequence#2 priority=10000 PREEMPT_ONLY
also at t2: tasksequence#3 priority=1 PREEMPT_AND_ABORT_ALL

at this time, the active tasksequence is tasksequence#2. And tasksequence#1 and tasksequence#3 are queued.

t3: End of tasksequence#2

The next tasksequence will be tasksequence#3 because of its priority. However, it seems that the PREEMPT_AND_ABORT_ALL is not executed and that tasksequence#1 remains in the queue. Is this the normal behavior?

If it is, how can I tell flexim to do its PREEMPT_AND_ABORT_ALL and get rid of tasksequence#1.

Thanks a lot,

Alex

Last edited by Cliff King; 07-18-2008 at 09:41 AM. Reason: changed "task" to "tasksequence"
  #2  
Old 05-07-2008
Anthony Johnson's Avatar
Anthony Johnson Anthony Johnson is offline
Manager of Product Development
 
Join Date: Jul 2007
Posts: 440
Downloads: 86
Uploads: 4
Thanks: 171
Thanked 899 Times in 288 Posts
Rep Power: 735
Anthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond repute
Default

Alexandre,

The TE will only perform the preemption type if the TE takes up the tasksequence immediately when you call dispatchtasksequence(). In other words, it only aborts all if the dispatching of the tasksequence actually causes preemption to occur. Otherwise, the tasksequence will queue up and will not abort all when it is started. To get around this, you could add a sendmessage task as the first task of the tasksequnce, and as part of the message, clear the content of the TE's tasksequence queue: clearcontent(gettasksequencequeue(current));

Good Luck,

Last edited by Cliff King; 07-18-2008 at 09:44 AM.
The Following 2 Users Say Thank You to Anthony Johnson For This Useful Post:
Cliff King (05-07-2008)
  #3  
Old 05-08-2008
Goksin Yilmaz's Avatar
Goksin Yilmaz Goksin Yilmaz is offline
Flexsim User
 
Join Date: Aug 2007
Location: ON, Canada
Posts: 21
Downloads: 11
Uploads: 0
Thanks: 23
Thanked 13 Times in 6 Posts
Rep Power: 213
Goksin Yilmaz is a jewel in the roughGoksin Yilmaz is a jewel in the roughGoksin Yilmaz is a jewel in the rough
Default

Hello,

I am a bit puzzled about this discussion. For example: "it only aborts all if the dispatching of the tasksequence actually causes preemption to occur". If the preemption type is "PREEMPT_AND_ABORT_ALL", how can one dispatch that tasksequence without preemption happening?

The other question is before using "clearcontent(gettasksequencequeue(current))", would it not make sense to re-assign the tasksequence? Obviously that tasksequence was created for some purpose, how is that purpose achieved if that tasksequence is cleared from the content of the tasksequence queue of the TE it was assigned to?

Thanks in advance...

Last edited by Cliff King; 07-18-2008 at 09:46 AM.
  #4  
Old 05-08-2008
Anthony Johnson's Avatar
Anthony Johnson Anthony Johnson is offline
Manager of Product Development
 
Join Date: Jul 2007
Posts: 440
Downloads: 86
Uploads: 4
Thanks: 171
Thanked 899 Times in 288 Posts
Rep Power: 735
Anthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond repute
Default

Preemption will not occur if the tasksequence is dispatched while the object is doing another tasksequence that is also preempting with a higher priority. In the example, tasksequence#2 is preempting and it has a higher priority than tasksequence#3, so when you dispatch tasksequence#3, it's not going to preempt tasksequence#2 because tasksequence#2 is "more important". Instead it will go into the tasksequence queue, and not perform the preemption.

If you don't want to abort the other tasksequences, then don't use PREEMPT_AND_ABORT_ALL. The whole idea behind PREEMPT_AND_ABORT_ALL is that you don't want to finish those other tasksequences for some reason, which is basically what clearcontent(gettasksequencequeue(current)) does if you didn't get the preemption to happen. If you still want those task sequences finished eventually, then use PREEMPT_ONLY. This is the option people will use 99% of the time.

You can also re-dispatch those unfinished tasksequences back to other objects by connecting the outputs of the TE back to the input ports of its dispatcher. This will cause the TE to pass preempted tasks back to the dispatcher for re-dispatch, although that can cause problems, for example, if the TE has already loaded a part. You don't want to tell another TE to unload the part that the first TE loaded, so be careful there as you may need to add some extra logic to the PassTo to get it to work right.

There's a page in the user manual that talks about this stuff. It's under Task Sequences > Task Sequence Preempting.

Last edited by Cliff King; 07-18-2008 at 09:48 AM.
The Following User Says Thank You to Anthony Johnson For This Useful Post:
Goksin Yilmaz (05-08-2008)


Thread Thread Starter Forum Replies Last Post
How to dispatch a preempting TS immediately Alexandre Ouellet Q&A 2 07-18-2008 10:20 AM
Queuing coordinated task sequences? Nico Zahn Q&A 19 04-02-2008 08:30 AM
The transporter and operator task sequence... syseo Q&A 1 09-22-2007 01:26 AM
creating a batch trip task sequence Paul Dowling Q&A 5 09-11-2007 06:55 PM


All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.