Created
March 3, 2012 20:04
-
-
Save lamprosg/1967924 to your computer and use it in GitHub Desktop.
Erlang B Equation - Traffic units and busy probability on GSM gateways
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Javascript: Percentage of busy | |
// calls with a=traffic and n lines | |
function erl(a,n) | |
{ | |
u=1; | |
for(i=1;i<=n;i++) | |
{ | |
u+=power(a,i)/factorial(i); | |
} | |
return((power(a,n)/factorial(n))/u+0.005)*100 | |
} | |
function factorial(i) // Get factorial of i | |
{ | |
k=1; | |
for (j=1; j<=i; j++) | |
{ | |
k*=j; | |
} | |
return k | |
} | |
function power(k,i) // Compute k power i | |
{ | |
w=1; | |
for (j=1; j<=i; j++) | |
{ | |
w*=k; | |
} | |
return w | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment