Lesson 5: Attributes, Variables and Action Logic



Attributes are placeholders associated with an individual entity. Its value cannot be seen or changed by any other entity. An attribute describes an entity such as name, size, color, type, condition, etc. They can be either numeric values or character descriptors (single-word descriptions). Attributes follow an entity as it moves through a model and can’t be changed globally by events that occur elsewhere in the model. All entities have 5 system-defined attributes, including Name, Cost, ID, VATime, and CycleStart. You may also create user-defined attributes. Attributes are often used to record time, control action logic, or make routing decisions in the model. User-defined attributes are not displayed in the output reports. You should begin all attribute names with “a_”. For example, a_Type, a_Color, a_Weight. That way, attribute names are easily recognized when reading your action logic. See What is an Attribute?


Variables are placeholders for either numeric values or character descriptors (single word descriptions). They may be used to describe or track activities and states in the system, such as the number of entities that have completed a particular activity, day of the week, an hour of the day, etc. Variables are global in nature. That means any entity can view them or assign a value in the Action tab of the Properties dialog at any location. Variables are shown in the output reports and may be used to export modeling results to Excel. You should begin all user-defined variable names with “v_”. For example, v_Count, v_Completed, v_BatchSize. That way, variable names are easily recognized when reading action logic. See What is a Variable?

Action logic

ProcessModel allows you to design custom behavior in your model by writing simple but powerful logic statements. Action logic allows you to go beyond the normal property fields to determine how an entity is processed. Examples include assigning values to attributes or variables or performing a test using an If…Then statement. See What is Action Logic?

Creating Attributes and Variables

You create an attribute by clicking the Insert menu and selecting Attributes & Variables. Then click New and enter the attribute name.

Attributes Variables

To create a variable click the Insert menu and selecting Attributes & Variables. Click the Global Variables tab, click New, and enter the variable name.

Customizing with Action Logic

Let’s begin customizing our model behavior by adding a variable that will track the number of entities in our model at any given time.

Open the Lesson 1 – Call Center model. Save the model as Lesson 5 In Process Count. Create a variable by clicking the Insert menu and selecting Attributes & Variables. Click the Global Variables tab. Click New and enter the name v_Count in the Name field.

Next, we need to write some action logic to use the v_Count variable.

Double click the arrival route (between the Call entity and the Take Call activity). Click the Action tab. In the window on the left, type Inc. That is a system statement that mean increment. Then click the Filter drop-down list on the right and select the Variable option. This will display the name of all variables you have created using the Insert / Attributes & Variables option. With v_Count highlighted, click the Paste button.

Even though you can just type v_Count rather than selecting it from the filter list, selecting from the list eliminates typing errors, and can save time when you have defined many variables and attributes but have trouble remembering exactly how you spelled each one.

Inc v_Count is equivalent to writing v_Count = v_Count + 1, just shorter.

Now that we are increasing v_Count each time an entity enters the model, we need to decrease or decrement v_Count when each entity leaves.

Double click the 75% route leaving Take Call, then click the Action tab. Repeat the steps to create the action logic on the arrival route, except use Dec (for decrement) instead of Inc.

Since entities also leave the model after the Return Call activity is complete, we need to add an exit route and add the needed action logic.

To save a little typing time, click and drag your mouse over the Dec v_Count action logic. Then hold down the Ctrl key on your keyboard and press C to copy the text. Now add an exit route to the Return Call activity by hovering your mouse over the Return Call activity. Then drag your mouse to the right. Click the Action tab. Click your mouse in the Action window. Hold down the Ctrl key on your keyboard and press V to paste the action logic from the Windows clipboard.

 To get a longer look at the process increase the simulation run length to 100 hours.

Click the Simulation menu and select Options. Change the Run Length to 100 hours.

Simulation Options

Click Close. Now save your model as Lesson 5 – In-Process Count. Simulate the model and view the results. To create a Time Series plot of the counter variable, click on the New Report icon in the ribbon menu.

Click on the layout to position the upper left corner of the graph or drag out a box to size the graph. Select which variables to show (in this case, only one is available).

Modify the chart using the ribbon menu.

When exiting Smart Stats, a dialog will prompt you to save the changes to the output. If Yes is selected, the view on saving will be the same as when reentering Smart Stats.


