Paul Toone avatar image
Paul Toone posted

Task Sequence Tutorial 3 Step-By-Step Model Construction   

Step 1: Load the Model

If you have not already done so, load the model from Task Sequence Tutorial 2.

Step 2: Delete the OnProcessFinish Trigger

Since you will be adding to the task sequence, a change needs to be made in how the Operator is released from the Utilize task. The freeoperator() command needs to be moved to the Request Transport From field in order for the model to work correctly. If you need more information, an in-depth explanation will be provided at the end of the tutorial.

  • Double-click on the first Processor to open its Properties window, and click the Triggers tab.
  • In the OnProcessFinish trigger, click the button, and then click the button to remove the function on this trigger.
  • Don't close the Properties window yet.

Step 3: Write the Flow Logic

Now you will need to free the operator in the Request Transport From () field. Also, since the next set of tasks you will add will override the Processor's flow logic, specifically the Request Transport From logic, you need to tell the processor that it doesn't need to create a task sequence.

Note: Whenever you write a task sequence that controls the output of an object somewhere other than the Request Transport From on the object the task sequence is affecting, you MUST return 0 in that object's Request Transport From logic, otherwise there will be serious problems. In this example, you are writing the task sequence on the Queue, but the next tasks you will add affect the Processors natural transport logic, so even though the task sequence is on the Queue, you will need to return 0 on the Processor's Request Transport From logic. You would also need to do this if you were writing a task sequence in a trigger field instead of in the Request Transport From.
  • Double-click on the first Processor to open its Properties window, and click the Flow tab.
  • Check the Use Transport box, then choose Free Operators from the drop down list. The default parameters should work fine for this model. Notice that the description points out that this option returns 0 for you, so you don't have to worry about writing this anywhere.

  • Click the OK button to close the Properties window.

Step 3: Write the rest of the Task Sequence

  • Click on the first Queue to open its properties in the Quick Properties.
  • Under the the Flow section, click the Code Edit button to the right of the Use Transport picklist to open the code editor.

  • You will need to create a local variable so that you can more easily reference the second Queue in you task sequence. On line 17, type the following:
    treenode downQueue = outobject(outobject(current, 1), 1);

  • Starting on line 27, type the following:
    inserttask(ts, TASKTYPE_FRLOAD, item, outobject(current, 1));
    inserttask(ts, TASKTYPE_TRAVEL, downQueue, NULL);
    inserttask(ts, TASKTYPE_FRUNLOAD, item, downQueue, 1);

  • Click the OK button on the Code Window and theProperties window to close them.

Note: The reason that the freeoperators() command needed to be changed from the OnProcessFinish is due to the fact that a written task sequence has the ability to override the internal logic of objects. If the downstream queue isn't available when the Processor finishes its process time, then the Processor will release the Operator to load/unload the part into the Queue before it's actually available, which can cause the Queue to be over-filled, and can cause some other problems. So by moving the freeoperators() to the Request Transport From field, the operator will only be freed to continue with the load/unload only when the downstream queue is ready to receive that part. The perfect solution to this problem would be to have two utilize tasks, freeing the Operator on both the OnProcessFinish, and the Request Transport From. This way, the operator would be free after the Processor finishes, in case you need him to break, but he won't move the item until the downstream object is available. See the Fixed Resource page for more information.

Step 4: Reset and Run the Model

  • Reset and Run the model. The Operator should Travel to the Queue, Load the item, Travel to the BasicFR, Delay for 10 seconds, Travel to the Processor, Unload the item, stay at the Processor for the Process Time, Load the item, Travel to the next Queue, and Unload the item.
  • Save the model.

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