# CoAR: Congestion-Aware Routing Protocol for Low Power and Lossy Networks for IoT Applications
## 4 Proposed Congestion-Aware RPL
### Routing Metrics  
Several routing metrics are considered that reflect the probable congestion situation at node and link level. These metrics are used to find the best parent in term of congestion and define as follows. Queue Utilization (QU): This metric refers to the neighboring nodes that have more free space in their buffers. It is defined as the buffer occupancy ratio of a node i to indicate the number of packets in the i's queue out of the total queue size as in Equation (1). It is chosen for detecting and distributing information about congestion. It can serve as a simple and good indication of congestion and reflects the existing congestion situation at each node. Based on this matric, packets will be forwarded towards the idle or under-loaded parent. Here, we use the sliding window-based averaging to obtain queue occupancy. \[QU(i)=\frac{N_{p}Q(i)}{QS_{z}(i)} \tag{1}\]  
where, \(QU(i)\in[0,1]\), \(N_{p}Q(i)\) is the number of packets in the queue of a node \(i\) and \(QS_{z}(i)\) is the total queue size of \(i\). Expected Transmission Count (ETX): The _ETX_ is known as a reliability metric that has been proposed in ([PERSON] and [PERSON], 2018). It is the expected number of transmissions required by a data packet to be delivered successfully as in Equation (2). This metric can help to select a data forwarding path that includes relatively high-quality communication link(s). It is an additive metric that adds the _ETX_ of each link along the path to the destination. It is used to distinguish congested and/or lossy links. A link quality increases with decreases the value of the _ETX_. \[ETX(i,j)=\frac{1}{d_{ij}(data)\times d_{ji}(ack)} \tag{2}\]  
where, \(d_{ij}(data)\) represents the measured probability that a packet is received successfully by the neighbor and \(d_{ji}(ack)\) is the measured probability that the acknowledgment is successfully received. Residual Energy (RE): This metric is used as the representative of network lifetime and permits to avoid selecting a node with low _RE_. The metric container uses the node energy object, as mentioned in Figure 3, to carry the _RE_. Likewise, node energy object contains the node type field which reveals the energy type of a node. In LLNs, how prone a node is to consume the energy depends on the node's placement in the network as well as other factors. The _RE_(\(i\)) is defined as the difference between the maximum energy _MxE_(\(i\)) and the energy consumption _Ec_(\(i\)) by a node \(i\) as in Equation (4). Moreover, energy consumption can be estimated based on the power consumed by the node in each of the following possible states in which a node can operate. The states are the transmission (\(T_{x}\)), reception (\(R_{x}\)), _LPM_ (low power mode, which basically means sleep mode) and _CPU_ (radio is off but the system is active when processing information). In Contiki Contiki (2018), an energy estimation module named _Energest_ is used to obtain information about how long a system has been in different states. Additionally, power consumptions in these states can be easily obtained from the datasheet of the CC2420 chip. Energy consumption _Ec_(\(i\)) of a node \(i\) based on all the states with respect to time is obtained as in Equation (3). \[Ec(i)=T_{T_{x}}\times P_{T_{x}}+T_{R_{x}}\times P_{R_{x}}+T_{CPU}\times P_{CPU} +T_{LPM}\times P_{LPM} \tag{3}\]where, \(T_{state}\) and \(P_{state}\) respectively, is the amount of time a node has spent in that particular state and the corresponding power consumed in that state at a particular unit of time. \[RE(i)=M_{x}E(i)-Ec(i) \tag{4}\]  
Neighborhood Index (NI): \(NI\) is used to avoid the use of nodes that have many potential child nodes (data supplier) and few parent nodes (data recipients). Every individual node \(i\) in the network has its neighboring node. We define the neighboring node of \(i\) as \(N_{n}(i)\) such that, each node \(j\) associated with \(i\) either as an upstream neighbor (\(U_{n}\)) or as a downstream neighbor (\(D_{n}\)).