Research Article

A Fuzzy-Decision Based Approach for Composite Event Detection in Wireless Sensor Networks

Algorithm 1

Construction algorithm of topology (CETC).
Input: graph , graph output:
Initialization: STATE = SLEEP, CB_Decide = false, CB_Decide indicates whether the node is a
-watching decision node
Choose :
(1)     Broadcast LDN packets //1 is performed in the period of time
(2)     Receive LDN packet, calculate itself whether can be a -watching decision node according
      to the condition of the determine criterion. If so, CB_Decide = true. //(2)–(4) will be
      implemented in the time period
(3)    broadcast(LN packets,);
(4)    receive(LN packets,);
(5)    if (CB_Decide = true) //(5)–(10) performed in the time period
(6)       calculate priority ;
(7)       broadcast(PP packets);
(8)    end if
(9)    receive(PP packets); //Before the end of the time period, the node is receiving PP data packet
(10)  if (CB_Decide = true)
(11)      Calculate ; //11 performed in the time period
(12)      starts timing after the period of time ; //(14)–(22) performing in ( ) time period
(13)     while ( )
(14)      if (receive(BDN packets))
(15)         stop the plan of sending BDN data package;
(16)      end if
(17)     end while
(18)  if (!receive(BDN packet)) //The node not received the BDN packet
(19)      broadcast(BDN packet);
(20)     STATE = DECIDE;
(21)  end if
(22) end if
(23) if (!receive(BDN packet) && CB_Decide = false) //(24)–(34) Performed in the time period
(24)    the maximum Prio node in PP packets;
(25)   if ( exists)
(26)         send( , CDN packet);
(27)      else
(28)         detected voids exist;
(29)   end if
(30) end if
(31)  if (receive(CDN packets))
(32)   STATE = DECIDE;
(33) end if
Choose : //The process executes in time period
(1)    if (STATE = DECIDE)
(2)     extract the information of LDN data packet;
(3)     ;
(4)     corresponding of all sensors of the current node = ;
(5)     sort node information by residual energy from large to small and get set .
(6)     foreach ( in )
(7)       if (any )
(8)         break;
(9)       end if
(10)     if ( corresponding to the integrated sensor on )
(11)       select as the sensor node, let the test attribute , ;
(12)     else
(13)      continue;
(14)     end if
(15)   end foreach
(16)   get a sensing node set , And property needs to ,};
(17)   foreach ( in )
(18)    send( , SN data packet);
(19)   end for each
(20) end if
(21)  if (receive(SN packets))
(22)  add the SN information to the local decision node list;;
(23)  send(SN.source, CF data packet);
(24)  if (STATE DECIDE)
(25)    STATE = SENSE;
(26)  end if
(27) end if
(28) if (receive(CF data packet))
(29)  extract the contents of the CF data package, add it to the sensing node list;
(30) end if
. STATE = DECIDE};
. STATE = SENSE};