Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I added the corrected code p _ state ( i ) = ( c - i ) / ( c - ( c -
I added the corrected code pstateicic c i; but I am still gettting the same error message: Part : Define parameters
c ; Number of servers
lambda ; Average Arrival Rate per minute
mu ; Service rate
Nwait ; Number of waiting customers
Part : Call the MMCQ function and retrieve results
Ws Wq cutil, pdrop, pstate MMCQ;
Part : Define a relative error function
relerror @x y absx y y;
Part : Validate and print results
pstateicic c i
fprintfWs: f
Ws;
fprintfWq: f
Wq;
fprintfcutil: f
cutil;
fprintfpdrop: f
pdrop;
fprintfState Probabilities: ;
for i :Nwait
i::;
pstateicic c i;
fprintfpstated: f i pstatei;
end
fprintf
;
Part : Validate and print "PASS" or "FAIL" for each metric
if relerrorWs
fprintfWs f PASS
Ws;
else
fprintfWs f FAIL
Ws;
end
if relerrorWq
fprintfWqf PASS
Wq;
else
fprintfWqf FAIL
Wq;
end
if relerrorcutil,
fprintfcutil f PASS
cutil;
else
fprintfcutil f FAIL
cutil;
end
if relerrorpdrop,
fprintfpdrop f PASS
pdrop;
else
fprintfpdrop f FAIL
pdrop;
end
Part : Corrected pstate initialization
pstate ;
Part : Check if the sum of probabilities is close to
if abssumpstatee
dispThe probabilities sum to Test PASSED.";
else
dispThe probabilities do not sum to Test FAILED.";
end
Part : Assuming states
numstates ;
fprintfThe probability of being in state d is f
Nwait, pstateNwait ;
dispExtra Tests PASSED.";function Ws Wq cutil, pdrop, pstate MMCQlambda mu c Nwait
INPUTS:
lambda arrival rate
mu service rate
Nwait Number of queue elements, not including servers
c Number of servers
OUTPUTS:
Ws Average wait in the system
Wq Average wait in the queue
cutil Average percentage of servers busy
pdrop probability the queue is full
pstate probability of each state
INSERT YOUR CODE HERE
Calculate traffic intensity
rho lambda c mu;
Compute the Erlang B formula to calculate the probability of blocking
pblock erlangbc rho;
Calculate the utilization factor
cutil rho c;
Display the result
Calculate pprobability of no customers in the system
pdenom sumcrho:c factorial:c;
pdenom pdenom crhoc factorialcrhorhoNwait rho;
p pdenom;
fprintfp: f
p;
Calculate pN probability of having N customers in the system
pstate zeros Nwait;
for i :Nwait
if i c
pstateirhoi factoriali p;
else
pstateirhoi factorialccic p;
end
pN pstateNwait;
Calculate pdrop probability of a customer being dropped
pdrop pN;
Calculate cutil utilization of the servers
cutil rhoc pfactorialc rho rhoNwait c ;
Calculate Wq average waiting time in the queue
Wq rhoc pfactorialc rhoNwait; Average waiting time in the queue
Print the result
fprintfAverage waiting time in the queue Wq: f Wq;
Calculate Ws average time spent in the system
Ws Wq mu;
Print the results
fprintfp: f p; fprintfpN: f p;
end
end
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