Cross-Level Sensor Network Simulation with COOJA

Cross-Level Sensor Network Simulation with COOJA

Cross-Level Sensor Network Simulation with COOJA Fredrik Osterlind,¨ Adam Dunkels, Joakim Eriksson, Niclas Finne, Thiemo Voigt Swedish Institute of Computer Science ffros,adam,joakime,nfi,[email protected] Abstract guages must be used. Conversely, a high-level simulator that does not model node hardware may provide short sim- Simulators for wireless sensor networks are a valuable ulation times but enables the development of high-level al- tool for system development. However, current simulators gorithms only. can only simulate a single level of a system at once. This The main contribution of this paper is COOJA, a novel makes system development and evolution difficult since de- simulator for the Contiki operating system [1] that enables velopers cannot use the same simulator for both high-level cross-level simulation: simultaneous simulation at many algorithm development and low-level development such as levels of the system. COOJA combines low-level simula- device-driver implementations. tion of sensor node hardware and simulation of high-level We propose cross-level simulation, a novel type of wire- behavior in a single simulation. COOJA is flexible and ex- less sensor network simulation that enables holistic simul- tensible in that all levels of the system can be changed or re- taneous simulation at different levels. We present an imple- placed: sensor node platforms, operating system software, mentation of such a simulator, COOJA, a simulator for the radio transceivers, and radio transmission models. Contiki sensor node operating system. COOJA allows for The simulator is implemented in Java, making the simu- simultaneous simulation at the network level, the operat- lator easy to extend for users, but allows sensor node soft- ing system level, and the machine code instruction set level. ware to be written in C by using the Java Native Interface. With COOJA, we show the feasibility of the cross-level sim- Furthermore, the sensor node software can be run either as ulation approach. compiled native code for the platform on which the simu- lator is run, or in a sensor node emulator that emulates an actual sensor node at the hardware level. 1. Introduction We show that the ability to perform cross-level simula- tions has several advantages over traditional simulations re- stricted to one level. We also show that COOJA is a suitable Code development for wireless sensor networks is dif- simulator for such cross-level simulations. ficult and tedious [6, 11]. Reasons include the distributed The remainder of this paper is structured as follows. We nature of sensor networks, as well as the longer compile- present the COOJA simulator in Section 2 and its imple- run-debug cycle caused by the need to transfer the compiled mentation in Section 3. In Section 4 we evaluate the system. program onto the set of sensor nodes used for development Related work is reviewed in Section 5. Finally, Section 6 and testing. summarizes our main conclusions. Software development for sensor networks can be sim- plified by using a system simulator which allows to develop algorithms, study system behaviour and observe interac- 2. COOJA tions in a controlled environment [4]. Current WSN sim- ulators perform simulation at a specific, fixed, level such as In this section we first present a high-level overview of the application, operating system or hardware level. The COOJA before describing how COOJA achieves cross-level level at which the simulation is performed affects both the simulation. We demonstrate the flexibility of COOJA by level at which software development can occur and the ex- describing COOJA's radio models and their usage during ecution efficiency of the simulator. A simulator that simu- simulation. lates a particular sensor node platform at the hardware level COOJA is a flexible Java-based simulator designed for enables the development of low-level software such as de- simulating networks of sensors running the Contiki operat- vice drivers but at the price of longer simulation times and ing system [1]. COOJA simulates networks of sensor nodes higher code complexity since low-level programming lan- where each node can be of a different type; differing not only in on-board software, but also in the simulated hard- NETWORK NS2 ware. COOJA is flexible in that many parts of the simulator (APPLICATION) COOJA can be easily replaced or extended with additional function- OPERATING SYSTEM TOSSIM ality. Example parts that can be extended include the simu- MACHINE CODE lated radio medium, simulated node hardware, and plug-ins INSTRUCTION SET AVRORA for simulated input/output. A simulated node in COOJA has three basic properties: Figure 1. COOJA can simultaneously simu- its data memory, the node type, and its hardware peripher- late at several levels. als. The node type may be shared between several nodes and determines properties common to all these nodes. For example, nodes of the same type run the same program code on the same simulated hardware peripherals. And nodes taching it to the entire Java simulator and breaking when of the same type are initialized with the same data mem- the JNI call is performed. Also entire simulation states may ory. During execution, however, nodes' data memories will be saved and later restored, skipping back simulations over eventually differ due to e.g. different external inputs. time. COOJA currently is able to execute Contiki programs in The hardware peripherals of simulated nodes are called two different ways. Either by running the program code interfaces, and enable the Java simulator to detect and trig- as compiled native code directly on the host CPU, or by ger events such as incoming radio traffic or a LED being lit. running compiled program code in an instruction-level TI Interfaces also represent properties of simulated nodes such MSP430 emulator. COOJA is also able to simulate non- as positions that the actual node is not aware of. Contiki nodes, such as nodes implemented in Java or even All interactions with simulations and simulated nodes nodes running another operating system. All different ap- are performed via plugins. An example of a plugin is a proaches have advantages as well as disadvantages. Java- simulation control that enables a user to start or pause a based nodes enable much faster simulations but do not run simulation. Both interfaces and plugins can easily be added deployable code. Hence, they are useful for the develop- to the simulator, enabling users to quickly add custom func- ment of e.g. distributed algorithms. Emulating nodes pro- tionality for specific simulations. vides more fine-grained execution details compared to Java- based nodes or nodes running native code. Finally, native 2.1. Cross-Level Simulation code simulations are more efficient than node emulations and still simulate deployable code. Since the need of ab- straction in a heterogeneous simulated network may differ As depicted in Figure 1, COOJA allows for simultaneous between the different simulated nodes, there are advantages simulations at three different levels, namely the network- in combining several different abstraction level in one sim- ing (or application) level, the operating system level and the ulation. For example, in a large simulated network a few machine code instruction level. nodes may be simulated at the hardware level while the rest Throughout this paper nodes at all different levels are are implemented at the pure Java level. Using this approach said to be simulated, although nodes at the instruction level combines the advantages of the different levels. The sim- are hardware emulated since the executable is compiled for ulation is faster than when emulating all nodes, but at the another architecture than the simulation platform. Nodes at same time enables a user to receive fine-grained execution the operating system level could similarly be called high- details from the few emulated nodes. level emulated. COOJA executes native code by making Java Native In- terface (JNI) calls from the Java environment to a compiled Networking Level During design and implementation of Contiki system. The Contiki system consists of the entire for example routing protocols, the specific hardware is often Contiki core, pre-selected user processes, and a set of spe- not as important as the networking itself. The most impor- cial simulation glue drivers. This makes it possible to de- tant factors may instead concern the radio medium, radio ploy and simulate the same code without any modifications, devices and perhaps sleep duty cycles of the sensor nodes. minimizing the delay between simulation and deployment. When performing such a design and implementation task The Java simulator has full control over the memory of it may be possible, but not necessary, to use a fine-grained simulated nodes. Hence the simulator may at all times view simulation environment such as an instruction-level simula- or change Contiki process variables, enabling very dynamic tor. interaction possibilities from the simulator. Another inter- COOJA supports code development by enabling the user esting consequence of using JNI is the ability to debug Con- to easily exchange certain simulator modules such as de- tiki code using any regular debugger, such as gdb, by at- vice drivers or radio medium modules. A simulation can be saved and reloaded using other more or less detailed mod- 2.2. Radio Models ules, still with the other simulation parameters unaltered. Furthermore, new radio mediums and interfaces such as ra- Each simulation in COOJA uses a radio model that char- dio devices can easily be developed in Java and be added to acterizes radio wave propagation. New radio models may the COOJA simulation environment. be added to the simulation environment. The radio model is To further simplify and speed up development in such chosen when a simulation is created. This enables a user to, scenarios, COOJA also supports adding pure Java code for example, develop a network protocol using a simple ra- nodes.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    8 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us