## 4 Intruder Tracking Algorithm  
In intruder detection and tracking applications, a real-time system is actually a soft real-time system, where some latency is allowed [36]. Identifying emergency situations in a few seconds will suffice for satisfying the application requirements. Therefore, applications for intruder detection and tracking require low end-to-end delay values for sensor reports. In the scope of intruder tracking, the challenge is to ensure that the delays from different sources are small enough to allow a timely data fusion, and that the data fusion algorithm is able to provide intruder position estimations as quickly as possible. To meet this goal efficiently, we should have: (i) routing algorithms that are robust, and that quickly adapt to topology changes, while imposing a low routing overhead; and (ii) data fusion algorithms that are able to track the intruder using a small number of reports, avoiding the use of large time windows for report gathering, and also being flexible in the presence of packet loss. In our approach, the following additional issues should also be taken into consideration:  
* The sensor detection is binary within a range of 10 m (equal to the minimum distance between sensors), and sensor coverage is omnidirectional. This implies that, for the proposed grid deployment strategy, the number of sensors simultaneously detecting an intruder can range from one to four. * The intruder location is constantly updated by the sink node based on the different sensors reports received, and taking into account the timestamp associated with each individual report id. Algorithm (1) summarizes the process used to continuously estimate the intruder location. This algorithm adopts a report grouping strategy for data fusion purposes that is able to reliably estimate the location of a quickly moving intruder while introducing a low degree of complexity and few calculations. This algorithm was optimized to achieve near real-time position updating for single-target tracking, which was made possible through low computational overhead and incremental filtering based on small time-intervals. Nevertheless, it is worth remarking that multiple-target tracking could be supported in our architecture just by replacing the tracking algorithm with an alternative one, such as [13, 15]. Each report is associated with a unique and sequential id by the sink. Notice that each group of data includes several sensor reports, being consecutive groups separated by a time interval (in seconds) defined by the user. Vector \(\overrightarrow{P_{e}}\) contains the sequence of estimated intruder locations, being constantly updated based on the location associated with the different sensors (\(\overrightarrow{P_{s}}\)) that report the intruder's presence. To obtain the sequence of \(\overrightarrow{P_{e}}\) values, the following operations are performed every time a new sensor report is received:  
* Initially (first group created), the intruder location is estimated based on an exponential filter that weights new and old values. Factor \(\alpha\) characterizes the behavior of this estimation: higher values make the system more responsive to abrupt changes in the position, whereas lower values make it more conservative. * From the second group created onward, all report groups are split into micro-groups, and both location (\(\overrightarrow{P_{mgr}}\)) and speed (\(\overrightarrow{V_{mgr}}\)) estimations are made for each microgroup. The estimated intruder location is again based on an exponential filter that weights microgroup locationestimations (\(\overrightarrow{P_{mgr}}\)) and location estimations derived from speed (\(\overrightarrow{P_{speed}}\)). The latter is calculated as the projection of the previous estimated location (\(\overrightarrow{P_{e}}[last\_id-1]\)) plus the distance provided by the velocity vector for the time elapsed between the two microgroups. * Parameter \(\alpha\) is dynamically calculated, increasing as the time difference between the current time and the initial microgroup time increases.