How do I Track Time Spent?

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.

Tracking times in ProcessModel

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 Smart Stats). 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.

Was this article helpful?

Related Articles