**5. Simulation Results**

The main purpose of this research was to reduce energy consumption and increase the network life time. In order to achieve this purpose, simulations were performed in MATLAB programming environment. Furthermore, to evaluate network stability, efficiency, and throughput of the proposed algorithm, this algorithm was compared to ECDC (2013) [24], HUCL (2015) [15], and EADUC-II (2016) [25] algorithms.

#### *5.1. Simulation Scenarios*

We also performed simulations for two different states shown in Table 2. In the first scenario, there are 100 nodes in 200 × 200 spaces and the BS is located outside the network space and located at 100 × 250. In the second scenario, the location of the BS has changed to the network center and 100 × 100 location.


In the proposed algorithm the count of alive nodes, the average of network energy and network stability, first node death (FND), half node death (HND), death of 10% and 20% of nodes (PND), and last node death (LND) during the whole simulation time were evaluated. The simulation was performed in 50 periods.

Definitions of some important concepts:

• Network lifetime: the time interval from the start of network operations to LND.


#### *5.2. Simulation Parameters*

Simulation parameters are displayed in Table 3. The optimum values of some of the parameters (for example *RLmax*) were determined from various simulation results.


**Table 3.** Parameters used in the simulation.

We performed simulations several times to determine the round numbers in a major slot (Figure 2) and major slot in data transmission stage (Figure 2). Simulation parameters, such as the nodes locations, are considered to be the same for all the nodes so that the results are reliable and solid. This simulation plays a crucial role in the proposed protocol. In this protocol, by decreasing the number of rounds, we can more accurately simulate a dynamic method which results in increased overhead and energy consumption and declined the network life span. In contrast, by increasing the number of rounds the proposed protocol gets closer to the static methods and, therefore, leads to a decrease is overhead and loss of energy in CH and, subsequently, the stability and throughput of the network reduced. Since the main aim of the proposed protocol was to increase the maximum lifetime of the network by eliminating maximum control messages and reducing overhead which leads to the reduced energy consumption of networks nodes. The number of rounds in a major slot and the number of major slots in data transmission should be optimized. In order to determine the abovementioned optimized numbers, the simulation was performed several times. Considering the structure of the proposed method, we preferred to set the amount of the mentioned parameter to the highest value of FND. According to Figures 5 and 6 we considered the count of rounds as 6 and the count of the major slot as *7*. The optimum FND average was obtained in different simulations. According to the simulation results, it can be seen that each data transmission stage consists of *7* portions of the major slot including 6 rounds, one CH rotation, and one adjustment route. Overall, during the data transmission stage, data was transmitted in 42 rounds and we aimed to remove the majority of the network overhead.

**Figure 5.** Network lifetime under different rounds in different major slots at data transmission stage for scenario #1 with Rlmax = 100 and initial energy = 1 J.

For results and considered parameters refer to Figure 2. Figure 2 demonstrates the protocol performance considering the number of rounds and major slots. According to the results of Figure 5, we set the number of rounds and a major slot in Figure 2.

One of the most important parameters in clustering is to determine the radius. The radius of the nodes in each layer of the proposed protocol is intentionally considered as different sizes. Thus, the value of *λ* in Equation (4) in the first layer is equal to 1, in the second and third layers is 1.25, and in the fourth layer is 1.75. Thus, the clusters which are closer to the BS are smaller and the CH can have more energy for relaying and routing other CH packets to the BS. To determine the *RLmax* parameter in the Equation (4) we carried out various simulation runs with different *RLmax* values to obtain the optimum value for *RLmax* parameter. Two of the important factors in IoT-based wireless nodes are the number of CH and the size of clusters, which are dependent on the radius of the nodes. The simulation results for different scenarios are shown in Figure 7.

**Figure 6.** Network lifetime under different rounds in different major slots at data transmission stage for scenario #2 with Rlmax = 100 and initial energy = 1 J.

**Figure 7.** CH generated in two scenarios.

The radius of each node must be so that the number of cluster nodes in the network is reasonable. In the paper, the number of optimal CH was considered equal to 5% of the total number of nodes in the network. In our proposed protocol, we assumed that the value of *RLmax* parameter is equal to 100 m which makes the number of CH approximately equal to 5 based on [3].

Figures 8 and 9 demonstrate the routing and clustering graph formed in one of the simulations for scenarios 1 and 2. Green nodes display CM nodes, turquoise color indicates ACH nodes, and CHs are indicated in blue color. According to these figures, clusters close to BS are smaller and as a result, they have more energy for distant CH data relay. In addition, ACH nodes cooperate with CH in data transmission. If the network area is larger, and the distance of nodes are farther, then the role of these nodes will be more effective.

**Figure 8.** Routing and clustering graph for scenario 1.

**Figure 9.** Routing and clustering graph for scenario 2.
