Math::Telephony::ErlangB - Perl extension for Erlang B calculations


  use Math::Telephony::ErlangB qw( :all );

  # Evaluate blocking probability
  $bprob = blocking_probability($traffic, $servers);
  $gos = gos($traffic, $servers); # Same result as above

  # Dimension minimum number of needed servers
  $servers = servers($traffic, $gos);

  # Calculate maximum serveable traffic
  $traffic = traffic($servers, $gos); # Default precision 0.001
  $traffic = traffic($servers, $gos, 1e-10);


This module contains various functions to deal with Erlang B calculations.

The Erlang B model allows dimensioning the number of servers in a M/M/S/0/inf model (Kendall notation):

  • The input process is Markovian (Poisson in this case)

  • The serving process is Markovian (ditto)

  • There are S servers

  • There's no wait line (pure loss)

  • The input population is infinite


None by default. Following functions can be imported at once via the ":all" keyword.


These variables control different aspects of this module, such as default values.

$default_precision = 0.001;

This variable is the default precision used when evaluating the maximum traffic sustainable using the traffic() function below.


The following functions are available for exporting. Three "concepts" are common to them all:

  • traffic is the offered traffic expressed in Erlang. When an input parameter, this value must be defined and greater or equal to 0.

  • servers is the number of servers in the queue. When an input parameter, this must be a defined value, greater or equal to 0.

  • blocking probability is the probability that a given service request will be blocked due to congestion.

  • gos is the grade of service, that corresponds to the blocking probability for Erlang B calculation. The concept of Grade of Service is a little different in perspective: in general, it should give us an estimate of how the service is good (or bad). In the Erlang B model this role is played by the blocking probability, thus the gos is equal to it.

$bprob = blocking_probability($traffic, $servers);

Evaluate the blocking probability from given traffic and numer of servers.

$gos = gos($traffic, $servers);

Evaluate the grade of service from given traffic and number of servers. For Erlang B, the GoS figure corresponds to the blocking probability.

$servers = servers($traffic, $bprob);

Calculate minimum number of servers needed to serve the given traffic with a blocking probability not greater than that given.

$traffic = traffic($servers, $bprob);
$traffic = traffic($servers, $bprob, $prec);

Calculate the maximum offered traffic that can be served by the given number of serves with a blocking probability not greater than that given.

The prec parameter allows to set the precision in this traffic calculation. If undef it defaults to $default_precision in this package.


You can google for plenty of information about Erlang B.


Flavio Poletti <>


Copyright (C) 2005 by Flavio Poletti

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.