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 12-22-2009
Dane Lee's Avatar
Dane Lee Dane Lee is offline
Flexsim User
 
Join Date: Jun 2009
Location: Beijing China
Posts: 23
Downloads: 187
Uploads: 0
Thanks: 6
Thanked 0 Times in 0 Posts
Rep Power: 134
Dane Lee is on a distinguished road
Default "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?
Attached Files
File Type: zip model&&Tree Picture.zip (96.1 KB, 193 views)
  #2  
Old 12-22-2009
Dane Lee's Avatar
Dane Lee Dane Lee is offline
Flexsim User
 
Join Date: Jun 2009
Location: Beijing China
Posts: 23
Downloads: 187
Uploads: 0
Thanks: 6
Thanked 0 Times in 0 Posts
Rep Power: 134
Dane Lee is on a distinguished road
Default

Hope your reply! Thanks
  #3  
Old 12-22-2009
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default

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)
  #4  
Old 12-22-2009
Dane Lee's Avatar
Dane Lee Dane Lee is offline
Flexsim User
 
Join Date: Jun 2009
Location: Beijing China
Posts: 23
Downloads: 187
Uploads: 0
Thanks: 6
Thanked 0 Times in 0 Posts
Rep Power: 134
Dane Lee is on a distinguished road
Default

Without "gettotalnroftasks(curts) ==getnroftasks(curts)",I try it,the transporter only loaded two flowitems,why?
  #5  
Old 12-23-2009
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default

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  
Old 12-24-2009
LINWEIXU
Guest
 
Posts: n/a
Downloads:
Uploads:
Default

"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  
Old 12-25-2009
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default


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)
  #8  
Old 12-25-2009
LINWEIXU
Guest
 
Posts: n/a
Downloads:
Uploads:
Default

sorry ,i confuse , i think "! returnts" equivalent to "break " ,so i ask ,i do not want to correct somebody wrongly.Maybe use wrong tone

Last edited by LINWEIXU; 12-26-2009 at 01:02 AM.


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


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.