GMACRO #Instructions for using this macro # save this file somewhere on your harddisk # # first set your interarrival rate # eg let k5=60/25 # # Then load it by typing %pathtofile\queue.mac # note that the "%" symbol is required # queue name c1 "servicetime" Random 1000 c1; Normal 1.8 0.25. name c2 "arrivaltimes" Random 1000 c2; Exponential k5. name c3 "cumulativearrival" Let c3 = PARS('arrivaltimes') name c4 "Service Start Time" let c4(1) = c3(1) DO k1 = 2:1000 let k3= c4(k1-1) + c1(k1-1) # the time at which previous person leaves if (c3(k1) gt k3) Let C4(k1) = c3(k1) # arrive after previous person leaves else Let c4(k1) = k3 # can't begin service until previous person finishes endif enddo name c5 "Leave Time" let c5= c4 + c1 name c6 "change time" name c7 "queue length" let c6(1) = 0 let c7(1) = 0 let k2 = 1 # indexes where we are in the arrival times let k3 = 1 # indexes where we are in the deparure (leave times) do k1 = 2:2001 if (c3(k2) LT c5(k3)) LET C6(k1) = c3(k2) Let C7(k1) = C7(K1 -1) +1 Let k2 = k2 + 1 else LET C6(k1) = c5(k3) Let C7(k1) = C7(K1 -1) -1 LET k3 = K3 +1 endif enddo # Some Other helpful hints # # 1. W is the difference between the starting service time and arrival time # 2. T is the difference between the leaving time and arrival time # 3. The period of time between when the previous customer left # and service for the next customer begins gives the idle time I. endMACRO