article

Paul Toone avatar image
0 Likes"
Paul Toone posted Ben Wilson commented

Tutorial - Kanban Labeler   

Process Flow includes features that allow you to easily customize logic on objects in the model. This tutorial will teach you how this works by implementing a kanban labeler, i.e. a processor that uses up material (labels that it stamps on items) as it processes items. Both material depletion and replenishment will be simulated.

This tutorial teaches the following Process Flow concepts.

  • Using Fixed Resource Process Flow instances to define customized logic on objects in the model.
  • Using Lists

The Problem

Quite often in manufacturing and other situations, machines use up material as they process products. Take for example a labeler machine that stamps sticker labels onto products. From a simulation perspective, you could implement this using a basic processor object. The core step is a delay associated with stamping the label onto the product.

However, using a simple processor to do this step does not simulate the machine's material usage, namely label paper, as it stamps products, nor the tasks required to replenish that material. Let's say the machine pulls labels off of a roll of sticker paper as it stamps products. Two rolls are stationed at the machine. When a roll is depleted, the machine automatically switches to the second roll, and a replenishment task is signaled to retrieve a new roll. The machine will pull from the second roll while the original roll is being replenished. If it happens that the second roll is depleted before a new roll is retrieved, the processor must stop until it has at least one roll. This scenario is a basic two-bin kanban system, where two "bins" (label rolls) are stored at the processing station, and depletion of one signals a replenishment to the station.

In standard FlexSim, you could simulate this as a combine operation. A combiner pulls the product from port 1, and then combines it with a label from port 2. However, this implementation would be very clunky. You'd have to split a roll into each label, and then do management of the two-bin-ness of the split roll and an extra roll. This would add a lot of extra objects to the 3D model that do not represent the real world system. The solution would feel like a work-around.

Process Flow makes simulating this scenario much easier. You can use a standard processor object, and then attach a Fixed Resource Process Flow to it, that listens for when the processor processes products, and performs the necessary kanban logic.

How It Will Work

We will build this model in two phases. In the first phase, we will only simulate label depletion/replenishment logically, meaning there won't be physical 3D objects representing the label rolls. They'll only be represented as tokens in the Process Flow. In the second phase we will implement the physical label rolls.

The first phase of the model is shown in the image below.

The labeler machine is simulated using a processor object. There will also be an operator for replenishing the rolls, and a queue where the operator travels to pick up a new roll.

The Process Flow for phase 1 is shown in the following image

The Process Flow is separated into two sections: label roll depletion and label roll replenishment.

Label Roll Depletion

The label roll depletion section manages the processor's usage of material. When an item enters the processor, it will grab a label from a roll. If it is successful (there is at least one non-empty roll at the station), it's done. If, however, it can't immediately grab a roll, it must stop the processor, and then wait until it can grab a roll before the processor can resume.

Label Roll Replenishment

The label roll replenishment section manages keeping the machine supplied with label rolls. At the start of the simulation it will put 2 rolls at the machine. Then, each time a roll is depleted, it will tell the operator to travel to roll storage and bring a new roll to the machine. As mentioned before, in phase 1 we're not simulating physical rolls, so the operator isn't going to pick up an actual roll in the 3D model. He only travels to the storage location and then travels back to the machine as-if he were carrying a roll.

Key Concepts

Lists

This model will use a list to represent the label rolls at a station. If you are new to lists you can refer to the Lists and Resources tutorial to learn more about them.

In the label roll replenishment section, when a roll is placed at the station, it is pushed onto the Label Rolls list. The label roll depletion section then pulls from the list of label rolls.

In this model, however, the pull operation is different than default pull operations. Usually a pull operation will pull/remove an entire entry from the list.

In this model, the list represents a list of label rolls, so a default pull would remove the full label roll. We don't want the label depletion to pull the full label roll. We only want to pull a single label from a roll on the list. Here we can use the SELECT clause in our pull query. Using the SELECT clause in a pull will cause the list to pull from a field on the list, instead of pulling the entire entry. The field value will be decremented with each pull operation. Once the field value reaches 0, the entry is removed from the list. In this model we will set a quantity field to be the total number of labels on the label roll. Each pull will decrement the field by 1. When the quantity field reaches 0, the label roll will be removed from the list.

See the List Functional Reference topic for more information on how this works.

Fixed Resource Process Flows and Instances

