## 4 Design of TLQoS
### Hybrid Potential and Routing Loop Avoidance  
Among the four potential fields we defined, only the hop-count potential is time-invariant, and the remaining potentials change dynamically. In [19], the authors proved that, a potential based routing with time invariant potential is loop-free. Thus, exploiting the delay, reliability and temperature potentials independently in routing decisions would result in routing loops. In TLQoS, we define the hybrid potential for each of the time-variant potential field to address this situation. Hybrid potential field combines a time-invariant potential (_i.e._, hop-count in TLQoS) with a time-variant potential field, and together impacts on the routing decision for particular traffic type. Different combination patterns are possible, however, for simplicity and tractability, we adopt linear combination of the potential fields. Let \(P_{n_{i}}^{Hd}\), \(P_{n_{i}}^{Hr}\), and \(P_{n_{i}}^{Ht}\) denote the hybrid potential field for delay, reliability and temperature potential respectively. Thus, the hybrid potentials at node \(n_{i}\) are defined as  
\[P_{n_{i}}^{Hd}=(1-\gamma)P_{n_{i}}^{h}+\gamma P_{n_{i}}^{d} \tag{12}\]  
\[P_{n_{i}}^{Hr}=(1-\gamma)P_{n_{i}}^{h}+\gamma P_{n_{i}}^{r} \tag{13}\]  
\[P_{n_{i}}^{Ht}=(1-\gamma)P_{n_{i}}^{h}+\gamma P_{n_{i}}^{t} \tag{14}\]  
Here, \(\gamma\) is an adjustable parameter where, \(0\leq\gamma\leq 1\). In TLQoS, \(\gamma\) has significant influences on routing decision since controlling this value decides which part of the hybrid potential field will dominate. Based on the hybrid potential field, we also define the hybrid forces from node \(n_{i}\) to \(n_{j}\in NB(n_{i})\):  
\[F_{Hd}(n_{i},n_{j}) =\frac{P_{n_{i}}^{Hd}-P_{n_{j}}^{Hd}}{c_{n_{i},n_{j}}} \tag{15}\] \[F_{Hr}(n_{i},n_{j}) =\frac{P_{n_{i}}^{Hr}-P_{n_{j}}^{Hr}}{c_{n_{i},n_{j}}}\] (16) \[F_{Ht}(n_{i},n_{j}) =\frac{P_{n_{i}}^{Ht}-P_{n_{j}}^{Ht}}{c_{n_{i},n_{j}}} \tag{17}\]  
The above equations can be rewritten as  
\[F_{Hd}(n_{i},n_{j}) =(1-\gamma)F_{h}(n_{i},n_{j})+\gamma F_{d}(n_{i},n_{j}) \tag{18}\] \[F_{Hr}(n_{i},n_{j}) =(1-\gamma)F_{h}(n_{i},n_{j})+\gamma F_{r}(n_{i},n_{j})\] (19) \[F_{Ht}(n_{i},n_{j}) =(1-\gamma)F_{h}(n_{i},n_{j})+\gamma F_{t}(n_{i},n_{j}) \tag{20}\]  
In TLQoS, a packet \(p\) with a particular traffic type is forwarded to a neighbor for which the relevant force is maximum, particularly, the neighbor in the direction of the steepest gradient for that related force. TLQoS purposefully controls the value of \(\gamma\) which changes dynamically depending on the number of hops a packet already traversed. This value significantly influences in routing decision. In particular, assigning more weights with time-variant potential field part dominates that potential in routing decision while more weights with time-invariant hop-count potential drives a packet to traverse over a shortest path to the \(BC\). While time-variant potential dominates, routing loop might be created as the packet can be forwarded to a neighbor that is in the same depth (_i.e._, same hop-count) or even it can be forwarded backward to a neighbor with higher hop-count. This situation prevails only when the hybrid potential of all the lower-depth neighbors is greater than the hybrid potential of the node itself. In TLQoS, for any node, the related potential can increase by \(\gamma\) at maximum. This is the situation when the \(D_{n_{i}}^{avg}=D_{p}^{req}\), or the average packet loss ratio, \(R(n_{i})=1\), or \(T_{n_{i}}^{avg}=T^{thr}\). Thus, a node will not choose a neighbor with lower hop-count if and only if \(\gamma>1-\gamma\). Hence, we get, \(\gamma>\frac{1}{2}\). TLQoS initialize the value of \(\gamma\) with some value greater than \(\frac{1}{2}\), allowing a packet to be traversed to a neighbor on which the related time-variant potential will be dominating and any neighbor can be chosen irrespective of its hop-count value.