Table of Contents

Table of Contents

FlexScript Class - TaskSequence

TaskSequence

Description

A class representing a sequence of tasks to be performed by a TaskExecuter.

See Task Sequence Concepts for more information on task sequences.

Properties

currentTask Accesses the first task in the task sequence that has not yet finished execution. This task may be currently executing, or it may be waiting for execution because the task sequence itself is waiting for execution.
labelProperties Use your own named properties to get/set label values.
preempt Gets/sets the preempt value of the task sequence.
priority Gets/sets the priority value of the task sequence.
rank Gets/sets the rank of the task sequence in its task sequence queue.
tasks Accesses the set of tasks in the task sequence. This member can be used like an array of TaskSequence.Tasks.

Methods

addTask Adds a new task to the task sequence.
dispatch Dispatches the task sequence.
move Moves the task sequence into a new dispatcher's task sequence queue.

Static Methods

create Creates a new task sequence.

Details

Do no remove, this fixes the anchor on doc.flexsim.com

TaskSequence.currentTask

readonly TaskSequence.Task currentTask

Description

Accesses the first task in the task sequence that has not yet finished execution. This task may be currently executing, or it may be waiting for execution because the task sequence itself is waiting for execution.


TaskExecuter op = Model.find("Operator1");
TaskSequence ts = op.taskSequences[1];
int curTaskType = ts.currentTask.type;
...
      
Do no remove, this fixes the anchor on doc.flexsim.com

TaskSequence.labelProperties

Variant labelProperties

Description

Use your own named properties to get/set label values.

The TaskSequence class allows you to get and set custom named properties that will apply to labels on the task sequence. For example, if you want to set a label named "MyLabel" on the task sequence ts to a value of 5, you can write the following code:

ts.MyLabel = 5;

This will set the label's value to 5. If a label of that name does not exist, then it will be added to the object's labels.

If you want to return the value stored in ts's "MyLabel" label, you can execute the following code:

return ts.MyLabel;

This works the same as the treenode class's dynamic property mechanism. See treenode.labelProperties for more information

Do no remove, this fixes the anchor on doc.flexsim.com

TaskSequence.preempt

int preempt

Description

Gets/sets the preempt value of the task sequence.


TaskExecuter op = Model.find("Operator1");
TaskSequence ts = op.taskSequences[1];
int preempt = ts.preempt;
...
      
Do no remove, this fixes the anchor on doc.flexsim.com

TaskSequence.priority

double priority

Description

Gets/sets the priority value of the task sequence.


TaskExecuter op = Model.find("Operator1");
TaskSequence ts = op.taskSequences[1];
double priority = ts.priority;
...
      
Do no remove, this fixes the anchor on doc.flexsim.com

TaskSequence.rank

int rank

Description

Gets/sets the rank of the task sequence in its task sequence queue.


TaskExecuter op = Model.find("Operator1");
TaskSequence ts = op.taskSequences[1];
int tsRank = ts.rank; // should be 1
...
      
Do no remove, this fixes the anchor on doc.flexsim.com

TaskSequence.tasks

readonly tasks

Description

Accesses the set of tasks in the task sequence. This member can be used like an array of TaskSequence.Tasks.


TaskExecuter op = Model.find("Operator1");
TaskSequence ts = op.taskSequences[1];
int numTasks = ts.tasks.length;
for (int i = 1; i <= numTasks; i++) {
  Task task = ts.tasks[i];
}
      
Do no remove, this fixes the anchor on doc.flexsim.com

TaskSequence.addTask()

TaskSequence.Task addTask( int type , treenode involved1 = null , treenode involved2 = null , Variant var1 = nullvar , Variant var2 = nullvar , Variant var3 = nullvar , Variant var4 = nullvar )

Parameters

involved1 The first involved object of the task. The meaning of this is dependent on the task type. See Task Type Quick Reference for more information.
involved2 The second involved object of the task. The meaning of this is dependent on the task type. See Task Type Quick Reference for more information.
var1 The first variable of the task. The meaning of this is dependent on the task type. See Task Type Quick Reference for more information.
var2 The second variable of the task. The meaning of this is dependent on the task type. See Task Type Quick Reference for more information.
var3 The third variable of the task. The meaning of this is dependent on the task type. See Task Type Quick Reference for more information.
var4 The fourth variable of the task. The meaning of this is dependent on the task type. See Task Type Quick Reference for more information.

Returns

TaskSequence.Task The added task.

Description

Adds a new task to the task sequence.


TaskSequence ts = TaskSequence.create(Model.find("Operator1"));
ts.addTask(TASKTYPE_LOAD, item, current);
...
ts.dispatch();
      
Do no remove, this fixes the anchor on doc.flexsim.com

TaskSequence.dispatch()

void dispatch( )

Description

Dispatches the task sequence.

Calling this method initiates Dispatcher logic for receiving the task sequence and dispatching it as needed. If the object on whom the task sequence was created is a TaskExecuter and the TaskExecuter is not already executing another task sequence, then the object will immediately begin execution of the task sequence.


TaskSequence ts = TaskSequence.create(Model.find("Operator1"));
ts.addTask(TASKTYPE_LOAD, item, current);
...
ts.dispatch();
      
Do no remove, this fixes the anchor on doc.flexsim.com

TaskSequence.move()

void move( Dispatcher dispatcher )

Parameters

dispatcher The dispatcher to move the task sequence to.

Description

Moves the task sequence into a new dispatcher's task sequence queue.

Do no remove, this fixes the anchor on doc.flexsim.com

TaskSequence.create()

static TaskSequence create( treenode obj , double priority = 0 , int preempt = 0 )

Parameters

obj Specifies the object in which to create the task sequence. Generally this should be a Dispatcher or TaskExecuter. In such a case, the task sequence will be created in the task sequence queue of the object. If the object is not a Dispatcher or TaskExecuter, then the task sequence will be created as a subnode of that object/node.
priority Optional. Defines the priority value of the task sequence.
msgparam1 Optional. Defines the preempt value of the task sequence. If not zero, it should be one of the following values: PREEMPT_ONLY, PREEMPT_AND_ABORT_ACTIVE, or PREEMPT_AND_ABORT_ALL.

Returns

TaskSequence The created task sequence.

Description

Creates a new task sequence.


TaskSequence ts = TaskSequence.create(Model.find("Operator1"));
ts.addTask(TASKTYPE_LOAD, item, current);
...
ts.dispatch();