## 6 Network Layer for WVSN
### _Hierarchical level based packet selection_  
In an energy level based scheme, the probability of discarding a packet is independent from the number of nodes that packet passed. Dropping a packet that is close to Sink (passed a lot of nodes) wastes more energy than dropping a packet close to the source node (only a few nodes passed) does. Thus, it is unfair to drop packets only on the basis of node energy. Consequently, an efficient packet discarding policy should consider preceding invested energy of each node. To achieve same drop probability for all packets (with the same priority level) received in the Sink, which originated from any node of the network, a fair drop selection policy should be defined. This motivates to find another probability factor to modify energy based drop probability. Therefore, the following equations should be satisfied:  
\[\begin{split} P_{11}^{(1)}=(1-\lambda)\\ P_{k2}^{(2)}=P_{k2}^{(1)}\
eq P_{k12}^{(1)}=(1-\lambda)\\ P_{k33}^{(3)}=P_{k33}^{(1)}\
eq P_{k23}^{(1)}\
eq P_{k13}^{(1)}=(1- \lambda)\\ \cdot\\ \cdot\\ P_{kab}^{(l)}=P_{kab}^{(1)}\ast P_{k(a-l)b}^{(1)}\ast...\ast P_{k(a-( l-1))b}^{(1)}=(1-\lambda)\end{split} \tag{7}\]  
In these equations, \(P_{kab}^{(l)}\) is the probability of receiving a packet in the base-station (Sink), where \(l\) is the number of levels that a packet should pass, \(k\) is packet priority level, \(a\) is the relying video node level, \(b\) is the source video node level, and \(\lambda\) is the constant that shows the specified dropping probability. It is optimistic to have functions that generate the related probabilities in the mentioned equations. Therefore, a close function is defined to calculate a probability that in conjunction with  
Figure 14: a) Dropping probability for packets with different priorities when energy state of node is higher than \(ES_{(N\cdot l)}\), b) Dropping probability for the packets with different priorities in a node with energy state lower than \(ES_{(k)}\)energy based packet drop probability results in a reasonable fair drop probability that somehow satisfies Equation (7). The proposed four-variable function is presented in Equation (8).  
\[F(a,b,t,n)=1-\begin{cases}\dfrac{\left[s-\left(a-t\right)\right]^{n}}{\left[s- \left(a-t\right)\right]^{n}+\left[t\right]^{n}}&,\left(s=b-a\right)\qquad if \left[s-\left(a-t\right)\right]>=0\\ 0&\textit{Otherwise}\end{cases} \tag{8}\]  
The presented function gives the second drop probability of each packet. In this equation \(t\) and \(n\) are two positive constant values that should be specified with regards to application. Both \(a\) and \(b\) are related to hierarchical levels (see Section 6.1. above) of relay and video capture node respectively.  
Using this probability function along with energy based dropping probability, increases the receiving chance of the packets which passed more nodes than others. In other words, the receiving chance of packets generated by nodes close to the Sink is somehow the same as packets generated by nodes far from the Sink.  
To drop a packet, a random number \(R\in\,[0,\,1]\) is chosen. In case of \(R=<F\)_(a, b, t, n)_, the received packet will be dropped if it has energy based dropping condition, otherwise the packet is forwarded. Figure 15, illustrates the effect of some parameters on the function \(F\left(a,b,t,n\right)\) at a network with _18_ hierarchical levels.