## Dynamic Key Sharing and Fuzzy Adaptive Route Selection
### Fuzzy Adaptive Selection of Data Forwarding Routes
#### 3.6.2 Input and Output Variables  
Our method makes use of fuzzy inferencing carried out at the e-CH and estimates the qualification of the data forwarding paths. Whenever the e-CH chooses to select one among the available paths, it considers the following factors as input variables into the fuzzy module:  
1. \(NKIH\) = The number of verification keys within \(h\) hops from the event cluster where \(h=L\);
2. \(DIST\) = The hop-count distance ratio between the routing path being considered and the longest path between the e-CH and the BS;
3. \(REL\) = The average of the residual energy levels of the nodes on the data forwarding path [31]. \(DIST\) is calculated as: \[DIST=\ \frac{d_{n}}{d_{L}}\times\ 100\ (\%),\] (5)  
where, \(d_{n}\) = the length of the path being considered for selection, \(d_{L}\) = the longest path length between the e-CH and the BS. \(NKIH\) is calculated using:  
\[NKIL\ =\ n/L, \tag{6}\]  
where, \(n\) = the number of keys within \(h\) hops on the path being considered, \(L\) = the cluster size (which is equal to the number of total authentication keys for the same event-reporting cluster). The authentication keys are shared by the cluster member nodes with the intermediate CHs after they are selected by e-CH. Therefore, the e-CH knows their IDs and distances as it does in [7; 11; 29]. If the distance between the e-CH and BS is greater than or equal to \(L\) the e-CH initially probabilistically chooses the number of verification nodes, which is equal to the size of cluster i.e., \(L\) verification nodes [7; 11; 29], for a given path between the BS and the e-CH. For a distance less than \(L\) hops, the e-CH may select an intermediate node to possess more than one authentication key for its cluster. The BS maintains the global key pool and performs the final verification of the reports. Therefore, for a cluster within \(L\) hops of the BS, all the verification/authentication keys happen to be within \(L\) hops, including those keys on the BS. For a cluster with a distance greater than \(L\) hops from the BS, the e-CH chooses \(L\) verification nodes on the path probabilistically as it does in [7; 11; 29]. \(REL\) is calculated as in Equation (7):  
\[REL\ =\ \sum_{i=1}^{n}\frac{E_{residuali}}{n}\ \times 100\ (\%), \tag{7}\]  
where, \(E_{residuali}\) = remaining energy of the intermediate CH\({}_{i}\) on the data forwarding path, \(L\) = total number of the verification CHs on the path. The path lengths are known to the CH from the route discovery phase [7; 11]. To calculate the energy consumptions of the nodes, the free space model is adopted as presented in [52]:  
\[E_{residual}=E_{initial}-E_{c}(t), \tag{8}\]  
\[E_{c}(t)=E_{t}+E_{r}, \tag{9}\]  
\[E_{t}=L\ \times E_{elc}+L\times\varepsilon_{free-space}\ \times d^{2}, \tag{10}\]  
\[E_{r}=L\times E_{elc}, \tag{11}\]  
\(E_{residual}\) is the residual energy of the node at time \(t\), \(E_{initial}\) denotes the initial energy, \(E_{t}\) is the total transmission energy, and \(E_{r}\) represents the energy consumed for data reception. \(E_{elc}\) represents the energy required to run the radio electronics of the node. \(\varepsilon_{free\_space}\) is the energy consumption parameter in free-space, \(L\) is the data size, and \(d\) is the distance between the transmitter and receiver. The BS acknowledges the receipt of the report and informs the e-CH of the receipt of the report. The e-CH knows the number of the reports generated within the cluster and therefore can deduce the attack ratio as given by [11]:  
\[Attack\ ratio=\frac{Reports_{senerated}-Reports_{acknowledged}}{Reports_{ generated}}\ \times 100(\%) \tag{12}\]  
The output of the fuzzy inference systems is the inferred fitness of the filtering path that is being considered for the selection. Rule-based fuzzy schemes are a handy instrument for imprecise reasoning when there is some ambiguity in the reasoning process and fuzziness in the information [53; 54]. The inference engine uses fuzzy membership functions and fuzzy rules to make a decision.