Learning Objectives

  • To be able to recognize and define the characteristics of a discrete-event dynamic system (DEDS)
  • To be able to explain how time evolves in a DEDS
  • To be able to simulate a simple queueing system by hand

Some Definitions

  • System: set of inter-related components that work together for a common purpose
  • State variable: a property of a system that is used to describe its behavior over time
    • In general, a system may have many properties, some are constants, some are parameters, and some are variables.
  • System state: the minimal set of variables that are necessary to completely describe future system behavior based on current values
  • Event: an instantaneous occurrence that changes the state of the system through an action
  • Action: the set of rules, procedures, and effects that are invoked to cause the state to change
  • Activity: a duration of time that is bounded by two events
  • Process: a set of activities related to a achieving a common purpose that occur over time
  • Resource: a component of the system that is required during an activity or process
  • Entity Type or Class: a class of things that flow through the system by potentially using resources while experiencing activities or processes
  • Entity Instance or Object: A particular realization of an entity type
  • Attributes are properties of entities.

Event Concepts

  • An event is something that happens at an instant in time that corresponds to a change in object state.
  • An event is a one-way transmission of information from one object to another that causes an action resulting in a change in state.
  • Actions may cause other events to occur or be schedules at some future time.
  • An event is said to be a scheduled event (or timed, determined, bounded) if its occurrence can be expressed as a function of system time and can thus be scheduled in time.
  • An event is said to be a conditional event if it is dependent upon the outcome of certain conditions that cannot be predicted with certainty in advance (e.g. the availability of a server).
    • Conditional events are sometimes called unbounded or contingent.
  • If a scheduled event ends an activity, then the activity is said to be a scheduled or timed activity; otherwise, it is said to be a conditional activity.

Simple Bank Teller Example

  • Let’s consider a simple bank which has two tellers that serve customers from a single waiting line. In this situation, the system of interest is the bank tellers (whether they are idle or busy) and any customers waiting in the line.
  • Suppose we have the following arrival times.
