article

Paul Toone avatar image
0 Likes"
Paul Toone posted

Using Labels in Process Flow   

This topic will discuss some of the key concepts related to understanding and using labels in the Process Flow module. It will contain the following topics:

What Are Labels?

In FlexSim, labels store specific pieces of information on objects such as tokens and flowitems. Labels are key to the overall functionality of FlexSim because they can track important information or dynamically change what happens during a simulation based on different conditions in the simulation model.

You use labels to track information and create dynamic logic in your process flows. The Process Flow module activities and shared assets can use custom labels for a variety of purposes. The following list has a few examples:

  • Decide activities can use a label to determine which downstream activity should receive an incoming token. For example, imagine you wanted the tokens in a process flow to represent three different products that might go through three different manufacturing processes. To simulate this kind of system, you could create a custom label on all tokens called ProductType that either has a value of 1, 2, or 3. When the Decide activity receives these tokens, it will evaluate the ProductType label and send the token to one of three possible downstream activities based on the value in that label.
  • A Zone shared asset can use a label to restrict access and collect statistics. For example, imagine you want to simulate a dump truck that can only hold a maximum weight of 5 tons and each token in a process flow will represent a varying amount of dirt that will be loaded into the dump truck. To simulate this kind of system, you could create a Zone to represent the dump truck and assign a custom label called Weight to each token. When each token tries to enter the dump truck (the Zone), it will evaluate the value of that token's Weight label and determine whether it would cause the dump truck to exceed its weight limit. If it would exceed the weight, the Zone would not allow that token to enter.
  • A Batch activity can use a label to determine which batch should receive an incoming token. For example, imagine you wanted the tokens in a process flow to represent three different products that will get loaded onto different pallets based on their product type. To simulate this kind of system, you could create a custom label on all tokens called ProductType that either has a value of A, B, or C. When the Batch activity receives these tokens, it will evaluate the ProductType label and organize the incoming tokens into three different batches based on the value in that label. Each batch will represent a different pallet, so all tokens with a ProductType of A will go on one pallet, all tokens with a ProductType of B will go another pallet, and so forth. When each pallet is full, it will get released to the next downstream activity.
  • Delay activities can use a label to determine how long a specific token should be delayed. For example, imagine you want to simulate a checkout line at a grocery store and each token will represent a customer coming through the line. Each customer could have any number of items. The clerk takes about 5 seconds to scan each item and put it in a grocery bag. Therefore, the total amount of time the customer spends at the checkout line will depend on how many items she or he has multiplied by 5 seconds. To simulate this kind of system, you could create a Delay activity and assign a custom label called NumberOfItems to each token. When the Delay activity receives the token, it would evaluate the token's NumberOfItems label and then multiply that value by 5 to determine the delay time for that token.

If you'd like more examples, many of the tutorials demonstrate how to use labels in a sophisticated way in process flow.

As these examples illustrate, you can use labels to create a dynamic simulation model that is capable of adapting to many different circumstances or business systems. The rest of this topic will discuss some of the key concepts related to understanding and using labels in the Process Flow module.

For Further Reading
See the Labels topic in the standard User Manual for more general information on labels.

Label Names and Label Values

Every label has two elements:

  • Name - Every label has a name that describes the type of information it contains. You'll use this label name to refer to the label and get information from it. The name of the label is assigned when the label is first created on the token and it won't change throughout the simulation run until the token is destroyed. If you create a custom label, you will define this name yourself. For example, you might create a label named Weight to keep track of a token's weight.
  • Value - Every label has a value that can vary from token to token. Values can be any type of data, such as text, numbers, references to other objects, and even arrays. Label values may change during a simulation run. For example, you could randomly assign a number between 10 and 30 to a label named Weight on a token when it is first created. Then, after the token finishes a business process (represented by a Delay activity), it could be assigned a new label that subtracts 5 from the original value to represent its new weight.

Using the Assign Labels Activity

The majority of the time, you'll likely use the Assign Labels activity to create, set, and change labels. The Assign Labels activity doesn't delay a token in any way during a simulation run; it only creates or changes a label on a token. This means you can use an Assign Label activity anywhere in a process flow without slowing down the amount of time the token spends in the process flow. For example, Delay activities do not have the ability to assign or change labels, but you can use an Assign Label activity immediately after a Delay activity to change a label. Perhaps the new label can be changed to represent something about the token that changed as a result of going through the Delay activity.

See the Assign Labels activity for more information about this activity's properties.

Creating a New Label

