## 3 The Proposed Intelligent Mixed Approach
### The Mixed Frequency Hopping Spread Spectrum and Smart Clustering Algorithm
#### 3.2.2 The Proposed Energy Efficient and Scalable Clustering and Network Coding Approach  
This section describes the proposed cluster groups formation as well as the energy and RSSI aware CHs selection process. The BS in cooperation with two NB-IoT nodes with reliable source powers are equipped with GPS devices and are used as anchor nodes for localization of the other NB-IoT nodes within the cell as follows. The coordinates of the two selected anchor nodes and the BS are known and modelled as \((x_{1},y_{1})\), \((x_{2},y_{2})\) and \((x_{BS},y_{BS})\) respectively. From the broadcast of interest packets as the various nodes join the network, the two nodes and the BS will work out three Euclidean distance values to each of the \((j-2)\) nodes, as per Figure 2, as follows  
\[\left\{ \begin{aligned} &{\left({x_{n}-x_{1}}\right)^{2}+{\left({y_{n}-y_{1}} \right)^{2}}={d_{1}}^{2}}\\ &{\left({x_{n}-x_{2}}\right)^{2}+{\left({y_{n}-y_{2}}\right)^{2}} ={d_{2}}^{2}}\\ &{\left({x_{n}-x_{BS}}\right)^{2}+{\left({y_{n}-y_{BS}}\right)^{2} }={d_{BS}}^{2}}\\ \end{aligned} \right. \tag{7}\]  
The solution of Equation (7) leads to solving the matrix equation: \(AX_{n}=B\) such as  
\[\left\{ \begin{aligned} & A=\begin{bmatrix}-2{\left({x_{1}-x_{BS}} \right)}&-2{\left({y_{1}-y_{BS}}\right)}\\ &-2{\left({x_{2}-x_{BS}}\right)}&-2{\left({y_{2}-y_{BS}}\right)}\\ & X_{n}=\begin{bmatrix}x_{n}\\ y_{n}\\ \end{bmatrix}\\ & B=\begin{bmatrix}{{d_{1}}^{2}-{d_{BS}}^{2}-{x_{1}}^{2}+{x_{BS}}^{2}-{y_{1}} ^{2}+{y_{BS}}^{2}}\\ {{d_{2}}^{2}-{d_{BS}}^{2}-{x_{2}}^{2}+{x_{BS}}^{2}-{y_{2}}^{2}+{y_{BS}}^{2}}\\ \end{bmatrix}\\ \end{aligned} \right. \tag{8}\]  
After the geographical localization of nodes within the cell, the BS through its downlink reply packet does not only distribute the initial adaptive spread spectrum frequency hopping seed, it also sends information that geographically groups NB-IoT nodes that are close to each other into clusters. A typical illustration of a typical cluster formation within an NB-IoT cell is shown in Figure 3.  
Figure 2: Network Coding for Enhanced Narrowband IoT (NB-IoT) nodes localization approach. The following steps are taken for clusters formation and CH selection. * Step 1: Determining the neighbor nodes of each node within the cell by the use of predefined transmission range threshold \(d_{th}\) or an optimum number of clusters \(p_{opt}\). The problem of least energy number of clusters is a well-studied optimization problem [53] in energy-efficient wireless sensor networks clustering research which is normally formulated as follows, \[p_{opt}=\underset{1\leq p\leq j}{\arg\min}\ E_{avg}(p)\] (9) subject to: \(0\leq P_{t}\leq P_{t_{max}}\). where \(E_{avg}(p)\) is the average energy consumption of the \(j\) nodes within the cell as modelled in [54] and \(P_{t},P_{t_{max}}\) are the transmission power and the maximum transmission powers respectively. * It is observed that in an adaptive clusters formation and CHs selection, the process should be dynamic to ensure not only energy efficiency but also energy consumption balance. Because, as the overall average remaining energy efficiency reduces, the number of clusters should be reduced. This means much bigger clusters should be formed to ensure more energy balance and make sure some CHs do not die faster than others. It is also true that the bigger the transmission range threshold used for clusters formation, the smaller the number clusters. This means that the average residual energy is inversely proportional to the transmission range threshold \(d_{th}\). * On the other hand, the higher the average RSSI value, the more eligible CHs as the more nodes can directly reach the BS. This also translates to a smaller number of clusters which means the higher the transmission range threshold. This means that the average RSSI value is directly proportional to the maximum transmission range threshold. Figure 3: NB-IoT cell cluster formation.