Simulation Platform for Wireless Sensor Networks based on the TrueTime Toolbox

Alberto Cardoso1, Sérgio Santos1, Amâncio Santos1,2 and Paulo Gil1,3 CISUC, Department of Informatics Engineering, University of Coimbra, Portugal 2 Department of Informatics Engineering and Systems, Institute of Engineering of Coimbra, Portugal 3 Electrical Engineering Department, Universidade Nova de Lisboa, Portugal,,,

Abstract— Research on Wireless Sensor Networks (WSN) has received considerable attention in the last few years due to their unique characteristics, including, flexibility, self-organization, easy deployment, which make them an ideal candidate for lowcost monitoring. In order to help WSN planning and to enable the design of new protocols and applications and assess their performance, several existent simulation platforms have been extended to include simulation frameworks for WSN. In this paper, a higher level simulation platform for WSN is proposed based on the TrueTime toolbox. Relevant features include graphical representation of communication components, wireless communication and battery-driven operation. Special attention was paid to the 3D graphical interface, simulator interactivity and its extendibility. Simulation results demonstrate the applicability and usability of the proposed simulation platform.



Wireless Sensor Networks (WSN) [1], [2] consist of a number of battery powered sensor nodes, endowed with physical sensing capabilities, limited processing and memory, and short-range radio communication. These nodes collectively form a network and forward gathered information to a data sink or gateway. A WSN comprises a potentially large set of nodes that may be distributed over a wide geographical area, indoor or outdoor [3]. WSNs enable a number of sensing and monitoring services in areas of vital importance such as efficient industry production, and environmental monitoring. In general, a sensor node includes a sensing device for data acquisition from the physical environment, a processing subsystem for local data processing and storage, and a wireless communication module. Additionally, a power source supplies the energy needed by the device to perform all the programmed tasks. This power source is in most cases battery-driven with limited available energy. Therefore, maximizing the network lifetime is also an important challenge (see e.g. [4]) and should be tackled either in the planning stage or by means of a recursive optimization of the network lifetime under minimal coverage constraint. Thus, in order to support planning and deployment as well as to enable testing of new protocols and applications, simulation platforms have been extended to include simulation frameworks for WSN. A comparative analysis of several

WSN simulation platforms can be found in [5] and [6]. In this paper a new simulation platform for WSN based on the TrueTime simulator is presented. Given its underlying features it provides researchers with a very flexible simulation environment with application in a number of scientific areas, such as, WSN communication protocols or distributed control over wireless networks. The approach followed here makes use of the TrueTime toolbox [7], [8], which is a freeware Matlab® library for simulating networked and embedded real-time control systems. This platform distinguishes from other competitors in that it i) provides higher level simulations under the Matlab® environment; ii) is a simulator and not an emulator as TOSSIM for TinyOS [9], or Cooja for Contiki [10] and thus, it does not require a complete application for running a simulation, but just the behavior description of the desired components; iii) presents the extendibility property, as researchers may take advantage of wide range of libraries available in Matlab®. This includes libraries for data visualization, design of fault tolerance mechanisms or data stream processing, just to mention a few. Additionally, the proposed simulator supports the ZigBee protocol (incorporated in the TrueTime toolbox), description of the WSN and its properties through a XML configuration file, 3D simulation and visualization as well as the possibility of real time simulations embedding real motes. The organization of this paper is as follows. Section II gives an overview of the simulation platform, pointing out the enhanced features and flexibility. Two use cases under the form of examples are presented in Section III, while in Section IV some conclusions are drawn. II. THE SIMULATION PLATFORM The simulator under development should support researchers and practitioners in the development of tasks related to WSN, such as, designing of new protocols and applications as well as assessing the overall WSN performance, including the WSN lifetime. Furthermore, it should offer a configurable realistic, abstraction of the underlying network and physical details, in order to be used in the study of data stream processing techniques. Finally, the platform should be easily extendible and modular in order to effortless allowing the

