# SASC: Secure and Authentication-Based Sensor Cloud Architecture for Intelligent Internet of Things
## 3 The Proposed Secure and Authentic Sensor Cloud Architecture
### Centroid-Based Cluster Formation Algorithm  
In the beginning, the initiation component is executed to construct the neighborhood tables and the adjustment of initial routing paths. The BS floods its identity (ID) and location \(loc(x,y)\) information in the sensor field. Upon receiving the flooded message, the adjacent neighboring nodes to the BS store the information in their local tables, increment the packet counter and forward the received information to their neighbors. The same practice is followed by all enduring nodes until they have the required information of their neighbors. Afterward, the network nodes send their own and neighbors position information to the BS on the constructed initial routing paths. On receiving, the BS measures the distance of each node from their neighbors and the BS itself in the sensor field. Subsequently, the computed distance information is sent back by the BS to particular nodes. Each node incorporates the received distance calculation in its local table. The main aim of the initialization component is to exchange messages among nodes and BS to have global information of the entire network field.  
Basically, in mathematical and engineering applications, the centroid is an arithmetic mean position of the points in a given space S. Unlike other solutions, the proposed SASC makes use of both energy and distance factors to compute the centroid vector. In traditional solutions, the position and weight of nodes do not change during network operations. Thus, the computation of centroids only in the use of position factor is useless. Hence, in robust and dynamic environments, SASC incorporates an energy aspect of nodes along with their distance information in a weighted manner to compute the function \(f(n)\) by following Equation (1).  
\[f(n)=\alpha.\ e(n)\ +\beta.\ c(x,y) \tag{1}\]  
In Equation (1), the contribution of both weighting parameters, i.e., \(\alpha\) and \(\beta\), must be equal to 100% such that \(\alpha+\beta=1\). \(e(n)\) is the arithmetic mean of residual energy of node n within a precise space S. Let \((n_{1},n_{2},\)\(n_{3}\)..., \(n_{k})\) is the set of nodes within a particular space \(S_{i}\), a centroid \(c(X,Y)\), which is like a virtual node, can be determined based on positions of the nodes. The \(c(X,Y)\) location is computed by taking the mean of the x-coordinates; \(X=\frac{1}{n}\sum_{i=1}^{n}\left(x_{i}^{2}\right)\), and the mean of the y-coordinates; \(Y=\frac{1}{n}\sum_{i=1}^{n}\left(y_{i}^{2}\right)\).  
In practice, the BS is a more powerful node and has no constraints in terms of resources as compared to other sensor nodes. Based on the position of nodes, the BS computes k number of  
Figure 1: Block diagram of Secure Sensor Cloud Architecture (SASC) Architecture.  
centroids (\(c_{1},c_{2}\), \(c_{3}\),..., \(c_{k}\)) and sends back the information to network nodes. In the proposed SASC, an unsupervised machine learning system is performed by using a k-means algorithm [65] that computes the nearest center of cluster based on computed \(f(n)\). Accordingly, a set of nodes \(n_{i}\) that is nearest to j-th centroid of the cluster are grouped to a particular region. This unsupervised machine learning system executes the same procedure continues until all nodes are divided into a unique region. Next, a node that is neighboring to the computed values of \(f(n)\) within each region is assigned the role of initial cluster head. All the selected cluster heads broadcast their status with their ID to members and schedule their data transmission slots using time division multiple access Moreover, the role of the cluster head is rotated based on network conditions, such that whenever the selected cluster head drops its energy level to the specified threshold, the next nearest node towards the \(f(n)\) value is selected as the new cluster head. Likewise, the newly selected cluster head adjusts the TDMA schedule and broadcasts its information inside a particular region only.