## Guide to Matlab programs for ErlangB, Engset, BCQ

Xuan Zheng and M. Veeraraghavan, March 30, 2004

Updated by Xiuduan Fang and Eric Humenay Nov 26, 2006

1. erlangb.m

The function [Pb, U]=erlangb(ρ, m)calculates the blocking probability and utilization for an M/M/m/m system with an infinite customer population. The arguments for erlangb.m are as follows:

1)ρ, offered traffic load (defined as the aggregate call arrival rate λdivided by the service rate μ); a positive number. The unit of ρ is Erlang.

2)m, the number of servers in the system; an positive integer.

The function erlangb returns two values:

1)Pb, call blocking probability.

2)U, utilization.

For example, entering the command [Pb,U]=erlangb(1,5), we get

Pb =0.0031 and U=0.1994, which means that the call blocking probability is 0.31% and the utilization is 19.94% whenρ=1erlang and m =5.

1. plot_Pb_util.m

The function plot_Pb_util(starting_rho,ending_rho,step_rho, m, testno) calls the function erlangb toplot call blocking probability and utilizationagainst load for a given value of m. It saves the calculated results into a txt file and the final figure into a Matlab figure. The arguments for plot_Pb_util are as follows:

1)starting_rho: lower bound for the load - can be > 1

2)ending_rho: upper bound for the load - can be > 1

3)step_rho: set step_rho a smaller value if you want finer granularity

4)m: the number of servers

5)testno: the id of the test; a number which is attached to the filename string (i.e., plot_Pb_util for this program) to create the file names for saving figures and data.For example, if the input testno is 2, then the output figure will be “plot_Pb_util 2.fig” and the output txt file will be “plot_Pb_util 2.txt”.

An example command to run this program is plot_Pb_util(1,20,1,20,1).

1. find_m_util.m

The function [m, U]=find_m_util.m(P_b, load) finds the m needed to meet a given Pb for a given load and calculates corresponding utilization too. The outputs are m, the number of servers needed and the utilization, U.

1. plot_m_util.m

The function plot_m_util(starting_rho, ending_rho, step_rho, Pb, testno) plot m and utilization against load for a given value of Pb. It saves the calculated results into a txt file and the final figure into a Matlab figure.

For example, plot_m_util(1, 100, 1, 0.01, 1).

1. bcc.m

The function [Pl, Pb]=bcc(load,server,customer) calculates the blocking probability for a finite number of sources queuing system using the Engset equation.

The arguments for bcc.m are as follows:

1)ρ, offered traffic load (defined as the per-customer call arrival rate λdivided by the service rate μ). The unit of ρ is Erlang.

2)m, the number of servers in the system.

3)n, the number of customers.

The function bcc returns two values:

4)Pl, call congestion probability.

5)Pb, time congestion probability.

For example, calling[Pl, Pb]=bcc(0.5,10, 30), we get call congestion probability Pl=0.2407 and time congestion probability Pb=0.2617 whenρ=0.5erlang,m =10, and n=30.

1. plot_bcc.m

The function plot_bcc(starting_rho, ending_rho, step_rho, server, customer, testno) calls the function [Pl, Pb]=bcc(load,server,customer) to plot call congestion probability, Pl and time congestion probability Pbagainst load for a given number of servers and a given number ofcustomers.

For example, plot_bcc(1/3, 10, 0.5, 3, 4, 1)

1. find_server.m

The function [server, realPl, realPb]=find_server(customer, load, Pl) finds the number of servers needed to meet a given call congestion probability, Pl, provided that we know the number of customer and the offer traffic load for a bcc queueuing system. The arguments for find_server.m are as follows:

1)customer: the number of customers, M

3)Pl: call congestion probability

The function find_server returns three values:

1)server: the number of servers, N

2)realPl: the actual call congestion probability

3)realPb: the actual time congestion probability

1. bcq.m

The function result=bcq(λ, μ, m, n)calculates the mean waiting time for an M/M/m/n system with a finite customer population. The arguments for bcq.m are as follows:

1)λ, the per-customer call arrival rate. The unit of λ is 1/s.

2)μ, the service rate. The unit of λ is 1/s.

3)m, the number of servers in the system.

4)n, the number of customers.

For example, a call bcq(0.5, 0.8, 10, 30) means the mean waiting time when λ=0.5, μ=0.8, m =10, and n=30.

1. plot_bcq.m

The function plot_bcq(lambda, starting_mu, ending_mu, step_mu, server, customer, testno) calls the function result=bcq(lambda,mu,server,customer) to plot call waiting time against call holding time for a given value of lambda, a given number of servers, and a given number of customers.

For example, plot_bcq(3, 1, 10, 1, 3, 10, 1)

1. demo.m

This file calls plot_Pb_util, plot_m_util, plot_bcc, and plot_bcq.