Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Ws: 2 . 8 6 8 5 Wq: 0 . 8 6 8 5 1 c _ util: 0 . 4 8 0 4 2
Ws:
Wq:
cutil:
pdrop:
pstate:
Ws FAIL
Wq FAIL
cutil FAIL
pdrop FAIL
pstate
The probabilities sum to Test PASSED
pstate:
The probabilities sum to Test PASSED. Test and validation code
lambda ; Arrival rate: calls per minute
mu ; Service rate: calls per minute per agent
c ; Placeholder, needs adjustment based on system requirements
Placeholder, needs adjustment based on system requirements
Nwait lambda mu lambda;
Calculate System Capacity N
N c Nwait;
Call the MMCQ function with the given parameters
Ws Wq cutil, pdrop, pstate MMCQ;
Display the results
dispWs: numstrWs;
dispWq: numstrWq;
dispcutil: numstrcutil;
disppdrop: numstrpdrop;
disppstate: numstrpstate;
Define a relative error function
relerror @xy absx yy;
Validate the results 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
fprintfWq f 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
fprintfpstate s
numstrpstate;
Extra Tests
pstate should have Nwait probabilities
if relerrorsumpstate
dispThe probabilities sum to Test PASSED';
else
dispThe probabilities do not sum to Test FAILED.;
end
Extra Tests
disppstate: numstrpstate;
if abssumpstatee
dispThe probabilities sum to Test PASSED.;
else
dispThe probabilities do not sum to Test FAILED.;
end
function Ws Wq cutil, pdrop, pstate MMCQlambda mu c Nwait
Calculate rho: the traffic intensity per server
rho lambda mu;
Calculate p the probability of having zero customers in the system
p sumc rho:c factorial:cc rhoc factorialc;
Initialize pstate
pstate zeros Nwait ;
pstate p;
Calculate pstate based on the number of customers relative to the number of servers c
for i :Nwait
ci mini c;
if i c
pstatei ci c pstatei rho factoriali;
else
pstatei cci factorialci pstatei rhoi factorialc;
end
end
pstate pstate sumpstate;
Calculate pN: the probability of dropping a customer the system being full
pN pstateNwait ;
Calculate the rate of lost customers due to the system being full
lambdaloss lambda pN;
Calculates the effective arrival rate, considering the lost customers
lambdaeff lambda lambdaloss;
Calculate Lq: the average number of customers in the queue, calculated using the state probabilities
Lq sum:Nwait pstate;
Calculates Ls: the total average number of customers in the system, both in service and in the queue
Ls Lq lambdaeff mu;
Calculate cbar Average Busy Servers and cutil Utilization Factor
cbar Ls Lq;
cutil cbar c;
pdrop pN;
Calculate Ws: the average time a customer spends in the system
Ws Ls lambdaeff;
Calculate Wq: the average time a customer spends in the queue
Wq Lq lambdaeff;
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