We created a variable to track the number of entities in the system at any time. We then added action logic to increment that variable each time an entity entered the model and used similar action logic to decrement the variable at each location where entities left the model. We can now see the trend of in-process entities using the Time Series Plot option in Smart Stats.

Take time to review the standard reports provided in the Smarts Stats program. See the Enity and Resource reports below.

The touch Time cost is added directly by usage, time spent in the entity, or direct cost. Total Cost includes the indirect cost such as unused resource time. For example, if a resource is assigned to a process, and 99% of the resource time is unused, then the unused resource time spreads over the entities exiting the system. Notice the difference in the touch time and total cost above.

Add an additional Level 2 resource and run the model again.

Review the output and answer the questions below.


  1. From an in-process inventory perspective, is it better to have two Level 2 resources?
  2. What are the factors involved in deciding if it was cost-effective to add a 2nd resource?
  3. Do you feel it is cost-effective to add a 2nd resource?
  4. Are there better alternatives?

It is possible to compare key statistics within and between models using Smart Stats. For example, comparing one or two Level 2 resources is a comparison made easily within a model. Changing resource assignments requires a model comparison between models. It is beyond the scope of this self teaching guide to teach how to set up comparative statistics within the Smart Stats program, but it is useful to see that its possible. Take a look at the report below showing the key stats in the Smart Stats program.

More Examples

There are many functions and statements that can be used in ProcessModel to achieve a high degree of customization. Let’s just look at a couple of other examples.

Learn about all the functions and statements.

Route Distribution

Download Lesson 5 – Route Distribution model here.

Open the model Lesson 5 – Route Distribution.

Route Distribution


The Process2 activity utilizes 2 entity attributes in action logic to distinguish between the two entity types and route them accordingly. NAME is a system-defined attribute given to all entities. In this model, a_Route is a user-defined attribute used in conjunction with the Conditional routes exiting Process2. All Item2 entities are to be routed to Process3 and are assigned an a_Route value of 1. The condition of the route leading to Process3 requires that a_Route must equal 1; therefore all Item2 entities will select that route. If the entity name is not Item2, a user-defined distribution is used to assign the a_Route value. 40% of all Item2’s are to be routed to Process4, and 60% to Process5.

Remember that a Percentage route must use a numeric constant in the Percent field. Distributions, attributes, and variables may not be used. However, if your routes are selected based on a percentage that may vary, Conditional routes can be used instead. The model above is only one example of using randomness in a percentage route selection.

Rework Loop

Rework is a common part of just about every industry. This next example demonstrates the concept that each time an entity goes through rework, the odds of it needing additional rework diminishes.

Download Lesson 5 – Rework Loop model here.

Install the model Lesson 5 – Rework Loop.

Rework Loop


When a Card arrives, the a_LoopCount attribute is initialized to a value of 0. At Inspect, that attribute is incremented to track how many times the entity has been inspected. The 1st time, there is a 50% chance it will require rework, and the a_OK attribute will be set to 0. If the Card is ready to ship, a_OK is set to 1. The 2nd time through the loop, 80% of the time, it is ready for shipping. The 3rd time, 90% of the time, it is ok. Cards are always ok the 4th time through.

If you need to execute multiple lines of action logic based on the result of an IF…THEN statement, you must enclose those statements within a {…} block. For example

If a_PatientType = Critical Then
   Get Nurse And Doctor
   Time(20 Min)
Free All


5. In the Route Distribution model, if you changed the condition on the route leading to Process3 to “Name = Item2”, how would you change the action logic in Process2 to make the model give the same results as it does now?
6. Since user-defined attributes are not shown in the output report, how can you report on the number of times cards were reworked?

Self Teaching Guide

Getting Started


  1. Your First Model
  2. Replications and Distributions
  3. Entity Arrivals
  4. Routings
  5. Attributes, Variables and Action Logic
  6. Shifts
  7. A More Complex Call Center
  8. Model Building Techniques

Case Studies

  1. Analysis
  2. Replications
  3. Froedtert Hospital Improves ICU Care
  4. Nuclear Site Cleanup
  5. Restaurant Customer Seating Optimization

Appendix: Answers to Lesson Questions

Was this article helpful?
Go to Top