@c This file has been automatically generated from singlestation.txi
@c by proc.m. Do not edit this file, all changes will be lost

@c -*- texinfo -*-

@c Copyright (C) 2008, 2009, 2010, 2011, 2012, 2014, 2016, 2018 Moreno Marzolla
@c
@c This file is part of the queueing package.
@c
@c The queueing package is free software; you can redistribute it
@c and/or modify it under the terms of the GNU General Public License
@c as published by the Free Software Foundation; either version 3 of
@c the License, or (at your option) any later version.
@c
@c The queueing package is distributed in the hope that it will be
@c useful, but WITHOUT ANY WARRANTY; without even the implied warranty
@c of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@c GNU General Public License for more details.
@c
@c You should have received a copy of the GNU General Public License
@c along with the queueing package; see the file COPYING.  If not, see
@c <http://www.gnu.org/licenses/>.

@node Single Station Queueing Systems
@chapter Single Station Queueing Systems

Single Station Queueing Systems contain a single station, and can
usually be analyzed easily. The @code{queueing} package contains
functions for handling the following types of queues:

@ifnottex
@menu
* The M/M/1 System::    Single-server queueing station.
* The M/M/m System::    Multiple-server queueing station.
* The Erlang-B Formula::
* The Erlang-C Formula::
* The Engset Formula::
* The M/M/inf System::  Infinite-server (delay center) station.
* The M/M/1/K System::  Single-server, finite-capacity queueing station.
* The M/M/m/K System::  Multiple-server, finite-capacity queueing station.
* The Asymmetric M/M/m System::  Asymmetric multiple-server queueing station.
* The M/G/1 System:: Single-server with general service time distribution.
* The M/Hm/1 System:: Single-server with hyperexponential service time distribution.
@end menu
@end ifnottex
@iftex
@itemize

@item @math{M/M/1} single-server queueing station;

@item @math{M/M/m} multiple-server queueing station;

@item Asymmetric @math{M/M/m};

@item @math{M/M/\infty} infinite-server station (delay center);

@item @math{M/M/1/K} single-server, finite-capacity queueing station;

@item @math{M/M/m/K} multiple-server, finite-capacity queueing station;

@item @math{M/G/1} single-server with general service time distribution;

@item @math{M/H_m/1} single-server with hyperexponential service time distribution.

@end itemize

@end iftex

@c
@c M/M/1
@c
@node The M/M/1 System
@section The @math{M/M/1} System

The @math{M/M/1} system contains a single server connected to an
unbounded FCFS queue. Requests arrive according to a Poisson process
with rate @math{\lambda}; the service time is exponentially
distributed with average service rate @math{\mu}. The system is stable
if @math{\lambda < \mu}.

@anchor{doc-qsmm1}


@deftypefn {Function File} {[@var{U}, @var{R}, @var{Q}, @var{X}, @var{p0}] =} qsmm1 (@var{lambda}, @var{mu})

@cindex @math{M/M/1} system

Compute utilization, response time, average number of requests and throughput for a @math{M/M/1} queue.

@tex
The steady-state probability @math{\pi_k} that there are @math{k}
jobs in the system, @math{k \geq 0}, can be computed as:

$$
\pi_k = (1-\rho)\rho^k
$$

where @math{\rho = \lambda/\mu} is the server utilization.

@end tex

@strong{INPUTS}

@table @code

@item @var{lambda}
Arrival rate (@code{@var{lambda} @geq{} 0}).

@item @var{mu}
Service rate (@code{@var{mu} > @var{lambda}}).

@end table

@strong{OUTPUTS}

@table @code

@item @var{U}
Server utilization

@item @var{R}
Server response time

@item @var{Q}
Average number of requests in the system

@item @var{X}
Server throughput. If the system is ergodic (@code{@var{mu} >
@var{lambda}}), we always have @code{@var{X} = @var{lambda}}

@item @var{p0}
Steady-state probability that there are no requests in the system.

@end table

@var{lambda} and @var{mu} can be vectors of the same size. In this
case, the results will be vectors as well.

@strong{REFERENCES}

@itemize
@item
G. Bolch, S. Greiner, H. de Meer and K. Trivedi, @cite{Queueing Networks
and Markov Chains: Modeling and Performance Evaluation with Computer
Science Applications}, Wiley, 1998, Section 6.3
@end itemize

