# 3 MSF: A Multi-Modal Adaptation of the 6 TiSCH Minimal Scheduling Function for the Industrial IoT
## 4 The Multi-Modal Minimal Scheduling Function
### Related to Metrics
* If neither the frozen nor the currently preferred interface-mode is down but the absolute difference between their inferred metrics exceeds a hysteresis threshold, switch to the preferred interface-mode. If the preferred interface-mode towards the preferred parent fails, a preferred parent switch will occur soon and shadow operations cannot be triggered. Finally, the path cost through a candidate neighbor is the sum of the normalized metric towards it and (because we use ETX) the rank it advertises. Metric normalization consists of (1) calculating a weight based on the number of unavailable interface-modes towards a neighbor using (5), and (2) calculating the normalized metric using (6). The way we calculate weights using (5) is slightly modified from [8] (Equation (2)). That is, we introduce a weight offset \(W_{off}\) term to allow for additional fine-tuning. Enough unicast packets must be sent to all neighbors on all interface-modes such that their normalized metric (and therefore, path cost) is always a reasonably accurate reflection of their capabilities. Since an interface-mode's inferred metric is updated after each unicast Tx attempt on a supercell tagged with a TSCH mode corresponding to (at least) said interface-mode, and there is often a non-equal amount of Tx opportunities per interface-mode towards the same neighbor over time, maintaining fresh inferred metrics without incurring excessive overhead is tricky, especially considering the MAC sequence number consistency requirements discussed in Section 4.2. The mechanism governing reachability detection/metric freshness generally determines a target (i.e., a neighbor). In our case, the same neighbor must remain the target until we have reached a minimal number of Tx attempts on all its interface-modes. Although a Tx attempt of any unicast packet will update an inferred metric, some unicast packets only serve to determine reachability through an interface-mode and/or to maintain a fresh inferred metric for it. Sending such packets over interface-modes with already up-to-date inferred metrics is wasteful. Contiki-NG [18], the Operating System (OS) we based our firmware on when designing and evaluating our 6 TiSCH architecture, normally (i.e., in single-mode configuration) uses unicast RPL control messages as probes (we used unicast DODAG Information Solicitation (DIS) messages because DIOs advertise DODAG connectivity, which is not allowed by 3 MSF prior to said node having at least one negotiated Tx (super)cell towards its preferred parent) to determine neighbor reachability and obtain metrics, as opposed to IPv6 Neighbor Unreachability Detection (NUD) [19] (Section 5.5). However, the probing of a given neighbor completes as soon as a unicast packet towards it (probe or not) is dequeued following a valid Tx attempt. As such, the probing mechanism was modified. Although the principles behind sending enough packets on each interface-mode of a neighbor are likely very similar regardless of the mechanism, we limit our discussion to Contiki-NG probing. Figure 12: Flowchart of events when the inferred metric update process is called for a given interface-mode of a given neighbor. \(C_{tx}\) and \(C_{ack}\) are the transmit (Tx) and acknowledgement (ACK) counters, \(C_{tx;max}\) is the Tx counter’s maximum value, \(C_{noack}\) counts consecutive non-ACKed Tx attempts, \(ETX_{init}\) is a constant used to initialize the inferred metric when receiving on a newly discovered interface-mode, \(ETX_{stor}\) is the actual inferred metric, and \(ETX_{noack}\) is a large constant, which must be greater than the inferred metric threshold. A separate set of these variables is maintained for each interface-mode of each neighbor. \[W= \begin{cases}0&\Leftrightarrow min(IM_{node}-VL,IL_{max})=0\\ \dfrac{min(IM_{node}-VL,IL_{max})}{IL_{div}}-W_{off}&\Leftrightarrow min(IM_{ node}-VL,IL_{max})>0\end{cases}  \tag{5}\]  
\[M_{norm}=W\times S+(1-W)\times M_{inf}\,, \tag{6}\]  
where: