1 THE KINLEITH WEIGHBRIDGE Don McNickie Department of Management, University of Canterbury, Christchurch, New Zealand. Key W ords: Queues, transient behaviour, Erlang services. Abstract Queues that start from empty each day are quite common, yet it is not easy to estimate the average waiting time over all customers for the class of M /G /l queues. An easily programmed algorithm calculates it exactly for M / i y i queues. The convergence of the average waiting time to the steady-state value turns out to be surprisingly independent of the number of stages. This was applied to a forestry weighbridge problem where the service time distribution depended on whether a truck arrived to an empty, or to a busy weighbridge. 1. INTRODUCTION A common queueing problem is to estimate the average or total delay time for a system which starts from empty each day. For the very useful class of M /G /l models it is difficult to find; % formula for the mean waiting time of the n-th customer because the imbedded Markov chain that forms the basis of the analysis of these systems is imbedded at the wrong points for waiting times, i.e. the times at which customers depart, rather than at the times at which they arrive. This difficulty is overcome for the steady-state average waiting time by using the property that Poisson arrivals see time averages (PASTA) (see, for example Kleinrock (1975) page 190). PASTA is a steady-state property, however, so this method cannot be used to find the mean waiting time of the n-th customer. The simplicity of the Pollaczek-Khinchine formula for the mean steady-state waiting time makes it attractive to try to find an approximate scaling factor for the formula that accounts for the transient behaviour of the system. That is, is there some method, that stops short of fitting a complete service-time distribution, and certainly does not involve evaluating the Laplace transform of such a distribution, that will give the average waiting time over the first n customers as a fraction of the steady-state waiting time?
2. AN APPLICATION TO A WEIGHBRIDGE QUEUE. 2 Every year some 2.5 million mj o f mostly pinus radiata, are transported to the Elders NZFP Ltd. complex at Kinleith. More than 400 truck-loads per day pass over a single lane weighbridge. Trucks must come to a complete halt on the weighbridge. A truck which arrives to an empty weighbridge drives straight onto it, whereas there is an appreciable move-up time for the next truck to move onto the bridge when it is busy. This effect combines with the high traffic intensity to produce waiting times which in 1989 sometimes reached 20 minutes per truck. The parameters o f the arrival, move-up, and weighing times were estimated to be: Table 1. W eighbridge Parameters Mean (minutes) Variance Inter-arrival Time 1.6782 3.0481 Move-up Time 0.3323 0.0748 Weighing Time 1.2070 0.5342 The arrival process proved to be almost indistinguishable from a Poisson process (see Figure 1 in M cnickle and W oollons (1990)). The extension of the Pollaczek-Khinchine formula to an M /G /l-lik e queue where the total service-time distribution o f a customer who arrives to an empty queue is different to that o f a customer who arrives when the server is busy, is given by Welch (1964). The mean time that a customer spends waiting in the queue in steady-state is: ^ _ A. ( q W ) _ A. ( o 2b+ml~ ( o 2a+/n,) ) q 2 ( 1 - \ m b) 2 (1-A. (mb-m g) ) Here mb and <rb2 are the mean and variance o f the total service time for a customer who airives when the server is busy, so for the weighbridge problem they are the sums of the ifiove-up and weighing parameters in Table 1. ac2 and me are the parameters of the weighing time distribution alone. W elch s equation predicts that the mean waiting time of a truck in the queue should be 10.35 minutes. Yet the observed average waiting times were about 8 minutes, and an extensive simulation over 10,000 days o f operation gave a mean daily waiting time o f 8.08 minutes, with a standard deviation o f this mean o f 0.05 minutes. It appears that the difference between the W elch s formula value and the simulation result is that the simulation model (and the actual system) starts from an empty queue, or at most one truck, each morning. The simulation program was simple, but a single run took over eight hours. The most valuable part o f the original study to management was a sensitivity analysis for the number of loads that could be carried per day. Doing this by simulation would have required eight hours for every point, so it was still more attractive to find even an approximate method for extending Welch s formula.
3. THE WAITING TIME OF THE N-TH CUSTOMER IN AN M JE Jl QUEUE. 3 The Markovian structure o f an M/M/1 queue, when observed at the time o f arrival of customers, has been used by Kelton and Law (1985) to determine the speed with which simulation results can be expected to converge to steady state. We can extend the algorithm they give to allow for Erlang service distributions with a number (k) o f identical service phases. Let X be the rate o f the Poisson arrival process, and 1/ji the mean length o f any eng o f the phases in the service process. We assume that at time zero there is a requirement for i (i > 0) phases o f service initially present. Usually i will be some multiple o f k, but this is not essential. Let X be the total number o f phases o f service just after the arrival o f the n-th customer. We define a = \ / ( \ + n), and /3 = /x/(x + n), and P(i,j;n) = P(XB = j J Xq = i), for k < j < i+ n k. {X J is a homogeneous Markov chain, and given that it starts from state i, the only non-zero n-step transition probabilities can be defined iteratively as: i * ( n - 1 ) Jc P (i,j;n) - ^2 a$r~j*kp (i, r ; n-1) for j - k + 1 i + n k r -j-k P(i,k;n) - i* (n-1) Jc p rp(i,r;n-l) where we define P(i,i;0) = 1, P(i,j;0) = 0 for i^ j. Note that it is easier to write these equations if we allow the state space of X to include states 1,2...k-1, which will have zero probability except possibly when n = 0. It may be useful, as an aid to interpreting (2), to regard /3 as the probability that the server "wins", in the sense o f completing a phase of service before the next arrival, whereas a is the probability that the server "loses. We move from state r at the (n-l)th arrival, to state j just after the n-th, if the server wins r-j+ k such competitions and then loses the last one. The memoryless property o f the distribution of the interarrival time, and of each phase of service, makes each competition independent of the length of the previous one. The equations can be re-written into a more efficient algorithm, similar to that in Kelton and Law. This requires the storage of only two vectors, an old vector Q and a new vector P, where: r Q = (P (i,l;n-1), P(i,2;n-1)...P(i,i + (n-l)k ;n -l)} P = {P (i,l;n), P (i,2;n),...p(i,i + nk;n)} The only problem is that since P(i,j + l;n) is used to calculate P(i,j;n), the calculation has to be done in reverse order, i.e. from j = i + nk down to j = k.
Algorithm. We initialize by putting Q (l) = Q(2) =... Q (k-l) = 0, Q(i) = l, P (l) = P(2) =... P(k-l) = 0. Then at the n-th step: P(i + nk) = a (or P (i+nk) = aq (i + (n-l)k) if this is quicker) For j = i + nk-1, step -1 until k+1: P(j) = «Q0-k) + /3P(j + 1 ) end P(k) = (/3/a)P (k + 1). The waiting time of the n-th arriving customer can now be calculated from: 4 i*nk. Finally put Q = P. This algorithm is easy to program, fast, and very stable. It is not usually necessary to normalize the probability vector P to one, for example, provided the calculations can be done with reasonable precision. Explicit formulas for Wn for M/M/1 and M/D/1 queues are given by Heathcote and Winer (1969), and by Mori (1976). In contrast they prove to be almost impossible to program for values o f n > 25, due to overflow problems, and as Kelton and Law point out, involve a great deal more computation than the algorithm. The algorithm can also provide additional information such as the distribution o f the queue length seen by the n-th arrival, and the probability that the n-th arrival does not have to wait over that given by formulas for W. 4. Some Numerical Results. We are interested in the average waiting time o f the first N customers, so we define W(N) = (W, + W2 +... + W n)/n. To standardize the results we plot the ratio o f W(N) to the appropriate value o f WB So the points on the graphs are the scaling factors which should be applied to the Pollaczek-Khinchine formula to estimate the average waiting time o f the first N customers. Values are plotted for M /M /1, M /E j/l, M/E4/ l, M /E /l, and M /D/1. The M /D/1 values were calculated from Heathcote and Winer s (1969) formula. We assume there is one customer present initially, just about to enter service. To pick an example off the graphs: suppose we have an M /E ^l queue with a traffic intensity of 0.9 which starts with one customer just about to enter service. Then the average waiting time of the next 30 customers will be about 35% of the steady-state value. From Figures 1 and 2 it is clear that for this class o f M /G /l models, the speed of convergence o f W(N) to depends strongly on the traffic intensity, and to a much lesser extent on the variance of the service time distribution.
Scaling Factors 5 Figure 1. Scaling Factors for the P-K Formula, rho = 0.5 Figure 2. Scaling Factors for the P-K Formula, rho = 0.9 Number of Customers
5. EXTENSION TO THE W EIGHBRIDGE PROBLEM. From the means and coefficients o f variation for the weighbridge data an M/E^/l queue where a customer requires four phases of service if the server is busy, and only three if the customer arrives to an empty queue, looks to be quite a close approximation. The algorithm can be extended to cover the case where a customer who arrives to an empty queue requires a different number of phases of service. The closest fit for the weighbridge parameters is to take k = 4. Then W,* = 10.20, and W (411) is 8.06 minutes. So the scaling factor suggested for the value of Welch s formula (1) is 8.06/10.20 =.790. When this is applied to the value from (1) calculated with the correct parameters we get an estimate of 8.17 minutes. This falls just inside a 95% confidence interval from the simulation o f 8.08 ± 0.1 minutes. As we might expect from Figures 1 and 2, since we have underestimated both the traffic intensity and the service-time variance the scaling factor appears to be slightly too large, when compared to the simulation results. CO NCLUSIO NS. These algorithms provide an easy, if approximate method for scaling the steady-state characteristics o f an M /G /l queues to reflect the transient behaviour. Practitioners may find them less intimidating than the idea of fitting service-time distributions, and certainly less intimidating than inverting Laplace transforms. Considering the sensitivity o f the weighbridge queue they gave very accurate estimates o f the average waiting time over the course o f a day. 6 References. Heathcote, C.R., and P. Winer, (1969), An approximation for the moments o f waiting times, Oper. Res.. 17, 175-186. Kelton, W.D., and A.M. Law, (1985), The transient behavior o f the M/M/S queue, with implications for steady-state simulation, Oper. Res.. 33, 378-396. Kleinrock, L. (1975) Queueing Systems. Volume 1: Theory. John Wiley, New York. M cnickle, D.C., and R. W oollons, (1990) Analysis and simulation of a forestry weighbridge installation, to appear in N.Z. J. Forestry Science. Mori, M., (1976), Transient behaviour of the mean waiting time and its exact forms in M/M/1 and M /D /1, J. Oper. Research Soc. of Japan. 19, 14-31. Welch. P.D., (1964), On a generalized M /G /l queuing process in which the first customer of each busy period receives exceptional service, Oper. Res.. 12, 736-752.