## 4 The Proposed Routing Protocol
### The Proposed Fuzzy System  
As mentioned in the prior subsections, the proposed protocol chooses one of its neighbors as _selected node_ by the proposed fuzzy system to transmit the sensed data or the buffered data packet to the base station. The proposed fuzzy system consists of two input variables, _distance_ and _number of neighbors_, and one output variable, _receiving probability_. The _distance_ variable represents the three-dimensional distance between each neighbor node and a point called _nearest point_. The nearest point is located on the radio range of the sender node which is closest to base station. _Number of neighbors_ is the number  
\begin{table}
\begin{tabular}{|c|p{142.3 pt}|} \hline
**Element Name** & **Features** \\ \hline Initiator ID & Indicates the ID number of the sender node \\ \hline Initiator Sequence Number & Illustrates the number of packets generated by the sender node \\ \hline Partial Route & Represents nodes traveled by the packets \\ \hline Data & Indicates the message content \\ \hline Start Round & Round of start sending packets \\ \hline Finish Round & Round of finish sending packets \\ \hline Delay Time & The total time required to send packets \\ \hline \end{tabular}
\end{table}
Table 2: Packet format used in the proposed protocol.  
of neighbors at each neighbor of the sender node. The receiving probability of each neighbor node is calculated by the proposed fuzzy system based on their input variables.  
The set of linguistic variables for _distance_ is _D(t)_ ={_very-near_, _near_, _medium_, _away_, _far-away_} where \(t\) is the _Node ID_ of the neighbor. Membership functions of input _distance_ are determined by triangular membership functions [37]. The graphical representation of the memberships for this input variable is shown in Figure 4.  
The set of linguistic variables for _number of neighbors_ is _N(t)_ ={_feeble_, _few_, _medium_, _many_, _lots_}. Membership functions of input _number of neighbors_ are also specified by triangular membership functions, which are depicted in Figure 5.  
The set of linguistic variables for _receiving probability_ is _R(t)_ ={_very-low_, _low_, _medium_, _high_, _very-high_}. Membership functions of the output are defined by bell shaped membership functions [37]. The graph of membership functions used in the output variable is shown in Figure 6.  
Figure 4: Memberships of the input variable _distance_.  
Figure 5: Memberships of the input variable _number of neighbors_.  
Figure 6: Memberships of the output variable _receiving probability_.  
are determined based on experiences on a network. As it was mentioned previously, these rules are the simple IF-THEN rules of _antecedent_ and _consequent,_ which are represented in Table 3. Because both of the input variables are formed of five linguistic terms, the number of fuzzy rules is \(5^{2}=25\). Total rule is constructed by aggregation of these rules to determine the output variable by fuzzy inference system. Because the output variable resulted by a fuzzy system is a fuzzy set, it should be converted to a crisp value by a _defuzzification_ method. The fuzzy set of receiving probability in the proposed fuzzy system is converted to the crisp value by means of center-of-gravity method [40] as follows:  
\[R(t)=\frac{\sum\limits_{i=1}^{n}\mu_{{}_{A}}(x_{{}_{i}})x_{{}_{i}}}{\sum \limits_{i=1}^{n}\mu_{{}_{A}}(x_{{}_{i}})} \tag{2}\]  
Where \(x_{i}\) specifies element of output universal set, \(\mu\)_(x\({}_{i}\))_ represents the membership degree of element \(x_{i}\), and \(n\) specifies the number of elements in the universal set. Table 3 represents the rule base used in SFRRP. Furthermore, Figure 7 illustrates the 3D combinational view of the determined rule base.