# Buffer with N Policy and Active Management
## 4 Analysis
To make it useful in practice, we need to derive its unknown components: \(A(k)\), \(B(k)\), \(\bar{P}\), and \(\bar{R}\). **Part 2. ** In this part, we will derive \(A(k)\) and \(\bar{P}\), which are needed in (17). We assume \(X(0)=0\), and the buffer starts its operation in the energy-saving mode (no transmission). Moreover, the dropping function \(d_{1}(n)\) is active in this phase. Let \(Q_{1}(j,t)\) represent the probability that \(j\) packets have been inserted into the buffer by time \(t\), where \(j=0,\ldots,K-1\), assuming \(X(0)=0\). Denote  
\[q_{1}(k,s)=\int_{0}^{\infty}e^{-st}Q_{1}(k,t)\mathrm{d}t. \tag{20}\]  
From Theorem 1 of [28], it follows that  
\[q_{1}(k,s)=\frac{\prod_{i=0}^{k-1}\lambda(1-d_{1}(i))}{\prod_{i=0}^{k}[s+ \lambda(1-d_{1}(i))]}. \tag{21}\]  
Since there are no transmissions in the energy-saving phase, we have the following:  
\[\mathbb{P}\{X(t)=k,P>t|X(0)=0\}=Q_{1}(k,t),\ \ k=0,\ldots,K-1. \tag{22}\]  
and  
\[\mathbb{P}\{X(t)=k,P>t|X(0)=0\}=0,\ \ k=K,\ldots,N. \tag{23}\]  
The latter relation is clear after noticing that if \(K\) or more packets are inserted into the buffer by time \(t\) in the energy-saving phase, then \(C>t\) is impossible. From (20) and (22) we obtain the following:  
\[\int_{0}^{\infty}\mathbb{P}\{X(t)=k,P>t|X(0)=0\}=q_{1}(k,0),\quad k=0,\ldots,K -1. \tag{24}\]Hence, (21) yields the following:  
\[A(k)=\left\{ \begin{array}{ll}\frac{1}{\lambda(1-d_{1}(k))},&\text{ if }\quad k=0,\ldots,K-1,\\ 0,&\text{ if }\quad k=K,\ldots,N.\end{array} \right. \tag{25}\]  
Now we can derive \(\overline{P}\). We have the following:  
\[\overline{P}=\int_{0}^{\infty}\mathbb{P}\{P>t|X(0)=0\}\mathrm{d}t=\sum_{k=0} ^{K-1}\int_{0}^{\infty}\mathbb{P}\{X(t)=k,P>t|X(0)=0\}\mathrm{d}t=\sum_{k=0}^{ K-1}A(k), \tag{26}\]  
which gives  
\[\overline{P}=\sum_{k=0}^{K-1}\frac{1}{\lambda(1-d_{1}(k))}. \tag{27}\]  
**Part 3. ** In this part, we will derive \(B(k)\) and \(\bar{R}\), which are needed in (17). We now assume that \(X(0)=n>0\), and the buffer starts its operation in the transmission mode. That is, at \(t=0\), transmission of a packet from the queue begins, and the dropping function \(d_{2}(n)\) becomes active. Denote  
\[H(n,k,t)=\mathbb{P}\{X(t)=k,Y_{1}>t|X(0)=n\},\quad n,k=1,\ldots,N, \tag{28}\]  
where \(Y_{1}\) is the time when the first transmission phase ends. Let \(Q_{2}(n,j,t)\) represent the probability that \(j\) packets have been inserted into the buffer by time \(t\) during the first transmission phase, assuming no transmissions have been completed by \(t\) and \(X(0)=n>0\). Function \(H(n,k,t)\) must satisfy the following set of integral equations:  
\[ \begin{split} H(n,k,t)=\sum_{j=0}^{N-n}\int_{0}^{t}H(n+j-1,k,t-u )Q_{2}(n,j,u)\mathrm{d}F(u)+\delta(n,k)Q_{2}(n,k-n,t)[1-F(t)],\\ n=2,\ldots,N;k=1,\ldots,N,\end{split}  \tag{29}\]  
where \(\delta(n,k)=1\) if \(k\geq n\) and \(\delta(n,k)=0\) otherwise. Specifically, (29) is procured by conditioning on the first packet's completion time, \(u\). The first component, i.e., the integral, handles the situation when \(u\leq t\). In this case, with probability \(Q_{2}(n,j,u)\), \(j\) new packets are inserted into the buffer by time \(u\); hence, the buffer occupancy at \(u\) is \(n+j-1\), and \(t-u\) time remains to achieve \(X(t)=k\). The second component of (29) handles the situation when \(u>t\), which has probability \(1-F(t)\). Moreover, in this situation \(X(t)=k\) is possible only if \(k\geq n\), hence \(\delta(n,k)\) is applied. Finally, to have \(X(t)=k\), exactly \(k-n\) packets must be inserted into the buffer by time \(t\), which has probability \(Q(n,k-n,t)\). Note that in the first component of (29), it is allowed that \(j=0\), i.e., no packets are inserted into the buffer by \(u\). However, we cannot have \(n=1\) and \(j=0\) simultaneously because it would imply that the buffer becomes empty at \(u\), which contradicts \(Y_{1}>t\). Hence, (29) is valid only for \(n\geq 2\). For \(n=1\), we need to write a separate equation. It is identical to (29), except that \(j=0\) must be excluded for the reason given above.