## 4 Proposed Metrics
### Valid Routes
#### 4.2.3 Global Metric  
Energy is a global metric that has an impact on autonomy in wireless networks. It is important that these networks operate for long periods without human intervention. All performance metrics mentioned in this work impact the energy consumption of the nodes directly or indirectly. This energy consumption is reflected in the life of the batteries and, therefore, in the connections and disconnections of nodes. All these topology changes represent more effort for the routing protocol, as they keep the channel busy while the network becomes reconfigured again. A contribution of our work is our proposed energy model capable of quantifying the total energy consumed and the energy invested in the main activities of the nodes in a network. This model is based on the time it takes each node to perform the main tasks as a part of a network. This time is reflected as a consumed energy in each activity and is calculated depending on the parameters involved in each task performed by the node. These times and the voltage and current consumption are listed in Table 3, where the different types of energy considered are shown. Our work considers the energy spent by the MAC and the network layers. An analytical model based on the CC2530 chip operation, the system-on-a-chip (SoC) solution for IEEE 802.15.4, ZigBee, from Texas Instruments, is proposed here. This model describes the energy used for each of the functions performed by a CC2530 chip, from the moment that a node is on and is part of the network, as it receives and sends messages, runs MAC layer algorithms and changes of state, to the time the node is off. This model includes the main types of energy of the basic activities that sensors carry out in a common performance in a network. These types of energy are: microcontroller energy \((E_{MC})\), start-up energy \((E_{Starting})\), shutdown energy \((E_{Shutdown})\), CSMA/CA algorithm energy \((E_{CSMA})\), switching energy \((E_{Switching})\), transmission energy \((E_{TX})\) and receiving energy \((E_{RX})\). All of these energies are expressed in Joules. \begin{table}
\begin{tabular}{l c c c c} \hline \hline  & **Voltage (mV)** & **Current (mA)** & **Time (ms)** & **Energy (J)** \\ \hline Start-up mode & 120 & 12 & 0.2 & \(E_{Starting}=0.000288\) \\ MCU running on 32-MHz clock & 75 & 7.5 & 1.7 & \(E_{MC}=0.000956\) \\ CSMA/CA algorithm & 270 & 27 & 1.068 & \(E_{CSMA}=0.00778\) \\ Switch from RX to TX & 140 & 14 & 0.2 & \(E_{Switching}=0.000392\) \\ Switch from TX to RX & 250 & 25 & 0.2 & \(E_{Switching}=0.00125\) \\ Radio in RX mode (processing and waiting) & 250 & 25 & 4.1915 & \(E_{RX}=0.0262\) \\ Radio in TX mode & 320 & 23 & 0.58 & \(E_{TX}=0.00426\) \\ Shut down mode & 75 & 7.5 & 2.5 & \(E_{Shutdown}=0.00141\) \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Energy model [34]. In order to better understand the process of using the various types of energy under the proposed model, Figure 15 explains this scheme conceptually. The process shown here is repeated several times during the sampling time, according to whether a node sends or receives packets. First, a node takes a starting time (\(t_{Starting}\)) in order to turn on. Then, a switching time (\(t_{Switching}\)) is taken to change the function before sending a packet to the medium. The node first runs the CSMA algorithm using a CSMA time (\(t_{CSMA}\)). Now, the node transmits a packet using a transmission time (\(t_{TX}\)). Again, the node takes a switching time (\(t_{Switching}\)) in order to change activities, remains in the idle state (\(t_{Idle}\)) and returns to change the task, taking a switching time (\(t_{Switching}\)) to start receiving using a receiving time (\(t_{RX}\)). The node will perform this chain of activities as many times as it sends and receives packets during the sampling period. Finally, the node turns off using a shutdown time (\(t_{Shutdown}\)). All of the time, the microcontroller stays in active mode.