The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Math::Telephony::ErlangC - Perl extension for Erlang C calculations

SYNOPSIS

  use Math::Telephony::ErlangC;

  # Evaluate probability that a service request will have to wait
  $wprob = wait_probability($traffic, $servers);

  # Probability that the wait time will be less than a fixed maximum
  # $mst is the mean service time
  $mwprob = maxtime_probability($traffic, $servers, $mst, $maxtime);

  # Average time waiting in queue
  # $mst is the mean service time
  $awtime = average_wait_time($traffic, $servers, $mst);

DESCRIPTION

This mosule contains various functions to deal with Erlang C calculations.

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

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

  • The serving process is Markovian (ditto)

  • There are S servers

  • The wait line is infinite (pure wait, no loss, no renounce)

  • The input population is infinite

EXPORT

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

CONCEPTS

Some concepts are common to the the following functions:

  • traffic is the offered traffic expressed in Erlang. When an input parameter, this value must be defined and greater or equal to 0. As per definition, this value is given by the product of the service request arrival and the average service time (see below for this).

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

  • wait probability is the probability that a given service request will be put inside the wait queue, which happens when all servers are busy.

  • (average) service time is the (average) time that each server needs to complete a service request; it's referred to as $mst most of the time below.

FUNCTIONS FOR WAIT PROBABILITY

$wprob = wait_probability($traffic, $servers);

Evaluate the probability that a call will have to wait in the queue because all servers are busy.

$servers = servers_waitprob($traffic, $wait_probability)

Evaluate the needed number of servers to handle $traffic Erlangs with a wait probability not greater than $wait_probability.

$traffic = traffic_waitprob($servers, $wait_probability, $prec);

Evaluate the maximum traffic that can be handled with $servers without having a wait probability for any request that is beyond the given value. The calculation is performed until the iteration process shows variations below $prec, which is optional and defaults to $Math::Telephony::ErlangB::default_precision.

FUNCTIONS FOR MAXIMUM WAIT TIME PROBABILITY

$mwprob = maxtime_probability($traffic, $servers, $mst, $maxtime);

Evaluate the probability that any given service request will be handled within the given maximum time.

$servers = servers_maxtime($traffic, $maxtime_probability, $mst, $maxtime);

Evaluate the needed number of servers given the $traffic in erlang, $maxtime_probability, i.e. the probability that any given request will be served in no more than $maxtime seconds, and $mst, which represents the mean service time for any given request.

$traffic = traffic_maxtime($servers, $maxtime_probability, $mst, $maxtime, $prec);

Evaluate the maximum traffic that can be handled with $servers, with $maxtime_probability that the any given request will be handled within $maxtime. Parameter $mst represents the average time needed to serve a request.

You can optionally specify a $prec precision for calculations, otherwise the precision will default to $Math::Telephony::ErlangB::precision.

$mst = service_time_maxtime($traffic, $servers, $maxt_prob, $maxtime);

Evaluate the mean service time required when other parameters are fixed.

$mst = service_time2_maxtime($frequency, $servers, $maxt_prob, $maxtime);

Evaluate the mean service time required when other parameters are fixed.

my $maxtime = max_time_maxtime($traffic, $servers, $maxt_prob, $mst);

Evaluate the maximum time required to process a request with a probability of $maxt_prob.

FUNCTIONS FOR AVERAGE WAIT TIME

$awtime = average_wait_time($traffic, $servers, $mst);

Evaluate the average waiting time, i.e. average time spent inside the queue by the generic request.

$servers = servers_waittime($traffic, $average_wait_time, $mst);

Evaluate the needed number of servers to serve the given $traffic with an average wait time in queue not exceeding $average_wait_time for each request. $mst is the mean service time.

$traffic = traffic_waittime($servers, $average_wait_time, $mst, $prec);

Evaluate the maximum traffic that can be handled with $servers, where the average wait time does not exceed $average_wait_time. $mst is the mean service time.

You can optionally specify a $prec precision for calculations, otherwise the precision will default to $Math::Telephony::ErlangB::precision.

$mst = service_time_waittime($traffic, $servers, $awt);

Evaluate the mean service time for $servers being offered $traffic, assuming that the average wait time in queue is $awt.

$mst = service_time2_waittime($frequency, $servers, $awt);

Evaluate the mean service time for $servers loaded with requests wich occur with $frequency, assuming that the average wait time in queue is $awt.

AGGREGATED FUNCTIONS

servers($param_hash_ref);

Solve equations to find needed servers. You can pass various input parameters:

  • {traffic => ..., wait_probability => ...}

  • {traffic => ..., avg_service_time => ..., avg_wait_time => ...}

  • {traffic => ..., avg_service_time => ..., max_wait_time => ..., maxtime_probability => ...}

SEE ALSO

You can google for plenty of information about Erlang C.

AUTHOR

Flavio Poletti <flavio@polettix.it>

COPYRIGHT AND LICENSE

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.