In this model we will use a Fixed Resource Process Flow. This is different than a General Process Flow in that it must be attached to objects in the model in order for any of its functionality to be executed. Any object that the Process Flow is attached to will become an instance of the Process Flow and will perform that ProcessFlow's logic. This means that, once we've defined the logic for the kanban labeler Process Flow, any object that we attach to the Process Flow will become its own kanban labeler.

Build the Model - Phase 1

Now let's build the model.

Model Layout

First we'll create the 3D objects. From a new model, create the layout as shown in the following image. This includes a source, two queues, a processor, a sink, and an operator.

Make sure you connect the processor's center port 1 to the operator, and center port 2 to the roll storage queue. We'll use these ports for referencing the objects in the Process Flow.

Process Flow

Now we'll implement the Process Flow. In the Toolbox press the button and select Process Flow > Fixed Resource. This will add a Fixed Resource Process Flow and open its modeling view.

Next, attach the Process Flow to the processor in the model. Click in the Process Flow view, and in Quick Properties under Attached Objects (instances), press the button and then click on the processor in the 3D view. This will make the processor into an instance of the Process Flow.

Add a List

Next we'll add a list to the Process Flow.

  1. From the library drag a List into the Process Flow view and name it Label Rolls.
  2. In its properties, under Type select Local.

    This means that each instance (labeler machine) will have its own set of label rolls at the station, instead of being shared globally.

  3. In the list's properties, press Advanced.

    This will open the list's full properties window.

  4. In the Fields tab, press the button and select Label.
  5. For the Label Field enter quantity. Make sure that Dynamic is not checked.

The quantity field will track the number of sticker labels remaining on a roll.

Label Roll Replenishment

The label roll replenishment activities are surrounded by a square Flow Chart display object. This does not affect simulation execution, but visually organizes activities. Add this object if desired and place subsequent activities inside it.

Create and connect the activities in the label roll replenishment section. This includes:

  1. A Schedule Soure activity

    Add the activity and name it Initial 2 Rolls. Go to its properties, and in its Arrivals table, in the first row under Quantity, enter 2.

    Next, under Assign Label to Created Tokens, add a label with a Name of quantity, and a Value of 20.

    With these settings, the source will create 2 tokens when the simulation starts. Each token represents a single roll at the labeler machine, and will have a label called quantity with a value of 20. The quantity label represents the total number of sticker labels on a roll.

  2. A Push to List activity

    Add the activity and name it Push to Label Rolls. Press its icon and then click on the Label Rolls list block.

    This will push the token (the label roll) onto the list of available label rolls at the processor. The token will remain in this activity until the label roll is pulled off of the list (by the label roll depletion section).

  3. A Travel activity

    Add the activity and name it Operator Gets New Roll. In its properties, under Executer / Task Sequence enter centerobject(current, 1), and under Destination enter centerobject(current, 2).

    When using Process Flow instances, the current keyword is used as a reference to the instance object (in this case, the processor object). The expression centerobject(current, 1) gets a reference to the object connected to the processor's first center port, or the replenishment operator. centerobject(current, 2) gets a reference to the object connected to the processor's second center port, or the roll storage queue.

    These settings will cause tell the replenishment operator to travel to the roll storage queue.

  4. A second Travel activity

    Add the activity and name it Operator Places New Roll. In its properties, under Executer / Task Sequence enter centerobject(current, 1), and under Destination enter current.

    These settings will tell the replenishment operator to travel back to the labeler machine as-if he were carrying a label roll back to it.

Once you've added these activities, connect them together with connectors.

Label Roll Depletion

The label roll depletion activities are surrounded by a square Flow Chart display object. Add this object if desired and place subsequent activities inside it.

