'' This is an event-oriented Simscript model of a M/M/1 queue '' (The code can be copied from the file: /home/courses/cse529/SIMSCRIPT_code/mm1_event.sim ) '' It will stop when the number of customers specified in variable '' num.delays has passed through the queue preamble normally, mode is undefined event notices include arrival and service temporary entities every customer has an arriv.time and may belong to the queue define arriv.time as a double variable the system owns the queue define queue as a fifo set accumulate util.server as the average of status accumulate ave.queue.length as the average of n.queue accumulate max.queue.length as the maximum of n.queue tally avg.queue.time as the average of wait.time define num.done, num.delays, current.customer and status as integer variables define wait.time as a double variable define .idle. to mean 0 define .busy. to mean 1 end ''=========================================================================== main print 1 line thus input Number of Delays required read num.delays status = .idle. num.done = 0 schedule an arrival in exponential.f(1.0,1) minutes start simulation end ''=========================================================================== event arrival schedule an arrival in exponential.f(1.0,1) minutes create a customer arriv.time(customer) = time.v if ( status = .idle. ) add 1 to num.done wait.time = 0.0 if ( num.done >= num.delays ) call report else status = .busy. current.customer = customer schedule a service in exponential.f(0.5,2) minutes always else file customer last in queue always end ''=========================================================================== event service destroy customer called current.customer if ( queue is empty ) status = .idle. current.customer = 0 else add 1 to num.done remove the first current.customer from the queue wait.time = time.v - arriv.time(current.customer) if ( num.done >= num.delays ) call report else schedule a service in exponential.f(0.5,2) minutes always always end ''=========================================================================== routine report print 6 lines with time.v*24.0*60.0, util.server, ave.queue.length, max.queue.length and avg.queue.time*24.0*60.0 thus clock time = *******.** minutes the utilization of the server was **.**** the average length of the queue was ***.** the maximum length of the queue was **** the average time in the system was ****.** minutes print 3 lines thus +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ '' The following line is just to stall Windows NT Simscript so that results can '' be examined. Uncomment the line when using the Windows version of Simscript. '' read num.delays stop end