implementation of specific algorithms, external constraints and new types of outputs, such as graphical visualizations or data logs. A WSN simulation model must contain the required entities for a correct representation. These include communication components (motes and gateways), the wireless network interconnecting these elements, sensor entities and, finally, the surrounding environment. All should be configurable, act accordingly and yield reliable results. The simulator was built using the Matlab®/Simulink® platform and the TrueTime toolbox. The present version was implemented for Matlab® R2007b and Simulink® 7.0 and based on TrueTime 1.5. It includes a Simulink® block library, Matlab® source code and a collection of MEX/DLL files. The kernel block simulates a real-time kernel executing userdefined tasks and interrupt handlers. The network blocks allow nodes to communicate over simulated wired or wireless networks. By using the TrueTime toolbox it is possible to simulate the temporal behaviour of computer nodes and communication networks that interact with the physical environment. A. The TrueTime toolbox TrueTime is a freeware toolbox1 for simulating networked and embedded real-time control systems. One of its main features involves the possibility of co-simulation of the interaction between the real-world continuous dynamics and the computer architecture in the form of task execution and network communication. Some fundamental features in the context of this work include: i) emulation of a wireless network and transmission models; ii) representation of the kernel of a mobile node communicating through the implemented network; iii) representation of battery-powered devices and some basic consumption models. This tool was essential for a correct, reliable and effortless abstraction of the underlying layers of the simulator, mainly the electronics and linking issues behind each wireless node and the wireless network. B. Graphical front-end The simulator’s environment consists of two distinct layers: a graphical front-end and a data back-end. The graphical front-end (Figure 1) includes all the controls and operations for running a given WSN simulation, including Simulink® blocks and data visualization modules. On the top of this front-end environment, an additional graphical user interfaces has been built (see Figure 2) to improve the usability of the simulator. It enables monitoring relevant data and executing common tasks, such as reconfiguring the network or selecting the appropriate routing algorithm.

Fig. 1. Main simulation platform interface.

Fig. 2. Simulator additional graphical user interface.

C. Features 1) Communication Components: These components are represented in three categories (see Figure 3). The sensor motes have sensing capabilities, which enable the acquisition of data from the external environment, process and relay data objects and are battery-operated with autonomy constraints. Access points or repeaters process and relay messages and may also have autonomy restrictions, in the case of batterypowered units. Servers or gateways receive the final data packets, and usually have no autonomy constraints. Fig. 3. Communication Components in a WSN.

Concerning the components behaviour, there are three different states: Active (fully functional), Idle (inactive but with minimal power consumption) and Offline (inactive and with no power consumption). Each network node has its own representation in a 3D coordinate system, which allows obtaining its relative position to other units, in a homogenous environment. Both properties can be changed while a simulation is running, (see Figure 4). The motes’ energy consumption is evaluated based on the underlying physical state (Active/Idle/Offline), the distance between nodes, transmission/reception costs and wireless network protocol costs. Other energy consumption models may be developed and integrated within the platform, since this functionality is represented by a Simulink® block. 2) Wireless Network: Users are allowed to configure several Wireless Network parameters. Some of them are automatically configured depending on the network type, namely IEEE802.11b or IEEE802.15.4. Those parameters that are automatically configured by default include data rate, minimum frame size, transmit power, receiver signal threshold, ACK timeout and maximum of retries. Additionally, the default path loss exponent and error coding threshold can also be defined. An implemented functionality to the TrueTime wireless network simulation is the support of path loss exponents for specific network links, which is useful to simulate predicted obstacles between specific motes or in specific network areas. Besides the graphical interface shown in Figure 5, all the network configuration, including the nodes’ parameters and position, may be set on a single XML file. This approach was already implemented in ATEM0 [11], a MICA2 platform emulator, though at a lower level than the one considered here. Figure 6 presents a partial example of a network configuration XML file, showing the wireless network parameters, specific path loss exponents and motes’ parameters.

Fig. 5. Wireless Network parameters.

[m] [m] Fig. 6. Partial example of a wireless network configuration XML file. [m]

Fig. 4. Communication components parameters.

3) Sensed entities: For simulation purposes, these are represented by continuous time signal generators, attached to the sensor mote analogue input port. Motes acquire these signals at a regular user defined sampling time. This can be extended to support more complex models or to integrate data collected from sensor nodes in real time.

4) Environment: The surrounding environment can be emulated in different ways, though most commonly through the path loss exponent. This parameter defines the attenuation of the signal with distance, being higher when the attenuation is more significant and the environment is more hostile to wireless communications. Other ways of representing specific conditions for the wireless communication channel, like specific errors at the transmission or reception level on the respective motes’ routines and errors on the network communications, were not implemented but may easily be included. . 5) Routing algorithm: A routing algorithm is used on the simulator, which defines the message distribution routes throughout the entire network. The teleonomy of the algorithm is to optimize some features of the network. It enables the maximization of the network useful lifetime, ensuring the most effective route. This routine is called at a configurable period and whenever a change occurs in a node state. Additionally, it must ensure coherent results. 6) Data output: The platform presents in the current stage four different output formats, although new frameworks for outputting simulation results could easily be implemented and included taking advantage of the available Matlab® toolboxes. The common mode is a 3D visualization display of the simulation outputs. All the nodes in a given WSN topology under simulation are represented in a real-time 3D graphic, with specific symbols representing their type and colors representing their state or battery level (Figure 7). Each node’s property can be queried by selecting it. In this case, some information will appear in a pop-up window on the screen, like the one shown in Figure 7.