To use an Assign Labels activity to create a new label on tokens in a process flow:

  1. Add an Assign Labels activity to the process flow. See Adding and Connecting Activities for more information.
  2. In Quick Properties, make sure the Assign To box displays Token: Entering. This property means that this activity will assign labels to all incoming tokens.
  3. Under the Labels group, click the Add button to add a new label.
  4. In the Name box, delete the existing text and type a new name that describes the information this label will contain. For example, if the label will represent the token's weight, name the label Weight.
  5. In the Value box, you will assign the value of the label. There are many different options for setting the value:
    • To set a fixed, static label that will be the same for all tokens, simply type a number or text in this box. For example, if you type 10 in this box, all tokens will be assigned a value of 10 for this label.
    • To make the label refer to a specific object in the 3D model or an activity in the process flow, you can use the Sampler button to select that object.
    • To use a statistical distribution to assign a range of randomly generated values to a label, click the arrow next to the box to open a menu. Select Statistical Distribution to open the Distribution Chooser. Select an appropriate statistical distribution and edit the parameters. For example, if you wanted to create three different product types, you could use a duniform distribution strategy with a minimum of 1 and a maximum of 3. See Distribution Chooser for more information about how to use this tool and some of the available statistical distributions.
    • To assign a certain percentage of tokens certain labels, click the arrow next to the box to open a menu. Select By Percentage to open its picklist options. Use the Add button to add as many different percentage groups as you need. Then edit the percentages and the values that will be assigned to those percentages.
    • Feel free to experiment with some of the options that are available in the pull-down menu for this property.
  6. Use the Add button to add any additional labels if needed. Use the Remove button to delete a label if needed.

Changing an Existing Label

To change an existing label on a token later in a process flow:

  1. Add an Assign Labels activity to the process flow.
  2. In Quick Properties, make sure the Assign To box displays Token: Entering. This property means that this activity will assign labels to all incoming tokens.
  3. Under the Labels group, click the Add button to add a new label.
  4. In the Name box, delete the existing text and type the exact name of the label that you want to change. For example, if you want to change a label named Weight, type that exact name in this box.
  5. In the Value box, you will assign the value of the label. A few of the options that might be useful for changing an label are:
    • Remove Label
    • Increment Label
    • Conditional Value

Other Activities That Can Assign or Match Labels

Many other process flow activities and objects can assign or match labels:

  • Sub Flows - Managing parent and child labels between sub flows and the main process flow that initiated the sub flow can be crucial to a process flow's logic. See Sub Process Flows - Linking Parent and Child Labels for more information.
  • Event-Listening Activities - Event-listening activities such as the Wait for Event or the Event-Triggered Source can match or assign labels on tokens based on relevant objects or values associated with the events they listen to. See Event Types and Related Properties for more information.
  • The Batch Activity - The Batch activity has the capability of putting tokens into batches based on the token's label. See Organizing Batches for more information. It can also assign new labels to tokens that are released as part of a batch. See Releasing Batches for more information.

The Universal Edit Feature

Many of the activities in process flow have special properties that use the Universal Edit feature. The Universal Edit feature is designed to make it easy to add complex functionality to certain properties without needing to know FlexScript.

You can tell when a property has the Universal Edit feature because it will have a blue border around the property box, as shown in the following image:

Properties with the Universal Edit feature can accept the Label: keyword. Typing this keyword will search for the available labels that you've created in the process flow so far and list these labels in a menu. You can then select the appropriate label from the list or continue typing the label name manually. This keyword is equivalent to the FlexScript command getlabel(token, "myLabel"). During the simulation run, the property will look for that label on the entering token. The property will then use the value listed for that label. See Editing Properties - About the Universal Edit Feature for more information.

The GetLabel Command

Most of the time, you can do anything you want using labels and the standard logic on the process flow activities. But occasionally you might need to use the getlabel command. The getlabel command is a FlexScript command that can be used in many different properties or picklists to get the value of a label. It's useful to know this command if you want to get a label value in a property that doesn't have the Universal Edit Feature or if you want to use the value of a label in an expression.

For example, consider the example of the grocery checkout line used in the first section of this topic. As a reminder, a Delay activity will represent the checkout line and each token will represent a customer coming through the line. The clerk takes about 5 seconds to scan each item and put it in a grocery bag. Therefore, the total amount of time the customer spends at the checkout line will depend on how many items she or he has multiplied by 5 seconds. You would need to use the getlabel command in order to create the expression that will perform this calculation. In this example, an Assign Labels activity could have been used to create a custom label called NumberOfItems with a randomly-generated value between 1 and 50. Then, in the Delay activity's Delay Time property, you could use the following command:

getlabel(token, "NumberOfItems") * 5

As you can see, this command has a few different components:

  • getlabel() - This part of the command tells the FlexSim system to use information from a label in this property. The parentheses after the command are used for entering the parameters of the command.
  • token - This parameter of the command indicates which object the label can be found. In this case, it's the entering token.
  • "NumberOfItems" - This parameter of the command uses the actual name of the label. Notice that the label name must be in quotation marks (" ") in order to be valid. That's because the label name is a string (text).
  • * 5 - This part of the command is the mathematical operation that will be performed on the label value. Operations like + 1 or / 2 would have also been valid. Technically, this part of the command isn't even necessary if you just want to get the label value for this property.

Use the getlabel command anywhere that seems appropriate in your process flow.

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.

Article

Contributors

paul.t contributed to this article

Navigation

FlexSim 2016.1