Skip to main content
. 2025 Jul 21;25(14):4510. doi: 10.3390/s25144510
Algorithm 1: Table Preparation Sub-Phase
Definitions
N[i]  the set of Ns located at distance ≥ do/2 from the CH
N[j]  the set of Ns located in the lower levels
CH[m]/IN[m]  the set of CHs/INs located at distance ≥ do/2 from the BS
CH[n]/IN[n] ∈ the set of CHs/INs located at distance ≥ do/2 from the BS
RT: Routing Table
Ann_Mess: Announcement message
Join_Req: Join Request message
Acc_Mess: Acceptance message
1: begin
2:  for each (N[i])
3:     if (received Ann_Mess from N[j]) then
4:       send Join_Req to N[j];
5:     end if
6:   for each (N[j]) received Join_Req
7:       if (has available in its TDMA table) then
8:          assign a slot to N[i];
9:          send Acc_Mess to N[i];
10:       end if
11:    end for
12:    for each (Acc_Mess received from N[j])
13:         compute cost (N[i], N[j]);
14:         add (N[j], cost (N[i], N[j]));
15:         sort RT[i] in ascending order;
16:     end for
17:  end for
18:  for each (CH[m]/IN[m])
19:     if (received Ann_Mess from CH[n]/IN[n]) then
20:         send Join_Req to CH[n]/IN[n];
21:     end If
22:   for each (CH[n]/IN[n])
23:       if (has available in its TDMA table)
24:         assign a slot to CH[m]/IN[m];
25:         send Acc_Mess to CH[m]/IN[m];
26:       end if
27:   end for
28:    for each (Acc_Mess from CH[n]/IN[n])
29:         compute cost (CH[m]/IN[m], CH[n]/IN[n]);
30:         add (CH[n]/IN[n], cost (CH[m]/IN[m], CH[n]/IN[n]));
31:         sort RT[m] in ascending order;
32:     end for
33: end for