@seealso{qsmmm, qsmminf, qsmmmk}

@end deftypefn


@c
@c M/M/m
@c
@node The M/M/m System
@section The @math{M/M/m} System

The @math{M/M/m} system is similar to the @math{M/M/1} system, except
that there are @math{m \geq 1} identical servers connected to a shared
FCFS queue. Thus, at most @math{m} requests can be served at the same
time. The @math{M/M/m} system can be seen as a single server with
load-dependent service rate @math{\mu(n)}, which is a function of the
number @math{n} of requests in the system:

@iftex
@tex
$$\mu(n) = \mu \times \min(m,n)$$
@end tex
@end iftex
@ifnottex
@example
mu(n) = min(m,n)*mu
@end example
@end ifnottex

@noindent where @math{\mu} is the service rate of each individual server.

@anchor{doc-qsmmm}


@deftypefn {Function File} {[@var{U}, @var{R}, @var{Q}, @var{X}, @var{p0}, @var{pm}] =} qsmmm (@var{lambda}, @var{mu})
@deftypefnx {Function File} {[@var{U}, @var{R}, @var{Q}, @var{X}, @var{p0}, @var{pm}] =} qsmmm (@var{lambda}, @var{mu}, @var{m})

@cindex @math{M/M/m} system

Compute utilization, response time, average number of requests in
service and throughput for a @math{M/M/m} queue, a queueing system
with @math{m} identical servers connected to a single FCFS
queue.

@tex
The steady-state probability @math{\pi_k} that there are @math{k}
requests in the system, @math{k \geq 0}, can be computed as:

$$
\pi_k = \cases{ \displaystyle{\pi_0 { ( m\rho )^k \over k!}} & $0 \leq k \leq m$;\cr
                \displaystyle{\pi_0 { \rho^k m^m \over m!}} & $k>m$.\cr
}
$$

where @math{\rho = \lambda/(m\mu)} is the individual server utilization.
The steady-state probability @math{\pi_0} that there are no jobs in the
system is:

$$
\pi_0 = \left[ \sum_{k=0}^{m-1} { (m\rho)^k \over k! } + { (m\rho)^m \over m!} {1 \over 1-\rho} \right]^{-1}
$$

@end tex

@strong{INPUTS}

@table @code

@item @var{lambda}
Arrival rate (@code{@var{lambda}>0}).

@item @var{mu}
Service rate (@code{@var{mu}>@var{lambda}}).

@item @var{m}
Number of servers (@code{@var{m} @geq{} 1}).
Default is @code{@var{m}=1}.

@end table

@strong{OUTPUTS}

@table @code

@item @var{U}
Service center utilization, @math{U = \lambda / (m \mu)}.

@item @var{R}
Service center mean response time

@item @var{Q}
Average number of requests in the system

@item @var{X}
Service center throughput. If the system is ergodic, 
we will always have @code{@var{X} = @var{lambda}}

@item @var{p0}
Steady-state probability that there are 0 requests in the system

@item @var{pm}
Steady-state probability that an arriving request has to wait in the
queue

@end table

@var{lambda}, @var{mu} and @var{m} can be vectors of the same size. In this
case, the results will be vectors as well.

@strong{REFERENCES}

@itemize
@item
G. Bolch, S. Greiner, H. de Meer and K. Trivedi, @cite{Queueing Networks
and Markov Chains: Modeling and Performance Evaluation with Computer
Science Applications}, Wiley, 1998, Section 6.5
@end itemize

@seealso{erlangc,qsmm1,qsmminf,qsmmmk}

@end deftypefn


@c
@c Erlang-B
@c
@node The Erlang-B Formula
@section The Erlang-B Formula

@anchor{doc-erlangb}


@deftypefn {Function File} {@var{B} =} erlangb (@var{A}, @var{m})

@cindex Erlang-B formula

Compute the value of the Erlang-B formula @math{E_B(A, m)} giving the
probability that an open system with @math{m} identical servers,
arrival rate @math{\lambda}, individual service rate @math{\mu}
and offered load @math{A = \lambda / \mu} has all servers busy.

@tex
@math{E_B(A, m)} is defined as:

$$
E_B(A, m) = \displaystyle{{A^m \over m!} \left( \sum_{k=0}^m {A^k \over k!} \right) ^{-1}}
$$
@end tex

@strong{INPUTS}

@table @code

@item @var{A}
Offered load, defined as @math{A = \lambda / \mu} where
@math{\lambda} is the mean arrival rate and @math{\mu} the mean
service rate of each individual server (real, @math{A > 0}).

@item @var{m}
Number of identical servers (integer, @math{m @geq{} 1}). Default @math{m = 1}

@end table

@strong{OUTPUTS}

@table @code

@item @var{B}
The value @math{E_B(A, m)}

@end table

@var{A} or @var{m} can be vectors, and in this case, the results will
be vectors as well.

@strong{REFERENCES}

@itemize
@item
G. Zeng, @cite{Two common properties of the erlang-B function, erlang-C function, and Engset blocking function}, Mathematical and Computer Modelling, Volume 37, Issues 12-13, June 2003, Pages 1287-1296
@end itemize

@seealso{qsmmm}

@end deftypefn


@c
@c Erlang-c
@c
@node The Erlang-C Formula
@section The Erlang-C Formula

@anchor{doc-erlangc}


@deftypefn {Function File} {@var{C} =} erlangc (@var{A}, @var{m})

@cindex Erlang-C formula

Compute the steady-state probability @math{E_C(A, m)} that an open
queueing system with @math{m} identical servers, infinite wating
space, arrival rate @math{\lambda}, individual service rate
@math{\mu} and offered load @math{A = \lambda / \mu} has all the
servers busy.

@tex
@math{E_C(A, m)} is defined as:

$$
E_C(A, m) = \displaystyle{ {A^m \over m!} {1 \over 1-\rho} \left( \sum_{k=0}^{m-1} {A^k \over k!} + {A^m \over m!} {1 \over 1 - \rho} \right) ^{-1}}
$$

where @math{\rho = A / m = \lambda / (m \mu)}.
@end tex

@strong{INPUTS}

@table @code

@item @var{A}
Offered load. @math{A = \lambda / \mu} where
@math{\lambda} is the mean arrival rate and @math{\mu} the mean
service rate of each individual server (real, @math{0 < A < m}).

@item @var{m}
Number of identical servers (integer, @math{m @geq{} 1}).
Default @math{m = 1}

@end table

@strong{OUTPUTS}

@table @code

@item @var{B}
The value @math{E_C(A, m)}

@end table

@var{A} or @var{m} can be vectors, and in this case, the results will
be vectors as well.

@seealso{qsmmm}

@end deftypefn


@c
@c Engset
@c
@node The Engset Formula
@section The Engset Formula

@anchor{doc-engset}


@deftypefn {Function File} {@var{B} =} engset (@var{A}, @var{m}, @var{n})

@cindex Engset loss formula

Compute the Engset blocking probability @math{P_b(A, m, n)} for a system
with a finite population of @math{n} users, @math{m} identical
servers, no queue, individual service rate @math{\mu}, individual
arrival rate @math{\lambda} (i.e., the time until a user tries to
request service is exponentially distributed with mean @math{1 /
\lambda}), and offered load @math{A = \lambda / \mu}.

@tex
@math{P_b(A, m, n)} is defined for @math{n > m} as:

$$
P_b(A, m, n) = {{\displaystyle{A^m {n \choose m}}} \over {\displaystyle{\sum_{k=0}^m A^k {n \choose k}}}}
$$

and is 0 if @math{n @leq{} m}.
@end tex

@strong{INPUTS}

@table @code

@item @var{A}
Offered load, defined as @math{A = \lambda / \mu} where
@math{\lambda} is the mean arrival rate and @math{\mu} the mean
service rate of each individual server (real, @math{A > 0}).

@item @var{m}
Number of identical servers (integer, @math{m @geq{} 1}). Default @math{m = 1}

@item @var{n}
Number of requests (integer, @math{n @geq{} 1}). Default @math{n = 1}

@end table

@strong{OUTPUTS}

@table @code

@item @var{B}
The value @math{P_b(A, m, n)}

@end table

@var{A}, @var{m} or @math{n} can be vectors, and in this case, the
results will be vectors as well.

@seealso{erlangb, erlangc}

@end deftypefn


@c
@c M/M/inf
@c
@node The M/M/inf System
@section The @math{M/M/}inf System

