# An Energy-Efficient Fail Recovery Routing in TDMA MAC Protocol-Based Wireless Sensor Network
## 4 Constraints and Objectives of NE-MCR Algorithm
\[E_{TX_{i}}^{new}=E_{tx}^{BP_{i}\to NBP_{i}}+\sum E_{tx}^{C_{m}\to BP_{i}}, \tag{11}\]  
Here, \(E_{tx}^{BP_{i}\to NBP_{i}}\) indicates the new transmit energy of a recovery route from \(MCR\_BP_{i}\) to \(NBP_{i}\). The second term \(\sum E_{tx}^{C_{m}\to BP_{i}}\) accounts for the total transmit energy of all other child nodes Cm forwards their data to \(MCR\_BP_{i}\) nodes. Using Equation (7), we can rewrite Equation (11) by Equation (12). \[ \begin{array}{l}E_{TX_{i}}^{new}=\ I_{MCR_{BP_{i}}}E_{elec}+(l_{c_{1}}E_{elec} +l_{c_{2}}E_{elec}+l_{c_{3}}E_{elec}+\ldots+l_{c_{m}}E_{elec})+\\ I_{MCR_{BP_{i}}}E_{FS}d_{MCR_{BP_{i}},NBP_{i}}^{2}+\left(l_{c_{1}}E_{FS}d_{c_{ 1}}^{2}+l_{c_{2}}E_{FS}d_{c_{2}}^{2}+l_{c_{3}}E_{FS}d_{c_{3}}^{2}+\ldots+l_{c_ {m}}E_{FS}d_{c_{m}}^{2}\right),\end{array}  \tag{12}\]  
In Equation (12), \(E_{elec}\) is the unit energy per data bit consumed by the transceiver circuit. This paper assumes that \(E_{elec}\) is constant for all nodes. \(l_{MCR_{BP_{i}}}\) denotes the length of the packet that \(MCR\_BP_{i}\) forwards to \(NBP_{i}\), whereas \(l_{C_{m}}\) indicates the length of the packet that the other child nodes \(C_{m}\) forwards to \(MCR\_BP_{i}\). \(d_{MCR_{BP_{i}},NBP_{i}}\) denotes the transmission distance from \(MCR\_BP_{i}\) to \(NBP_{i}\), while \(d_{c_{m}}\) indicates the distance from \(C_{m}\) to \(MCR\_BP_{i}\). Since the first two terms are constant, it can be substituted by \(C_{elec}\), so Equation (12) is simplified by Equation (13). \[E_{TX_{i}}^{new}=C_{elec}+E_{FS}(l_{MCR_{BP}}d_{MCR_{BP_{i}},NBP_{i}}^{2}+\sum _{1\leq m\leq M}l_{C_{m}}d_{C_{m}}^{2}), \tag{13}\]  
Here, \(E_{FS}l_{MCR_{BP}}d_{MCR_{BP_{i}},NBP_{i}}^{2}\) denotes the transmission energy of the link from \(MCR_{BP_{i}}\) to \(NBP_{i}\), whereas \(E_{FS}\sum_{1\leq m\leq M}l_{C_{m}}d_{C_{m}}^{2}\) represents the sum of transmission energy from all Cm's to \(MCR_{BP_{i}}\). Using Equation (13) as the cost function, the objective formula of the proposed algorithm NE-MCR is given by Equation (14) under the constraints given by Equations (15)-(17). For all nodes \(n_{i}\in N\), it selects a set of backup pairs (\(MCR\_BP_{i}\), \(NBP_{i}\)) that minimize the cost function \(E_{TX_{i}}^{new}\), respectively for each \(n_{i}\). Objective:  
\[\text{Minimize }E_{TX_{i}}^{new}\text{ while selecting }MCR\_BP_{i}\text{ and }NBP_{i}\text{ for every node }n_{i}\in N \tag{14}\]  
Such that:  
\[l_{NBP_{i}}+l_{MCR\_BP_{i}}<t_{s}, \tag{15}\]  
\[d\left(C_{m},MCR_{BP_{i}}\right)\leq W, \tag{16}\]  
\[d\left(MCR_{BP_{i}},NBP_{i}\right)\leq W, \tag{17}\]  
Equation (15) defines the constraint that the aggregated data length of \(NBP_{i}\) must not exceed a threshold \(t_{s}\) as presented in Equation (9). Equation (16) stipulates that the child node considered as \(MCR\_BP_{i}\) must be reachable from all other child nodes \(C_{m}\) with the wireless range \(W\), whereas Equation (17) stipulates that \(NBP_{i}\) must be reachable from the selected \(MCR\_BP_{i}\). In this way, the NE-MCR algorithm finds an optimal backup pair (\(MCR\_BP_{i}\), \(NBP_{i}\)) that meets the optimization objectives and constraints given by Equations (14) and (17). For example, Figure 9 illustrates a subtree of a network to depict how NE-MCR selects an optimal pair of \(MCR\_BP_{i}\) and \(NBP_{i}\) for a node \(n_{i}\). NE-MCR repeats this selection process for every node \(n_{i}\in N\) (\(N\)-the total number of node in a network) as a process to find a recovery route path for the case where \(n_{i}\) indeed fails during normal operation. In Figure 9, the potential faulty node \(n_{i}\) is highlighted. In this subtree, none of its child node \(C_{m}\)'s can reach their grandparent \(g\), and thus the MCR algorithm fails in finding a backup parent. Therefore, NE-MCR attempts to find an optimal pair (\(MCR\_BP_{i}\), \(NBP_{i}\)) as follows. NE-MCR checks the potential of each \(C_{m}\) and adds \(C_{m}\) to the candidate set of \(MCR\_BP_{i}\), if \(C_{m}\) meets the constraints of Equation (16).