# COALA: A Protocol for the Avoidance and Alleviation of Congestion in Wireless Sensor Networks
## 3 Proposed Protocol Description
### Steady-State Phase
The mathematical representation of this cost function is defined in (1):  
\[AC(i)=\Big{[}w_{\widetilde{BO}}\cdot\widetilde{BO}(i)+w_{\widetilde{DE}}\cdot \widetilde{DE}(i)+w_{\widetilde{L}}\cdot\widetilde{L}(i)+w_{\widetilde{VI}} \cdot\widetilde{VI}(i)+w_{\widetilde{pPI}}\cdot\widetilde{PI}(i)+w_{\widetilde {D}}\cdot\widetilde{D}(i)\Big{]}\cdot AI(i) \tag{1}\]  
where:  
\(AC(i)\) denotes the accumulative cost of node \(i\)  
\(\widetilde{BO}(i)\) denotes the normalized buffer occupancy of node \(i\)  
\(\widetilde{DE}(i)\) denotes the normalized dissipated energy of node \(i\)  
\(\widetilde{L}(i)\) denotes the normalized level number of node \(i\)  
\(\widetilde{VI}(i)\) denotes the normalized vicinity index of node \(i\)  
\(\widetilde{PI}(i)\) denotes the normalized popularity index of node \(i\)  
\(\widetilde{D}(i)\) denotes the normalized geographical distance of node \(i\) from the transmitting node  
\(AI(i)\) denotes the availability index of node \(i\)  
\(w_{\widetilde{BO}^{\prime}}\), \(w_{\widetilde{DE}^{\prime}}\),\(w_{\widetilde{LI}}\),\(w_{\widetilde{VI}}\),\(w_{\widetilde{PI}}\),\(w_{\widetilde{D}}\) are the corresponding weighting factors  
Once the accumulative cost has been calculated for all alternative neighboring nodes, COALA routing algorithm selects the node that has the minimum value of accumulative cost as the next recipient of the data in the routing path towards the sink. The buffer occupancy metric is considered in order to prefer nodes that have more free space in their buffers. The dissipated energy parameter is used so as to avoid the use of nodes that have low energy reserves. The level number is considered in order to give priority to upper level nodes, so that data are routed towards the sink. The vicinity index metric is used in order to avoid the utilization of nodes that have plenty of probable data suppliers and few data recipients. The popularity index is taken into consideration so as to slide over network nodes that tend to be repetitively busy. For instance, nodes that are located either in centric routing paths or within areas with frequent creation of events have high popularity and thus are more probable to get congested. The geographical distance between neighboring nodes is taken under consideration in order to give increased priority to the data relaying via the closest nodes than the more distant ones. The overall sum of products is multiplied by the availability index in order to prevent the utilization of nodes that are unavailable due to either insufficient energy, or inadequate buffer space or even inaccessible upper level neighboring nodes. Additionally, the existence of the weighting factors in this cost function, aims to support the appropriate adaptation of the algorithm in order to satisfy the different demands of every individual application. For instance, wherever the conservation of energy has major priority, \(w_{\widetilde{DE}}\) is assigned a greater value. In Figure 2, a descriptive flowchart of COALA protocol is illustrated.