The @math{M/M/\infty} system is a special case of @math{M/M/m} system
with infinitely many identical servers (i.e., @math{m = \infty}). Each
new request is always assigned to a new server, so that queueing never
occurs. The @math{M/M/\infty} system is always stable.

@anchor{doc-qsmminf}


@deftypefn {Function File} {[@var{U}, @var{R}, @var{Q}, @var{X}, @var{p0}] =} qsmminf (@var{lambda}, @var{mu})

Compute utilization, response time, average number of requests and throughput for a @math{M/M/\infty} queue.

The @math{M/M/\infty} system has an infinite number of identical
servers; this kind of system is always stable for every arrival and
service rates.

@cindex @math{M/M/}inf system

@tex
The steady-state probability @math{\pi_k} that there are @math{k}
requests in the system, @math{k @geq{} 0}, can be computed as:

$$
\pi_k = {1 \over k!} \left( \lambda \over \mu \right)^k e^{-\lambda / \mu}
$$
@end tex

@strong{INPUTS}

@table @code

@item @var{lambda}
Arrival rate (@code{@var{lambda}>0}).

@item @var{mu}
Service rate (@code{@var{mu}>0}).

@end table

@strong{OUTPUTS}

@table @code

@item @var{U}
Traffic intensity (defined as @math{\lambda/\mu}). Note that this is
different from the utilization, which in the case of @math{M/M/\infty}
centers is always zero.

@cindex traffic intensity

@item @var{R}
Service center response time.

@item @var{Q}
Average number of requests in the system (which is equal to the
traffic intensity @math{\lambda/\mu}).

@item @var{X}
Throughput (which is always equal to @code{@var{X} = @var{lambda}}).

@item @var{p0}
Steady-state probability that there are no requests in the system

@end table

@var{lambda} and @var{mu} can be vectors of the same size. In this
case, the results will be vectors as well.

@strong{REFERENCES}

@itemize
@item
G. Bolch, S. Greiner, H. de Meer and K. Trivedi, @cite{Queueing Networks
and Markov Chains: Modeling and Performance Evaluation with Computer
Science Applications}, Wiley, 1998, Section 6.4
@end itemize

@seealso{qsmm1,qsmmm,qsmmmk}

@end deftypefn


@c
@c M/M/1/k
@c
@node The M/M/1/K System
@section The @math{M/M/1/K} System 

In a @math{M/M/1/K} finite capacity system there is a single server,
and there can be at most @math{K} jobs at any time (including the job
currently in service), @math{K > 1}. If a new request tries to join
the system when there are already @math{K} other requests, the request
is lost. The queue has @math{K-1} slots. The @math{M/M/1/K} system is
always stable, regardless of the arrival and service rates.

@anchor{doc-qsmm1k}


@deftypefn {Function File} {[@var{U}, @var{R}, @var{Q}, @var{X}, @var{p0}, @var{pK}] =} qsmm1k (@var{lambda}, @var{mu}, @var{K})

@cindex @math{M/M/1/K} system

Compute utilization, response time, average number of requests and
throughput for a @math{M/M/1/K} finite capacity system. In a
@math{M/M/1/K} queue there is a single server; the maximum number of
requests in the system (including the request being served) 
is @math{K}, and the maximum queue length is @math{K-1}.

@tex
The steady-state probability @math{\pi_k} that there are @math{k}
jobs in the system, @math{0 @leq{} k @leq{} K}, is:

$$
\pi_k = {(1-a)a^k \over 1-a^{K+1}}
$$

where @math{a = \lambda/\mu}.
@end tex

@strong{INPUTS}

@table @code

@item @var{lambda}
Arrival rate (@code{@var{lambda}>0}).

@item @var{mu}
Service rate (@code{@var{mu}>0}).

@item @var{K}
Maximum number of requests allowed in the system (@code{@var{K} @geq{} 1}).

@end table

@strong{OUTPUTS}

@table @code

@item @var{U}
Service center utilization, which is defined as @code{@var{U} = 1-@var{p0}}

@item @var{R}
Service center response time

@item @var{Q}
Average number of requests in the system

@item @var{X}
Service center throughput

@item @var{p0}
Steady-state probability that there are no requests in the system

