\documentclass[a4paper,12pt]{article}
\usepackage[fleqn,tbtags]{amsmath}
\usepackage[dvips]{graphicx}
\usepackage{mathtools}
\begin{document}
\title{Telecommunications System Modelling \\ A Two Stage Buffer Dimensioning Problem}
\author{Jing Du \\ Marek Dziadosz-Findlay \\ Brendan Hennessy}
\maketitle
\newpage

\section{Executive Summary}

\newpage

\section{Connection Level Model}

The switch consists of N servers processing up to N connections. New connections arriving are blocked if all servers are busy. This gives the following state space and state transition diagram.

State Space S = \{0,1,2,\ldots,N\}

\includegraphics{Model.eps}

Rate equations are as follows\\
\begin{align*}
q_{j,j+1} &= \lambda &for \quad & 0 \leq j \leq N-1\\
q_{j,j-1} &= j\mu &for \quad &1 \leq j \leq N\\
q_{j,j} &= -(j\mu + \lambda ) &for \quad &0 \leq j \leq N-1\\
q_{N,N} &= -N\mu\\
\end{align*}
Assume equilibrium condition, since we are only interested in the stable condition.
\\
Global Balance equation:
\[
\sum_{k\not =j , k\varepsilon S}^n \pi_kq_{k,j}\
=
\sum_{k\not =j , k\varepsilon S}^n \pi_jq_{j,k}\
\]
The total sum of rate of change at one state is zero.
Hence we can come out with
\begin{align}
N\mu \pi_N &= \lambda \pi_{N-1} 
&& \text{at boundary state N.}\\
(j\mu+\lambda ) \pi_j &= \lambda \pi_{j-1} + (j+1)\mu \pi_{j+1} 
&& \text{for for $j\varepsilon\{1,2,\ldots,N-1\}$ }\\
\lambda \pi_0 &= \mu \pi_1 
&& \text{at boundary state 0}
\end{align}
From equation (2) we get
\begin{align*}
j\mu \pi_j + \lambda \pi_j &= \lambda \pi_{j-1} + (j+1)\mu \pi_{j+1}\\
\Rightarrow  j\mu \pi_j - \lambda \pi_{j-1} &= (j+1)\mu \pi_{j+1} - \lambda \pi_j\\
\end{align*}
Which is of the form\\
\indent $A_j = A_{j+1}$\\
Where\\
\indent $A_j = j\mu\pi_j - \lambda \pi_{j-1}$\\
Hence $A_j = A_1$ 
for all states $j \varepsilon S$, but $A_1 = 0$ by equation (3).\\
\\
Therefore we have\\
\begin{align}
j\mu\pi_j = \lambda\pi_{j-1} && \text{for $j\varepsilon\{0,1,2,\ldots,N\}$}
\end{align}
\begin{align*}
\text{Hence} \indent \pi_j &= \frac{\lambda \pi_{j-1}}{j\mu}\\
&=\frac{\lambda^2 \pi_{j-2}}{j(j-1)\mu^2}\\
&=\left(\frac{\lambda}{\mu}\right)^j \frac{1}{j!} \pi_0 && \text{for $j\varepsilon\{0,1,2,\ldots,N\}$}
\end{align*}
\begin{align*}
\text{We know} \indent &\sum_{j=0}^N \pi_j = 1\\
&\Rightarrow \sum_{j=0}^N \left(\frac{\lambda}{\mu}\right)^j \frac{1}{j!} \pi_0 = 1\\
&\Longrightarrow \pi_o = \left[ \sum_{j=0}^N \left(\frac{\lambda}{\mu}\right)^j \frac{1}{j!} \right]^{-1}
\end{align*}
\begin{align*}
\text{Therefore} \indent \pi_j = \frac{\left(\frac{\lambda}{\mu}\right)^j \frac{1}{j!}}{ \sum_{i=0}^N \left(\frac{\lambda}{\mu}\right)^i \frac{1}{i!} }\\
\end{align*}

\newpage

\section{Packet Level Model}

Packets arriving to the switch from active connections can be queued in an M-packet length buffer. Assume maximum number of connections N are present, with each connection  given an equal share of the packet buffer and the service rate. Therefore a single server queue with buffer size P can model the packet arrival process for a single connection. This gives the following state space and state transition diagram. 
\\
State Space S = \{0,1,2,\ldots,P\} where P is the maximum buffer size for a single connection and is equal to M/N

