'''
爱尔兰公式,根据B(s,a)与B(s-1,a)的迭代关系计算
'''
from math import factorial
def ErlangB1 (s, a):
InvB = 1
for j in range(1, s+1):
InvB = 1+ InvB * (j/a)
return (1 / InvB)
'''根据泊松流计算溢出呼叫流的均值,方差,峰值因子'''
import math
def overFlow(s,a):
alpha=a*ErlangB1(s,a)
z=(1-alpha+a/(s+1+alpha-a))
nu=alpha*z
return alpha,nu,z
'''rapp方法'''
def rErlang(alpha,nu,z)
aR=nu+3*z*(z-1)
sR=math.floor(aR*(alpha+z)/(alpha+z-1)-alpha-1)
aR=(sR+alpha+1)*(alpha+z-1)/(alpha+z)
return sR,aR
'''求溢出呼叫流满足呼损要求的最小中继线数'''
def minLines(s,a,p):
for i in range(0,100):
if(ErlangB1(s+i,a)<p):
return i
break
rapp方法详见论文原文