Research Article

CAF: Cluster Algorithm and A-Star with Fuzzy Approach for Lifetime Enhancement in Wireless Sensor Networks

Algorithm 1

Proposed CAF method.
Input:
   : a network
   : optimal election probability of a node to become a
  CH
   : number of nodes in the field
   : percentage of nodes that are advanced
   : multiple of the advanced node is times greater
  than the normal node
   : the number of rounds
output:
  NA( ): the number of alive nodes in each round
  RP( ): the remaining power of each node in
  each round
   _FND: the round of first node are dead
   _HNA: the round in which half of the nodes are alive
Function:
  FuzzyLogic(Remain_Power, Traffic_Number);
  Insert_Open( val, val, parent_ val, parent_ val,
   , cost, )
  Expand_Array(node_ , node_ , hn, Target,
   Target, (LOSED, MAX_ , MAX_ , exp_neibor)
  Max_Fn(OPEN, OPEN_COUNT, Target, Target)
  Seek_Node_Id(C, xval, val)
  Node_Index(OPEN, val, val)
  Arrow( start, end);
Initialization:
(1)    ;
(2)   * ;
(3)  RP * ;
(4)  TN rand(1) * ;
(5)  Pro( ) FuzzyLogic(RP, TN);
(6)   _cost2dis 0.7
Main:
(7)  For  : 1 : n
(8)   If (temp_rnd >= * )
(9)     ( ).type nor;
(10)  else ( ).type adv;
(11)   end if
(12) end for
(13)  * for every clustering round *
(14) For  : 1 : 
(15)  if(( ( ).type== nor (temp_rand <= ( nrm
     (1 – nrm * mod( , round(1 nrm)))))))
(16)    ( ).type ch; Election CHs from normal nodes
(17)  end if
(18)  if(( ( ).type == adv (temp_rand <= ( adv
     ( adv mod( , round(1 adv)))))))
(19)    ( ).type ch; Election CHs from advanced nodes
(20)  end if
(21) end for
(22) Voronoi( );
(23)  , voronoin( );
(24) For  : 1 : cluster
(25)  *Find the optimal route using the A-star method*
(26)  MH sqrt
      ;
(27)  NC( ) _cost2dis*(Pro( ) Max_cost) + (1 − _cost2dis)
     * ((Max_distance-MH( )) Max_distance);
(28)   ( ).ver ( , 1), ( , 2) ;
(29)  if the polygon and have two same vertexes or more
(30)    ( ).neighbor( Nei) ; Find the neighbor of each CH
(31)   end if
(32)  while(( Node ~= Target Node ~= Target)
      NoPath == 1)
(33)   if node is in Exp_Array table and not in OPEN table
(34)     OPEN(OPEN_COUNT,:) Insert_Open(
     Exp_Array( , 1), Exp_Array( , 2), Node,
       Node, Exp_Array( , 3), Exp_Array( , 4), Exp_Array( , 5));
(35)   end if
(36)   index_max_node Max_Fn(OPEN, OPEN_COUNT,
       Target, Target);
(37)   if (index_max_node ~= −1)
(38)     CLOSED(CLOSED_COUNT,1) Node;
(39)     CLOSED(CLOSED_COUNT,2) Node;
(40)   else NoPath 0;
(41)   end if
(42)  end while
(43)  while(parent_ ~= Start parent_ ~= Start)
(44)   parent_ OPEN(Node_Index(OPEN, val, val),4);
(45)   parent_ OPEN(node_index(OPEN, val, val),5);
(46)    node node_index(OPEN, parent_ ,parent_ );
(47)    Start parent_ , parent_ ;
(48)    End val, val ;
(49)   Arrow( Start, End);
(50)  end while
(51) end for