md1 <- function (lam, mu) {
# If p is less than 1, we have a stable queue
p <- lam/mu
# Lq is the steady state average number of entities in the queue
Lq <- p^2 / (2*(1-p))
#L is the steady state average number of entities in the system (rather than the number in queue)
L <- (p^2 / (2*(1-p))) + p
#W is the steady state average time in the system
W <- (1/mu) + (p)/(2*mu*(1-p))
#Wq is the steady state average time in the queue
Wq <- p/(2*mu*(1-p))
df <- data.frame(p=p, Lq=Lq, L=L, W=W, Wq=Wq)
return(df)
}
mm1 <- function (lam, mu) {
# If p is less than 1, we have a stable queue
p <- lam/mu
# Lq is the steady state average number of entities in the queue
Lq <- p^2 / (1-p)
#L is the steady state average number of entities in the system (rather than the number in queue)
L <- p / (1-p)
#W is the steady state average time in the system
W <- mu/(1-p)
#Wq is the steady state average time in the queue
Wq <- (mu*p)/(1-p)
df <- data.frame(p=p, Lq=Lq, L=L, W=W, Wq=Wq)
return(df)
}
df <- md1(1,1/0.9)
df <- rbind(df, mm1(1,1/0.9))
df
## p Lq L W Wq
## 1 0.9 4.05 4.95 4.95000 4.05
## 2 0.9 8.10 9.00 11.11111 10.00
As we would expect the wait times and the size of the queues are decreased in an M/D/1 queue due to the decrease in randomness as compared to an MM1 model with a probabilistic service time