Question
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!
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
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(); NumberOfCustomers++; } 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
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 triangular distribution with a 1.5, b 2.7, c 6.8 (the time unit is still minute)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started