# A Clustering WSN Routing Protocol Based on k-d Tree Algorithm
## 5 Simulation and Results Analysis
### Results Summary  
Figure 17 shows a general overview of the distribution symmetry of metrics, showing that (a) LEACH and LEACH-C shows a tendency to a symmetrical distribution of CH nodes in both the random and deterministic scenarios (This is due to the random function used in its algorithm). This result does not occur with H-kdtree. The four anomalous values shown in LEACH and LEACH-C are the minimum and maximum values in the observed rounds, outside the first and third quartile. The anomalous values for H-kdtree in the deterministic scenario are in the last rounds. Regarding CH node formation, H-kdtree shows low variability, with most of the data in the first and second quartile. Our interpretation is that at least 75% of CH nodes formed showed low variability along the observed rounds. Figure 17a and Table 3 show the low variability in the number of CH nodes. H-kdtree kept the number of CH nodes below the number of CH nodes generated by LEACH for the first 75 rounds (Q3). H-kdtree showed a reduction of 14.21% for the random scenario and of 30.14% for the deterministic scenario, as compared to LEACH. Regarding average energy consumption for all nodes as shown in Figure 17b and Table 4, the energy behavior was similar in both H-kdtree and LEACH during the observed rounds. LEACH-C presents an energy efficiency above 40%, in relation to LEACH and H-kdtree. Figure 17c and Table 5 shows a proportional relationship between CH node formation and the number of dead nodes along the observed rounds. To compare the results and quantify them as percentages, we used normalized averages. This will allow us to estimate the performance improvement for the metrics in the protocols, taking as a reference point the results for LEACH in the random scenario. Figure 17: General energy metrics with 200 nodes. Figure 17c and Table 5 shows that between quartiles Q1 and Q3, which correspond to the 25% and 7% of the number of observed rounds, H-kdtree presented the lowest number of dead nodes. In its final stage, H-kdtree shows the highest number of dead nodes due to the on-demand CH node generation mechanism, compensated with energy expenditure after the Q3 quartile. Although H-kdtree does not provide an optimal node energy distribution, the on-demand CH node selection mechanism provides a significant improvement in QoS, as measured in delay, jitter, and throughput. The variability in delay, jitter, and throughput of the proposed H-kdtree protocol as compared to LEACH and LEACH-C is very low in the random and deterministic scenarios, as shown in Figure 18. This is because the level of dispersion of values from the central trend in LEACH and LEACH-C is quite noticeable. These observations allow us to estimate QoS both quantitatively and qualitatively, supporting applications with higher demands. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Protocol** & **LEACH (r)** & **LEACH-C (r)** & **H-kdtree (r)** & **LEACH (d)** & **LEACH-C (d)** & **H-kdtree (d)** \\ \hline Min & 0.03918 & 0.08321 & 0.04041 & 0.04849 & 0.07806 & 0.04343 \\ Q1 & 0.05265 & 0.09902 & 0.06184 & 0.06551 & 0.09443 & 0.05878 \\ Average & 0.07959 & 0.11681 & 0.09122 & 0.09061 & 0.11377 & 0.0851 \\ Q3 & 0.112 & 0.1343 & 0.12 & 0.1188 & 0.13331 & 0.1157 \\ Max & 0.1416 & 0.15162 & 0.142 & 0.1339 & 0.1623 & 0.1414 \\ Normalized average & 1 & 1.4676 & 1.1461 & 1.1384 & 1.4294 & 1.0692 \\ Variance & 0.001139 & 0.000406 & 0.001115 & 0.000951 & 0.000487 & 0.001042 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Average energy of each node with 200 nodes. (r) random—(d) deterministic.