## 5 Simulation Experiment and Analysis
### Scenario One  
In this experiment, a fixed number of packets were sent to the sink node from a fixed data source node. The source node and the sink node were located at opposite ends of the network. The packet delivery ratios and average energy consumptions of the proposed algorithm, the TANARP algorithm, the ACORC algorithm and the QOS-PSO algorithm were compared for different numbers of malicious nodes. The packet delivery ratio is defined as the ratio of the number of data packets delivered to the total number of packets sent from the source node to the sink node. The final results of the experiment are shown in Figure 7. When no malicious node exists in the network, the proposed algorithm, TANARP, ACORC and QOS-PSO all present similar results. It is obvious that as the number of malicious nodes increases, the packet delivery ratios of the three algorithms exhibit a decreasing trend. Of the three algorithms, the rate of decrease of ACORC's \begin{table}
\begin{tabular}{c c} \hline
**Parameter** & **Value** \\ \hline Number of nodes & 100 \\ Network area & 100 m \(\times\) 100 m \\ Data packet size & 64 bytes \\ Link bandwidth & 1 Mbps \\ Maximum data transfer rate & 128 kbps \\ Communication range & 30 m \\ Normal node reputation value & 0.8 \\ Malicious node reputation value & 0.3 \\ Node coincidence threshold & 1.75 \\ Weakening factor & 0.4 \\ Node group radius & 10 m \\ \hline \end{tabular}
\end{table} 
Table 1: List of experimental parameters. \begin{table}
\begin{tabular}{c c c c} \hline
**Node Coincidence Threshold** & **5 m** & **10 m** & **20 m** \\ \hline
1 & 0 & 0 & 0 \\
1.5 & 2 & 2 & 0 \\
1.75 & 2 & 5 & 0 \\
2 & 2 & 13 & 0 \\
2.5 & 2 & 18 & 0 \\ \hline \end{tabular}
\end{table} 
Table 2: The number of redundant nodes under different parameter settings. delivery ratio is the largest, that of the algorithm proposed in this paper is the smallest, and that of the QOS-POS algorithm is in the middle. The main reason for this phenomenon is that the algorithm proposed in this paper not only considers factors such as time delay and residual energy in the pheromone calculation process but also treats the reputation value as a component of the pheromone. When selecting the next-hop node, the current node considers the node reputation values and will jump over a node with a lower reputation value. The security factor of the node reputation is used to select the transmission path; therefore, this algorithm can function well even in the presence of a large number of malicious nodes while also maintaining a high rate of packet delivery, thereby effectively reducing the damage to data transmission caused by malicious nodes. Since the ACORC algorithm considers only the path length in pheromone calculation, the robustness of the nodes during the transmission process is relatively poor. Figure 8 compares the average energy consumptions of the four algorithms with respect to the number of malicious nodes. As seen from the plot, the average energy consumption of the proposed algorithm is lower than those of the other three algorithms. When no malicious node exists in the network, the average energy consumption of the proposed algorithm, TANARP and QOS-PSO are very close, because they all have considered energy efficiency and energy consumption balance, especially for small sized networks. However, the ACORC algorithm based on ant-colony  
Figure 8: Comparison of the average energy consumptions for different numbers of malicious nodes. Figure 7: Comparison of packet delivery ratios for different numbers of malicious nodes. optimization considers only the path length in the pheromone computations, so its average energy consumption is relatively large. As the number of malicious nodes increases, the energy consumptions of all four algorithms increase. The other three algorithms do not fully consider network security factors in their routing protocols, whereas the proposed algorithm measures the node credibility by monitoring the communication behaviors of the nodes.