Paul Toone avatar image
Paul Toone posted tannerp commented

List Examples   

Here we will build a model that uses lists for routing items in a simple job shop model. The following image shows the basic layout, namely a source, 8 processors, and a finish queue.

Fixed Resource Routing Example

As the image shows, there are basically four types of operations:

  • Alpha - 2 Stations
  • Beta - 2 Stations
  • Gamma - 2 Stations
  • Delta - 2 Stations

In this model we will have 3 different types of products, designated by item type. Each type has a unique sequence of operations that must be performed on the part before it is finished. The following table shows the manufacturing steps required for each type.

Model Building Steps

  1. Add an Item List - In the Toolbox, press the button and choose Global List > Item List from the drop-down menu. This will add an Item List to the model. For now you can close the List properties window.
  2. Add the Steps Table - In the Toolbox, press the button and choose Global Table from the drop-down menu. In the table view, define the name of the table as "Steps" and give it the following data:

  3. Create a Source - Create a source object in your model.
  4. Define Source Properties - Double-click on the source.
    1. Give the source an Inter-Arrivaltime of exponential(0, 30, 0).
    2. Select the Flow tab. Under Send To Port, press the drop-down button and choose Use List > Push to Item List.

      Make sure that the list name matches the name of the list you added.

    3. Select the Triggers tab in the Source properties. In the OnCreation, add triggers to set a label named stepRow to 1, and set item type and color to duniform(1, 3).

      The stepRow label will designate the row in the Steps table that the item is currently on. After each operation, the stepRow label will be incremented.

  5. Define List Fields - Go back to the Item List's properties (double-click the Item List in the ToolBox). For this model we will use the following fields:
    • stepRow - This field will reference the current stepRow label on the item. We'll use this to prioritize items who are further into their process (ORDER BY stepRow DESC).
    • step - This field will reference the name of the current step that the item is on, e.g. Alpha, Beta, Gamma, or Delta. We will use it to match against the station that will pull from the list.
    • itemType - This field will not be used in any queries. Rather it will be used to better visualize the items that are on the list.
    1. In the Item List's Fields tab, remove all fields but itemType
    2. Add a Label field named stepRow.
    3. Add an Expression field and give it the expression gettablestr("Steps", getlabel(value, "stepRow"), getitemtype(value)).
      In expression fields you use "value" to access the primary value on the list. This expression gets a value from the Steps table (gettablestr("Steps", ... ) where the row is the item's current stepRow (getlabel(value, "stepRow")), and the column is the item's type (getitemtype(value))
    4. Press Apply in the List properties window.
  6. Do a Quick Test Model Run - In the General tab of the List properties, click View Entries... to open a window showing current entries on the list. Reset and run the model just to test that the source is properly assigning the data and pushing the item onto the list. After the source's first inter-arrival time has expired, the list should get an item on it.

  7. Create a Processor Object - Drag a processor object from the library into the model.
  8. Define Processor Properties - Double-click on the processor.
    1. Name the process Alpha1
    2. Give the processor a string label named operation. Set the value to Alpha.

    3. Select the Flow tab. Under Send To Port, press the drop-down button and choose Use List > Push to Item List.

      Make sure that the list name matches the name of the list you added.

    4. In the Input pane, check Pull, then under Pull Strategy, press the drop-down button and choose Use List > Pull from Item List.

      Make sure that the list name matches the name of the list you added, and define the Query as WHERE step == Puller.operation ORDER BY stepRow DESC.

      This will make the processor only pull items from the list whose step field matches the processor's operation label. It will also prioritize items with the highest stepRow label, i.e. items that are further along in their steps.

    5. Select the Triggers tab. In OnProcessFinish, add a trigger to set the stepRow label. In the Value field for the trigger, enter the code getlabel(item, "stepRow") + 1.

  9. Define Remaining Processors - Now that you've defined the processor object, you can copy/paste the other processors from that object. Define a second Alpha processor (copy/paste it). Define two Betas, two Gammas, and two Deltas by copy/pasting the original processor, and change the pasted objects' operation label to its corresponding operation (Beta, Gamma or Delta).
  10. Add a Finish Queue - Drag a queue from the library. The queue will have much of the same properties as the processors. It will be the queue to dump the items when they reach their Finish step.
    1. Name the queue Finish
    2. Give it an operation label with the value Finish
    3. In its Flow tab, check Pull and under the Pull Strategy choose Use List > Pull from Item List.
    4. Define the pull query as WHERE step == Puller.operation. We don't need to prioritize here because it's essentially a sink.
  11. Run the Model - Now you should be able to reset and run the model. You may also want to go back to the Item List and view its back orders. Right-click on the list in the Toolbox, and select View Back Orders.

    As the model runs you should see items moving through the various processors in the order defined in their associated Steps table column (red = type 1, green = type 2, blue = type 3).



flexsim users manualusers manual
· 10
5 |100000

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

Jason Merschat avatar image Jason Merschat commented ·

@Paul T

Is it just me or does this example not work in version 2017? I have no flow items going over the alphas and the model will time out 813.89. I rebuilt it once following the instructions closely, but without complete success. The flow items end up in the Finish queue with step 7 listed for all of them. Looking for help and an update as I am looking to use this technique on a current project.

Thanks and I appreciate any help you can provide!


0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ Jason Merschat commented ·

Are you using 17.1 or 17.0? In 17.1 itemtype was deprecated and replaced with a Type label. So instead of using getitemtype(item) you just say item.Type.

0 Likes 0 ·
ernesto daniel AG avatar image ernesto daniel AG commented ·

hello @Paul T2, could you share the model of the tutorial already done? I have tried for hours and I do not have positive results I use version 18.2

0 Likes 0 ·
Logan Gold avatar image Logan Gold ♦♦ ernesto daniel AG commented ·

@ernesto daniel AG

I am attaching a model (listexample-18-2.fsm) that was built in FlexSim 2018 Update 2 (version 18.2). I think the problem is this tutorial was created using an older version of the software (16.1) and some things work differently in 18.2. For example, in step 5.3, the Expression field should be using:


And in 8.5, the Value field should be using:

item.stepRow + 1
1 Like 1 ·
dipak S avatar image dipak S commented ·

Sir do u have Video of this Tutorial.If it is there plz provide link.

0 Likes 0 ·
Ben Wilson avatar image Ben Wilson ♦♦ dipak S commented ·

@dipak S, sorry, there is no video of this tutorial

0 Likes 0 ·
dipak S avatar image dipak S Ben Wilson ♦♦ commented ·

exception: FlexScript exception: MODEL:/Alpha 2>variables/receivefromport exception: FlexScript exception: MODEL:/Beta 1>variables/receivefromport exception: FlexScript exception: MODEL:/Beta 2>variables/receivefromport exception: FlexScript exception: MODEL:/Gamma 1>variables/receivefromport exception: FlexScript exception: MODEL:/Gamma 2>variables/receivefromport exception: FlexScript exception: MODEL:/Delta 1>variables/receivefromport exception: FlexScript exception: MODEL:/Delta 2>variables/receivefromport time: 11.215140 exception: FlexScript exception: Label property step retrieved on /Source1/Box. Label does not exist. at MODEL:/Tools/GlobalLists/ItemList1>variables/fields/step/expression

I am getting this error ..i did same as you, but dont know where i am doing wrong. t

0 Likes 0 ·
Show more comments



paul.t contributed to this article


FlexSim 2016.1