# How do I use TIME Statement?

The time statement allows you to require the entity to spend time at an activity and has the same effect as entering a time value under the General tab of the properties dialog. This permits you to define a processing time based on logical criteria such as the value of an entity attribute.

Syntax

TIME( time expression <wk/day/hr/min/sec >)

time expression The amount of time to detain the entity at the activity. It can also be expressed as a distribution to add variability to the processing time.

<hr/min/sec> The time unit for the expression.

• DO NOT use this statement in an arrival connection’s Action logic. Doing so will result in an error when you run the simulation.

Example 1

In the first example, a 5-second activity time is specified. In the second, the activity time is a normal distribution with a mean of 10 minutes and a standard deviation of 2.5 minutes. The third example illustrates a discrete distribution function where the activity has a 20% chance of taking 5 minutes, a 30% chance of taking 8 minutes, and a 50% chance of taking 10 minutes. The fourth example uses a mathematical expression to indicate an activity time in hours equal to 2.5 times the value of the a_ Size attribute.

1) TIME(5 sec)
2) TIME(N(10, 2.5) min)
3) TIME(D3(20, 5, 30, 8, 50, 10) min)
4) TIME(a_Size * 2.5 hr)

• The time expression and time unit must be used together and separated by a space. A Day time unit equals 24 hours and Week time unit equals 168 hours.

Example 2

Using a Time statement with 0 time can be a very helpful piece of action logic. The purpose of this statement is to place the current entity at the bottom of the simulation’s processing stack. One application of this kind of statement is as follows. Suppose you want to have 20 items enter a storage, one at a time or in groups, and have all 20 items leave the storage at the same time. You can accomplish this with batching. However, you can simplify your model by using the following action logic in a storage.

Inc v_Counter
Wait Until v_Counter = 20
Time(0 Min)
Dec v_Counter

This action logic will count entities entering the storage, and hold them until there are 20. Once the Wait condition is true, all 20 entities move to the Time statement which will place each entity at the bottom of the simulation’s pending actions queue. The result is that the v_Counter variable is not decremented until all 20 entities have passed the Time statement. Since the processing sequence of all 20 entities are now consecutive, they all move one after the other to the Dec statement, reducing the counter to 0 before any new entities enter the storage. The process then repeats for the next 20 entities entering the storage.