# Optimal Routing for Time-Driven EH-WSN under Regular Energy Sources
## 6 Numerical Results
Given that the network size is \(N\), it can be shown that the algorithm requires \(N(N+1)/2\sim N^{2}\) matrix explorations (assuming that the spanning tree is given in matrix form), \(N\) sums and \(N\) evaluations of the duty cycle according to Equation (13). ```
Let \(S\) be a symmetric \((N+1)\)x\((N+1)\) matrix representing the given spanning tree. Let \(S_{ij}\) be an element of the matrix, with \(i,j=0\ldots N\) (node 0 represents the base station). Let \(S_{ij}=1\) if there is a direct connection between nodes \(i\) and \(j\), and \(S_{ij}=0\) otherwise. By inspecting element by element of the upper (lower) triangle of matrix \(S\), determine the set of layers \(SL=\{layer_{i},i=1\ldots NL\}\), with \(NL\) the number of layers, and the set of children of every node \(x_{k}\in layer_{i}\). Note that \(layer_{i}\cap layer_{j}=\varnothing\)\(\forall i\
eq j\) and \(layer_{1}\cup\ldots\cup layer_{NL}=U\), with \(U\) the whole set of sensor nodes in the network (universal set). for\(i=NL\) downto\(i=1\)do  Calculate \(\sigma(x_{k})\) for every node \(x_{k}\in layer_{i}\). Here, recall the general expression provided in Section 2: \(\sigma(X)=\sum_{i=1}^{CH(X)}(1+\sigma(c_{i}(X)))\). Note also that \(\sigma(x_{k})=0\)\(\forall x_{k}\in layer_{NL}\). for\(i=1\)to\(i=NL\)do  Obtain \(DC(x_{k})\) for every node \(x_{k}\in layer_{i}\), by taking into account that the duty cycle of the base station is 100%. if\(DC(p(x_{k}))==0\)then\(DC(x_{k})=0\) else  Calculate \(DC(x_{k})\). if\(DC(x_{k})<0\)then\(DC(x_{k})=0\)  Calculate the average duty cycle: \(DC=\frac{1}{N}\sum_{x_{k}\in U}DC(x_{k})\). ```  
**Algorithm 1**Evaluation of the duty cycle  
As it can be noticed from Figure 7, all routing criteria give rise to very similar duty cycles (around 50%) for moderately large network sizes of up to 300 nodes approximately. However, as the network size increases beyond this value, only MHC is capable of maintaining such a 50% duty cycle, whereas  
Figure 7: Evolution of the average duty cycle in terms of the network size, for different routing criteria. CTP and GRP exhibit highly-decreasing trends. Note that the gap between MHC and CTP might appear to be surprising, since CTP searches to minimize the link-level delay, which is also a consequence of the duty cycle maximization pursued by MHC. However, there is a subtle difference that explains this gap: CTP decides the next-hop neighbor based on the immediate number of transmission tries, a fact that leads it to select intra-layer in addition to forward inter-layer connections. This behavior increases as the network size increases, and hence the decreasing trend, as shown in Figure 7. On the other hand, a small duty cycle has a negative impact on the whole distribution of the number of transmission tries, whose upper bound increases. So, indeed CTP selects the shortest routes based on the link-level delays, but these result from increasingly spread out distributions. In contrast, MHC selects exclusively forward inter-layer connections, which allows nodes to sustain large duty cycles even under increasing network sizes. Consequently, link-level delays in MHC-based routing obey distributions with smaller variances than those corresponding to CTP.