Create and connect the activities in the label roll depletion section. This includes:

  1. An Event-Triggered Source activity

    Add the activity and name it On Entry. In its properties make sure Object has current in it, and then under Event, click the button and then click on the processor in the 3D model. Choose On Entry.

    These settings will make the activity create a new token each time an item enters the labeler machine.

  2. A Pull from List activity

    Add the activity and name it Pull a Label from a Roll. Press its icon and then click on the Label Rolls list block.

    In the activity's properties under Query enter SELECT quantity.

    Check Use Max Wait Timer, and in the trigger settings for OnWaitTimerFired, expand the Release token behavior. Under Destination enter "Fail".

    These settings will make the activity pull a single label sticker from the Label Rolls list by decrementing its quantity field by 1. Also, the Use Max Wait Timer settings make it so that, if the token cannot immediately pull from the label rolls list, i.e. there are no label rolls left, it will abort the operation and release the token through its "Fail" connector.

  3. A Custom Code activity to stop the processor

    Add the activity and name it Stop the Processor. In its properties press the button and select Control > Stop Object. Then under Object enter current.

    This will stop the labeler machine.

  4. A second Pull from List activity

    Add the activity and name it Pull a Label from a Roll. Press its icon and then click on the Label Rolls list block.

    In the activity's properties under Query enter SELECT quantity.

    These settings will make the activity pull a single label sticker from the Label Rolls list by decrementing its quantity field by 1. It will wait until there is a roll available to pull from.

  5. A second Custom Code activity to resume the processor

    Add the activity and name it Resume the Processor. In its properties press the button and select Control > Resume Object. Then under Object enter current.

    This will resume the labeler machine.

  6. A Sink activity

    Add the activity. This will finish the token.

Once you've added these activities, connect them together with connectors.

Make sure the Succeed connector is the first ranked connector from the pull from list activity (connect it first). This is important because if the pull succeeds, it will always send the token out its first connector. Make sure the Fail connector is named properly because we reference it by its name.

Run the Simulation

The model is now ready. Reset and run it. To view the Label Rolls list live as the model runs, click on the block and in its properties press View Entries...

You should see the quantity field decrease with each item that enters the processor. Once a roll's quantity reaches 0, it will be removed from the list, and the operator will travel to the roll storage queue and back.

Now try to get the label rolls to be completely depleted, to see the processor stop. You can do this by either moving the roll storage queue really far away (so it takes a long time to retrieve the label roll), or by decreasing the operator's speed. When the label roll is completely depleted, the processor should stop working until a roll is replenished.

Phase 2 - Animation

Next we'll implement real rolls that are replenished to the labeler, and are animated as they are depleted.

In phase 2 we will add a global list called Storage Rolls. This will represent the list of rolls that are available to be picked up from storage. The roll storage queue will receive items (rolls) from a source, and then push them onto the Storage Rolls list. Then the label roll replenishment section of the Process Flow will pull from that list to find an item to pick up. The item will be loaded by the operator and then placed beside the labeler.

Model Layout

The 3D layout for this model doesn't change much. Primarily we add a source to feed the roll storage queue, and then make the queue push to the Roll Storage list. Also, we won't use the labeler's 2nd center port to reference the roll storage queue. Instead we'll load the item pulled from the list.

Process Flow

The label roll replenishment section is where most of the changes will occur to the Process Flow. Here, the 2 initial tokens will create a roll in the 3D model. We'll also need to do a little more tracking of the quantity label, so that sizes can be properly updated. Also, when we replenish the roll, we need to pull a real roll from the queue, have the operator pick it up, and then place it next to the labeler machine.

The label roll depletion section of the Process Flow will be adjusted. When it pulls a label from the label roll, it will update the roll's size based on its remaining quantity of labels. This will allow you to see the roll being visually depleted.

Build the Model - Phase 2

Now let's build the model.

3D Model Adjustments

Update the model 3D layout according to the following image

  1. Add a source object and connect it to the roll storage queue. Open the source's properties, and under FlowItem Class, select Cylinder.
  2. Disconnect the labeler's 2nd center port from the roll storage queue with a 'W' connect.
  3. Open the RollStorage1 queue's properties. In its Triggers tab, under OnEntry press the button and select Lists > Push to List.
  4. In the behavior settings popup, under List, press the button and select Add New List...

    This will add a new global list and open its properties (you could alternatively add the list through the Toolbox).

  5. Name the list Storage Rolls
  6. Go back to the queue's OnEntry behavior settings. Under List, press the button and select Storage Rolls.

  7. Open the FlowItem Bin. Select the Cylinder and decrease its z size so that it looks like what you think a roll of label stickers might look like. Changed its x and y size to 1.

Process Flow Adjustments

We'll need to change settings on some of the existing activities as follows.

  1. In the Initial 2 Rolls activity's properties, under Assign Labels to Created Tokens remove the quantity label assignment (we'll assign the quantity label later on), and instead add a label with the Name of rollNum and for its Value press the button and select Token Index.

    Here we are setting the rollNum label to the index of the token that will be created. The first token will get a value of 1, and the second a value of 2. We will use this in placing the roll in the correct location so the two rolls don't overlap in the 3D view.

  2. In the label roll replenishment section, delete the two operator travel activities. We'll recreate that whole section.
  3. In the Label Rolls list properties, press Advanced to open the list's full properties window. In the Fields tab, beside the quantity field, check Dynamic.

    Making this field dynamic will cause the list, in addition to decrementing the quantity field value on the list, to also decrement the quantity label value on the token itself. This means that we can know the remaining quantity of the roll so that we can properly update its size. See List Functional Reference for more information on how and why this works.

Process Flow Additions

Add and insert activities to the Process Flow according to following image.

Label Roll Replenishment

We'll start with the label roll replenishment section. Required activity additions are as follows.

  1. A Create Object activity

    Add the activity, place it after Initial 2 Rolls and name it Create Roll.

    In its properties, under Object press the button and select Flowitems > Cylinder. Then for Destination press the button and select Model. Finally, under Assign To enter Label: roll.

    These settings will create a cylinder object, place it in the model, and assign a label named roll on the token to be a reference to that object.

  2. An Assign Labels activity

    Add the activity, place it before Push to Label Rolls (add the activity then snap Push to Label Rolls below it) and name it Set Quantity to 20.

    In its properties, add a label with a Name of quantity and a Value of 20.

    This will set the token's quantity label to 20. Since pull operations will decrement this label to 0, we need to reset it back to 20 each time before we push it back onto the list.

  3. A Change Visual activity

    Add the activity, place it between Set Quantity to 20 and Push to Label Rolls (you can add it in between the activities by double-clicking on the line between those activities and selecting the activity to add) and name it Set Roll Location.

    In its properties, for Object enter getlabel(token, "roll").

    For X Location enter xloc(current) + getlabel(token, "rollNum").

    For Y Location enter yloc(current) - ysize(current).

    For Z Location enter 0.

    This will set the location of the roll object (the object referenced by the token's roll label) based on the location of the labeler machine (current). The first roll (rollNum 1) will be placed on the left, and the second (rollNum 2) will be placed on the right.

  4. A Destroy Object activity

    Add the activity, place it where the previous operator travel activities were, and name it Destroy Empty Roll.

    In its properties, under Object(s) enter Label: roll.

    This will destroy the empty roll once it is depleted.

  5. An Assign Labels activity

    Add the activity, place it after the Destroy Empty Roll activity and name it Reset Roll Label.

    In its properties, add a label with a Name of roll and for the Value press the button and select Remove Label.

    This will remove the roll label. We do this because each time we pull a new roll from the roll storage list, if the roll label already exists on the token, it will prepend the newly pulled roll into an array on the roll label. We don't want an array, we just want the latest roll that was pulled, so we first remove the roll label before we perform the pull.

  6. A List block

    Add the block, place it beside Reset Roll Label and name it Storage Rolls.

    In its properties, under List press the button, and then click on the Storage Rolls list in the Toolbox (you can hover the cursor over the Toolbox tab to activate that tab). Select Tools/GlobalLists/Storage Rolls.

    This will make the Process Flow list an alias for the global Storage Rolls list.

  7. A Pull from List activity

    Add the activity, place it after Reset Roll Label and name it Find a Roll in Storage.

    Press its icon and then click on the Storage Rolls block.

    In its properties, under Assign To enter Label: roll.

    These settings will make the activity pull a roll from the global Storage Rolls list and assign it to the token's roll label.

  8. A Load activity

    Add the activity, place it after Find a Roll in Storage and name it Pick Up New Roll.

    In its properties, under Executer / Task Sequence enter centerobject(current, 1). Then for Station enter up(getlabel(token, "roll")). Finally, for Item enter Label: roll.

    These settings will tell the operator (the object connected to the labeler's first center port) to load the roll (the object referenced by the token's roll label) from the roll storage queue (the parent or "up" object of the object referenced by the token's roll label, i.e. whatever queue the roll is currently in).

  9. A Travel activity

    Add the activity, place it after Pick Up New Roll and name it Travel to Labeler.

    In its properties, under Executer / Task Sequence enter centerobject(current, 1). Then for Destination enter current.

    These settings will tell the operator (the object connected to the labeler's first center port) to travel back to the labeler (current).

  10. A Move Object activity

    Add the activity, place it after Travel to Labeler and name it Move Roll into Model.

    In its properties, under Object(s) enter Label: Roll, then under Destination enter model().

    This will move the roll object into the model. Note that we don't want to move the roll into the labeler itself. Since the labeler maching is processor, moving the roll into it would cause the labeler to think it was an item that needed to be processed. Instead, we will put the roll into the model, and then set its location right next to the labeler.

Label Roll Depletion

Next we'll add activities to label roll depletion section. The primary change we make here is, when we pull a label from the label rolls list, we want to update the size of the roll based on how many labels are left.

Required activity additions are as follows.

  1. An Assign Labels activity

    Add the activity, place it before Sink (add the activity then snap Sink below it) and name it Set Roll Reference.

    This activity will add 3 labels to the token, as follows.

    1. A label with the Nameroll and a value of getlabel(getlabel(token, "pulled"), "roll")

      This retrieves a reference to the 3D roll object from the roll token (the token in the label roll replenishment section that was pulled from the Label Rolls list) and assigns it locally to this token's roll label.

    2. A label with the Namequantity and a value of getlabel(getlabel(token, "pulled"), "quantity")

      This retrieves the current quantity label from the roll token (the token in the label roll replenishment section that was pulled from the Label Rolls list) and assigns it locally to this token's quantity label.

    3. A label with the Namesize and a value of getlabel(token, "quantity") / 20

      This sets the new size for the roll, which is the just-assigned quantity label divided by 20 (the max quantity of a label roll). This means a roll with 16 labels left will be assigned a size of 16 / 20 or 0.8.

  2. A Change Visual activity

    Add the activity, place it between Set Roll Reference and Sink (you can add it in between the activities by double-clicking on the line between those activities and selecting the activity to add) and name it Resize Roll.

    In its properties, press the button and select Set Location, Rotation or Size.

    For Set select Size. For Object enter getlabel(token, "roll"). For both X Size and Y Size enter getlabel(token, "size"). For Z Size enter zsize(getlabel(token, "roll")).

    This will set the size of the roll (the object referenced by the token's roll label. The x and y size will be set to the token's size label, set previously. The z size will be set to whatever it was before (it will not be changed).

Once we've added all the new activities, make sure they are connected properly.

Run the Simulation

Now the model is ready. Reset and run. You should see two rolls appear at the labeler machine. As items are processed, one of the rolls should shrink. When it is completely depleted, it will be destroyed and a new roll will be retrieved from the roll storage queue.

Troubleshooting

With the current setup it can be difficult to see tokens moving through the Process Flow. This is because, for the most part, everything happens immediately at certain events in the model (mainly when an item enters the labeler). To better see the tokens moving through the Process Flow, you can place "breathe" points in the Process Flow by inserting zero-second delays. For example, you might put a zero-second delay after the On Entry source. Then stop the model and step forward until an item enters the labeler. Then you can step through the Process Flow and see the token moving through it.

Adding More Labelers

At this point it is pretty easy to add another labeler object. Just add another processor to the model, then attach the Process Flow to that object by clicking in a blank area in the Process Flow and in Quick Properties under Attached Objects (instances) press the button and then click on the newly added processor in the 3D view. Make sure the processor has a center port connection to an operator, and you're done. The processor will become a labeler machine.

When you add an additinal labeler instance to the Process Flow, the Process Flow view will show tokens for all instances (you may for example see 4 tokens in the label roll replenishment section instead of 2, namely 2 for each labeler machine). You can see a token's instance by clicking on the token in the Process Flow view. The instance (the labeler machine associated with that specific token) will be shown in Quick Properties. Also, if you only want to see the tokens associated with a specific instance, you can click in a blank area of the Process Flow view, and in Quick Properties under Attached Objects (instances) select the instance you want from the list, and then press Open Process Flow View. This will open a Process Flow window that only shows the tokens associated with that specific machine.

flexsim users manualuser manuals
· 2
5 |100000

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

Stéphane Jaubert avatar image Stéphane Jaubert commented ·

Hello, This tutorial is very interesting but unfortunately the illustration images are no longer present. Would it be possible to have an updated or complete version? Thank you very much!

0 Likes 0 ·
Ben Wilson avatar image Ben Wilson ♦♦ Stéphane Jaubert commented ·

Hi @Stéphane Jaubert ,

This old article from 2016 is deprecated. Please see the latest Process Flow tutorials in our online user manual, starting here:

Process Flow Tutorial 1

0 Likes 0 ·

Article

Contributors

paul.t contributed to this article

Navigation

FlexSim 2016.1