Rapid Prototyping Suite of IEEE 802.15.4-Compliant Sensor Networks
Total Page:16
File Type:pdf, Size:1020Kb
Rapid prototyping suite of IEEE 802.15.4-compliant Sensor Networks Mangesh Chitnis1, Paolo Gai2, Giuseppe Lipari1, Paolo Pagano1, and Antonio Romano1 1Scuola Superiore Sant’Anna 2Evidence s.r.l. Piazza Martiri della liberta,` 33 Via Moruzzi, 1 56127 Pisa (I) 56124 Pisa (I) {m.chitnis, lipari, p.pagano, a.romano}@sssup.it [email protected] Abstract amount of computation in real-time. The rate at which data must be sampled is higher than typical WSNs application This paper presents a toolsuite for rapid prototyping and for environmental monitoring. For example, the sampling implementation of real-time applications on Wireless Sen- rate of a sensor can go up to hundreds of Hz. Also, many sor Networks. The work is motivated by the need to use tasks may need to be executed concurrently. For example, WSNs in industrial control contexts, where the sampling we may have tasks for data filtering, actuation, diagnos- rate, the workload is much higher than typical current ap- tic, logging, communication, etc. In practice, the compu- plications of WSNs, and the real-time constraints are much tational load on each node (in terms of amount of process- tighter. We present a simulator for early evaluation of ing time needed by the application tasks) may become rel- the real-time behavior of a WSN application; and a real- evant. In addition, such applications exhibit real-time con- time operating system that implement appropriate real-time straints, sometimes hard real-time ones. Many activities, scheduling policies to allow timing analysis and guarantee like sampling and actuation, must be triggered periodically timing constraints. We provide a demo based on a simple and executed with bounded response time, and late sensor but realistic network scenario showing that simulation is in messages may not be considered acceptable, otherwise the agreement with experimental results. system may not work properly. In a real-time system, it is important to guarantee system 1 Introduction predictability. The designer must check at system design time that the timing constraints will be respected under all conditions. A schedulability analysis for real-time applica- Many companies have recently started to consider the tions must be performed to guarantee that the system will use of Wireless Sensor Networks (WSN) in industrial au- work properly under worst-case load conditions. tomation systems and process control. The most urging mo- Unfortunately, the use of proper real-time mechanisms tivation is the need to reduce the amount of physical wires in in WSNs has not been deeply investigated until now. While a industrial plant. Reducing cables can significantly reduce few real-time Operating Systems have been proposed in the the cost for building and maintaining the system. Moreover, research literature and in the commercial market, TinyOS with less cables it is easier to dynamically reconfigure the is by large the most popular Operating System for WSN. machines, and implement plug-and-play components. An Unfortunately, TinyOS does not support predictable real- example of research effort in this sense is the the RI-MACS time scheduling policies. At the network level, mechanisms project [5], whose goal is to increase reconfigurability and for real-time communication and Quality of Service (QoS) adaptiveness of industrial automation platforms by using control (like the Collision Free Period access included in WSNs in selected cases. In the context of RI-MACS, we IEEE 802.15.4 standard[3]) are not implemented. But most are investigating the possibility to use WSNs for process importantly, what is missing is a proper comparative study control and configuration. and evaluation of the impact that various communication However, the requirements of these systems are substan- protocols and Operating System policies have on the real- tially different from those of other domains of WSNs. In time behavior of the system. addition to requirements for increased robustness and fault Another problem concerns the lack of proper simulation tolerance, each node is expected to perform a substantial tools. Simulation plays an important role both for research 1-4244-1455-5/07/$25.00 c 2007 IEEE. and for industrial practice. In academic research, simula- tion is a fundamental tool to compare different algorithms The Operating System puts these tasks into the Running and protocols, and to assess the performance of proposed status following the scheduling policy selected at the time solutions on complex realistic settings. In industrial design, when RT-App is instantiated. it is important to simulate the system before deployment for Because of the adopted scheduling algorithm, the tasks early assesment of performance, for system dimensioning, can be delayed by some time from the activation. In the case and to identify potential bottlenecks and problems. of a priority-based scheduler like FP, the preemption of the CPU depends on the difference in priority between the run- 2 The rapid prototyping suite ning task and the one which has been suddenly activated. In a scheduler based on activation times, the tasks are queued We propose to the community under GPL license: up and executed in FIFO order. In the latter case, the user • the RTNS [6] package, able to model and simulate, is not asked to specify a priority ad the delays are strongly not only the functional but also the temporal behavior, dependent on the load of the node. both at the network level and at the CPU level; RTNS can simulate single and multi-hop communica- tions for all the network topologies defined in the IEEE • the Erika Enterprise [2] Operating System customized 802.15.4 standard. The MAC and Physical layers of the for Wireless Sensor Network. Network Stack are natively simulated by NS-2 and RTNS only wraps these services into tasks handled by RT-App. Together these tools play the role of a rapid protyping suite, permitting to simulate and test in real hardware a va- 2.2 The Operating System riety of protocols and distributed applications suitable for real-time operations of WSN. The OS counterpart in this prototyping suite is ERIKA Enterprise (EE) commercialized by Evidence srl. EE con- 2.1 The simulator sists of a single and multi-processor real-time OS ker- nel implementing a collection of APIs similar to those of The RTNS simulator is a combination of the popular NS- OSEK/VDX standard for automotive embedded controllers. 2 package [4] for network protocol simulation, and of RT- It implements a shared memory model for a layered archi- Sim [7] for Real-Time OS (RTOS) simulation. Thanks to tecture composed by a substrate Kernel acting on a Hard- our simulator, it is possible to model the real-time tasks run- ware Abstraction Layer (HAL) dependent on the specific ning on each node, with their priority, execution time, and a platform. A set of software modules implements the task high-level pseudo-code modelling their functional behavior, management and the scheduling policy. and the network protocol used for communication between It is well suited to respond to the stringent pre-requisites nodes. In this way, it is possible to model end-to-end activi- of Wireless Sensor Networks, because of: ties, and measure the delay in transferring data from sensor to destination. • the minimal footprint in terms of RAM (about 3 The RTNS allows to simulate the networking aspects via KBytes), partially dependent on the hardware platform NS-2 as well as the real-time Operating Systems aspects and the adopted configuration; via RTSim. In NS-2, protocols are implemented as Agents: • the hard real-time compliance, because it complements any class that implements a protocol has to extend the Agent FP scheduling providing support for Immediate Prior- class. Instances of an agent class are the endpoints of wired ity Ceiling and Preemption Thresholds on single CPU and wireless connections. They are identified by INET ad- systems; dress and port and are the lowest layer able to pack and inject messages into the network. Application code is mod- • the supported Atmel AVR 5 architecture, very popular eled by the Application class. Applications use agents to in WSN contexts; send and receive messages. To simulate the behavior of the Operating System run- • the application layer customizable to fit diversified sce- ning on a node we construct an NS-2 Application called narios where WSN are deployed. RT-App abstracting all the features of a Real-Time Kernel. To implement the Network Stack substrate we adapted The simulator creates an instance of RT-App for each node, the libraries provided by Atmel[1] and compliant with the and enables the connected agent (RT-Agent) to send and IEEE 802.15.4 standard. The Atmel set of functions, or- receive data packets. RT-App creates aperiodic tasks for ganized as a network library, have been linked to ERIKA “networking” and “computational” purposes and schedules core. them adopting one of the policies implemented in RTSim, To the best of the authors knowledge, in so far only a few Operat- e.g. First Come First Served (FCFS), Earliest Deadline First ing Systems have been ported to AVR 5 architecture; namely Nano-RK, (EDF), Fixed Priority (FP), etc. TinyOS and recently ERIKA. Conditional compilation is used to customize the cases rupt Service Routine (ISR) initiating the data reception at of ordinary devices and Personal Area Network (PAN) co- the Physical layer of the network stack. The reception com- ordinator. pletes at the MAC layer whenever the payload is extracted The network initialization is organized by means of an from the incoming data frames: depending on the adopted aperiodic task: on the coordinator side, such a task estab- scheduling policy and the computational load present at the lishes a new network, sets the communication mode (peer- sink, the completion may be delayed by some time.