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
|
||||
|
||||
"Break to" Requirement
treenode tsqueue = gettasksequencequeue(current);
treenode returnts = NULL; for(int index = 1; index <= content(tsqueue) && ! returnts; index++) { treenode curts = rank(tsqueue, index); treenode involved = gettaskinvolved(curts,2,1); if( getitemtype(involved) == getitemtype(first(current)) // Check to see if the itemtypes match && gettotalnroftasks(curts) ==getnroftasks(curts)// Make sure it is a complete sequence ) returnts = curts; } return tonum(returnts); These code is written in "Break to" Requirement in Transporter object, What does it means that "gettotalnroftasks(curts) ==getnroftasks(curts)"? I can not understand "gettotalnroftasks(curts)" && "getnroftasks(curts)" founctions means. In Attach Files , there is a tree picture, "Task Sequence - curtask: 4 priority: 0.00 preempt: 0 " in it, What is "4" mean? |
#3
|
||||
|
||||
First of all, you are looking at an old library. In version 4.52 this code looks different.
Secondly, have you looked at the command list? The difference is very clearly stated there. If you still don't understand, please read through all the information about tasksequences in the user manual. curtask stands for "current task" so 4 is the task the taskexecuter is currently working on (the "active" task). |
The Following User Says Thank You to Steven Hamoen For This Useful Post: | ||
Jörg Vogel (12-22-2009) |
#5
|
||||
|
||||
Again, Have you looked at the helpfile? And do you know how the tasksequence system works?
accoording helpfile getnroftasks(curts): Returns the number of tasks that still need to be completed in the tasksequence (including the current task). gettotalnroftasks(curts): Returns the total number of tasks that were ever added to the tasksequence. So if you compare and check if they are the same, it means that if the comparison is true, it is a tasksequence of which no tasks have been executed. And actually the comment in the code "// Make sure it is a complete sequence" gives that away too. Now for your question why it only takes two items. When you hit the breaktask in the activetasksequence (we call this TS1) it looks for a second task in the tasksequencequeue. It finds this new task (TS 2) and put the TS1 one at the front of the tasksequencequeue. Then when it hits the breaktask of TS2 it looks through the tasksequence queue again and because you now removed the check for a new tasksequence it takes the first tasksequence that it finds, which is TS1 and continuous with that one. So as a result it will only have processed 2 tasksequences just as you witnessed. |
The Following 3 Users Say Thank You to Steven Hamoen For This Useful Post: | ||
Tom David (12-23-2009) |
#6
|
|||
|
|||
"it looks through the tasksequence queue again "
for(int index = 1; index <= content(tsqueue) && ! returnts; index++) { treenode curts = rank(tsqueue, index); treenode involved = gettaskinvolved(curts,2,1); if( getitemtype(involved) == getitemtype(first(current)) // Check to see if the itemtypes match //&& gettotalnroftasks(curts) ==getnroftasks(curts)// Make sure it is a complete sequence ) returnts = curts; } there is not "break" in for loop,i think it return last one ,not first one |
#7
|
||||
|
||||
I'm talking about the break task in the tasksequence and not in the code!! Further more that piece of code exits not only at the end of the for loop but also if a tasksequence full fills the condition ("&& ! returnts") There is no use in correcting somebody wrongly, it makes the thread complicated and less usuable. |
The Following User Says Thank You to Steven Hamoen For This Useful Post: | ||
Tom David (12-26-2009) |
Thread | Thread Starter | Forum | Replies | Last Post |
"Break to"problem | Vic Li | Q&A | 0 | 10-30-2008 10:02 AM |
Is it possible one object comprised of the function of "combiner" and "separetor"? | Vic Li | Q&A | 1 | 08-19-2008 04:41 AM |
Can coordinated task sequence and "break to requirement" be used together? | qin tian | Q&A | 1 | 05-26-2008 10:44 AM |
about "no select" and "show parameter window from side bar" | qin tian | Gripes and Goodies | 3 | 03-21-2008 08:10 AM |
"Getting Started" and "Tutorial" models for v4.01 | Cliff King | Product Announcements | 0 | 12-10-2007 07:34 PM |