# A New Centralized Clustering Algorithm for Wireless Sensor Networks
## 3 Proposed Method
### Node Scoring  
The fuzzy system used to infer a score for each node is a Type-2 one. This kind of artificial intelligence is especially suitable for WSN, in which there is no mathematical function to model its performance and in which the uncertainty degree is really high. Type-2 Fuzzy sets also work better in those applications whose input variables also have uncertainty because they could be estimations from measurements with a high level of tolerance. In WSN, it is necessary to rely on estimations to decrease the control information exchanged among the nodes and, as a consequence, the consumption due to the control tasks is jointly decremented. Type-2 Fuzzy systems are also applied in other technological fields such as decision in Mobile Ad hoc Networks [17], risk analysis in Marine Power [18], wireless indoor location [19] and PID control [20]. The block diagram of a Type-2 Fuzzy inference system is shown in Figure 2. As can be noticed, Type-2 Fuzzy systems differ from Type-1 systems only in the output processing block. Each input is fuzzified before entering into the inference system, that is connected to the knowledge base. The knowledge base includes the rules that link input and output variables to be used by the output processor. This last block differs from the Type-1, because the reducer is added before the final defuzzification is accomplished. Besides, the output of the T2 FIS is an interval (\(s_{l}\),\(s_{h}\)) instead of a crisp value obtained by a Type-1 fuzzy system. Both limits of the interval are used when computing the best CHs according to the following rule: if the node was elected as CH in the previous round, then the lowest value of the interval, \(s_{l}\), is chosen for a comparison operation. Otherwise, the highest value of the interval, \(s_{h}\), is used in the comparison. This strategy was followed in some previous works such as [5; 15]. This rule avoids that a node with a high output value could be selected continuously as a CH. This setting should be avoided as it would eventually deplete its battery. The input variables of the T2 FIS was carefully selected to achieve an efficient balance between energy consumption, performance and reliability (availability of the measurements from all the sensors in the network). Therefore, the input variables captures the evolution of the energy spent in every node and the behaviour of each node. Consequently, the T2 FIS was designed with the following input variables:  
* Residual Energy (\(R_{i}\)) of node \(i\), measured as the ratio between the current energy and the initial energy of each node. The current energy of a node is estimated by the BS basing on the energy consumption model explained in Section 3.3. * Normalized Distance (\(D_{i}\)), computed as the distance from the BS to the node \(i\) divided into the maximum one. * The degree of deviation of the energy (\(DDE_{i}\)) in a node \(i\) (\(R_{i}\)) compared with the average energy of all the alive nodes (\(R_{a}\)). As the input variable of the fuzzy system must be kept between 0 and 1, this ratio is normalized according to Equation (1). Nodes with a high residual energy charge could saturate this value. For the normalization of \(DDE_{i}\), the value 1.5 was set because it is assumed that a node with more than the 50% of the average energy should be a good candidate to be elected as CH and it is desirable to avoid higher levels of unbalanced battery charges in the network. \[DDE_{i}= \begin{cases}1&if\ R_{i}\geq 1.5\times R_{a}\\ \frac{R_{i}}{1.5R_{a}}&if\ R_{i}<1.5\times R_{a}\end{cases} \] (1)
* Normalized number of rounds without being a CH (\(RnoCH_{i}\)). It is defined as the number of rounds without being CH (\(roundsnoCH_{i}\)) compared with a threshold (\(RnoCH_{th}\)). This input is established according to Equation (2). \[RnoCH_{i}= \begin{cases}1&if\ roundsnoCH_{i}\geq RnoCH_{th}\\ \frac{roundsnoCH_{i}}{RnoCH_{th}}&if\ roundsnoCH_{i}<RnoCH_{th}\end{cases}