# An Energy-Efficient Fail Recovery Routing in TDMA MAC Protocol-Based Wireless Sensor Network
## 4 Constraints and Objectives of NE-MCR Algorithm  
In this Section, we describe how the proposed network topology aggregates data and how the size of the aggregated data grows. Figure 8 illustrates an example subtree of a network that shows a data aggregation flow. In every active period, a node \(n_{i}\) wakes up and obtains its sensing data \(D_{i}\) of size S from its sensor. If \(n_{i}\) is a leaf node, it forwards Ds to its parent node. If \(n_{i}\) is a parent node, it receives a set of sensing data \(D_{k}\) from all child nodes \(n_{k}\). The parent node \(n_{i}\) then aggregates the set of sensing data with its own sensing data. Finally, \(n_{i}\) forwards the aggregated data to its parent node. For example, in the subtree, node n38 is chosen as a parent by two leaf nodes n41 and n42 nodes. We assume the sensing data generated by every node is of the same size S. Since n41 and n42 each send a datum of size S, n38 concatenates the two data and its own data into an aggregated packet of size 3S and forwards it to its grandparent n25. This Figure shows the size of data aggregated by every node in the above method. As described in Section 2, in our network topology, every node is allocated with a TDMA time slot. Let \(t_{s}\) be the fixed length of each time slot. This fixed slot length constrains the length of aggregated data in each node. For example, nodes n11 and n12 aggregate sensing data into a length of 8S each, which is the maximum data length in this subtree. The length of each aggregated data must be shorter than the time slot constraint \(t_{s}\). The routing algorithm selects route paths that meet this constraint. The proposed algorithm NE-MCR also ensures that this constraint is satisfied when it searches for the optimum NBP. The constraint on the aggregated data length for NE-MCR is given by Equation (9). \[l_{NBP_{i}}+l_{MCR\_BP}<t_{s}, \tag{9}\]  
Here, \(l_{NBP_{i}}\) is the length of \(NBP_{i}\)'s packet that is aggregated with the data received from all its child nodes. \(l_{MCR\_BP}\) is the length of \(MCR\_BP\)'s aggregated packet that is forwarded from \(MCR\_BP\) to NBP\({}_{i}\). The energy model of tree-structured WSN comprises the sum of all transmission energy consumed by every child node \(n_{i}\) and the sum of all reception energy consumed by every parent node while receiving data from its child nodes \(n_{i}\). The energy model of a normal operation with no failed nodes can be formulated as follow:  
\[E_{total}=\sum_{n_{i}\in N}E_{tx}(l_{n_{i}},d(n_{i},p_{n_{i}}))+\sum_{n_{i}\in N }E_{rx}(l_{n_{i}}), \tag{10}\]  
Figure 8: Data aggregation in tree-structured WSN. Here, \(N\) is the set of all nodes in the network, while \(n_{i}\) represents every node in N. \(p_{n_{i}}\) represents the parent node of \(n_{i}\). \(l_{n_{i}}\) denotes the length of data aggregated by node \(n_{i}\). \(d(n_{i},p_{n_{i}})\) is the distance between \(n_{i}\) and its parent \(p_{n_{i}}\). \(E_{tx}(l,d)\) is the transmission energy consumed by \(n_{i}\) for transmitting a datum of length 1 through the distance d, while \(E_{rx}(l)\) is the receiving energy consumed by a parent for receiving a datum from \(n_{i}\). In this work, for the sake of simplicity, we assume that the condition in Equation (9) is satisfied by the selected \(NBP_{i}\)'s parents \(S_{i}^{NBP_{i}}\) and their successive parents who can receive additional data from the child nodes. We now describe the energy model of a network with a fail recovery process for the case where node \(n_{i}\) failed. Assume that the MCR algorithm selects \(MCR\_BP_{i}\) as an MCR backup parent node for \(n_{i}\). Assuming that \(MCR\_BP_{i}\) cannot reach the parent of pi, now suppose that the NE-MCR algorithm selects \(NBP_{i}\) as a neighbor backup parent. When failure occurs at \(n_{i}\), the new data forwarding recovered by using the preselected \(MCR\_BP_{i}\) and \(NBP_{i}\) incurs variable transmission energy \(E_{TX_{i}}^{new}\) which can be expressed by Equation (11).