## 5 Analysis of the Solution and Simulation
### Analytical and Validation Study
The node power consumption during _the duty cycle mechanism_ (energy employed by the radio interface during sleep and periodic listening) is easily calculated if power-consuming profiles of both, the AP and SP are identified. Defining \(T_{AP}\) as the time the node spends in awake mode, \(T_{SP}\) as the time the node spends in sleep mode, \(I_{AP}\) and \(I_{SP}\) as the currents drawn in awake and sleep mode respectively and V as the voltage supplied by the batteries, the energy consumed is expressed by Equation (2):  
\[E(J)=(T_{AP}*I_{AP}+T_{SP}*I_{SP})*V \tag{2}\]  
Figure 7: **(a)** Analytical results of PRR _vs._ AP for different values of P(L); **(b)** TOSSIM Simulation results of PRR _vs._ AP for different environments. Unlike the PRR, the power consumption is sharply affected by the duration of AP and SP. As depicted in Figure 8a, the greater the AP, the more energy is consumed; and hence, the first tradeoff is found: to increase the PRR, the AP must be enlarged; however, doing so would increase the power consumption and reduce nodes' lifetime. Figure 8b illustrates the correctness of the Equation (2) comparing the calculated values with the simulation results obtained by means of Avrora. As already commented, in these simulations the precise consumption profiles of the microcontroller and the radio transceiver are taken into consideration. As regards to the delay, the analytical expression is derived in Equation (3) obtaining the expected delay (_E[D]_). When node A wants to transmit a packet to node B (next hop in the route to root node), the transmitter (A) must wait a certain amount of time \(D\) until the receiver (B) enters in its Active Period (_AP_) (this is due to the phase-lock mechanism). Therefore, \(D\) ranges from 0 s ([PERSON] wants to transmit at the very moment [PERSON] in its AP) to _SP_ seconds ([PERSON] wants to transmit at the very moment [PERSON] enters in its sleeping period--_SP_). The following figure (Figure 9a) models the waiting time \(D\) and its dependence on _SP_ and \(AP\). The abscissa axis represents the precise moment A wants to transmit its packet and the ordinate axis represents the corresponding waiting time \(D\). To obtain the expected delay (equation denoted as 3) it is necessary to average the values of \(D\) over the entire AP+SP period, _i.e._, find the average value of such geometrical figure:  
\[E[D]=\frac{1}{T}\int_{-\infty}^{\infty}f(x)dx=\frac{1}{AP+SP}\left(\int_{- \infty}^{AP}0+\int_{AP}^{AP+SP}(-x+AP+SP)dx\right)=\frac{(AP+SP)}{2}+\frac{AP^{ 2}}{2(AP+SP)}-AP \tag{3}\]  
Figure 8: **(a)** Consumption _vs._ AP for different values of SP—Mathematically obtained. **(b)** Consumption _vs._ AP for a fixed value of SP = 3s—Comparison of analytical and simulation results. The analytical values in Figure 9b ignore the effects on the delay of different phenomena such as processing time or radio propagation effect. However, as can be observed in the comparison of mathematical and simulated values plotted in Figure 9b, these omitted extra delays do not have a meaningful impact on the overall delay. Finally, if the AP is small (as it usually occurs), the expected delay can be approximated to a half of the SP--as observed in Figure 9b. As already mentioned, in the Smart Grid the end-to-end delay should not exceed fifteen seconds, therefore for a typical communication network of up to 10 hops, the SP should always be lower than 3 s (a SP of duration 3 s generates a delay of about 1.5 s between a pair of nodes which, multiplied by the 10 hops, results in 15 s). Figure 9: **(a)** Representation of the expected delay and its dependence on AP and SP; **(b)** Mathematical and simulated delay values for a given pair of nodes. It is worth mentioning that the analytical model here proposed is based on a series of assumptions that simplifies the associated formulae. Such assumptions allowed us to propose a model that reflects the interaction between only two nodes--a transmitter and a receiver--and therefore, unlike many other works ([66, 67]) it can only be applied to SENSED-SG.