# Event Coverage Detection and Event Source Determination in Underwater Wireless Sensor Networks
## 3 Event Detection and Sensory Data Aggregation
In this case, if there are no less than two sensor nodes whose sensory data deviate from a normal sensing range and should be relayed to \(SN\) by \(uv_{rel}\), \(uv_{rel}\) can be a candidate relay node for forwarding sensory data of these sensor nodes. ```
1:- \(uv_{rel}\in{UV}\): a sensor node in the network
2:- \(UV_{hb}=UV_{cld}\)\(\bigcup\)\(UV_{sb}\): a set of sensor nodes whose hop count is no smaller than that of \(uv_{rel}\) and whose \(HeartB_{ext}\) control packets have been received by \(uv_{rel}\)
3:
4:- \(uv_{rel}\) may broadcast an EPONG control packet
5:
6:\(cft\leftarrow\) get the number of sensor nodes in \(UV_{hb}\) whose _tag_ is 1
7:if (\(cnt\equiv 0\)) or (\(cnt=1\) and \(uv_{rel}(tag)=0\)) then
8:return
9:endiff
10:\(uv_{rel}\) broadcasts the control packet EPONG = \(<uv_{rel}\), \(null\), \(pid\), \(HC(uv_{rel})\), energy, queue, null, bit_mask\({}_{pld}\), bit_mask\({}_{IR}\), cnt\(>\)
```  
**Algorithm 1** Response for \(HeartB_{ext}\) control packets. It is worth mentioning that, given a sensor node \(uv\) whose sensory data deviate from a normal sensing range, when any sensor node \(uv_{rgb}\), neighboring to \(uv\), cannot satisfy the condition specified by Line 2 in Algorithm 1, \(uv\) corresponds to an outlier (or error), whose sensory data should not be routed to \(SN\). When \(uv_{rel}\) is examined to be a candidate relay node for neighboring sensor nodes, it broadcasts an EPONG control packet for the competition of being the relay node:  
\[EPONG=<id_{uv},null,pid,HC(uv_{rel}),queue,energy,null,bit_mask_{L_{pt}},bit_mask_{ IR},cnt> \tag{7}\]  
where the parameters for target sensor node and link quality are set to \(null\). Different from the PONG control packet in the routing tree maintenance [22], the parameter \(cnt\) specifies the number of sensor nodes whose sensory data should be aggregated and forwarded by \(uv_{rel}\). Generally, the larger the \(cnt\) is, the smaller the number of sensory data packets is to be routed to \(SN\), although the relatively larger the sensory data packets are in size. This strategy should decrease the network traffic and reduce the energy consumption of the whole network to a certain extent. As presented in Algorithm 2, when a sensor node \(uv\) receives several EPONG control packets, an appropriate sensor node should be selected as the relay node for \(uv\). As presented in Line 3, when a candidate sensor node \(EPONG_{cur}.uv_{rel}\) can:  
* relay sensory data for a larger number of sensor nodes, which may reduce the number of sensory data packets to be forwarded in the network, or
* have more remaining energy with respect to its hop count (reflected by \(EPONG_{cur}.energy\div EPONG_{cur}.HC\)), which may promote the balance of energy consumption between sensor nodes and, thus, prolong the network lifetime. It is worth noting that when (i) the condition \(EPONG_{cur}.HC\geq EPONG_{sel}.HC\) holds, which means that \(EPONG_{cur}.uv_{rel}\) is not nearer \(SN\) in hop count in comparison with \(EPONG_{sel}.uv_{rel}\), but (ii) the condition \(EPONG_{cur}.energy\div EPONG_{cur}.HC>EPONG_{sel}.energy\div EPONG_{sel}.HC\) holds, which means that \(EPONG_{cur}.uv_{rel}\) can forward a larger number of sensory data packetsthan \(EPONG_{sel}.uv_{rel}\), \(EPONG_{cur}.uv_{rel}\) is assumed more appropriate than \(EPONG_{cur}.uv_{rel}\) to serve as the relay node,  
\(EPONG_{cur}.uv_{rel}\) is chosen as the relay node for \(uv\). Consequently, \(uv\) sends an acknowledge control packet ACK to \(uv_{rel}\) for the confirmation of this selection (Line 8). Note that when \(EPONG_{cur}.uv_{rel}\) is examined not as a candidate relay node for \(uv\), \(EPONG_{cur}.uv_{rel}\) ignores the received EPONG control packet, and no ACK control packet will be sent from \(uv\) to \(uv_{rel}\).