Paul Toone avatar image
Paul Toone posted

Querying Information on Task Sequences   

Once you have dispatched task sequences, you can query and change certain values on those task sequences. The following commands allow you to make such queries and changes.

treenode gettasksequencequeue(treenode dispatcher)

This command returns a reference to the task sequence queue of a dispatcher/taskexecuter object. It can be treated like a regular treenode. Say, for example, I am a dispatcher, and I want to query things on the first task sequence in my queue. I could access the task sequence by:


treenode gettasksequence(treenode dispatcher, int rank)

This command is another way that you can get references to task sequences. Rank is the rank of the task sequence in the task sequence queue. Also, if rank = 0, then it will return a reference to the currently active task sequence for the task executer, or the task sequence that he is doing right now.

treenode gettaskinvolved(treenode tasksequence, int rank, int involvednum)

This command returns a reference to an involved object for a given task in a task sequence. Rank is the rank of the task in the task sequence. Involvednum is a 1 or a 2, and references which involved object. Say, for example, that a TaskExecuter is about to do a load task, but he wants to know the object from whom he is loading the item. In a load task, involved1 is the item, and involved2 is the station from which to load. Let's say also that I know that the load task is the 3rd task in the sequence, and the task sequence is currently the active task sequence to get a reference to the station, I would code:

gettaskinvolved(gettasksequence(current,0), 3, 2)

You'll need to know task types and which involved means what for a given task type, but once you know that, it's easy. Most of it is documented in the begintask() method of the TaskExecuter in the library.

int gettasktype(treenode tasksequence, int rank)

This command returns the task type of a given task. Rank is the rank in the task sequence. You can compare this with macros like TASKTYPE_LOAD, TASKTYPE_TRAVEL...

int getnroftasks(treenode tasksequence)

Returns the number of tasks in the task sequence that have not yet been finished.

int gettotalnroftasks(treenode tasksequence)

Returns the total number of tasks in the task sequence.

int gettaskvariable(treenode tasksequence, int rank, int varnum)

Returns the value of a variable in the task of a tasksequence. Again, rank is the rank of the task in the task sequence. Varnum is a number between 1 and 4, and is the variable number. As in the involved objects, variable numbers and what they mean depend on the task type.

int getpriority(treenode tasksequence)

Returns the priority of a given task sequence.

void setpriority(treenode tasksequence, double newpriority)

Sets the priority of the tasksequence

int getpreempt(treenode tasksequence)

Returns the preempt value for the task sequence. You can compare this with PREEMPT_NOT , PREEMPT_ONLY, PREEMPT_AND_ABORT_ACTIVE, PREEMPT_AND_ABORT_ALL. For information on preempting, go to Task Sequence Preempting.

void setpreempt(treenode tasksequence, int newpreempt)

Sets the preempt value of a task sequence. You would pass into newpreempt one of the previously mentioned macros. For information on preempting, go to Task Sequence Preempting.

flexsim users manual
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.



paul.t contributed to this article


FlexSim 2016.1