Task 1.3 - Tasks Using Lists

Task Overview

In this task, you'll learn how to build tasks using lists in a process flow. Lists share some similarities to resources, but they have the added advantage of allowing you to sort or prioritize tasks using your own custom criteria. This tutorial will also include a discussion of the pros and cons of building tasks with lists.

When you're finished, your simulation model will operate similar to the following model:

Step 1 Copy and Modify the 3D Model

In this step, you'll copy the system you used to build the resource logic. When you're finished, your 3D model should look similar to the following image:

Be aware that before copying the plane you'll also undo some of the changes that were made to the model at the end of the previous tutorial task. To make these changes to the 3D model:

  1. Delete the center port connection from Processor1B to Operator2A. (Press and hold the W key while clicking two connected objects to remove port connections.)
  2. Double-click Processor1B to open its properties.
  3. In the Processor tab, clear the Use Operator(s) for Process checkbox.
  4. Click the OK button to close the window and save the changes.
  5. Click the ResourceLogic plane to select it. (It's the orange one.)
  6. Press Ctrl+C to copy the plane and all the objects on it. Click somewhere blank in the model to de-select the original plane. Press Ctrl+V to copy the plane.
  7. With the copied plane selected, in Quick Properties, change the name of the plane to ListLogic.
  8. Click the arrow next to the color box to open the color selector menu. Choose the lightest shade of red.
  9. Rename each of the 3D objects on the copied plane, replacing any 2 numbers with a 3, such as Queue3, Operator3A, Processor3A, etc.
  10. Right-click Operator3A to open a menu. Point to Object Groups and notice that there is a check mark next to the ResourceOperators group. This means that Operator3A currently belongs to this group. Click ResourceOperators to remove this operator from that group.
  11. Repeat the previous step to remove the following objects from the following groups:
    • Remove Operator3B from the ResourceOperators group
    • Remove Processor3A from the ResourceProcessors group
    • Remove Processor3B from the ResourceProcessors group
  12. Right-click Operator3A to open a menu. Point to Object Groups and select Add to New Group.
  13. In the group properties window, change the name of the group to ListOperators.
  14. Click the Sampler button to enter sampling mode.
  15. In the 3D model, click Operator3B to sample it and add it to the group.
  16. Close the group properties window.
  17. Right-click Processor3A to open a menu. Point to Object Groups and select Add to New Group.
  18. In the group properties window, change the name of the group to ListProcessors.
  19. Click the Sampler button to enter sampling mode.
  20. In the 3D model, click Processor3B to sample it and add it to the group.
  21. Close the group properties window.

Check to ensure that your 3D model looks similar to the image shown at the beginning of this step.

Step 2 Create Tasks Using Lists

In this step, you'll add activities to a general process flow to build a process flow that uses lists to create transportation task logic.

When you're finished, your process flow should look similar to the following image:

For now, you'll merely add and connect these activities to the process flow. You'll edit the properties to add the functionality in a later step.

To add and connect these activities:

  1. On the main toolbar, click the Process Flow button to open a menu. Select Add a General Process Flow.
  2. Click a blank space in the process flow so that nothing is selected. In Quick Properties, change the name of the process flow to ListLogic.
  3. With the process flow open and active, drag two Process shapes from the Library (under Flowchart).
  4. In Quick Properties, change the name of the first shape to Queue Pushes Tasks to List.
  5. Click the arrow next to the Color box to change it to red. You'll use red because it matches the color of the ListLogic plane.
  6. Change the name of the second shape to Operators Pull Tasks From List. Repeat the previous step to change the color of the second shape to red as well.
  7. In the Queue Pushes Tasks to List shape, add the following activities to create a stacked block:
    • An Event-Triggered Source (under Token Creation)
    • A Push to List (under Shared Assets)
    • A Sink (under Basic)
  8. Add a List shared asset to the right of the stacked block.
  9. Rename the activities and shared assets as follows:
  10. Activity New Name
    List List: Items to Transport
    Source (Event Triggered) Source: Item Enters Queue
    Push to List Push to List: Items to Transport
    Sink Sink: Item Was Pushed
  11. In the Operators Pull Tasks From List shape, create a stacked block with:
    • A Schedule Source (under Token Creation)
    • An Acquire Resource (under Shared Assets)
  12. Under the newly-created stacked block, create a second stacked block with the following activities:
    • A Pull from List (under Shared Assets)
    • A Load (under Task Sequences)
    • A Travel (under Task Sequences)
    • A Delay (under Basic)
    • An Acquire Resource (under Shared Assets)
    • An Unload (under Task Sequences)
    • A Wait for Event (under Basic)
    • A Release Resource (under Shared Assets)
  13. Add two Resource shared assets to the right of the stacked blocks.
  14. Rename the activities and shared assets as follows:
  15. Activity New Name
    Resource (first one) Resource: Operators
    Resource (second one) Resource: Processors
    Source (Schedule) Source: Simulation Starts
    Acquire (first one) Acquire Operator
    Pull from List Pull from List: Items to Transport
    Load Load Item from Queue
    Travel Travel to ScanStation
    Delay Delay: Scan Item
    Acquire (second one) Acquire Processor
    Unload Unload Item at Processor
    Wait for Event Wait for Event: Process Finish
    Release Release Processor
  16. Create a connector going from Acquire Operator to Pull from List: Items to Transport.
  17. Create a connector going from Release Processor that loops back to Pull from List: Items to Transport.
  18. Click a blank area in the process flow to ensure nothing is selected. In Quick Properties, click the More Properties button.
  19. On the Variables tab, click the Add button to create a new variable.
  20. In the Name box, change the name of the variable to NumberOfOperators.
  21. Confirm that the Type menu is set to Number.
  22. In the Default Value box, delete the current value and type Group("ListOperators").length.
  23. Click the OK button to close the window and save the changes.

Check to make sure your process flow looks similar to the image shown in the beginning of this step.

Step 3 Create the Push to List Logic

One thing to keep in mind when working with lists is that they are slightly more complex than resources because you are usually working with more than one flow. The term flow here refers to two different streams of tokens that will move through the process flow. One flow of tokens will manage the flow of items in the 3D model, pushing them to the task list when they're ready for transport. Another flow of tokens will manage the flow of the operators in the 3D model, directing them to pull items from a list and complete a series of tasks.

In this step, you'll edit the properties for the activities in the Queue Pushes Tasks to List process flow. These activities will essentially control the flow of items that need to be transported. Simply put, when a flow item enters the queue, it will get pushed to a list where it will wait indefinitely until it can be transported.

The following is an overview of how each activity and shared asset will function:

Activity Explanation
List: Items to Transport This list will store a reference to all the flow items in Queue3 that are ready to be transported to a processor.
Source: Item Enters Queue The Event-Triggered Source is an event-listening activity that will listen to events in the 3D model. When a flow item enters Queue3, this activity will create a token and release it to the next downstream activity. You'll assign a label to this token named FlowItem that will contain a reference to the specific flow item that triggered the event.
Push to List: Items to Transport This activity will push all flow items that are in the queue onto the Items to Transport list. When the items get pushed to the list, they will retain the reference to the specific flow item using the FlowItem label.
Sink: Item Was Pushed This activity removes the token from the process flow. You'll use its default settings.

To create this functionality:

  1. Click the Source: Item Enters Queue activity to select it. Click the Exclamation Point button to enter sampling mode.
  2. In the 3D model, click Queue3 to open a menu. Select Queue3: On Entry.
  3. In Quick Properties, in the Label Assignment table, click the cell that is on the Entering Item row under the Label Name or Value column. Type FlowItem.
  4. Click the cell that is on the Entering Item row under the Operation to open a menu. Select assign.
  5. Click the Push to List: Items to Transport activity to select it. Click the Exclamation Point button to enter sampling mode.
  6. Click the List: Items to Transport shared asset to select it. A blue line will now link this activity to the shared asset.
  7. In Quick Properties, click the arrow next to the Push Value box to open a menu. Point to Token Label, then select FlowItem.

In the next step, you'll set up the logic that will cause the operators to pull items from the list and begin the transportation tasks.

Step 4 Create the Pull from List Logic

In this step, you'll edit the properties for the activities in the Operators Pull Tasks From List process flow. In the previous step, you learned how process flows that use lists usually have more than one flow of tokens. In this process flow, one flow of tokens will control the flow items and one will control the operators.

In this step, you'll design the logic that controls the operators. This set of activities will tell an available operator to pull an item from the list and transport that item. Notice how in the previous process flow, the tokens represented flow items. In this process flow, the tokens will represent the task executers.

The following is an overview of how each activity and shared asset will function:

Activity Explanation
Resource: Operators You'll link this shared activity to ListOperators group in the 3D model so that the operators in this group can be acquired for the transportation tasks.
Resource: Processors You'll link this shared activity to ListProcessors group in the 3D model so that the processors in this group can be acquired, restricting them to one flow item at a time.
Source: Simulation Starts When the simulation starts, this activity will create a token for each operator in the ListOperators group. You'll set this activity to reference the NumberOfOperators process flow variable that you set up earlier in the tutorial. This activity will determine how many tokens to create by referencing how many operators are in the group at the time the simulation starts.
Acquire Operator This activity will attempt to acquire a resource (one of the operators) to work on the transportation tasks. If an operator is not available to work on the task, the token will wait at this activity until the operator becomes available. If an operator is available to work on the task, the token will acquire that resource and release the token to the next downstream object. When the resource is acquired, you'll assign the token a label named Operator that will contain a reference to the specific operator that was acquired.
Pull From List: Items to Transport This activity will pull a flow item from the Items to Transport list. You'll assign the token a label called TransportedItem that will contain a reference to the flow item that was pulled from the list.
Load Item from Queue This activity tells the operator which flow item needs to be picked up and where it is located.
Travel to ScanStation This activity will tell the operator to travel to the ScanStation3 object.
Delay: Scan Item This activity will simulate the amount of time that it takes to scan the flow item in the computer. You'll set the delay to 1 second.
Acquire Processor This activity will attempt to acquire a processor when an operator is ready to unload a flow item. If the processor is available, the token will acquire that resource and release the token to the next downstream object. When the resource is acquired, you'll assign the token a label named Processor that will contain a reference to the processor in the 3D model that was acquired.
Unload Item at Processor This activity tells the operator where to unload the flow item. When this task is finished, the token will loop back to the Pull From List activity and the process will repeat itself.
Wait for Event: Process Finish This is an event-listening activity, which means it will listen to an object in the 3D model and release the token to the next downstream activity once the event occurs. This activity will wait for the processor to finish processing the item before releasing the token to the next activity.
Release Processor This activity will release the processor so that it can accept another flow item. It will use the Processor label to release the processor.

To create this logic:

  1. Click the Resource: Operators shared asset to select it. In Quick Properties, click the arrow next to the Reference box to open a menu. Point to Group, then select ListOperators.
  2. Click the Resource: Processors shared asset to select it. In Quick Properties, click the arrow next to the Reference box to open a menu. Point to Group, then select ListProcessors.
  3. Click the Source: Simulation Starts activity to select it. In Quick Properties in the Arrivals table, click the cell under the Quantity column. With that cell selected, click the arrow next to the Arrival 1: Quantity box under the table to open a menu. Point to Process Flow Variable, then select NumberOfOperators.
  4. Click the Acquire Operator activity to select it. Click the Exclamation Point button next to the activity to enter sampling mode.
  5. Click the Resource: Operators shared asset to select it. A blue line will now link this activity to the shared asset.
  6. In the Assign To Label box, delete the current text and type token.Operator.
  7. Click the Pull from List: Items to Transport activity to select it. Click the Exclamation Point button next to the activity to enter sampling mode.
  8. Click the List: Items to Transport shared asset to select it. A blue line will now link this activity to the shared asset.
  9. In Quick Properties, under the Assign To button, delete the current text and type token.TransportedItem.
  10. Click the Load Item from Queue activity to select it. In Quick Properties, click the arrow next to the Task Executer / Sequence box to open a menu. Point to Token Label and select Operator.
  11. Click the arrow next to the Item box to open a menu. Point to Token Label and select TransportedItem.
  12. Click the Travel to ScanStation activity to select it. In Quick Properties, click the arrow next to the Task Executer / Sequence box to open a menu. Point to Token Label and select Operator.
  13. Next to the Destination box, click the Sampler button to enter sampling mode.
  14. In the 3D model, click ScanStation3 to open a menu. Select ListLogic/ScanStation3.
  15. Click the Delay activity to select it. In Quick Properties in the Delay Time box, delete the current text and type 1.00.
  16. Click the Acquire Processor activity to select it. Click the Exclamation Point button next to the activity to enter sampling mode.
  17. Click the Resource: Processors shared asset to sample it. A blue line will now link this activity to the shared asset.
  18. In Quick Properties, in the Assign to Label box, delete the current text and type token.Processor.
  19. Click the Unload Item at Processor activity to select it. In Quick Properties, click the arrow next to the Task Executer / Sequence box to open a menu. Point to Token Label and select Operator.
  20. Click the arrow next to the Item box to open a menu. Point to Token Label and select TransportedItem.
  21. Click the arrow next to the Station box to open a menu. Point to Token Label and select Processor.
  22. Click the Wait for Event: On Process Finish activity to select it. Click the arrow next to the Object box to open a menu. Point to Token Label and select Processor.
  23. Next to the Event box, click the Sampler button to enter sampling mode.
  24. In the 3D model, click Processor3A to open a menu. Select On Process Finish.
  25. Click the Release Processor activity to select it. Click the arrow next to the Resource(s) Assigned To to open a menu. Point to Token Label, then select Processor.

Reset and run the model:

As you can see, the process flow that uses a list can do everything that the process flow that only uses resources can do. The two models operate identically. The only disadvantage of using the list logic is that it is a little more complicated to set up initially. Lists require you to think through your logic more thoroughly.

But what are some of the advantages of using a list? One main advantage of using lists is that you can build in some fairly complex logic into it. You can use lists to prioritize certain tasks, to assign tasks to operators based on list fields, to sort tasks, and much more. The next step will demonstrate how you can use lists to sort transportation tasks by priority.

Step 5 Use Labels to Prioritize Tasks

In this step, you'll use lists to add a priority level to flow items. The operators will transport flow items with a high priority before flow items that do not have a high priority. To create this logic, you'll add a label to all of the flow items called RushOrder. This label will have either a true or false value (where 1 is true and 0 is false) to indicate whether the flow item is a rush order or not. You'll set it so that 30% of the items are rush orders. You'll also change the color of the rush order items to red so that you can see the logic more visibly.

Lastly, you'll edit the properties of the Pull From List: Items to Transport activity so that the operators will transport rush order items first. You'll create this logic by adding a query to this activity where items with a higher RushOrder value will get pulled from the list first.

To create this logic:

  1. In the 3D model, double-click Source3 to open its properties window.
  2. On the Triggers tab, click the Add button to open a menu. Point to On Creation to add this trigger.
  3. Next to the OnCreation box, click the Add button to open a menu. Point to Data, then select Set Label. A picklist options window will appear.
  4. In the Label box, delete the current text and type "RushOrder".
  5. In the Value box, delete the current text and type bernoulli(30, 1, 0).
  6. Next to the OnExit box, click the Add button to open a menu. Point to Visual, then select Set Object Color. A picklist options window will appear.
  7. In the Color box, delete the current text and type Color.byNumber(item.RushOrder).
  8. Press the OK button to save the changes and close the properties window.
  9. In the ListLogic process flow, click the List: Items to Transport shared asset to select it. In Quick Properties, click the View Entries button to open the entries window. You'll use this later when you run the model, so move it off to the side if you need.
  10. Returning back in the Quick Properties for the list shared asset, click the Advanced button to open the list properties.
  11. On the Fields tab, click the Add button to open a menu. Select Label to add a label field to the list.
  12. In the Label Field box, delete the current text and type RushOrder.
  13. On the Back Orders tab, check the Reevaluate All Values On Push checkbox.
  14. Click the OK button to save the changes and close the window.
  15. In the ListLogic process flow, click the Pull from List: Items to Transport activity to select it. In Quick Properties, click the arrow next to the Query / Object box to open a menu. Point to ORDER BY (Sort) and select RushOrder. In the query that now shows up in this box, change the ASC to DESC.
  16. Before you run the model, it might help to open the list entries so that you can view it during the simulation run. Click the List: Items to Transport shared asset to select it. In Quick Properties, click the View Entries button.

Reset and run the model. Pay attention not just to the 3D model, but what is happening on the list's entries as well.

Notice that the operators always prioritize transporting the red rush order items before other items. If they don't pick up a rush order item immediately, it's usually because the rush order item arrived in the queue after the operator's token reached the Pull from List activity.

Lists enable you to build this kind of complex task logic. They can be ideal for systems in which task executers need to sort, filter, or prioritize tasks.

Step 6 Add an Additional Task

As you noticed in the previous task, every once in a while the task executers don't pick up one of the rush order flow items in the queue. This problem is caused by subtle timing issues where the rush order item arrived in the queue after the task executer had already begun the loading task. You can fix this problem by simply adding a Travel activity before the Pull From List activity. That way, the task executer will travel back to the queue before pulling an item from the list, which will ensure that high priority items are always picked first.

When you're finished, your process flow will look similar to the following image:

To make these changes:

  1. With the process flow open and active, drag a Travel activity and append it to the top of the second stacked block.
  2. Rename this activity Travel to Queue.
  3. In Quick Properties, click the arrow next to the Executer / Task Sequence box to open a menu. Point to Token Label, then select Operator.
  4. Next to the Destination box, click the Sampler button to enter sampling mode.
  5. In the 3D model, click Queue3 to open a menu. Select ListLogic/Queue3 to sample it.

Reset and run the model:

Now the operators always pick up the rush order items whenever one is in the queue. The key take-away from this step is to remember that task order and sequencing is important. It can affect the behavior of operators in subtle, but important ways.

Conclusion

Now that you've built transportation tasks using lists in a process flow, you can see that it has a few advantages:

  • Lists have many of the same advantages as resources - Like the logic that uses resources, lists are relatively easy to use, have visible logic, and can be customized easily.
  • You can sort and prioritize tasks - Lists give you the ability to create more complex task logic, such as determining which tasks should be completed first.

However, there are some disadvantages that come from using lists to build task logic:

  • Not quite as intuitive to use as resources - Lists can sometimes be a little more complicated to set up because you have to think through how your logic will work on a deeper level. There's more elements or token flows that you have to consider when setting up your list logic. For example, you have to think through the logistics of which events in the simulation model will cause something to be pushed to a list and which events will cause something to be pulled from that list. You also have to think more carefully about what the tokens in the process flow will be linked to in the 3D model. (For example, do they represent flow items or task executers, etc.).
  • Might not always behave like you expected - Sometimes the timing of events or the sequence of tasks can affect the behavior of the operators in ways that you didn't expect. However, process flows are fortunately fairly easy to troubleshoot and fix when unexpected behaviors occur.

Up to this point, you've learned how to use local lists to create task logic. In the next tutorial, you'll learn how to use global lists to explore even more possibilities for building different types of task logic. Continue to Tutorial Task 1.4 - Tasks Using Global Lists.