## 4 Energy Aware Software Defined Network (EASDN) Routing Algorithm
First we develop the ad hoc network using a 802.11 ac wireless LAN. Each node can connect with neighbor nodes through a wireless ad hoc connection. In our experimental scenario, the node's communication is real-time with simulation-based energy consumption calculation. For energy consumption measurement, we used a simulation because Raspberry Pi cannot measure the directly residual battery capacity. It needs an external chip (i.e., MoPi) which can measure it. The energy consumption model is already explained in Section 3 as to how to calculate the energy consumption and the simulation parameters used to calculate the energy consumption are given in Table 1. We deployed six Raspberry Pi 3 as sensor nodes and one node as a controller in two different areas at the fourth floor of IRIT-1 building, University Paul Sabatier Toulouse as shown in Figure 9, which has a 30 m \(\times\) 38 m area and the second deployment was in one room which has a 3 m \(\times\) 10 m area dimension. Each raspberry pi connects with neighbor nodes which are accessible in his range through ad hoc connection and each pi node sends a data packet up to a controller though multihop. The deployment scenario is shown in Figure 10.

Figure 3:0 Real-time nodes deployment on the fourth floor of IRIT-1 building. ### Experimental Platform

We implemented our experiment by using Python 3.0 and tested it on Raspberry Pi 3 that is low cost and low-powered with a credit size single-board computer. Raspberry Pi is used for both the sensor node to transmit the data and controller that controls the whole network as well as collects the data of sensors. Recently, it has become very popular because of its use in robotics projects, WSN, and cloud computing applications [43; 44; 45]. In our experimental work, we used Raspberry Pi B+ model. It comes with a powerful 1.4 GHz 4 x Cortex-A53 CPU and runs an ARMv8 microcontroller with 1 GB RAM [36]. It supports various operating systems including a Debian Linux-based OS that is used to optimize the Raspberry hardware and also recommended by the Raspberry Pi foundation. The Raspberry Pi B+ model has good specifications when compared to other models. RPi B+ model also contains 802.11 ac wireless LAN card that is used for wireless communication (e.g., wireless ad hoc connection). It is also deployed as an intelligent sensor node [43; 44; 46] in many WSN networks and boosted by a micro SD card. ### Evaluation Metrics

The experimental results are based on the following metrics: \begin{table}
\begin{tabular}{c c} \hline
**Parameter** & **Value** \\ \hline Initial energy & 1 J \\ E\({}_{\text{elec}}\) & 50 nJ/bit/m\({}^{2}\) [14] \\ E\({}_{\text{fs}}\) & 100 pJ/bit/m\({}^{2}\) [14] \\ E\({}_{\text{mp}}\) & 0.0013 pJ/bit/m\({}^{4}\) [14] \\ Data packet size & 296 bit \\ \hline \end{tabular}
\end{table} 
Table 1: Energy parameters. Figure 10: Raspberry Pi nodes deployment structure on the fourth floor of IRIT-1 building. #### 5.3.1 Network Lifetime (LT)

It is a time duration in which the network remains operational. We considered two definitions to calculate the network lifetime:

* The time until the first node runs out of energy;
* The time until the last node (sink is not reachable) runs out of energy. #### 5.3.2 Packet Delivery Ratio (PDR)

It is the percentage of packets successfully delivered at the destination. _TPTx_ is the total number of packets transmitted from all network nodes while TPRx accounts the total number of packets received at the destination during experimental time. \[PDR=(TPRx/TPTx)\times 100. \tag{4}\]

#### 5.3.3 Number of Alive Nodes (NAN)

It is the summation of the number of nodes that are alive after each round (time step). One round is completed when each node generates the packet after a specific period (i.e., 1 s, 2 s). #### 5.3.4 Average Energy Consumption Per Bit (ECPB)

It is a summation of all nodes initial energy, divided by the total number of received bits.