Question: Setup: You need to generate D elements and insert them into an element queue. Each element has two properties:Arrival time ( based on exponential inter
Setup: You need to generate D elements and insert them into an "element" queue. Each element has two properties:Arrival time based on exponential interarrival time distribution, added to the previous elements arrivalOnce youve established all arrival and service times, you need to run a simulation experiment where you process each element in the queue and determine the next event:Arrival, wait in queue if server is busyArrival start service if server is freeEnd service for current customer being served departure start service for next in line if queue has at least one customerEnd service for current customer being served departure and wait for next arrival if queue has zero customers During the simulation, you should keep track of current time, and advance it to the time of the next event arrival or departure You should keep track of elements in the queue at current time, so you can have two pointers that point to "first element in queue at current time" and "last element in queue at current time". The next event would be either the departure of the first element or an arrival for the element beyond the current last element. Function to run the simulationvoid Simulationstruct Queue elementQ double lambda, double mu int printperiod, int totaldepartures
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
