# Event Coverage Detection and Event Source Determination in Underwater Wireless Sensor Networks
## 3 Event Detection and Sensory Data Aggregation
```
0:-\(uv\in UV\) : a sensor node in the network
0:-\(EPONG_{set}\) : a set of EPONG control packets received by \(uv\)
0:-\(uv_{rel}\) : a sensor node to be selected for relaying sensory data of \(uv\)
1:\(EPONG_{cur}.\bigotimes\), where \(\bigotimes\) means an empty set
2:for\(EPONG_{cur}\in EPONG_{set}\)do
3:if\((EPONG_{cur}.cnt>EPONG_{sel}.cnt)\) or \(((EPONG_{cur}.cnt=EPONG_{sel}.cnt)\) and \((EPONG_{cur}.energy\div EPONG_{cur}.HC>EPONG_{sel}.energy\div EPONG_{sel}.HC))\)then
4:\(EPONG_{sel}\gets EPONG_{cur}\)
5:endif
6:endfor
7:\(uv_{rel}.\bigotimes\gets EPONG_{sel}.id_{uv}\)
8:\(uv\)'sends an acknowledge control packet ACK to \(uv_{rel}\)
```  
**Algorithm 2** Relay node selection. An example of the relay node selection is shown in Figure 1, where (i) the sensor node with a mark of 86 is the relay node for the sensor nodes with marks of 66, 88 and 85 and (ii) the sensor node with a mark of 84 is the relay node for the sensor nodes with marks of 62, 86 and itself. This mechanism may make overload an optimal relay node \(uv_{rel}\) responsible for a relatively large number of sensory data packets in a certain time slot, while other relay nodes \(UV_{rel}\), which are not as optimal as \(uv_{rel}\) in this time slot, may relay sensory data for quite a few sensor nodes. This may cause a relatively large amount of energy to be consumed for \(uv_{rel}\) at this moment. Therefore, \(uv_{rel}\) may be found not as an optimal relay node in the following time slots, and another sensor node in \(UV_{rel}\) is found optimal instead. This means that different sensor nodes may serve as optimal rely nodes in different time slots, which may cause the energy consumption of sensor nodes to be almost the same as the average in the long term. We argue that this strategy can avoid the energy over-consumption of any single sensor node and, thus, prolong the network lifetime somehow. ```
0:-\(uv_{rel}\) : a relay sensor node
0:-\(UV_{rel}\) : a set of sensor nodes whose sensory data should be relayed by \(uv_{rel}\)
0:-\(SRYDT_{uv}\) : a set of sensory data to be gathered and routed by \(uv_{rel}\)
1:\(uv_{rel}\) sends a \(getData=<id_{uv}\), \(\{\bar{id}_{uv}\}\), \(pid\), \(HC(uv_{rel})\)> control packet to \(\forall\)\(uv_{rel}\in UV_{rel}\)
2:\(\bar{c}_{full}^{\prime}\gets 0\)
3:while\(uv_{rel}\) receives a \(sryD_{tw}\) data packet from a sensor node \(uv_{rel}\in UV_{rel}\)do
4:\(SRYDT_{tw}\div RSYDT_{tw}\div\)\(\langle\)\(sryD_{tw}\rangle\)
5:\(\bar{c}_{full}^{\prime}\gets\)\(\bar{c}_{full}^{\prime}\)
6:if\(



\[getData=<id_{uv},\{\widetilde{id_{uv}}\},pid,HC(uv_{rel})> \tag{8}\]

where \(\widetilde{id_{uv}}\) refers to the identifier of a sensor node \(uv_{eet}\in UV_{eet}\). \(uv_{eet}\) will forward its sensory data to \(uv_{rel}\) in terms of the format:

\[sryDt_{uv}=<\widetilde{id_{uv}},crd_{uv},val_{uv},atr_{uv}> \tag{9}\]

where \(val_{uv}\) is the value of sensory data, and \(atr_{uv}\) refers to the attribute to be sensed by \(uv_{eet}\). Whenever \(uv_{rel}\) receives the sensory data packet \(sryDt_{uv}\) from any sensor node (Line 4), \(uv_{rel}\) aggregates it into \(SRYDT_{uv}\) (Line 4). When sensory data for all sensor nodes contained in \(UV_{eet}\) have been gathered (Lines 5-8), \(uv_{rel}\) routes the aggregated data packet to \(SN\) through the routing tree (Line 10). The function _sizeOf()_ in Line 6 returns the number of elements contained in a certain set. ## 4 Event Coverage Detection and Event Sources Determination

When \(SN\) receives sensory data \(sryDt_{uv}\in SRYDT\) from all sensor nodes, whose sensory data may exhibit a deviation from a normal sensing range, the event coverage is to be detected as introduced by Algorithm 4. A weighted graph \(g_{eet}=(UV_{eet},\)\(EG_{eet},\)\(WGT_{eet})\) is adopted to represent the event coverage, where \(UV_{eet}\) and \(EG_{eet}\) represent sensor nodes and edges connecting these sensor nodes in this graph, while \(WGT_{eet}\) is the weight specified upon the edges \(EG_{eet}\).