MMC<-function(lamda,miu,c)
{
# utilization
p=lamda/(c*miu)
# solve for p(0)
r1<-((c*p)^c)/(factorial(c)*(1-p))
r2<-0
for(i in 0:(c-1)){
r2<-r2+((c*p)^(i))/factorial(i)
}
p0<-(r1+r2)^-1
# solve for the system
lq<-(p*((c*p)^c)*p0)/(factorial(c)*(1-p)^2)
l<-lq+(lamda/miu)
wq<-(((c*p)^c)*p0)/(factorial(c)*c*miu*(1-p)^2)
w<-wq+(1/miu)
result<-data.frame("P"=p,"u"=miu,"c"=c,"P0"=p0,"Ls"=l,"Lq"=lq,"Ws"=w,"Wq"=wq)
result<-round(result,5)
row.names(result)<-"Values"
return(result)
}
c<-1
lamda=120
miu=190
MM1<-MMC(lamda,miu,c)
r=100/MM1[7]
MM1
## P u c P0 Ls Lq Ws Wq
## Values 0.63158 190 1 0.36842 1.71429 1.08271 0.01429 0.00902
display=paste0("Entities in the System : ",round(r))
display
## [1] "Entities in the System : 6998"
Compare the Run Time:
As shown in the figure 4.9.1 above The run time improve 6 times using non-standard Library.