## 6 Results and Analysis
\begin{table}
\begin{tabular}{c c} \hline \hline
**Notation** & **Meaning** \\ \hline N & Network size \\ BS & Base Station \\ CH & Cluster Head \\ CH\({}^{\prime}\) & Compromised Cluster Heads \\ CN & Cluster Node \\ CM & Cluster Members \\ NC & Number of cluster heads within a round \\ NC\({}^{\prime}\) & Number of compromised CHs [attackers] within a specific round \\ NO-DATA-PKT & Number of data packets received by a CH \\ SCH & Second Cluster Head \\ \hline \hline \end{tabular}
\end{table} 
Table 7: Equations’ notations and their meanings. without any attacks and the second one is after injecting the attack. The results of implementing these two scenarios are illustrated in Figure 9, Figure 10, and Figure 11. These results are after injecting 30% of the network's nodes with packet-dropping attacks. Figure 9 illustrates the amount of consumed energy along the simulation time. It can be seen that the consumed energy within an attack is less than without an attack. This is because, when the node drops data packets, it basically does not process or transmit data and hence it saves energy. On the other hand, this has a bad impact on the packet delivery ratio as will be explained in Figure 10.  
In reference to [65] and in case of the no attack scenario, it has been proven that the amount of sensed data packets that are delivered to the BS at the end of each round is calculated in Equation (4):  
\[\textit{Sent Sensed data}\ [\textit{No attack}]\ =\ \sum_{i=1}^{NC}\frac{\textit{ NO}-\textit{DATA}-\textit{PKT}}{\textit{CM of CHi}} \tag{4}\]  
According to LEACH, CH receives the sensed data from the sensors nodes/cluster members (CMs) according to the TDMA schedule, it aggregates them into one packet, and sends it to the BS. Throughout the round, the number of packets sent to the CH from CMs is \((NO-DATA-PKT)\), but, due to the aggregation process, only \((\frac{\textit{NO}-\textit{DATA}-\textit{PKT}}{\textit{CMs of CHi}})\) packets will be sent to the BS. Having NC of CHs, then the overall data packets received by BS are \(\sum_{i=1}^{NC}\frac{\textit{NO}-\textit{DATA}-\textit{PKT}}{\textit{CMs of CHi}}\). However, in case of compromised CHs, which will drop all packets received by them, the number of sent packets will be reduced as calculated in Equation (5), which explains the reduction in the consumed energy with the existence of packet dropping attacks. \(\textit{Sent Sensed data}\ [\textit{With attack}]\ =\ \\)  
\[\sum_{i=1}^{NC}\frac{\textit{NO}-DATA-PKT}{\textit{CMs of CHi}}\ -\ \sum_{j=1}^{NC^{\prime}}\frac{ \textit{NO}-DATA-PKT}{\textit{CMs of CHi}^{\prime}j}. \tag{5}\]  
Furthermore, the effect of the attack was measured through the packet delivery ratio because what this attack basically does is drop the packets, so it is important to measure the amount of delivered data. Packet delivery ratio is defined in Equation (6), which is the ratio of the number of delivered data packets to the destination to those generated by the source [66]:  
\[\textit{PDR}\ =\ \frac{\textit{No. of PKT Delivered}}{\textit{No. of PKT Sent}}. \tag{6}\]  
Figure 9: Energy consumption measurement. Therefore, in Figure 10, it can be seen that, without an attack, the data delivery ratio is 100% because all data sent are received. On the other hand, the percentage has decreased when the attacks were injected. The percentage of the delivery ratio has reached 97% at a simulation time of 220 s, which will continue to decrease throughout the network lifetime. As shown in Figure 11, with the existence of security attacks, the nodes live longer in the network as compared to the network that has no attacks. On the other hand, the percentage has decreased when no attacks were injected to drop the sent packets. The percentage of alive nodes has reached 77% at simulation time 240 s.  
Afterwards, the results of the implementation and testing of the suggested designs are compared and discussed in the following subsections.