## 2 System Specification
### Overall System Description  
In each feedback control loop in Figure 1, there is a decision-making function based on fuzzy logic (FDM1 and FDM2) that actually decides what to do at each moment. Within the primary feedback control loop, the communication range (\(CR\)) (_i.e._, transmission power) can be updated at a certain time instant \(k\) as follows:  
\[e_{ND}(k)=ND_{R}(k)-ND(k) \tag{2}\]  
\[e_{1}(k)=k_{ND}\cdot e_{ND}(k),\quad\Delta cr(k)=k_{cr}\cdot\Delta u_{1}(k) \tag{3}\]  
\[\Delta u_{1}(k)=f_{DM1}\big{(}e_{1}(k)\big{)} \tag{4}\]  
\[CR^{*}(k)=cr(k)+\overline{CR_{0}} \tag{5}\]  
\[cr(k)=cr(k-1)+\Delta cr(k)\]  
\[CR(k)=\left\{ \begin{array}{cc}CR_{min},&\quad CR^{*}(k)<CR_{min}\\ CR^{*}(k),&\quad CR_{min}\leq CR^{*}(k)\leq CR_{min}\\ CR_{max},&\quad CR^{*}(k)>CR_{min}\end{array} \right. \tag{6}\]  
\(\overline{CR_{0}}\) is the initial value of the communication range (_i.e._, the initial transmission power) and \(f_{DM1}\) represents the FDM1 function. The function input \(e_{1}\) is the normalized node degree error, and the output \(\Delta u_{1}\) is the normalized communication range variation factor. Furthermore, the value of \(CR\) is saturated between its minimum value \(CR_{min}\) and maximum value \(CR_{max}\). \(k_{ND}\) and \(k_{cr}\) are normalization or scale factors for the input and the output, respectively. Both factors can be calculated as:  
\[k_{ND}=1/\overline{ND},\quad k_{cr}=\overline{\Delta cr} \tag{7}\]  
where \(\overline{ND}\) represents the nominal or desired value of the node degree when the battery has a critical energy level (\(\overline{E_{cr}}\)). Factor \(\overline{\Delta cr}\) is the communication range variation rate. The secondary feedback control loop tunes the desired value for the node degree according to the battery level and can be formalized as follows:  
\[e_{E}(k)=\overline{E_{cr}}-E(k) \tag{8}\]  
\[e_{2}(k)=k_{E}\cdot e_{E}(k),\quad\Delta nd(k)=k_{\Delta nd}\cdot\Delta u_{2} (k) \tag{9}\]  
\[\Delta u_{2}(k)=f_{DM2}\big{(}e_{2}(k)\big{)} \tag{10}\]  
\[ND_{R}(k)=\overline{ND}+\Delta nd(k) \tag{11}\]  
where \(e_{E}\) is the difference between the battery critical level and the actual level and \(\Delta nd\) is the node degree variation factor. Besides, \(f_{DM2}\) represents the FDM2 function where its input \(e_{2}\) is the normalized or scaled value of \(e_{E}\) and output \(\Delta u_{2}\) is the scaled node degree variation factor. \(k_{E}\) and \(k_{\Delta nd}\) are scale factors for the input and the output, respectively. Both factors can be calculated as:  
\[k_{E}=1/\overline{E_{cr}},\quad k_{\Delta nd}=\overline{\Delta nd} \tag{12}\]  
where \(\overline{\Delta nd}\) is the node degree variation rate. In general terms, both loops can be seen as a function, which receives the actual values of \(ND\) and \(E\) as inputs, returning a new value of \(CR\) as output and requiring a set of parameters \(\overline{\textbf{P}}\):  
\[\overline{\textbf{P}}=\Big{[}\overline{CR_{0}},\overline{ND},\overline{E_{cr} },\overline{\Delta cr},\overline{\Delta nd},CR_{min},CR_{max}\Big{]} \tag{13}\]where the complete parameters' list is: the initial value of the communication range (\(\overline{CR_{0}}\)); the desired value of the node degree when the battery has a critical energy level (\(\overline{ND}\)); the critical energy level (\(\overline{E_{cr}}\)); the communication range variation rate (\(\overline{\Delta cr}\)); the node degree variation rate (\(\overline{\Delta nd}\)); the minimum and maximum value of the communication range (\(CR_{min}\) and \(CR_{max}\)). The fuzzy transfer functions FDM1 and FDM2 are depicted in Figure 2a,b, respectively. Notice that FDM1 shows a larger slope for negative inputs than for positive values. When the FDM1 input is negative, the present number of neighbors is greater than the desired one \(ND_{R}\), the node is wasting transmission power, because it does not need so many neighbors, and Figure 2a suggests to reduce the transmission power very quickly.