## 10.9 – Statistics Gathering Techniques

Common model statistics are gathered by ProcessModel automatically and reported after the model is simulated (see Chapter 6, Analyzing Output Data). This section covers techniques involved in gathering additional statistics of particular interest through the use of variables and attributes. To learn more about variables and attributes, see Attributes and Variables.

## 10.9.1 – Tracking Entity Conditions

Counting the total number of entities meeting a special condition.

### Suggested Technique

1. Determine the condition or attribute to be counted.

2. Create a variable of type Integer to use to keep a tally.

3. In the appropriate Action logic, increment or decrement the variable to reflect the condition being counted.

Example: A restaurant has a buffet. The management wants to know how many men, women, and children go through the buffet. An attribute called a_Gender has been defined and assigned one of three descriptors (man, woman, kid) in the arrival Action logic of the Customer entity according to a discrete distribution. Three variables have been defined to count the number for each gender: Children, Men, and Women.

TO DO: Create the variables and attribute as described above. Enter the Action logic as shown in the above illustration in the properties dialog for the Buffet activity.

To examine the results, look for variable statistics in the General Statistics Report (see General Statistics Report) where you will find the average value of each variable. The total count is reported as the current value of each variable.

## 10.9.2 – Tracking Contents

Tracking the time-weighted average number of entities occupying a stage in the process that consists of more than a single activity.

### Suggested Technique

1. Define a variable of type Integer to track the contents.

2. Increment the variable in Action logic when entering the particular processing stage.

3. Decrement the variable in Action logic after leaving the processing stage.

Example: Once a customer leaves a car at the repair shop, it is serviced, cleaned, and readied for the customer to pickup. We want to know the average number of cars between the start of the Service and the end of the Cleaning activities.

TO DO: Define the variable Serv_Clean_Content as type Integer . Enter the Action logic as depicted in the illustration above.

To examine the results, look for variable statistics in the General Statistics Report (see General Statistics Report) where you will find the average value of the variable. The average value is the average contents of the processing stage being tracked. The change in the contents over time can be viewed by selecting Time Series from the View menu in the Output Module . See Time Series Plots & Histograms.

## 10.9.3 – Tracking Times

Tracking the length of time spent in a particular stage of a process.

### Suggested Technique

1. Define an attribute of type Real called a_ Start_Time (or some other appropriate name) to record when each entity starts a process stage.

2. Define a variable of type Real to store the accumulated time called v_ Accum_Time (or some other appropriate name).

3. Define a variable of type Integer to count the number of entities passing through the stage called v_ Entity_Count (or some other appropriate name).

4. Define a variable of type Real to which the average time may be assigned called v_ Avg_Time (or some other appropriate name).

5. When entering the processing stage, enter the following Action logic: a_Start_Time = Clock()

6. When leaving the processing stage, enter the following Action logic:
v_CycleTime = Clock() – a_Start_Time
INC v_Accum_Time, v_CycleTime
INC v_Entity_Count
v_Avg_Time = v_Accum_Time / v_Entity_Count

Example: Once a customer leaves a car at the repair shop, it is serviced, cleaned, and readied for customer pickup. We want to know the average time spent from the time it is sent to service to the time it is returned from cleaning.

TO DO: Create the attribute and variables. Enter the Action logic as shown in the above illustration.

The ending or current value of the Avg_Time variable is reported under variable statistics in the General Statistics Report (see General Statistics Report). You may also want to examine the Time Series graphs on the Avg_Time variable to see how the average time varied during the duration of the simulation run.

## 10.9.4 – Tracking Times Against a Standard

Counting the number of times that an activity or other time consuming events fell within a particular range.

### Suggested Technique

1. Create two variables and an attribute (all of type Real) used in tracking the statistic.

2. In the appropriate Action logic, increment or decrement the variable accordingly.

Example: A call service center with 50 operators wants to measure its level of service by tracking the number of calls that are answered within 30 seconds compared with the number of calls that are not. Calls are answered by an automated system and put on hold until they can be answered by an operator. A variable is created to track each number: v_ Above and v_ Below . An attribute called a_ Start_Time is used to track the waiting time.

TO DO: Create the variables v_ Above and v_ Below and the attribute a_ Start_Time . Enter the Action logic in the storage and activity as shown above. Enter an Input Queue Size of 0 (zero) and a capacity of 50 for the activity. Enter a Move time of 0 (zero) for the routing connection between the storage and activity.

## 10.9.5 – Tracking Resource Uses

Tracking the number of times a particular resource is used for a particular activity or set of activities.

### Suggested Technique

1. Create a variable used to track the statistic.

2. In the appropriate Action logic, test for the resource being used.

3. Based on the outcome of the test, increment the tracking variable accordingly.

Example: A team leader takes support calls when no other technicians are available. We want to know how many calls the team leader is taking. A variable called Lead_Calls is defined to track the number of calls the team leader takes.

TO DO: Define the variable Lead_Calls . In the resource connection for the Lead, select the Use as alternate option. Enter the Action logic as shown in the above illustration in the Answer activity.

## 10.9.6 – Creating a 24-Hour Clock

Create an on-screen clock that will display the time of day and day of week.

### Suggested Technique

1. Create a variable for the hour of the day (v_Hour) and for the day of the week (v_Day).

2. Place both newly created variables in screen (See Display a variable in a user defined position)

3. Place an entity with a single arrival (Repeat every set to 0, Quantity per arrival set to 1, First time set to 0).

4. Have the entity arrive at an activity with the following action logic.

Example: For presentation purposes, a display of a 24-hour clock and day of week is critical to help team leaders see the timing of certain events.

Action Logic (action logic will go into the activity):

v_Day = 1
While 1 = 1 Do
{

Time(1 Hr)
Inc v_Hour
If v_Hour = 24 Then
{

v_Hour = 0
Inc v_Day
If v_Day = 8 Then
{

v_Day = 1

}

}

}

TO DO: Define the variables V_Hour and V_Day. Create a new entity arriving at a new activity. Set the arrival type to periodic and the arrival frequency to zero. In the action logic at the activity place the action logic provided above.

## 10.9.7 – On-Screen Variables

Show dynamic variables while the simulation runs.

### Suggested Technique

1. Create a variable used to track the statistic.