## 4 Proposed Solution
### Packet Transmission at Source Node
We designed and programmed the modules described above using C++ and implemented the various classes to work with existing NS-3.19 modules. Several modifications were also carried out on existing NS-3.19 modules to incorporate the various required node behaviors and the overall functionality of the proposed algorithm. In order to analyze the efficiency and other important aspects of the proposed solution ESTA is compared with the standard AODV protocol. In addition, to emphasize the effect of trust among the nodes in the network, a simulation was conducted with and without use of trust value in proposed solution. Based on the simulation results, the parameters that are compared are:

Average Packet Delivery Fraction (PDF): This is the ratio of data packets received at the destination to those generated at the CBR sources. The PDR is calculated using the Formula (8). \[PDF=\frac{1}{n}\sum_{A=0}^{n}\frac{(Pr*100\,)}{ps} \tag{8}\]

where:

_Pr_: Packets received at destination. _Ps_: Packets transmitted from source. _A_: application ID. _n_: total applications. Average End-to-End Delay: The difference in terms of delivery time of the first data packet at destination node to the time it was transmitted by the source node. The Formula (9) used for calculating the average value. \[E=\frac{1}{n}\sum_{A=0}^{n}(\,tr-ts\,) \tag{9}\]

where:

_tr_: Time of first received packet at destination. _ts_: Time of first received packet at source. _A_: application ID. _n_: total applications. Average Throughput: The number of data bits delivered at the destination node in unit time. Its measure is bits per second (bps). The Formula (10) is used for the average throughput calculation:

\[T=\frac{1}{n}\sum_{A=0}^{n}\frac{(\,N*1024+8\,)}{Transmission\,Time} \tag{10}\]

where:

_A_: application ID. _N_: total number of packets delivered. _n_: total applications. ## 6 Results and Analysis

In order to study the effect of Area, Node Mobility, and varying number of Malicious nodes, different scenarios are taken into consideration with variation in node mobility, number of nodes and variation in malicious nodes numbers. ### Scenario A

This scenario considers an area of 1000 m \(\times\) 1000 m, 50 nodes with a transmission range of 250 m each. Seven CBR-based traffic generating applications are used which produce four packets/sec of size 1024 bytes. A fixed node mobility of 2 m/s is applied with varying pause time of 0, 5, 10, 15 and 20 s. In this case, a single blackhole node is being considered with its position strategically defined to interrupt possibly all traffic taken into consideration for simulation. In order to display the effect of trust among nodes in this scenario, a simulation was done by stopping the trust implementation in the proposed algorithm. First, the PDF of AODV, ESTA and ESTA (no-Trust) with different pause times was studied. The results captured in Figure 7 show that, in the absence of any malicious node, the performance of all the nodes is high. However, there is a slight improvement with increase in the pause time. In this case, the performance of ESTA (no-Trust) is higher than ESTA. This happens due to the absence of any check mechanism on the performance of the gateway nodes, which do have connectivity to the destination, but, due to possibly longer paths, the delivery reports are taking more time to reach source nodes. So, due to this delay, the trust value is getting reduced and these gateways are not being in a trusted version. With the introduction of a blackhole node, the performance decreases overall. A unique feature noticed in this case is that, with no pause time and a moderate node speed, the performance of the ESTA is very high. If trust mechanism is not implemented, the performance of ESTA (no-Trust) is lower, but still much better than AODV. Second, for this scenario, the average end-to-end delay for the first data packet delivery is studied. Results captured in Figure 8 show that the delay in the case of AODV is always lower than the ESTA and ESTA (no-Trust).