# Parent and PHY Selection in Slot Bonding IEEE 802.15.4e TSCH Networks
## 3 Parent and PHY Selection Heuristic
### Heuristic  
The proposed heuristic aims to optimize the overall packet delivery ratio (PDR) of the network. Its inputs are a reliability threshold value (i.e., \(\delta\), which defines the minimum reliability a selected PHY for a parent node should have, compared with the most reliable PHY to that parent node), the data rates of the available PHYs and, for each node, the link reliability values for all PHYs to all the node's possible parents. The output of the heuristic is a preferred parent and a PHY, to connect to that parent, for each node in the network. To achieve its goal, the heuristic first selects, for each node, a preferred PHY for each of its possible parents. Afterwards, taking into account those PHYs for each possible parent, the heuristic minimizes the number of allocated slots from each node to the root. Therefore, it considers the bonded slot length necessary for each PHY and the link reliability to that possible preferred parent. Both steps of the heuristic are described in Algorithms 1 and 2 and are discussed in detail below. ```
1:proceduremapPHYPerParent(\(n,\delta\))
2:\(m_{n}=map()\)\(\triangleright\) for node \(n\), map possible parents to PHY
3:for\(\triangleright\)\(P_{n}\)do\(\triangleright\) loop over every possible parent of node \(n\), in \(P_{n}\)
4:\(m_{reliable}=None\)\(\triangleright\) most reliable PHY to parent \(p\)
5:for\(\mathbf{m}\in M_{p}\)do\(\triangleright\) find most reliable PHY
6:if\(reliability(m)>reliability(m_{reliable})\)then
7:\(m_{reliable}=m\)\(m_{reliable}\)
8:\(m_{n}[p]=m_{reliable}\)
9:for\(\mathbf{m}\in M_{p}\)do\(\triangleright\) find possible faster PHY
10:if\(rate(m)>rate(m_{n}[p])\)then
11:if\(reliability(m_{reliable})-reliability(m)\leq\delta\)then
12:\(m_{n}[p]=m\)
13:return\(m_{n}\)
```  
**Algorithm 1** Procedure to determine the preferred PHY per possible parent. In the first step of the heuristic, each node in the network, except the root (i.e., each node \(n\) in the set \(N_{0}\)), assigns a preferred PHY to each possible parent in its set of possible parent nodes. To do so, it considers the trade-off between reliable and/or fast PHYs, as it was observed in the allocation analysis of our previous work that both metrics are important when picking a parent [7]. This PHY selection procedure is shown in Algorithm 1 (and this procedure is in Algorithm 2 at line 3). Given node \(n\), this algorithm first searches for every possible parent of \(n\) (i.e., in set \(P_{n}\)), for the most reliable PHY, \(m_{reliable}\) from node \(n\) to that parent \(p\). Afterwards, based on the known data rate of each possible PHY, the fastest PHY is selected that is within a given threshold (i.e., the parameter \(\delta\)) of the most reliable PHY to that parent. Formally, this means that for the selected PHY \(m\) to a possible parent the link reliability \(l_{m}\) is such that \(l_{m}\geq l_{max}-\delta\) with \(l_{max}\) being the highest possible reliabilityamong all PHYs supported by the node to that possible parent. Choosing a small \(\delta\) value will lead to more reliable links between a node and its parent, but also leads to less free space in the schedule as PHYs with lower data rates need more time to transmit a packet and thus need more regular slots to be bonded together. Choosing a large \(\delta\) allows less reliable PHYs to be chosen, and assuming that less reliable PHYs have faster date rates that need a shorter bonded slot to transmit a packet (this assumption is largely confirmed by the PDR results of the different IEEE 802.15.4g modulations in [8]), this will lead to more free space in the schedule. Specifically, if \(\delta=0\), the heuristic always chooses the most reliable PHY for each possible parent, while when \(\delta=1\), the heuristic always chooses the PHY with the fastest data rate. The value of \(\delta\) should thus be determined empirically and can be network-, application- or even node-specific.