# Energy Efficient Routing Protocol in Sensor Networks Using Genetic Algorithm
## 5 Simulation, Parameters and Metrics  
Our implementation is carried out using the NS2.35. It is a discrete-time event network simulator. In our simulation, we wrote an Object-Oriented Tool Command Language (OTcl) script to design the network in terms of its parameters and topologies such as traffic source, used routing algorithms, simulation time, the total number of nodes, sensors mobility speed and other parameters. NS2.35 provides a wide range of modules to employ in the simulation network such as different models of physical layer, different access control modules, transport layer protocols and applications [34]. Two files are produced when the simulation runs: Network AniMator (NAM) used to visualize the network and trace files which include a vestige of various events that happen during the simulation time. In Table 1, we assume the default network parameter values. We used a MAC based on IEEE 802.11 where Wireless Multimedia Sensor Networks (WMSNs) [35] and WSN [26] utilizing this standard in mesh networks are efficient solutions in various applications including security and ehealth [36] systems. The Xgraph program draws a graph on an X display given data read from either data files or from standard input if no files are specified. Xgraph in NS2 is used to plot the network parameter characteristics like throughput, delay, packet delivery ratio, latency, etc. We used Intel Dual-core 2.5 GHz with 2 GB RAM. In Table 1, we present our assumptions for the network configuration. To evaluate the performance of routing protocols quantitative metrics are practiced [37]. We use the below performance metrics to evaluate our routing protocol. (1) Throughput: This is the measure of how fast we can send packets through the network. The number of packets delivered to the receiver provides the throughput of the network. The throughput is defined as the total amount of data a receiver receives from the sender divided by the time it takes for the receiver to get the last packet. The throughput is calculated as:  
\[G=\frac{\sum B_{r}\times 8}{T}\times 10^{-6}\ \ \ \text{[Mbps]} \tag{2}\] \begin{table}
\begin{tabular}{c c} \hline \hline
**Parameters** & **Values** \\ \hline Simulator & Network Simulator 2 \\ Simulation Node & 150 \\ Interface Type & Phy/Wireless \\ Channel & Wireless Channel \\ Mac Type & MAC/IEEE 802.11 \\ Queue Type & Queue/DropTail/Priqueue \\ Queue Length & 201 packets \\ Antenna Type & Omni Antenna \\ Propagation Type & TwoRay Ground \\ Initial Energy & 1000 J \\ Size of Packet & 512 bytes \\ Protocol Algorithm & DSR, AODV, EPAR, GA\_AOMDV, EPAR\_BFS \\ Traffic & TCP/CBR \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Simulation Parameters. where \(G\) is the throughput, \(B_{r}\) is the total number of received bytes, and \(T\) is the simulation time. (2) Energy Consumption: Battery energy consumption refers to the power spent in calculations that take place in the nodes for routing and other decisions. It is the power consumed in processing the packets per time unit. The energy is calculated as:  
\[E=\sum_{i=0}^{m}I_{i}-E_{i}\ \ \ \ \ \ [\text{Joules}] \tag{3}\]  
where \(E\) is the total energy consumption for all nodes \(m\), \(I_{i}\) is the initial energy at node \(i\) and \(E_{i}\) is the energy at the end of the simulation process at node \(i\). (3) Packet Delivery Ratio: The ratio of the data packets delivered to the destinations to those generated by the constant bit rate (CBR) sources. It is the fraction of received packets by destination to the generated packets by source. Packet delivery ratio is calculated as:  
\[PDR=\frac{\sum N_{d}}{\sum N_{s}}\times 100\ \ \ \ \ \ \ [\%] \tag{4}\]  
where \(N_{d}\) represents the number of delivered packets and \(N_{s}\) represents the number of sent packets. (4) Round Trip-Time (RTT): This is the time measured from sending a route request packet (RREQ) until receiving a route reply packet (RREP). Having a long RTT indicates a slow data transmission and hence the throughput is low.