@item @var{pK}
Steady-state probability that there are @math{K} requests in the system
(i.e., that the system is full)

@end table

@var{lambda}, @var{mu} and @var{K} can be vectors of the
same size. In this case, the results will be vectors as well.

@seealso{qsmm1,qsmminf,qsmmm}

@end deftypefn


@c
@c M/M/m/k
@c
@node The M/M/m/K System
@section The @math{M/M/m/K} System 

The @math{M/M/m/K} finite capacity system is similar to the
@math{M/M/1/k} system except that the number of servers is @math{m},
where @math{1 \leq m \leq K}. The queue has @math{K-m} slots. The
@math{M/M/m/K} system is always stable.

@anchor{doc-qsmmmk}


@deftypefn {Function File} {[@var{U}, @var{R}, @var{Q}, @var{X}, @var{p0}, @var{pK}] =} qsmmmk (@var{lambda}, @var{mu}, @var{m}, @var{K})

@cindex @math{M/M/m/K} system

Compute utilization, response time, average number of requests and
throughput for a @math{M/M/m/K} finite capacity system. In a
@math{M/M/m/K} system there are @math{m \geq 1} identical service centers
sharing a fixed-capacity queue. At any time, at most @math{K @geq{} m} requests can be in the system, including those being served. The maximum queue length
is @math{K-m}. This function generates and
solves the underlying CTMC.

@tex

The steady-state probability @math{\pi_k} that there are @math{k}
jobs in the system, @math{0 @leq{} k @leq{} K}, is:

$$
\pi_k = \cases{ \displaystyle{{\rho^k \over k!} \pi_0} & if $0 \leq k \leq m$;\cr
                \displaystyle{{\rho^m \over m!} \left( \rho \over m \right)^{k-m} \pi_0} & if $m < k \leq K$\cr}
$$

where @math{\rho = \lambda/\mu} is the offered load. The probability
@math{\pi_0} that the system is empty can be computed by considering
that all probabilities must sum to one: @math{\sum_{k=0}^K \pi_k = 1},
which gives:

$$
\pi_0 = \left[ \sum_{k=0}^m {\rho^k \over k!} + {\rho^m \over m!} \sum_{k=m+1}^K \left( {\rho \over m}\right)^{k-m} \right]^{-1}
$$

@end tex

@strong{INPUTS}

@table @code

@item @var{lambda}
Arrival rate (@code{@var{lambda}>0})

@item @var{mu}
Service rate (@code{@var{mu}>0})

@item @var{m}
Number of servers (@code{@var{m} @geq{} 1})

@item @var{K}
Maximum number of requests allowed in the system,
including those being served (@code{@var{K} @geq{} @var{m}})

@end table

@strong{OUTPUTS}

@table @code

@item @var{U}
Service center utilization

@item @var{R}
Service center response time

@item @var{Q}
Average number of requests in the system

@item @var{X}
Service center throughput

@item @var{p0}
Steady-state probability that there are no requests in the system.

@item @var{pK}
Steady-state probability that there are @var{K} requests in the system
(i.e., probability that the system is full).

@end table

@var{lambda}, @var{mu}, @var{m} and @var{K} can be either scalars, or
vectors of the  same size. In this case, the results will be vectors
as well.

@strong{REFERENCES}

@itemize
@item
G. Bolch, S. Greiner, H. de Meer and K. Trivedi, @cite{Queueing Networks
and Markov Chains: Modeling and Performance Evaluation with Computer
Science Applications}, Wiley, 1998, Section 6.6
@end itemize

@seealso{qsmm1,qsmminf,qsmmm}

@end deftypefn


@c
@c Asymmetric M/M/m
@c
@node The Asymmetric M/M/m System
@section The Asymmetric @math{M/M/m} System 

The Asymmetric @math{M/M/m} system contains @math{m} servers connected
to a single queue. Differently from the @math{M/M/m} system, in the
asymmetric @math{M/M/m} each server may have a different service time.

@anchor{doc-qsammm}


@deftypefn {Function File} {[@var{U}, @var{R}, @var{Q}, @var{X}] =} qsammm (@var{lambda}, @var{mu})

@cindex asymmetric @math{M/M/m} system