It is also possible to visualize feasible routes/links (through reachable distances between nodes), current active links, and to query each route/link properties, as similar to the nodes query. There are other two real-time graphical visualizations. One is a group of graphics representing the battery level for each node. The second group of graphics represents the analogue output port for each node (Figure 8), which corresponds to the received data packets. This visualization is useful for identifying lost packets or communication delays. Additionally, at the end of each simulation, a record of the output of every routing algorithm execution is saved on a “.mat” file format. III. SIMULATOR USE CASES

In this Section two WSN simulation examples are presented so as to highlight the flexibility and applicability of this simulation platform for WSN. These use cases are directly linked to the purposes of this simulation platform within the Ginseng Project2, which main goal is the planned deployment of WSN that meet application-specific performance targets, in particular with respect to latency and reliability. It should be mentioned that the platform applicability does not restrict itself to these particular examples. A. Development of energy optimization algorithms Maximizing the network lifetime is an important challenge, still being currently under investigation (see e.g. [12] and [13]). By using a WSN simulation platform it is possible to monitor the active links, following in real-time the outcomes of its energy optimization algorithm under the constraint of maximizing the WSN lifetime. Both the nodes’ battery and transmitted messages would reflect this optimization procedure. The WSN considered in the following examples is spatially deployed over a vast region, where each node is batterypowered and all the gathered sensors’ data must relayed to sink nodes. In addition, all the nodes are packet relay capable and should be able to dynamically adjust the transmit power depending on the distance to the node they are communicating with.

Fig. 7. 3D nodes visualization.

Fig. 8. Visualization of the analog output of each node.


EU-FP7 Grant agreement no. 224282

Figure 9 shows the schematic 3D representation of a WSN, where motes are presented with cubes, access points/repeaters with double crosses and the server or gateway is identified with a rectangular box. The visualization also shows the state of the motes. Since all the motes are green, they are all active. Additionally, it is possible to observe all the feasible communication links. Each mote can only exchange data with those sufficiently near, due to the wireless network characteristics. There is an alternative visualization mode of the WSN, where instead of the mote state, the color can represent the battery level. The stronger the color the higher is the battery capacity. In the initial state (initial conditions), every mote’s battery is near the full capacity, represented here by a strong blue color. In Figure 10, one particular mote has been selected and marked in red. Therefore, only its feasible transmission links are visible. Those links being used for data transmission are larger and colored blue, while the others are thinner and white. In this case, the selected sensor mote has four feasible links.

The information about which links are in use and the corresponding usage percentage is provided by the optimization algorithm. Some additional information for the selected mote is available on the information window: type, mote identification number, 3D position and battery level information. During the simulation, the motes’ power consumption will depend on their communication and operational costs, while the server is assumed to have no limited availability of energy. Figure 10 shows the motes’ battery levels, where the two nearly white sensor motes have the lowest amount of available energy. Due to the low battery level of those two sensor motes, the next iteration of the optimization algorithm will redirect less traffic to them, in order to maximize the network lifetime. Consequently, the access point selected on Figure 11, has only one active transmission link, with nearly 100% of the generated traffic. Another feature is the possibility of dynamically configure the motes’ parameters during simulations. Whenever a change occurs or is detected, the optimization algorithm is executed in order to adapt the network active links to the new physical characteristics. In the situation described on Figure 12, the middle access point was deactivated, turning its color into white. That action led to a reconfiguration of nearby motes’ links. The selected mote stopped transmitting all its information/packets to the middle access point, redirecting it to the two motes with active links.

Fig. 9. Representation of the state of Sensor motes (cubes), Access Points/Signal repeaters (double crosses) and a Server or Gateway (rectangular box) in a WSN.

Fig. 11. Traffic redirection in a WSN according to the optimization algorithm.

Fig.10. Representation of the components power level in a WSN with two sensor motes with a low battery level.

Fig. 12. Deactivation of an access point in a WSN and the corresponding links reconfiguration according to the optimization algorithm.

Finally, in order to analyze over time the results of a given optimization algorithm, a different visualization scope was implemented. For each node, a table is rendered containing the results of the algorithm iterations, during the simulation time. For a given node, each entry corresponds to the percentage of traffic routed through all admissible links. An example is presented in Figure 13, where the traffic of the mote no.6 was routed through nodes 2, 3 and 5, in the simulation run. The network nodes not receiving any traffic from sensor mote no.6 are presented with small blue dots, while the other nodes have black stars with the corresponding traffic percentage appended.



