|
Algorithm 2 Root selection algorithm in the presence of CFO |
|
Initialization: N, K, I, s = 1, , , , , r = 1, i = 1, j = 1 |
| 1: While do
|
| 2: if then , r = 1, i = 1, j = 1, , ,
|
| 3: else
|
| 4: if
or then
r = r + 1 |
| 5: else
|
| 6: if i=1 then
, j = j + 1, , i = i + 1, r = r + 1 |
| 7: else
|
| 8: if there exists such that then
r = r + 1 |
| 9: else
|
| 10: , index = 0 |
| 11: for k = 1 to j-1 do
|
| 12: if then
|
| 13:
|
| 14: if
for all (, ), |
| 15: and then
|
| 16: , , i = i + 1, r = r + 1, index = 1 |
| 17: break
|
| 18: end if
|
| 19: end if
|
| 20: end for
|
| 21: if index = 0 and then
|
| 22: , j = j + 1, , i = i + 1, r = r + 1 |
| 23: end if
|
| 24: end if
|
| 25: end if
|
| 26: end if
|
| 27: end if
|
| 28: end while
|