# Improvement of Perception Layer Routing Protocol with Static Nodes in IoT-Based Microgrids
## 4 Algorithm Simulation and Analysis  
To accurately evaluate the performance of the proposed SERP protocol and verify its effectiveness in reducing energy consumption and prolonging the network life cycle in a static-node IoT perception layer network, a simulation experiment is conducted. A simulation environment is set up with the MATLAB tools, and simulation parameters are set by referring to [1,2]. Compared with the LEACH protocol, the main parameters of simulation are shown in Table 1.  
It is impossible for the normal network to maintain its normal functions when there are too few surviving nodes. In the paper, simulation will be termin  
Figure 4: Flow chart of the SERP protocol algorithm. of dead nodes exceeds 95%, so that the performance of various routing protocols can be more effectively compared. In the paper, the LEACH protocol, HEED protocol and the proposed SERP protocol are selected, compared and analyzed in terms of performance from the total network energy consumption, the network life cycle and total data throughput, respectively. To eliminate the contingency of the simulation results, the number of nodes is set to \(N=100\) and \(N=300\), respectively, to compare the performance of routing protocols under different network scales. It can be seen from Figures 5 and 6 that the energy consumption rate of nodes in the SERP protocol is slower than that in either the LEACH protocol or the HEED protocol, and the round of energy depletion also emerges later. With the increase of the number of running rounds, some nodes begin to die, and the increase rate of the total energy consumption of the three protocols gradually slows down until all nodes die to a maximum. When the number of nodes n increases from 100 to 300, the node energy consumption rate under LEACH protocol becomes significantly faster. In contrast, the node energy of heed protocol and SERP protocol can maintain a stable increase. At the same time, the total energy consumption of nodes under SERP protocol remains the lowest and the total number of running rounds is the largest. This shows that the SERP protocol can still maintain stable energy loss in large-scale node networks. This indicates that the improvement of the cluster head selection threshold is achieved through the distance factor and energy factor. \begin{table}
\begin{tabular}{c c} \hline \hline
**Parameters** & **Setting** \\ \hline Positions of base station nodes & \((50\) m, \(150\) m) \\ Energy coefficient, \(\epsilon\) & \(4\) pJ/ \((\) bit/m\({}^{2})\) \\ Initial energy of node, \(E_{0}\) & \(0.005\) \\ Energy consumption for transmission of a unit bit of data, \(E_{PX}\) & \(4\) pJ/bit \\ Energy consumption for receiving a unit bit of data, \(E_{RX}\) & \(60\) pJ/bit \\ Energy consumption for fusing a unit bit of data, \(E_{DA}\) & \(5\) pJ/bit \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Simulation parameters. Figure 5: Total energy consumption of the network when the number of nodes \(N=100\). From Figures 7 and 8, it can be seen that compared with the LEACH protocol, the SERP protocol has a slower rate of node death, and requires a larger number of rounds before 95% of nodes die, which effectively prolongs the network life cycle and improves slightly compared with the HEED protocol. At the same time, when the number of network nodes N increases, in the LEACH protocol, nodes die in the 300 th-400 th rounds, indicating that the LEACH protocol is not stable enough for larger networks. As a direct result, LEACH protocol has lost most nodes when it runs to half of the total number of running rounds. Instead, the SERP protocol can still maintain a low rate of node death, which demonstrates that it has a network stability than the LEACH protocol. From Figures 9 and 10, the total data throughput of the network can be observed. Although the LEACH protocol has a high data throughput rate at the beginning, its nodes die faster, thus significantly reducing the throughput rate when the number of dead nodes reaches a certain level.