CLOCK( ) or CLOCK(time unit)
a_Time = Clock( )
Clock( ) – CycleStart
If Clock(Hr) > 24
The default clock function returns the elapsed time of the simulation clock in minutes. It can be accessed, but not assigned a value. For example a variable could be assigned the value of the clock in minutes: v_Var1 = Clock() would result in the number of minutes elapsed in the simulation assigned to the variable. To assign the number of hours that have elapsed, use v_Var1 = Clock(hr), and to get the number of seconds, use v_Var1 = Clock(sec).
A common use of the Clock( ) function is collect and plot individual cycle times for entities. It can be used to help collect individual times in just part of the model or individual entities for the entire cycle time. Why would this be important? Doesn’t ProcessModel automatically collect and report the average cycle time for each entity type? Yes it does, but a major reason for simulation is to dig deeper than averages, because averages are misleading.
ProcessModel automatically notes the simulation clock time when each entity first enters the process and writes that information to a default entity attribute called CycleStart. You can use a formula below calculate and record the processing time for each entity.
Example: v_Time = Clock() – CycleStart
Each entity that crosses the action statement that contains this formula will find out the current simulation time, subtract the starting time of the entity and write the result to variable defined (in this case, v_Time).
Many times, however, it is helpful to know the time it takes for an entity to complete only a portion of the process, for example activities 4 to 6 of a larger process. In this case, you would enter a_attribute1 = clock() in the action logic of the route entering activity 4. [Not specifying a unit of time by not putting anything in the parentheses after “clock” causes ProcessModel to use the default time unit which is minutes.] This would cause ProcessModel to note the time that each entity enters activity 4. You would also enter v_variable1 = clock() – a_attribute1 in the action logic of the route leaving activity 6. This would cause ProcessModel to take a new clock reading, subtract from it the first clock reading, and write to a variable that reflected the difference which you could then track in your output reports.
- If you change the default time units to hours, then the value returned will be divided by 60. If you change the default time units to seconds, then the value returned will be multiplied by 60.