Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please use JAVA for this problem! The server queueing simulation model posted on Blackboard that is included with many .java files is as follows: MainClass.java

Please use JAVA for this problem!

image text in transcribed

The server queueing simulation model posted on Blackboard that is included with many .java files is as follows:

MainClass.java file is as follows:

public class MainClass{ public static void main(String argv[]){ Simulator ss = new Simulator(); ss.FutureEventList = new EventList(); ss.Customers = new Queue(); ss.stream=new Rand(); ss.Clock=0.0; ss.MeanInterArrivalTime=7.7; ss.MeanServiceTime=6.21; ss.Initialization(); //Loop until clock is greater than 10000 while (ss.Clock

Queue.java file is as follows:

import java.util.Vector; public class Queue{ private Vector all_data; public Queue(){ all_data = new Vector(); } public void enqueue(Event e){ all_data.addElement(e); } public Event dequeue(){ Event res = all_data.elementAt(0); all_data.removeElementAt(0); return res; } public Event Get(int i){ return all_data.elementAt(i); } }

Rand.java file is as follows:

public class Rand { final static int a = 16807; final static int c = 0; final static int m = 2147483647; // setting the seed x0. long x;

public Rand(){ x =123457 ; }

double next(){ // Calculate next value in sequence. x = ((a * x) + c) % m; // Return its 0-to-1 value. return (double)x/m ; } }

Simulator.java file is as follows:

public class Simulator { public Simulator(){} public final static int arrival=1; public final static int departue=2; public double Clock,MeanInterArrivalTime,MeanServiceTime, LastEventTime, TotalBusy,SumResponseTime,SumWaitTime,wightedQueueLength; public long NumberOfCustomers,Queuelength, TotalCustomers,NumberInService, NumberOfDepartures, MaxQueueLength; public int counter,counters; public EventList FutureEventList; public Queue Customers; public Rand stream; public void Initialization(){ Clock=0.0; NumberInService=0; Queuelength=0; LastEventTime=0.0; TotalBusy= 0.0 ; MaxQueueLength = 0 ; SumResponseTime=0.0; NumberOfDepartures=0; SumWaitTime=0.0; wightedQueueLength=0.0; //Create First Arrival Event Event evt = new Event(arrival,exponential(stream,MeanInterArrivalTime)); FutureEventList.enqueue(evt); } public void ProcessArrival(Event evt){ Customers.enqueue(evt); wightedQueueLength+=(Clock-LastEventTime)*Queuelength; Queuelength++; //if the server is idle, fetch the event, do statistics and put into service if(NumberInService==0) { ScheduleDeparture(); } else TotalBusy+=(Clock-LastEventTime); //server is busy //adjust max Queue Length statistics if(MaxQueueLength

public void ProcessDeparture(Event e){ //get the customers description Event finished= (Event) Customers.dequeue(); // if there are customers in the queue then schedule the departure of the next one wightedQueueLength+=(Clock-LastEventTime)*Queuelength; if (Queuelength>0) ScheduleDeparture(); else NumberInService=0; //measure the response time and add to the sum double response= (Clock-finished.get_time()); SumResponseTime+=response; TotalBusy+=(Clock-LastEventTime); NumberOfDepartures++; LastEventTime=Clock; } public static double exponential(Rand rng,double mean){ return -mean*Math.log(rng.next()); }

public static double triangular(Rand rng,double a, double b, double c){ double R = rng.next(); double x; if (R

Event.java is as follows:

public class Event{ private double time ; private int type; public Event ( int _type , double _time ){ type = _type ; time = _time ; }

public double get_time(){ return time ; } public int get_type (){ return type; } }

EventList.java file is as follows:

import java.util.PriorityQueue; import java.util.Comparator;

public class EventList{ public PriorityQueue event_list; public int size (){ return event_list.size(); } public EventList(){ event_list = new PriorityQueue(100, new Comparator(){ public int compare(Event e1, Event e2){ if (e1.get_time() e2.get_time()) return 1; return 0; } }); } public Event getMin(){ return event_list.peek(); } public void dequeue(){ event_list.remove(); } public void enqueue(Event e){ event_list.add(e); } }

Please change the service time distribution in the single server queueing simulation model posted on Blackboard from exponential with a mean of 5 minutes to a uniform distribution with a 1.5, b 6.8 (the time unit is still minute)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions