## 4 Proposed Metrics
### Valid Routes
#### 4.2.3 Global Metric
This process gives a measure of the energy spent for each of the principal activities of a node in the network. Depending on the task of a node and the time it takes to execute it, this corresponds to certain values of voltage and current; thus, we can obtain the total energy used by each node in each of the functions performed in the network based on the model above [34]. Microcontroller energy will depend on the node operation mode. For instance, sleeping techniques reduce energy consumption by setting the unit microcontroller into idle mode at given time intervals. Nevertheless, for our analysis, we assume that the CC2530 in each node operates in continuous active mode running at a 32-MHz clock frequency, since we want to study how the energy consumption  
Figure 15: Conceptual scheme. behaves under a given routing protocol without the influence of sleeping techniques. Therefore, total microcontroller energy will be given by Equation (4):  
\[E_{MC}=T_{MC}\times I_{MC}\times V_{MC} \tag{4}\]  
where \(T_{MC}\) is the time in seconds in which the microcontroller unit operates at \(V_{MC}\) volts and \(I_{MC}\) amperes. The start-up energy is calculated based on the voltage, current and time it takes the nodes to turn on and be ready for the network and is described in Equation (5):  
\[E_{Starting}=T_{Starting}\times I_{Starting}\times V_{Starting} \tag{5}\]  
where \(T_{Starting}\) is the time in seconds that it takes to turn on a node while it operates at \(V_{Starting}\) volts and \(I_{Starting}\) amperes. The model also describes the energy spent by turning off nodes when the network time is over: this is the sampling period. This energy is given in Equation (6), and it is called shutdown energy. \[E_{Shutdown}=T_{Shutdown}\times I_{Shutdown}\times V_{Shutdown} \tag{6}\]  
where \(T_{Shutdown}\) is the time in seconds that it takes to turn off a node while it operates at \(V_{Shutdown}\) volts and \(I_{Shutdown}\) amperes. The switching energy is consumed when the node changes from the receiving mode to the transmitting mode or _vice versa_. It is given by Equation (7):  
\[E_{Switching}=T_{Switching}\times I_{Switching}\times V_{Switching} \tag{7}\]  
where \(T_{Switching}\) is the time in seconds it takes a node to switch from receiving to transmitting (or from transmitting to receiving) while it is driven by \(V_{Switching}\) volts and \(I_{Switching}\) amperes. The CSMA/CA algorithm states that whenever a node wants to transmit, first it checks if the channel is idle. If it is, then it can transmit; otherwise, it must back off a random time prior to another transmission attempt. The energy consumed for the CSMA/CA algorithm is given by Equation (8):  
\[E_{CSMA}=T_{CSMA}\times I_{CSMA}\times V_{CSMA} \tag{8}\]  
where \(T_{CSMA}\) is the time in seconds during which a node runs the CSMA/CA algorithm while it operates at \(V_{CSMA}\) volts and \(I_{CSMA}\) amperes. Transmission energy corresponds to the radio energy in transmission mode. In this case, nodes transmit packets from themselves or forward packets from other nodes. The transmission energy is described in Equation (9):  
\[E_{TX}=P_{Length}\times T_{TX}\times I_{TX}\times V_{TX} \tag{9}\]  
where \(P_{Length}\) is the length of a packet in bytes and \(T_{TX}\) is the time in seconds it takes a node to send one byte while it operates at \(V_{TX}\) volts and \(I_{TX}\) amperes. As in the transmission mode, a node consumes receiving energy when it receives a packet. This energy is shown in Equation (10):  
\[E_{RX}=P_{Length}\times T_{RX}\times I_{RX}\times V_{RX} \tag{10}\]where \(P_{Length}\) is the length of a packet in bytes and \(T_{RX}\) is the time in seconds it takes a node to receive one byte while it operates at \(V_{RX}\) volts and \(I_{RX}\) amperes. Values from Equations (4) to (10) are presented in Table 3. Therefore, the total energy can be calculated with Equation (11):  
\[ \begin{array}{ll}E_{Total}=&E_{MC}+E_{Starting}+E_{Shutdown}+E_{CSMA}+\\ &E_{Switching}+E_{TX}+E_{RX}\end{array}