| Algorithm 2. CFNGS |
| Input: n, Emax, Emin, Pt, , , , ei |
| Output: {t1,t2,…tn} |
| 1: initial medial parameters: cn = 0 % charging times, flag = 1 % end mark for charging |
| 2: initial T, EMC according to Theorems 2 and 3 |
| 3: while (flag) |
| 4: solve Problem (11) with CVX tool |
| 5: for i = 1:n |
| 6: e(i) = E(i) + Pt × × × Tw − × T; %update nodes’ residual energy |
| 7: if e(i) ≥ Emin |
| 8: cn = cn + 1 9: ouput {t1,t2,…tn} |
| 10: else |
| 11: flag = 0 |
| 12: end if |
| 13: end for |
| 14: end while |