## 4 Enhanced Objective Function for Routing in Agricultural Low-Power and Lossy Network
### Scalable Context-Aware Objective Function with Composite Routing Metrics
#### 4.2.2 Designing Combinable Energy-Aware and Resource-Aware Routing Metrics  
Based on the above discussions, the RE metric has to be adapted to an additive routing metric then it should be strictly monotonic and isotonic to satisfy all the assumptions of theorems proposed in [37]. The selected additive RE metric is based on summated metric values of the links in the corresponding routing path. For example, we assume one path \(\alpha\) and its length is n hops, then the weight of path \(\alpha\) indicates the energy on average for all traversing nodes:\[\omega(\alpha)=\frac{\sum_{1}^{n}\frac{1}{Rem.Energy^{t}}}{n} \tag{1}\]  
Note that the previous RE needs to be transformed to (1/RE), and (1/RE) will have the same metric range in the required granularization, order relation, metric operator as ETX. Like the guidelines shown by [37], Table 3 depicts two adopted metrics and one derived form of RE. Moreover, this routing metric cannot work alone since it also needs the hop count information, and three rules have to be clarified: (1) If two paths \(\alpha\) and \(\beta\) have the same length n and all the traversing routers are battery-powered without the effects of energy harvesting devices, the path with higher average energy will be preferred; (2) If \(\alpha\) and \(\beta\) have the same average energy value, then the path with the lowest length (or number of involved nodes) will be preferred; (3) If \(\alpha\) and \(\beta\) have different average energy values and path lengths, then the routing decision should be made with the cooperation of ETX metrics. Moreover, two bit of \"T\" flags of the RE metric container [10] can be used to represent the node powered mode types, and each DIO message with this information could be disseminated by its sender. The receiver nodes can select an optional routing path through an appropriate routing strategy to avoid using the battery-powered node. The optional Type-Length-Value (TLV) can be used to record the count of these three types of nodes. For example, the count of battery-power node is able to be described as an accessory routing metric organized in additive aggregation rule and \"\(<\)\" as its order relation. Namely, a routing path with fewer battery-powered nodes is preferred. Meanwhile, the counts of main-powered nodes or energy-scavenger-powered nodes can be also considered and carried in the TLVs. However, the domain of this metric is not compatible with ETX and (1/RE), so it only can be used in lexicographic manner based on the theorems of [37]. The other resources of A-LLNs device, such as affordable workload, hardware robustness and availability information, can also be considered as supplements of the energy-aware metric. Three new routing metrics can be piggybacked in the link color object container of a DIO message in RPAL:  
* The definition of affordable workload is inspired by the battery index [45] that represents how prone a node is to consume energy. In most cases, this metric will be highly dependent on the node localization, but its computation can be generalized by the following four operating states of a radio transceiver: transmission (TX), reception (RX), idle and sleep. In other words, this metric is a hierarchical Radio Duty Cycle (RDC) since almost all the discrepant energy consumption is associated with the radio operations;
* The hardware robustness is presented as a hardware restart count since the system starts working (_i.e._, the record provided by NanoRisc on Ext_Milive board [71]); \begin{table}
\begin{tabular}{c c c c} \hline
**Adopted Metrics** & **Domain** & **Aggregation Rule** & **Order Relation** \\ \hline ETX & [1, 512]\(\times\) 128 & Additive & (\(<\)) \(\xrightarrow{}\) ([1, 512], “\(+\)”, “\(<\)”) \\ Rem.Energy (\%) & [0, 1] & Concave (min.) & (\(>\)) \(\xrightarrow{}\) ([0, 1], “min.”, “\(>\)”) \\
1/Rem.Energy & [1, 255] & Additive & (\(<\)) \(\xrightarrow{}\) ([1, 255], “\(+\)”, “\(<\)”) \\ \hline \end{tabular}
\end{table} 
Table 3: Descriptions of the ETX, RE and derived RE routing metrics.