# Buffer with N Policy and Active Management
## 3 Model  
We consider a WSN node with a buffer for packets of capacity \(N\), including the packet currently transmitted, if any. The buffer is fed by packets according to a Poisson process with rate \(\lambda\). This is an external process, which is independent of the operation of the node, and is never suspended. The packets arriving at the node are inserted into the buffer at the back of the queue, i.e., in the FIFO manner.  
Initially, the node operates in the energy-saving mode. This means that the output radio is off, packets are not transmitted from the queue, and the queue can only increase, but cannot decrease. The energy-saving phase terminates when the queue size achieves a critical threshold \(K\), where \(K\leq N\). Upon reaching \(K\), the transmission phase begins. Specifically, the output radio is activated and the queue starts being drained from the head through the successive transmission of packets. Transmission of a packet requires a random time, distributed in accordance with the distribution function \(F\), which has an arbitrary form. It is only assumed that it has a finite mean, \(\overline{F}\).  
The transmission phase ends when the buffer is drained completely, i.e., there are no packets to be transmitted. At this moment, the output radio is deactivated, transmission of packets is stopped, and the energy-saving phase begins again. Then the scheme repeats, with alternating energy-saving and transmission phases.  
In the course of the operation of the node, not all arriving packets are inserted into the buffer upon arrival. Some of them are dropped. Firstly, the packets arriving in the transmission phase may temporarily increase the queue size beyond \(K\). The queue may even reach level \(N\), saturating the buffer completely. If the buffer gets saturated, then every arriving packet is dropped owing to the absence of storage capacity.  
Moreover, the arriving packets are subject to active queue management, which has different parameters in the energy-saving phase and the transmission phase. Specifically, if in the energy-saving phase the queue size is \(n\) upon a packet's arrival, the incoming packet is removed with probability \(d_{1}(n)\). If in the transmission phase the queue size is \(n\) upon a packet's arrival the incoming packet is removed with probability \(d_{2}(n)\).  
Both dropping functions \(d_{1}\) and \(d_{2}\) can take arbitrary forms. In particular, one or both of them may have the form of the shifted Heaviside step function, i.e.:  
\[d^{*}(n)=\left\{\begin{array}{l l}0,&\text{ if }&n<N,\\ \\ 1,&\text{ if }&n\geq N.\end{array}\right. \tag{1}\]  
If \(d_{1}(n)=d^{*}(n)\) or \(d_{2}(n)=d^{*}(n)\), then in one or two phases of operation we in fact have passive queue management, with the classic drop-tail algorithm. Therefore, the examined model includes the previously researched model without active management if \(d_{1}(n)=d_{2}(n)=d^{*}(n)\). However, it is much more general than that because, in general, functions \(d_{1}(n)\) and \(d_{2}(n)\) can have any arbitrary complex form.  
Hereafter, \(\mathbb{P}\) denotes probability, \(X(t)\) denotes the queue length at \(t\). We maintain the convention that \(X(t)\) includes the packet transmitted at \(t\), if applicable. The stationary distribution of the queue length is denoted by \(\pi(k)\), i.e.:  
\[\pi(k)=\lim_{t\to\infty}\mathbb{P}\{X(t)=k\},\ \ k=0,1,\ldots,N, \tag{2}\]  
whereas the average queue size by \(\overline{X}\), i.e.:  
\[\overline{X}=\sum_{k=0}^{N}k\pi(k). \tag{3}\]  
The energy efficiency \(E\) is defined as the long-run portion of time when the output radio is off. In other words, \(E\) is the expected length of the energy-saving phase divided by the expected length of the whole cycle, i.e., energy-saving phase plus transmission phase.  
The throughput \(\gamma\) is defined as the count of packets transmitted in a time unit, averaged over both the energy-saving and transmission phases.