## 4 WEAMR Overview
### Data Transmission  
Once the primary and secondary routes are established, the sender node would select the primary route and send its data. In order to balance the energy cost for the path the sender will switch between the discovered paths using a random approach. Although the idea proposed by [27] can be implemented to increase the efficiency of the network further, for the sake of simplicity we have used random switching strategy for data transmissions. In order to update associated cost of a discovered path \(C_{p}\), we suppose that average energy cost of transmitting an average sized message from one node to next node is \(\mathrm{Msg_{cc}}\) with every transmission of a message the cost of the path is adjusted locally in sender's routing table as:  
\[C_{p}=\alpha H+\beta L+\ \frac{1}{\gamma E^{\gamma}}\text{, where }\frac{1}{\gamma E }=\frac{1}{\gamma E}-\mathrm{Msg_{cc}}\]  
As we are using fixed topology the hop count and latency would remain reasonably constant, the only changing variable in the equation is energy. This local update mechanism for cost at the sender node incurs much less processing overhead and no additional control packets are required for updating the cost of the path. The intermediate nodes in the path might be involved in sending/forwarding data to the sink nodes which will make our locally calculated \(C_{p}\), invalid. Since \(C_{p}\) represents the cost value of the path which is calculated based on the lowest energy node value in the path, so to keep the value of \(C_{p}\), updated with the lowest energy value node in the path our scheme proposes that every intermediate node checks its local energy value with expected lowest energy value sent in Data Packet by source node. This expected lowest energy value is populated by the source node from the energy field in routing table _i.e._, \(LE_{p}\) is value of lowest energy of a node on primary path. This value in the data packet is compared by intermediate nodes as the data packet moves toward the destination. An intermediate node sends back an update message to source node to update its \(LE_{p}\) value if difference of energy value at the intermediate node and \(LE_{p}\)sent in the data packet is lower than a threshold value _i.e._,:  
\[LE_{p}-\ E_{t}>E_{t}\]where \(E_{t}\) is a constant value and can be adjusted based on studying the energy depletion patterns of the network over a given time. \(E_{i}\) is energy value at the intermediate node and \(LE_{p}\) is the lowest energy value sent by the sender in data packet. In the case where the difference is within the threshold range, the intermediate node forwards the data packet. If the difference crosses the threshold then the intermediate node updates the expected energy value as \(E_{i}\), assuming itself to be the least energy node in the path and forwards the data packet. After transmitting the data packet the intermediate node sends a RREP update message to the source node with an updated sequence number and sets Energy as \(E_{i}\). Any subsequent intermediate node can also generate an update RREP message in case its energy is less than \(E_{i}\). The threshold range \(E_{t}\) of intermediate nodes can be set in multiples of \(\mathrm{Msg_{ec}}\), _i.e._, a node having an \(E_{t}\) of 5 * \(\mathrm{Msg_{ec}}\) means that node will only update the sender if its energy level is less than the expected energy value sent by the sender by a value of 5 * \(\mathrm{Msg_{ec}}\)_i.e._, Cost of energy required to send five average sized messages. The sender and the intermediate nodes in reverse path receive the update RREP message and update the corresponding routing entry's \(LE_{p}\) value and update the path cost in the table. The threshold difference value \(E_{t}\) ensures the RREP updates are kept to a minimum and local cost update formulae based on message transmission cost ensures no additional network traffic as the cost for the path is updated locally. In case a link is broken the RERR messages received at the sender would mark the entry as invalid.