In this paper a new simulation platform for WSN, based on the TrueTime toolbox, has been proposed. Special attention was paid to 3D network visualization, interactivity and extendibility of this platform. Another useful feature is its inherent ability to interact with real motes. In order to emphasize the importance of those features in terms of simulation capabilities and “test bed” for optimization algorithms, two use cases were presented and analyzed. ACKNOWLEDGMENT This work was supported in part by the Ginseng Project (FP7 Grant agreement no. 224282) and by the Integration into Research Grants from FCT (The Portuguese Foundation for Science and Technology). REFERENCES
[1] [2] [3] G. Borriello, K. I. Farkas, F. Reynolds, and F. Zhao, “Building a Sensor-Rich World,” IEEE Pervasive Computing, 2007, vol. 6, no. 2, pp. 16-18, 2007. C.-Y. Chong, and S. P. Kumar, “Sensor networks: evolution, opportunities, and challenges,” in Proceedings of the IEEE 2003, vol. 91, n0. 8, pp. 1247-1256, 2003. I. F. Akyildiz, W. Su, Y. Sankarasubramaniam, and E. Cayirci, "Wireless sensor networks: a survey," Computer Networks, vol. 38, pp. 393–422, 2002.G. Anastasi, M. Conti, M. Di Francesco, and A. Passarella, "Energy conservation in wireless sensor networks: A survey," Ad Hoc Networks, 2008. J. C. F. Li and S. Dey, “Lifetime Optimization for Multi-hop Wireless Sensor Networks with Rate-Distortion Constraints”, in Seventh IEEE International Workshop on Signal Processing Advances in Wireless Communications, 2006, pp. 1–5. M. Becker, A. Timm-Giel, K. Murray, C. Lynch, C. Görg, D. Pesch, “Comparative Simulations of WSN,” Cunningham, P.; Cunningham, M. (eds.), ICT-MobileSummit 2008. D. Curren, “A Survey of Simulation in Sensor Networks”. A. Cervin, D. Henriksson, B. Lincoln, J. Eker, and K.-E. Årzén, "How Does Control Timing Affect Performance?," IEEE Control Systems Magazine, vol. 23, no. 3, pp. 16-30, 2003. M. Ohlin, D. Henriksson, and A. Cervin, "TrueTime 1.5 — Reference Manual," Department of Automatic Control, Lund University, Sweden, 2007. Available: P. Levis, N. Lee, M. Welsh, D. Culler, “TOSSIM: accurate and scalable simulation of entire TinyOS applications,” Proceedings of the 1st international conference on Embedded networked sensor systems, pp. 129-137, 2003 F. Osterlind, A. Dunkels, J. Eriksson, N. Finne, T. Voigt, "Cross-Level Sensor Network Simulation with COOJA," pp.641-648, Proceedings. 31st IEEE Conference on Local Computer Networks, 2006 J. Polley, D. Blazakis, J. Mcgee, D. Rusk, J. S. Baras, “ATEMU: A fine-grained sensor network simulator,” IEEE Communications Society Conference on Sensor and Ad Hoc Communications and Networks, 2004 A. Alfieri, A. Bianco, P. Brandimarte, and C. F. Chiasserini, "Maximizing system lifetime in wireless sensor networks, "European Journal of Operational Research, vol. 181, pp. 390-402, 2007. R. Madan, S. Cui, S. Lall, and A. Goldsmith, “Cross-Layer Design for Lifetime Maximization in Interference-Limited Wireless Sensor Networks,” IEEE Trans. on Wireless Communications, vol. 5, no. 11, pp. 3142–3152, 2006.

Fig 13. Table presenting the evolution of the weight of each network link.

B. Embedding real motes Instead of constructing models to simulate data collected by sensor nodes, the simulation platform can enable its integration with real motes. Collecting live data from real motes can be useful to validate algorithms, evaluate the noise injected by the environment, or just retrieve sets that behave more similarly with the deployment scenario. By default, in the simulator all sensor nodes use as inputs samples from a global signal defined by the developer. Since through the Matlab® platform it is possible to read from COM or USB ports, the global signal may be easily replaced by data streams collected from external devices and received in any format. Besides collecting data, it is also possible to send information through the same kind of ports to motes. This can be used not only to relay data, but also to change motes’ configurations or send specific commands, for instance to a local agent. This functionality is particularly useful if we consider motes with digital-analogue conversion (DAC) capabilities, being the output signal sent to an actuator device, such as a valve or a damper. In a more elaborated situation, through these interactions, the simulation platform can act as a sub-network inside a wider network made of real motes or similar simulation platforms.


[5] [6] [7] [8] [9]

[10] [11]

[12] [13]

Sign up to vote on this title
UsefulNot useful