# A Cooja-Based Tool for Coverage and Lifetime Evaluation in an In-Building Sensor Network+
## 1 Introduction  
Wireless sensor network (WSN) technologies that are available today allow easy network installation. However, the true cost of WSNs has shifted into the area of the maintenance costs that are inherent to networks with a large number of nodes and a limited battery life. Since the majority of the sensors used are still battery powered, these batteries require regular changing and/or recharging. Moreover, when used for long-term monitoring, a network evolves: new nodes may be added to the system; failed nodes are removed from the system; and user requirements and system functionality change over time. In addition, for an in-building WSN, the building itself may evolve: physical obstacles, such as walls and doors, that affect sensing coverage and communications, are often removed or added when a refurbishment is carried out. In long-term deployments, it is these evolutionary changes that can be highly disruptive to the network, affecting its ability to operate as expected.  
Contiki's Cooja [1] is a very popular WSN simulator. Similar to other WSN simulators, such as OMNeT [2], TOSSIM [3], OPNET [4], Ns-2 [5] and Ns-3 [6], it lacks support for modelling sensing coverage, focusing instead on network connectivity and protocol performance. However, in practice, itis the ability of a sensor network to provide a satisfactory level of coverage that defines its ultimate utility for end-users. In this paper, we introduce WSN-Maintain, a Cooja-based tool for coverage and network lifetime evaluation in an in-building WSN. It takes the floor plan of a building specifying the locations of obstacles, such as walls and doors, the coverage requirement of each region and the locations of sensor nodes. With WSN-Maintain, users can specify different degrees of coverage to different regions. For example, a server room and an electrical room require that each point in the area is covered by at least two sensors, and the rooms must be 100% covered, while it is enough for an office space to be 75% covered, and each point is covered by one sensor. WSN-Maintain runs in parallel with the collect-view tool of Contiki, which was integrated into the Cooja simulator and allows an interactive view of a data-gathering application.  
Application developers can use WSN-Maintain to implement and evaluate different techniques/algorithms to maintain coverage, where the tool finds coverage redundant nodes, puts them to sleep and turns them on when active nodes fail and coverage quality decreases. As our use cases, we implement two redundant node algorithms: greedy-maintain, a centralised algorithm, and local-maintain, a localised algorithm to configure the initial network and to turn on redundant nodes. We also incorporate the concept of reading correlation using the inverse distance weighting interpolation method. Sensors whose reading can be predicted using the reading of nearby active sensors can be considered as redundant and can be put to sleep to conserve energy. WSN-Maintain and Cooja simulation results using data from five real deployments show that utilising simple redundant node algorithms with reading correlation can improve energy efficiency by putting more nodes to sleep.