Given,
N = Total number of truncked channels, Erl
A = Total traffic intensity, Erl
Probability of call blocking, AKA Grade of Service (GoS), is determined by ErlangB formula.
\begin{equation} GoS = \frac{\cfrac{A^N}{N!}}{\sum_{i=1}^N \cfrac{A^i}{i!}} \end{equation}#Erlang B formula
from math import factorial
def ErlangB(A,N):
'''
Calculate Probability of call blocking (Grade of Service)
Input:
A- Total offered load (Busy Hour Traffic (BHT))
N- Number channels
'''
ratiosum=0
for i in range(N+1):
ratio=(A**i)/factorial(i)
ratiosum+=ratio
return (ratio/ratiosum)
#Plotting GoS familty of curves, derived from ErlangB formula
import numpy as np
import matplotlib.pyplot as plt
#Create x axis--> Offered Load values
x=np.linspace(0.1,0.9,19)
x=np.concatenate([x,10*x,100*x,[100]])
aarray=list(x) #28 items
#Create Channel number list
carray=[1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,35,40,45,50,60,70,80,90,100] #26 items
prlist=[]
prsetlist=[]
for c in carray:
for a in aarray:
pr=ErlangB(a,c)
prlist.append(pr)
prsetlist.append(prlist)
prlist=[]
#Plot in log-log scale
plt.figure(1, figsize=(16,10))
for prsetlistitem in prsetlist:
plt.loglog(aarray, prsetlistitem)
plt.grid(which='both', axis='both')
plt.xlim(0.1,100)
plt.ylim(0.001, 0.1)
plt.xlabel('Traffic Intensity in Erlang')
plt.ylabel('Probability of Blocking')
plt.title ('Number of Trunked Channels (N)')
plt.xscale('log')
plt.show()
With 60 avaiable truncked channels, what will be the probalibility of blocking (GoS) if the offered load is 50 erlang?
N=60
A=50
pr=ErlangB(A, N)
print("Probability of blocking: {:.3f} ".format(pr))
print("Or GoS: {:.2}% ".format(pr*100))
Probability of blocking: 0.022 Or GoS: 2.2%
Given the traffic intensity, A and number of agent, N, the probability of a caller waiting is given by Erlang C formula.
\begin{equation} P_{w}=\frac{\frac{A^{N}}{N!}\frac{N}{N-A}}{\left ( \sum_{i=0}^{N-1}\frac{A^{i}}{i!} \right )+\frac{A^{N}}{N!}\frac{N}{N-A}} \end{equation}
#Erlang C formula
from math import factorial
def ErlangC(A,N):
'''
Calculate Probability of call waiting
Input:
A- Total offered load (Busy Hour Traffic (BHT))
N- Number channels (servers, agents)
'''
ratiosum=0
for i in range(0,N):
ratio=(A**i)/factorial(i)
ratiosum+=ratio
ratio=(A**N)/factorial(N)
ratio2=N/(N-A)*ratio
# print (ratio, ratiosum)
return (ratio2/(ratiosum+ratio2))
#Example
N=11
A=10
pr=ErlangC(A, N)
print("Probability of waiting: {:.2f}% ".format(pr*100))
2505.210838544172 12842.305114638448 Probability of waiting: 68.21%