Paul Toone avatar image
Paul Toone posted

Task Sequences   

In previous versions of FlexSim, creating custom task sequences required writing FlexScript code. Now with the process flow module, you can create complex task sequences without code. You'll also be able to more easily visualize and edit task sequences because they'll be listed in a step-by-step pattern.

This topic will explain the key concepts related to task sequences. It contains the following sections:

What is a Task Sequence?

A task is an individual task activity that could be assigned to a task executer such as loading a flowitem, traveling to a specific destination, etc. A task sequence is a set of tasks, a series of actions that can be assigned to a task executer (such as an Operator or Transporter). The task executer will usually complete each task in a task sequence in sequential order.

The following image shows an example of a task sequence:

In this example, a task executer will clean a processing station after transporting an item, using the following task sequence:

  1. Load or pick up a flowitem from a processor
  2. Unload a flowitem at a new destination
  3. Travel to the closet where the cleaning supplies are stored
  4. Acquire the cleaning supplies (a Resource)
  5. Travel back to the processor
  6. Clean the processor (represented by a timed Delay)
  7. Send a Message to the processor indicating it is now clean and can accept more flowitems (represented by a Custom Task)
  8. Travel back to the closet to return the cleaning supplies
  9. Release the cleaning supplies (return them to the supply closet)

Once you've created a task sequence such as this, you can easily assign any task executer to the task sequence without writing Flexscript code or using a Dispatch object.

How Task Sequences Work

The following list explains how a basic task sequence works from beginning to end:

  1. During a simulation run, a token enters any Task Sequence activity (such as a Travel or a Load activity).
  2. The task is assigned to a task executer or task sequence.
    • If the task is assigned to a task executer, a unique task sequence is created on the task executer that represents that specific task.
    • If the task is assigned to a task sequence, the task will be appended to the end of the task sequence.
  3. The task executer will complete task sequences in the order they are received. If task sequences have different priorities, they will be performed in the order of their priority.
  4. If the task executer finishes a task sequence and nothing else is added to the task sequence, the task sequence will be deleted.
  5. After the task sequence is deleted, the task executer is free to work on other task sequences.

If multiple tokens or objects give task sequences to a task executer, you may need to adjust how the tasks are implemented in the process flow to ensure they are performed in the proper order. This can be done by using a Resource to prevent multiple tokens from giving the task executer tasks simultaneously, or by assigning the tasks to a task sequence (not a task executer). See the Executer / Task Sequence property for more information.

If you want to create a more complex system for handling tasks, there are a few different ways you can change the way a task executer handles task sequences:

  • You can create a complete task sequence and dispatch it to a Global List rather than a task executer. See Creating and Dispatching Task Sequences for more information.
  • You can prevent a task sequence from being deleted because it is empty. See Deleting Task Sequences for more information.
  • You can assign priorities to task sequences so that important task sequences are completed before less important ones. You can also make a task sequence preempt (interrupt) another less important task sequence. See Task Sequence Priorities and Preemption for more information.

Creating and Dispatching Task Sequences

As was stated in the previous section, using any of the task sequence activities in a process flow will automatically create a task sequence any time that task sequence is used in a simulation run. However, you can use a Create Task Sequence to:

  • Associate a set of tasks together, not allowing the task executer do other tasks in the middle.
  • Create a task sequence up front, and then dispatch it later in the simulation run.

When you use a Create Task Sequence activity, you are essentially grouping a set of tasks together into a single unit, so the task executer will not do anything else until that entire group of tasks is finished. Once the task executer has completed all of the tasks in a task sequence, the task sequence will be deleted.

The Dispatch Task Sequence activity can dispatch a task sequence to a task executer. Generally you won't need to use the Dispatch Task Sequence activity with your task sequences because the Create Task Sequence activity and other task sequence activities will be dispatched immediately by default.

However, you could use a Dispatch Task Sequence if you would prefer instead to build a series of task sequences first and dispatch them later. There are two different methods you can use to build a task sequence that is dispatched later:

  • You could use a Task Sequence Global List. (See Global Lists for more information.) Using this method, the task sequences you create will be pushed to the global list where it will wait until a task executer becomes available. When a task executer becomes available, a token could pull the task sequence from the Global List will then dispatch the task sequence to the Task Executer.
  • You could use a Create Task Sequence activity to create a task sequence but set the Task Executer / Dispatcher property to None. (See Create Task Sequence for more information about this property.) You can then add tasks to the end of this task sequence (not waiting for them to be finished). After the task sequence has been built, the token can later dispatch it using the Dispatch Task Sequence activity. (See Dispatch Task Sequence for more information.)

Deleting Task Sequences

When a task executer finishes all the tasks in a task sequence, the task sequence is deleted. In other words, if you don't want a task sequence to be deleted, you should make sure that the task sequence is continually supplied with new tasks. You might experience error messages if you try to reference a task sequence that has been deleted. You can avoid these problems two different ways:

  • You could give tasks to the Task Executer directly using the task sequence activities, instead of using the Create Task Sequence activity.
  • You could use a Wait for Task activity in your task sequence at the point where a delay may occur.

You may have noticed that there is no Wait for Task activity in the Process Flow Library. To use a Wait for Task activity:

  1. Add a Custom Task activity to your process flow.
  2. In Quick Properties for the activity, click the Task Type menu to open it. Select Wait for Task from the menu.

Task Sequence Priorities and Preemption

By default, task executers will complete task sequences and activities in the order they were received (first in, first out). However, you might want a task executer to complete more important tasks first. You can use the Priority box on the Create Task Sequence activity to cause the task executer to work on higher priority tasks sequences before lower priority task sequences. You can also use the Preemption menu to determine if requests for higher priority tasks should force a task executer to stop its current task sequence when it receives a higher priority task sequence. See the Create Task Sequence activity for more information.

Assigning Task Executers

The Executer / Task Sequence box is available on most of the Task Sequence activities. You can use this box to determine which task executer or task sequence should receive the task. If you choose to give this task to a task executer, a new task sequence will be automatically created with this task and then it will be sent to the task executer.

You can:

  • Assign a specific, fixed task executer in the 3D model
  • Dynamically assign the task executer during a simulation run using labels
  • Assign the task executer using the current command if you are in a task executer or sub flow process flow type.
  • Append this task to an existing task sequence

See Common Process Flow Object Properties - Executer / Task Sequence for more information about how to assign task executers to a task.

For More Information

See the Task Sequence tutorial for an example of how to build a task sequence and link it to a 3D simulation model.

If you would like a deeper understanding of how tasks sequences work without process flow, see Task Sequences - Concepts and the subsequent topics in this chapter. You might get a deeper understanding of how task sequences work by reading this chapter.

flexsim users manualuser manuals
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