ATTENTIONThis 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 |
#1
|
|||
|
|||
How to dispatch a preempting TS immediately
Hello,
In my model, a preempting TS is given to a dispatcher. I want it to immediately dispatch the TS to the TE instead of queueing it. I know I have to specify that in the Pass To function, but I don't know how to do that. Did someone already does that? Thanks Alex |
#2
|
||||
|
||||
Alexandre,
If the PassTo trigger returns a port number for the task executer that is to recieve the task sequence then the task sequence will be passed on immediately. If the PassTo trigger returns a 0 then the task sequence will be queued up. So, you need to make sure that your PassTo trigger on the dispatcher returns a value other than 0 when you send it a preemptive task sequence. Brandon
__________________
thats not normal. |
#3
|
||||
|
||||
Passing only Preemptive TaskSequences Immediately
Here's some code I have used successfully in a PassTo field of a Dispatcher to pass preempting tasksequences on immediately (so that they will actually get a chance to preempt another tasksequence), but queue up all non-preempting tasksequences (and possibly queue up preempting tasksequences that can not find a downstream TE that is either available, working on a non preempting tasksequence or working on a preempting tasksequence with lower priority). This entire code can be copied into a PassTo field.
Code:
treenode tasksequence = parnode(1); treenode current = ownerobject(c); /**Pass Preemptive TaskSequences to the Shortest Queue Having No Preempting Tasks of Equal or Higher Priority. All Other TaskSequences Queue-Up for First Available Object.*/ if(getpreempt(tasksequence) == 0) return 0; int minindex = 0; int curmin = 1000000; for(int index = 1; index <= nrop(current); index++) { treenode curobj = outobject(current,index); if(objectexists(curobj)) { int curcontent = content(gettasksequencequeue(curobj)); treenode activets = gettasksequence(curobj,0); if(curmin > curcontent && (!objectexists(activets) || !getpreempt(activets) || getpriority(activets) < getpriority(tasksequence)) ) { curmin = curcontent; minindex = index; } } } return minindex; |
The Following User Says Thank You to Cliff King For This Useful Post: | ||
shafizad (08-28-2010) |