## 4 Proposed Metrics
### Valid Routes
#### 4.2.3 Global Metric
However, network conditions are not always the best, and there will be collisions and, hence, packet retransmissions and retries in listening to the channel, then the \(N_{RT_{i}}\) and \(P_{RTX_{i}}\) variables will take non-zero values. Throughout the sampling time (\(T_{Sampling}\)), the node consumes microcontroller energy in an active mode for this model. Therefore,  
\[E_{MC_{i}}=T_{Sampling}\times I_{MC}\times V_{MC} \tag{17}\]  
Therefore, when the sampling time starts, all of the nodes start, so that the starting energy consumed by node \(i\) is \(E_{Starting_{i}}=T_{Starting}\times I_{Starting}\times V_{Starting}\). Finally, when the time is over, node \(i\) turns off, consuming shutdown energy, so \(E_{Shutdown_{i}}=(T_{Shutdown}\times I_{Shutdown}\times V_{Shutdown})\). In this way, at the end of the sampling time, the node has a total cumulative energy consumed by all of the functions that were performed during the network processes. Therefore,  
\[ \begin{array}{ll}nodeEnergy_{i}=&E_{Starting_{i}}+E_{MC_{i}}+E_{Shutdown_{i }}+\\ &E_{Switching_{i}}+E_{CSMA_{i}}+E_{TX_{i}}+E_{RX_{i}}\end{array}  \tag{18}\]  
If we want to obtain the total network energy, we add the total energy of each node when the sampling time is over, as follows:  
\[totalEnergy=\sum_{i=1}^{totalNodes}nodeEnergy_{i} \tag{19}\]  
where \(totalNodes\) is the total number of nodes. The flowchart in Figure 16 describes the actions taken by node \(i\) since it switches on (consuming starting energy, \(E_{Starting_{i}}\)) and is part of a network, to the time it shuts down. The most complex stage is when the node listens to the channel. This activity causes the node to transmit or not. All sent packets (transmitted packets or retransmissions) imply that it must first listen to the channel, _i.e._, the node ran the CSMA/CA algorithm using CSMA energy (\(E_{CSMA_{i}}\)). If the channel is free, the node uses transmission energy (\(E_{TX_{i}}\)) and transmits the packet (\(P_{TX_{i}}\)). If the channel is busy, the node generates a retry variable (\(N_{RT_{i}}\)), because it has to run the CSMA/CA algorithm again. After the node sends the packet, if it receives an ACK, the receiving energy is used (\(E_{RX_{i}}\)) and receives the packet (\(P_{RX_{i}}\)). In contrast, if the  
Figure 16: Flowchart scheme of the energy model for node \(i\). Energy  
As we have pointed out, a very important metric to measure network performance is the energy. A low energy consumption allows reduced maintenance costs in the network; the sensors are able to supply much information, and then, the network will be scalable and long-lived across time. Figure 17 shows the total energy consumption for the topology shown in Figure 10 for each of the mentioned protocols and ZTR. The authors established the range of a node of 8 m and simulated the energy consumption for each of the protocols under different traffic rates. We see that for traffic rates, such as 5, 25 and 50 packets/s, MPH and ZTR have a very good energy performance with respect to AODV and DSR. However, when the traffic becomes higher, such as 250 packets/s, the energy consumption of MPH and ZTR is closer to AODV and DSR consumption, possibly because of collisions, retransmissions and forwarding of packets that exceed the network capacity. Because of the hierarchical routing, ZTR and MPH have similar energy consumption, showing that the MPH protocol competes with other multi-hop network protocols in sensor networks, and it has an energy performance similar to that one of a simple routing tree. We can calculate that MPH protocol shows a reduction of 15.9% on energy consumption with respect to AODV, 13.7% with respect to DSR and 5% compared with ZTR. Figure 17: Global energy consumption. The MPH protocol takes the minimum number of hops to reach the coordinator (destination). This may occur, because sometimes, the AODV and DSR protocols do not have the shortest path to the destination, because this route has not been updated or because the shortest route has expired and a node took a back-up route.