Compute @emph{approximate} utilization, response time, average
number of requests in service and throughput for an asymmetric
@math{M/M/m} queue. In this type of system there are @math{m} different
servers connected to a single queue. Each server has its own
(possibly different) service rate. If there is more than one server
available, requests are routed to a randomly-chosen one.

@strong{INPUTS}

@table @code

@item @var{lambda}
Arrival rate (@code{@var{lambda}>0})

@item @var{mu}
@code{@var{mu}(i)} is the service rate of server
@math{i}, @math{1 @leq{} i @leq{} m}.
The system must be ergodic (@code{@var{lambda} < sum(@var{mu})}).

@end table

@strong{OUTPUTS}

@table @code

@item @var{U}
Approximate service center utilization,
@math{U = \lambda / ( \sum_i \mu_i )}.

@item @var{R}
Approximate service center response time

@item @var{Q}
Approximate number of requests in the system

@item @var{X}
Approximate system throughput. If the system is ergodic, 
@code{@var{X} = @var{lambda}}

@end table

@strong{REFERENCES}

@itemize
@item
G. Bolch, S. Greiner, H. de Meer and K. Trivedi, @cite{Queueing Networks
and Markov Chains: Modeling and Performance Evaluation with Computer
Science Applications}, Wiley, 1998
@end itemize

@seealso{qsmmm}

@end deftypefn


@c
@c
@c
@node The M/G/1 System
@section The @math{M/G/1} System 

@anchor{doc-qsmg1}


@deftypefn {Function File} {[@var{U}, @var{R}, @var{Q}, @var{X}, @var{p0}] =} qsmg1 (@var{lambda}, @var{xavg}, @var{x2nd})

@cindex @math{M/G/1} system

Compute utilization, response time, average number of requests and
throughput for a @math{M/G/1} system. The service time distribution
is described by its mean @var{xavg}, and by its second moment
@var{x2nd}. The computations are based on results from L. Kleinrock,
@cite{Queuing Systems}, Wiley, Vol 2, and Pollaczek-Khinchine formula.

@strong{INPUTS}

@table @code

@item @var{lambda}
Arrival rate

@item @var{xavg}
Average service time

@item @var{x2nd}
Second moment of service time distribution

@end table

@strong{OUTPUTS}

@table @code

@item @var{U}
Service center utilization

@item @var{R}
Service center response time

@item @var{Q}
Average number of requests in the system

@item @var{X}
Service center throughput

@item @var{p0}
Probability that there is not any request at system

@end table

@var{lambda}, @var{xavg}, @var{t2nd} can be vectors of the
same size. In this case, the results will be vectors as well.

@seealso{qsmh1}

@end deftypefn


@c
@c
@c
@node The M/Hm/1 System
@section The @math{M/H_m/1} System
@anchor{doc-qsmh1}


@deftypefn {Function File} {[@var{U}, @var{R}, @var{Q}, @var{X}, @var{p0}] =} qsmh1 (@var{lambda}, @var{mu}, @var{alpha})

@cindex @math{M/H_m/1} system

Compute utilization, response time, average number of requests and
throughput for a @math{M/H_m/1} system. In this system, the customer
service times have hyper-exponential distribution:

@tex
$$ B(x) = \sum_{j=1}^m \alpha_j(1-e^{-\mu_j x}),\quad x>0 $$
@end tex

@ifnottex
@example
@group
       ___ m
       \
B(x) =  >  alpha(j) * (1-exp(-mu(j)*x))   x>0
       /__ 
           j=1
@end group
@end example
@end ifnottex

where @math{\alpha_j} is the probability that the request is served
at phase @math{j}, in which case the average service rate is
@math{\mu_j}. After completing service at phase @math{j}, for
some @math{j}, the request exits the system.

@strong{INPUTS}

@table @code

@item @var{lambda}
Arrival rate

@item @var{mu}
@code{@var{mu}(j)} is the phase @math{j} service rate. The total
number of phases @math{m} is @code{length(@var{mu})}.

@item @var{alpha}
@code{@var{alpha}(j)} is the probability that a request
is served at phase @math{j}. @var{alpha} must have the same size
as @var{mu}.

@end table

@strong{OUTPUTS}

@table @code

@item @var{U}
Service center utilization

@item @var{R}
Service center response time

@item @var{Q}
Average number of requests in the system

@item @var{X}
Service center throughput

@end table

@end deftypefn


