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
FAQ Downloads Calendar Search Mark Forums Read

Q&A Using Flexsim and building models

Reply
 
Thread Tools Display Modes
  #1  
Old 08-08-2007
AlanZhang's Avatar
AlanZhang AlanZhang is offline
Flexsim Super Moderator
 
Join Date: Aug 2007
Location: CA
Posts: 289
Downloads: 64
Uploads: 0
Thanks: 88
Thanked 91 Times in 47 Posts
Rep Power: 223
AlanZhang is a jewel in the roughAlanZhang is a jewel in the roughAlanZhang is a jewel in the rough
Question Remove a tasksequence from a tasksequencequeue?

Is there any way to remove a tasksequence from a tasksequencequeue?

The commands gettasksequencequeue() and gettasksequence() can return the reference of a tasksequence. But I did not find a command to remove the tasksequence.


Thanks.

Alan
Reply With Quote
  #2  
Old 08-09-2007
Jeff Nordgren's Avatar
Jeff Nordgren Jeff Nordgren is offline
Technical Support Manager
 
Join Date: Jul 2007
Location: Orem, UT
Posts: 65
Downloads: 79
Uploads: 0
Thanks: 40
Thanked 21 Times in 17 Posts
Rep Power: 231
Jeff Nordgren is just really niceJeff Nordgren is just really niceJeff Nordgren is just really niceJeff Nordgren is just really nice
Default

Alan,

The short answer is yes. Care should be taken anytime you "delete" anything abnormally but with that said, all you need to do is make sure you reference the node that has the task you want to delete and do a destroyobject() on that node.
__________________
Jeff
Flexsim Support
Reply With Quote
  #3  
Old 08-09-2007
AlanZhang's Avatar
AlanZhang AlanZhang is offline
Flexsim Super Moderator
 
Join Date: Aug 2007
Location: CA
Posts: 289
Downloads: 64
Uploads: 0
Thanks: 88
Thanked 91 Times in 47 Posts
Rep Power: 223
AlanZhang is a jewel in the roughAlanZhang is a jewel in the roughAlanZhang is a jewel in the rough
Default

Quote:
Originally Posted by Jeff Nordgren View Post
Alan,

The short answer is yes. Care should be taken anytime you "delete" anything abnormally but with that said, all you need to do is make sure you reference the node that has the task you want to delete and do a destroyobject() on that node.
Thanks, Jeff. I did try to use destroyobject() command to destroy treenode reference returned by gettasksequence command. But nothing seems happened.

Alan
Reply With Quote
  #4  
Old 08-09-2007
Jeff Nordgren's Avatar
Jeff Nordgren Jeff Nordgren is offline
Technical Support Manager
 
Join Date: Jul 2007
Location: Orem, UT
Posts: 65
Downloads: 79
Uploads: 0
Thanks: 40
Thanked 21 Times in 17 Posts
Rep Power: 231
Jeff Nordgren is just really niceJeff Nordgren is just really niceJeff Nordgren is just really niceJeff Nordgren is just really nice
Default

Alan,

It's probably just a matter of how you are referencing the node. The way you can "prove" to yourself that is does work is to pause your model when your task executer has task sequences. Open a tree view of the task executer and open up the tasksequencequeue node (cued up task sequences). Right click on the node icon of the task sequence you want to delete and designate it as the so() node. Then open a Script window and type in the command: destroyobject(so()); You should see that node disappear. So I'm guessing that it's just a matter of how you are referencing that node in your code.
__________________
Jeff
Flexsim Support

Last edited by Jeff Nordgren; 08-09-2007 at 02:39 PM.
Reply With Quote
  #5  
Old 08-10-2007
AlanZhang's Avatar
AlanZhang AlanZhang is offline
Flexsim Super Moderator
 
Join Date: Aug 2007
Location: CA
Posts: 289
Downloads: 64
Uploads: 0
Thanks: 88
Thanked 91 Times in 47 Posts
Rep Power: 223
AlanZhang is a jewel in the roughAlanZhang is a jewel in the roughAlanZhang is a jewel in the rough
Default