\includegraphics{Model2.eps}
Rate equations are as follows\\
\begin{align*}
q_{j,j+1} &= \lambda &for \quad & 0 \leq j \leq P-1\\
q_{j,j-1} &= \mu &for \quad &1 \leq j \leq P \\
q_{j,j} &= -(\mu + \lambda ) &for \quad &0 \leq j \leq P-1\\
q_{P,P} &= -P\mu\\
\end{align*}
Assume equilibrium condition, since we are only interested in the stable condition.
\\
Global Balance equation:
\[
\sum_{k\not =j , k\varepsilon S}^n \pi_kq_{k,j}\
=
\sum_{k\not =j , k\varepsilon S}^n \pi_jq_{j,k}\
\]
The total sum of rate of change at one state is zero.\
Hence we can come out with
\begin{align}
\mu \pi_N &= \lambda \pi_{P-1} 
&& \text{at boundary state P.}\\
(\mu+\lambda ) \pi_j &= \lambda \pi_{j-1} + (j+1)\mu \pi_{j+1} 
&& \text{for for $j\varepsilon\{1,2,\ldots,P-1\}$ }\\
\lambda \pi_0 &= \mu \pi_1 
&& \text{at boundary state 0}
\end{align}
From equation (6) we get
\begin{align*}
\mu \pi_j + \lambda \pi_j &= \lambda \pi_{j-1} + \mu \pi_{j+1}\\
\Rightarrow  \mu \pi_j - \lambda \pi_{j-1} &= \mu \pi_{j+1} - \lambda \pi_j\\
\end{align*}
Which is of the form\\
\indent $A_j = A_{j+1}$\\
Where\\
\indent $A_j = \mu\pi_j - \lambda \pi_{j-1}$\\
Hence $A_j = A_1$ 
for all states $j \varepsilon S$, but $A_1 = 0$ by equation (7).\\
\\

Therefore we have\\
\begin{align}
\mu\pi_j = \lambda\pi_{j-1} && \text{for $j\varepsilon\{0,1,2,\ldots,P\}$}
\end{align}
\begin{align*}
\text{Hence} \indent \pi_j &= \frac{\lambda \pi_{j-1}}{\mu}\\
&=\frac{\lambda^2 \pi_{j-2}}{\mu^2}\\
&=\left(\frac{\lambda}{\mu}\right)^j  \pi_0 && \text{for $j\varepsilon\{0,1,2,\ldots,P\}$}
\end{align*}
\begin{align*}
\text{We know} \indent &\sum_{j=0}^N \pi_j = 1\\
&\Rightarrow \sum_{j=0}^N \left(\frac{\lambda}{\mu}\right)^j  \pi_0 = 1\\
&\Longrightarrow \pi_o = \left[ \sum_{j=0}^N \left(\frac{\lambda}{\mu}\right)^j \right]^{-1}
\end{align*}
\begin{align*}
\text{Therefore} \indent \pi_j = \frac{\left(\frac{\lambda}{\mu}\right)^j }{ \sum_{i=0}^P \left(\frac{\lambda}{\mu}\right)^i  }\\
\end{align*}

\newpage

\section{Results}
With the two expressions for the blocking probabilities:
\begin{align*}
\indent \pi_N = \frac{\left(\frac{\lambda}{\mu}\right)^N \frac{1}{N!}}{ \sum_{i=0}^N \left(\frac{\lambda}{\mu}\right)^i \frac{1}{i!} } \indent \text{and} \indent \pi_P = \frac{\left(\frac{\lambda}{\mu}\right)^P }{ \sum_{i=0}^P \left(\frac{\lambda}{\mu}\right)^i  }\\
\end{align*}
we were able to calculate the maximum number of connections the switch needs to handle aswell as the required size of the buffer in each switch. \\
\subsection{The Five Cases}
This is a list of calculated sizes given the contraints and requirements included in the five different cases. One thing we noticed is the buffer size seems to be particularly sensitive to the average connection time of the connections, as even a small increase from case 4 to case 5 caused the required buffer to increase greatly. \\

\subsubsection{}

For the first case, where connections arrived at a rate of 10 per minute with each having a mean sojourn time of 3 minutes with each connection transmitting packets at a rate of 9000 per second. The switch needs to handle up to 42 connections, and the buffer needs to accomodate up to 128,730 packets.\\

\subsubsection{}
The second case had connections arriving at a rate of 100 per minute, a mean sojourn time of 3 minutes and a packet transmission rate of 900 packets per second. With these, the switch needs to handle up to 324 connections and the buffer needs to be 195,670 packets long.\\

\subsubsection{}
The third case had connections arriving at a rate of 10 per minute, a mean sojourn time of 30 minutes and a packet transmission rate of 900 packets per second. With these, the switch needs to handle up to 324 connections and the buffer needs to be 195,670 packets long.\\

\subsubsection{}
The fourth case had connections arriving at a rate of 100 per minute, a mean sojourn time of 30 minutes and a packet transmission rate of 90 packets per second. With these, the switch needs to handle up to 3023 connections and the buffer needs to be 568,320 packets long.\\

\subsubsection{}
The last case had connections arriving at a rate of 100 per minute, a mean sojourn time of 32 minutes and a packet transmission rate of 90 packets per second. With these, the switch needs to handle up to 3222 connections and the buffer needs to be 1,643,220 packets long.\\


\end{document} 