## 4 Event Packet Forwarding Algorithm  
The proposed packet forwarding algorithm aims to determine the optimal node to forward a packet based on the GGF [16] algorithm. This is achieved by using a utility function that takes into account various network characteristics, such as the power level and distance to the sink. Power level refers to the amount of energy a sensor node has remaining. Nodes with more energy are better suited to forwarding the packet as they  
Figure 6: (**a**) Invalid area for position packets according to the position distance algorithm. (**b**) Invalid area for position packets according to the circle limit algorithm.  
are less likely to shut down before transmitting to the next hop. The distance to the sink represents the ratio between the distance from the receiving node to the sink and the distance from the sending node to the sink. The lower this ratio, the better the node is for packet forwarding as it will be closer to the sink. This ratio is particularly important when the packet is near the sink, as there may be multiple routes available for forwarding the packet. An example of this scenario can be seen in Figure 7.  
After the localization estimation algorithm runs, each sensor node stores the position of its neighbors and the sink. As the sink moves, it shares its new positions, and the sensor nodes update the stored sink position to ensure they have the most recent information. The sink position packet also has a time to live (TTL), which means that when a sensor node receives this packet, it decreases the TTL by one. If the TTL is still greater than zero, the node forwards the packet to its neighbors, allowing nodes further away from the sink to update their sink position information. Table 1 provides a description of the fields found in the sink position packet. Similarly, each sensor node shares its current battery level, its address, its position, and the accuracy of its position, which is determined by using three accurate position packets. Table 2 provides a description of the contents of a sensor node position packet.  
\begin{table}
\begin{tabular}{l c c} \hline \hline
**Field** & **Type** & **Description** \\ \hline \multirow{2}{*}{sqnNum} & \multirow{2}{*}{integer} & Sequence number of the packet, the nodes are going to update the position of the sink only if the sqnNum is bigger than the previous received. \\ \hline posX & double & Position of the sink in the X-axis. \\ \hline posY & double & Position of the sink in the Y-axis. \\ \hline ttl & integer & The nodes are going to forward the sink position packet to its neighborhood until it is 0. \\ \hline \hline \end{tabular}
\end{table}
Table 1: Sink position packet.  
Figure 7: Distance to sink. Sensor node 1 can choose between 2 and 3 and the distance is not a great factor to make the decision. On another hand, it is more important that node 4 forwards the packet to sensor node 5 than to sensor node 6 because node 5 is in the sink reception range.  
Using this information, it is possible to define a utility function expressed by Equation (6) to estimate the best node to forward the packet to.  
\[U_{i}=w_{p}P_{i}+w_{d}(1-D_{i}/D) \tag{6}\]  
\[w_{p}+w_{d}=1 \tag{7}\]  
where \(i\) is the \(i\)th neighbor node, \(w_{p}\) is the weight for the power attribute, \(P_{i}\) is the power of neighbor nodes \(i\), \(w_{d}\) is the weight of the distance attribute, \(D_{i}\) is the distance to the sink of the neighbor node \(i\), \(D\) is the distance to the sink of the sender node.  
By Equation (7), we have that the sum of the weights must be 1. Since the routing algorithm is based on GGF, the most important attribute in Equation (6) is the distance to the sink. Thus, the proposed values for the weights are \(w_{p}\) = 0.25 and \(w_{d}\) = 0.75, in order to prioritize the sensor node position.