Thanks, Jeff. I just tried your method. It works.
Reply With Quote
  #6  
Old 08-14-2007
AlanZhang's Avatar
AlanZhang AlanZhang is offline
Flexsim Super Moderator
 
Join Date: Aug 2007
Location: CA
Posts: 289
Downloads: 64
Uploads: 0
Thanks: 88
Thanked 91 Times in 47 Posts
Rep Power: 223
AlanZhang is a jewel in the roughAlanZhang is a jewel in the roughAlanZhang is a jewel in the rough
Default

More questions...

If a dispatcher is used, there is no tasksequence nodes under tasksequencequeue treenode in either the dispatcher or connected operators. So where is the tasksequencequeue of the dispatcher? How do I know how many tasksequences is in the queue of the dispatcher? How to get the reference of these tasksequences?

Thanks.
Alan
Reply With Quote
  #7  
Old 08-15-2007
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: 682
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

Alan,

If you send a tasksequence to a dispatcher and the transporter/operator can execute it immidiately it will be placed in the node "activetasksequence" of the taskexecuter. That is the node where you find the tasksequences that are currently being executed. Because the dispatcher can't execute a tasksequence it doesn't has this node.

If you send more than 1 tasks you will see that they are queued up, either in the tasksequencequeue of the dispatcher or if you create a custom passto that sends them on immediately, you find them in the tasksequencequeue of the transporter.

Regards,
Steven
Reply With Quote
The Following User Says Thank You to Steven Hamoen For This Useful Post:
shafizad (10-16-2010)
  #8  
Old 08-15-2007
AlanZhang's Avatar
AlanZhang AlanZhang is offline
Flexsim Super Moderator
 
Join Date: Aug 2007
Location: CA
Posts: 289
Downloads: 64
Uploads: 0
Thanks: 88
Thanked 91 Times in 47 Posts
Rep Power: 223
AlanZhang is a jewel in the roughAlanZhang is a jewel in the roughAlanZhang is a jewel in the rough
Default

Steven,

You are right. I made a small model to see the tasksequencequeue for dispatchers and operators. And I saw tasksequence nodes under the tasksequencequeue treenode of both dispatcher and operator. And the number of task sequences in the queue is actually drawn beside these task executors with small dots. A small secret of Flexsim!

Thanks again!

Alan
Reply With Quote
  #9  
Old 10-17-2007
Nico Zahn's Avatar
Nico Zahn Nico Zahn is offline
Flexsim User
 
Join Date: Sep 2007
Location: Bingen am Rhein, Germany
Posts: 179
Downloads: 19
Uploads: 4
Thanks: 66
Thanked 60 Times in 32 Posts
Rep Power: 198
Nico Zahn has a spectacular aura aboutNico Zahn has a spectacular aura about
Question User Command to remove Tasksequences

Hi,
I tried to solve a problem which is on my list for quite a long time, using the getutilzedOperator - command from Tom.
If you try to put up a modell where the processors have cycletimes exceeding the shiftmodell and you want the OPs also to work on other processes it is necessary to free the OPs before stopping the processor. This can be easily done with this very nice getutilizedoperator command.
While one group of processors is down the operators move over to the second group and start to be utilzed. When the first group of processors starts to work again, they will request operators.
If those Operators are not available and the processors need to go down again, there is still the tasksequence requested in the dispatcher. So I put up a user command to remove all task from the taskseuqence queue of the dispatcher for a certain object.
Works well so far. (please see attached modell).
But after a few cycles the processors stays in the state "Waiting for operator" while the operators get utilized... ??
Can some one explain to me what went wrong?? Thanks..
P.S.
(there are some debugging message in the output console)
Attached Files
File Type: zip Remove_Tasksequence_from_Queue.zip (52.7 KB, 296 views)
__________________
kind regards Nico.

Last edited by Nico Zahn; 10-18-2007 at 05:48 AM.
Reply With Quote
  #10  
