# A Secure Protocol against Selfish and Pollution Attacker Misbehavior in Clustered WSNs
## 5 Simulation Setup and Results
### Simulation Results  
The sensor network, which is composed of 100 nodes with IDs [1; 100] randomly deployed, is illustrated in Figure 5. \begin{table}
\begin{tabular}{c c} \hline \hline
**Parameter** & **Value** \\ \hline Size of the region & 600 \(\times\) 600 (in meters) \\ Placement of nodes & uniform random distribution \\ Location of the \(BS\) & x = 150, y = 200 \\ Routing algorithm used & SSP and SNCR \\ Number of rounds & 500 \\ Number of nodes deployed & 100 \\ Number of clusters \(N\) & 15 \\ Total number of original messages \(O\) & 85 \\ number of original packets \(t\) & 5 \\ number of transformed packets \(p\) & 10 \\ number of \(MN\)s among the \(CH\)s (threshold \(K\)) & 4 \\ Initial energy of a sensor node (\(E_{0}\)) & 2 J \\ \(E_{elec}\) & 50 nJ/bit \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Network parameters. We execute a \(K\)-means algorithm, and the obtained result is 15 clusters distributed as shown in Figure 6. The \(K\)-means algorithm processes an unsupervised learning with the aim of minimizing the distance between member nodes and their \(CH\)s. Consequently, it reduces the energy consumption of inter-cluster communication. Figure 7 depicts the \(PDR\) ratio and the correct messages ratio for both \(SNCR\) and \(SSP\) when a \(DoS\) attack is performed. The first ratio is between the number of data packets received at the \(BS\) and the number of data packets sent in the network. The second ratio is between the number of successfully constructed messages within the \(BS\) and the number of total messages sent by source nodes. Figure 5: The initially deployed network. Figure 6: The network clustered. Calculations were done by varying the number of rounds and fixing the number of selfish \(CH\) nodes at the value \(t-p-1\). The resulting values were similar for each round for each protocol. This is why we presented a single value for the \(PDR\) ratio and for the correct messages ratio for both protocols. Figure 7 shows that in the case of a defenseless \(SNCR\), the value of the correct messages ratio successfully received at the \(BS\) decreased significantly compared to the \(PDR\) ratio value. It also shows that for the \(SSP\) protocol, the value of the correct messages ratio is greater than the \(PDR\) ratio value. This graph shows that a \(DoS\) attack conducted by the \(M\)N and affecting the \(PDR\) ratio parameter has a negative influence on the total number of successfully received messages for the \(SNCR\) protocol, which decreased to 30%. It does not affect the total number of successfully received messages in the case of the \(SSP\) protocol, which maintains a value of almost 100%. In fact, as the \(PDR\) ratio decreases, the correct messages ratio increases. We can conclude from these results that the proposed solution is beneficial in maintaining reception of a high number of correct data packets at the final destination despite an adversarial attack. In fact, if a number of data parts are lost due to attacks on the network, the \(BS\) is still capable of constructing all the original data packets. Figure 8 presents the impact of increasing the number of malicious \(CH\) nodes, performing a pollution attack, on the variation in the number of correct messages received at the \(BS\) for \(SNCR\) and \(SSP\) protocols. The number of correct messages received at the \(BS\) is the number of correctly constructed messages at the end of the routing process. This variation decreases significantly as the intensity of pollution attack increases in the case of \(SNCR\), as shown by the red line in Figure 8. As can be seen in the graph, the presence of two or three misbehaving \(CH\) nodes in the network reduced the number of correct messages received at the \(BS\) by more than half. This number continued to decrease until it reached 0 when the number of \(M\)N was 7. This same number of correct messages has a certain stability in the case of the \(SSP\) protocol, when the intensity of the pollution attack increases.