Skip to main content
. 2018 May 10;18(5):1509. doi: 10.3390/s18051509
Algorithm 2: Discrete method to calculate data load and energy consumption
Input: The whole network radius R, original broadcast radius r, common ratio q, the probability of generating data λ and energy parameters in Table 1
1.   Initializetotal_Q to all zeros/*total_Qi denotes a set of total data load in the Sector i */
2.   InitializeQ to all zeros/*Qi is a set of average data load for each node in Sector i */
3.   for i in [R...1] do
4.   /*i is the distance from current node v to sink*/
5.        Treat i as dv and calculate nv using Equation (11)
6.        Calculate rv using Equation (12)
7.        total_Q(i) = total_Q(i) + i
8.        tmpi = i − ⌊rv
9.        if tmpi > 0 then
10.             total_Q(tmpi) = total_Q(tmpi) + total_Q(i)
11.        end
12.        Q(i) = (total_Q(i)/i)λ
13.        Calculate energy consumption E(i) using Equation (3)
14.   end for
15.   Output: Q and E