Old 10-17-2007
AlanZhang's Avatar
AlanZhang AlanZhang is offline
Flexsim Super Moderator
 
Join Date: Aug 2007
Location: CA
Posts: 289
Downloads: 64
Uploads: 0
Thanks: 88
Thanked 91 Times in 47 Posts
Rep Power: 223
AlanZhang is a jewel in the roughAlanZhang is a jewel in the roughAlanZhang is a jewel in the rough
Default

Hi Nico,

Did you forgot attaching your model? Or you have uploaded to somewhere? It is a interesting discussion. A sample model would be very helpful.

Alan
Reply With Quote
  #11  
Old 10-18-2007
Nico Zahn's Avatar
Nico Zahn Nico Zahn is offline
Flexsim User
 
Join Date: Sep 2007
Location: Bingen am Rhein, Germany
Posts: 179
Downloads: 19
Uploads: 4
Thanks: 66
Thanked 60 Times in 32 Posts
Rep Power: 198
Nico Zahn has a spectacular aura aboutNico Zahn has a spectacular aura about
Default Missing Modell

Sorry, somehow the upload didnĀ“t work.... The modell is now attached.
__________________
kind regards Nico.
Reply With Quote
  #12  
Old 10-19-2007
AlanZhang's Avatar
AlanZhang AlanZhang is offline
Flexsim Super Moderator
 
Join Date: Aug 2007
Location: CA
Posts: 289
Downloads: 64
Uploads: 0
Thanks: 88
Thanked 91 Times in 47 Posts
Rep Power: 223
AlanZhang is a jewel in the roughAlanZhang is a jewel in the roughAlanZhang is a jewel in the rough
Default

Hi Nico,

Your problem is really an interesting one. If I understand it correctly, the main problem is that the processor's state is not set correctly.

The reason is that when you resume the object, the object will go into whatever previous state when it is stopped (with matched id). The requestoperators() command will create a tasksequence which will pass to an operator. In that tasksequence, the following tasks will be created (see more details in the requestoperators command help):
1. put a preempt "bookmark" in the task sequence (TASKTYPE_MILESTONE)
2. travel to the station (TASKTYPE_TRAVEL)
3. resume the station (TASKTYPE_STOPREQUESTFINISH)
4. be utilized at the station (TASKTYPE_UTILIZE)

Since there is no task to set station's state, the state of station will not be changed (I guess, for a standard processor, it has its own logic to set the station's state and request operators). That's why you see the the processor is in the state of waiting_for_operator when the operator is utilized for that station.

In my attached model, in the Resume Function, I simply duplicate the requestoperator logic, but insert one more task to set the processor's state.

The main code in the Resume Function of your Timetable and Timetable2 is something like:

Code:
 
.......
// utilize OPs
//requestoperators(disp,downobject,item,1,0,0);

// instead of use requestoperators(), create our own task which will set processor state
treenode statenode = state_current(downobject);
stopobject(downobject, STATE_WAITING_FOR_OPERATOR, 100002); // need to go into STATE_WAITING_FOR_OPERATOR because unless operator arrives, the process cannot be really resumed
treenode newts = createemptytasksequence(disp,0,0);
inserttask(newts, TASKTYPE_MILESTONE,NULL,NULL,3);
inserttask(newts, TASKTYPE_TRAVEL, downobject, NULL, 0, 0);
inserttask(newts, TASKTYPE_STOPREQUESTFINISH, downobject, NULL, 0, 100002, 0, 0);
inserttask(newts, TASKTYPE_SETNODENUM, statenode, NULL, STATE_PROCESSING, 0); // set the processor state
inserttask(newts, TASKTYPE_UTILIZE, item, downobject,0);
dispatchtasksequence(newts);
.......
I hope I have addressed your question. Let me know if you find any thing wrong.

Have fun!
Alan
Attached Files
File Type: zip Remove_Tasksequence_from_Queue_az.zip (56.0 KB, 303 views)
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 08:57 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.