(#tab:CustArrivals) Customer Time of Arrivals
Customer Time of arrival Time between arrival
1 2 2
2 5 3
3 7 2
4 15 8

Discrete-Event Perspective

  • From the discrete-event perspective, nothing is happening in the bank from time \([0,2)\); however, at time 2, an arrival event occurs and the subsequent actions associated with this event need to be accounted for with respect to the state of the system.

Customer Arrival Process

What are the arrival event actions?

  • The customer enters the waiting line.

  • If there is an available teller, the customer will immediately exit the line and the available teller will begin to provide service.

  • If there are no tellers available, the customer will remain waiting in the line until a teller becomes available.

What are the actions that occur when a customer departs the system?

  • The customer departs the bank.

  • If there are waiting customers, the teller indicates to the next customer that he/she will serve the customer. The customer will exit the waiting line and will begin service with the teller.

  • If there are no waiting customers, then the teller will become idle.

Customer Service Times

(#tab:CustServiceTimes) Service Time for First Four Customers
Customer Service Time Started Service Time Service Time Completed
1 2 8 10
2 5 7 12
3 10 9 19
4 15 2 17

Customer Service Process

Based on the figure, customer 1 can enter service at time two because there were no other customers present in the bank. Suppose that it is now 9:02 am (time 2) and that the service time of customer 1 is known in advance to be 8 minutes. Customer 1 will complete service at time 10 (current time + service time = 2 + 8 = 10). Customer Service Process

Time Ordered Sequence of Events

If the arrival and the service completion events are combined, then the time ordered sequence of events for the system can be determined. Suppose you are standing at time two. Looking forward, the next event to occur will be at time 5 when the second customer arrives.

Events Ordered by Time Process

Simulating a Queue by Hand

Let’s assume that the bank opens at 9 am with no customers present and the teller idle. The time of arrival of the first eight customers is provided in the following table.

Customer Number Time of Arrival Service Time
1 3 4
2 11 4
3 13 4
4 14 3
5 17 2
6 19 4
7 21 3
8 27 2

We are going to process these customers in order to recreate the behavior of this system over from time 0 to 31 minutes.

Define Variables for Representing System State

  • Let \(t\) represent the current simulation clock time.

  • Let \(N(t)\) represent the number of customers in the system (bank) at any time \(t\).

  • Let \(Q(t)\) represent the number of customers waiting in line for the teller at any time \(t\).

  • Let \(B(t)\) represent whether or not the teller is busy (1) or idle (0) at any time \(t\).

Because we know the number of tellers available, we know that the following relationship holds between the variables:

\[N\left( t \right) = Q\left( t \right) + B(t)\]

Note also that, knowledge of the value of \(N(t)\) is sufficient to determine the values of \(Q(t)\) and \(B(t)\) at any time \(t.\) For example, if we know that there are 3 customers in the bank, then \(N\left( t \right) = 3\), and since the teller must be serving 1 of those customers, \(B\left( t \right) = 1\) and there must be 2 customers waiting, \(Q\left( t \right) = 2\).

Entity Attributes

  • Let \(\mathrm{ID}_{i}\) be the identity number of the customer. \(\mathrm{ID}_{i}\) is a unique number assigned to each customer that identifies the customer from other customers in the system.

  • Let \(A_{i}\) be the arrival time of the \(i^{\mathrm{th}}\) customer.

  • Let \(S_{i}\) be the time the \(i^{\mathrm{th}}\) customer started service.

  • Let \(D_{i}\) be the departure time of the \(i^{\mathrm{th}}\) customer.

  • Let \(\mathrm{ST}_{i}\) be the service time of the \(i^{\mathrm{th}}\) customer.

  • Let \(T_{i}\) be the total time spent in the system of the \(i^{\mathrm{th}}\) customer.

  • Let \(W_{i}\) be the time spent waiting in the queue for the \(i^{\mathrm{th}}\) customer.

Quantities such as \(A_{i}, S_{i}, D_{i}, \mathrm{ST}_{i}, T_{i}\) and \(W_{i}\) all represent quantities that can be observed at specific event times. These quantities are often called observation-based or tally based variables.

Bank by hand bookkeeping table

Bank by hand notes

  • Because customer 1 arrived to an empty system, they immediately started service at time 3. Since we know the service time of the customer, \(\text{ST}_{1} = 4\), and the current time, \(t = 3\), we can determine that customer 1, will depart from the system at time 7 (\(t = 3 + 4 = 7\)).

  • According to the provided data, the next customer, customer 2, will arrive at time 11. Thus, we have two pending events, a departure of customer 1 at time 7 and the arrival of customer 2 at time 11.

  • Since the pending event set is E(13) = A(3), E(15) = D(2) the next event will be the arrival of the third customer at time 13 before the departure of the second customer at time 15.

  • This logic continues until time 31

Compute the waiting time and the system time

We can compute the sample averages ( \(\bar{T}\) and \(\bar{W})\) of the observed quantities (\(T_{i}\) and \(W_{i}\)) for each departed customer.

\[\bar{T} = \frac{1}{7}\sum_{i = 1}^{7}T_{i} = \frac{4 + 4 + 6 + 8 + 7 + 9 + 10}{7} = \frac{48}{7} \cong 6.8571\]

\[\bar{W} = \frac{1}{7}\sum_{i = 1}^{7}W_{i} = \frac{0 + 0 + 2 + 5 + 5 + 5 + 7}{7} = \frac{24}{7} \cong 3.4286\]

Computing the average number in queue

\(Q(t)\) takes on constant values during intervals of time corresponding to when the queue has a certain number of customers. \(Q(t) = \{ 0,1,2,3,\ldots\}\). The values of \(Q(t)\) form a step function. Number of Customers Waiting

Computing the average number in queue

Let \(Q\left( t \right) = \ q_{k}\ \)for\(\ t_{k - 1} \leq t \leq t_{k}\). Then, the time-average can be rewritten as follows:

\[\bar{Q} = \frac{\int_{t_{0}}^{t_{n}}{Q\left( t \right)\text{dt}}}{t_{n} - t_{0}} = \sum_{k = 1}^{n}\frac{q_{k}(t_{k} - t_{k - 1})}{t_{n} - t_{0}}\]

Note that \(q_{k}(t_{k} - t_{k - 1})\) is the area under the curve, \(Q\left( t \right)\) over the interval \(t_{k - 1} \leq t \leq t_{k}\).

The quantity \(t_{n} - t_{0}\) represents the total time over which the variable is observed. Thus, the time average is simply the area under the curve divided by the amount of time over which the curve is observed. From this equation, it should be noted that each value of \(q_{k}\) is weighted by the length of time that the variable has the value. If we define, \(w_{k} = (t_{k} - t_{k - 1})\), then we can re-write the time average as:

\[\bar{Q} = \frac{\int_{t_{0}}^{t_{n}}{Q\left( t \right)\text{dt}}}{t_{n} - t_{0}} = \sum_{k = 1}^{n}\frac{q_{k}(t_{k} - t_{k - 1})}{t_{n} - t_{0}} = \frac{\sum_{k = 1}^{n}{q_{k}w_{k}}}{\sum_{i = 1}^{n}w_{k}}\]

Computing \(\bar{Q}\) and \(\bar{N}\)

We have that the numerator computes as follows: \[\sum_{k = 1}^{n}{q_{k}\left( t_{k} - t_{k - 1} \right)} = 0\left( 13 - 0 \right) + \ 1\left( 14 - 13 \right) + \ 2\left( 15 - 14 \right) + \ 1\left( 17 - 15 \right) + \ 2\left( 19 - 17 \right)\] \[\ + 1\left( 19 - 19 \right) + \ 2\left( 21 - 19 \right) + \ 3\left( 22 - 21 \right) + \ 2\left( 24 - 22 \right) + \ \] \[1\left( 27 - 24 \right) + \ 2\left( 28 - 27 \right) + \ 1\left( 31 - 28 \right) = 28\] And, the final time-weighted average number in the queue is: \[\bar{Q} = \frac{28}{31} \cong 0.903\] The average number in the system can also be computed in a similar manner, resulting in: \[\bar{N} = \frac{52}{31} \cong 1.677\]

Server Utilization

The average number of busy tellers can also be computed, resulting in: \[\bar{B} = \frac{24}{31} \cong 0.7742\] Because there is only 1 teller, the fraction of the tellers that are busy is 0.7742. This quantity represents the utilization of the teller. The utilization of a resource represents the proportion of time that the resource is busy. Let c represent the number of units of a resource that are available. Then the utilization of the resource is defined as:

\[\bar{U} = \frac{\bar{B}}{c} = \frac{\int_{t_{0}}^{t_{n}}{B\left( t \right)\text{dt}}}{c(t_{n} - t_{0})}\] Notice that the numerator of this equation is simply the total time that the resource is busy. So, we are computing the total time that the resource is busy divided by the total time that the resource could be busy, \(c(t_{n} - t_{0})\), which is considered the utilization.

⌂ Index