Self-Organization in Autonomous Sensor/Actuator Networks [SelfOrg]

Similar documents
TinyOS. Lecture Overview. UC Berkeley Family of Motes. Mica2 and Mica2Dot. MTS300CA Sensor Board. Programming Board (MIB510) 1.

nesc Prof. Chenyang Lu How should network msg be handled? Too much memory for buffering and threads

Politecnico di Milano Advanced Network Technologies Laboratory. Internet of Things. TinyOS Programming and TOSSIM (and Cooja)

Sensor Networks. Dr. Sumi Helal & Jeff King CEN 5531

WSN PLATFORMS, HARDWARE & SOFTWARE. Murat Demirbas SUNY Buffalo

Group Members: Chetan Fegade Nikhil Mascarenhas. Mentor: Dr. Yann Hang Lee

Introduction to Programming Motes

Technology Perspective

nesc Ø Programming language for TinyOS and applications Ø Support TinyOS components Ø Whole-program analysis at compile time Ø Static language

Sensors as Software. TinyOS. TinyOS. Dario Rossi Motivation

System Architecture Directions for Networked Sensors[1]

Programming Sensor Networks

Politecnico di Milano Advanced Network Technologies Laboratory. TinyOS

Sensor Networks. Part 3: TinyOS. CATT Short Course, March 11, 2005 Mark Coates Mike Rabbat. Operating Systems 101

The Emergence of Networking Abstractions and Techniques in TinyOS

TinyOS. Jan S. Rellermeyer

Interfacing Java-DSP with Sensor Motes

Enabling Networked Sensors

The Emergence of Networking Abstractions and Techniques in TinyOS

Sensor Network Application Development ZIGBEE CONCEPTS 2

Static Analysis of Embedded C

System Architecture Directions for Networked Sensors. Jason Hill et. al. A Presentation by Dhyanesh Narayanan MS, CS (Systems)

Programming TinyOS. Lesson 3. Basic Structure. Main.nc

Sensors Network Simulators

The nesc Language: A Holistic Approach to Networked Embedded Systems

Wireless Sensor Networks (WSN)

Programming TinyOS. Lesson 2. Execution Flow. Tasks. commands. Events generated by interrupts preempt tasks Tasks do not preempt tasks

Adding Preemption to TinyOS

ZiLOG Real-Time Kernel Version 1.2.0

Towards a Resilient Operating System for Wireless Sensor Networks

Processes and Non-Preemptive Scheduling. Otto J. Anshus

Integrating Concurrency Control and Energy Management in Device Drivers

Introduction to Microcontroller Apps for Amateur Radio Projects Using the HamStack Platform.

Energy-aware Reconfiguration of Sensor Nodes

NanoRK. EECE 494 Sathish Gopalakrishnan

Zilog Real-Time Kernel

Politecnico di Milano Advanced Network Technologies Laboratory. Internet of Things. TinyOS Programming and TOSSIM

BaseStation Based on GenericComm. Aly El-Osery Electrical Engineering Dept. New Mexico Tech Socorro, NM

Mobile and Ubiquitous Computing Routing Protocols. Niki Trigoni

Integrating Concurrency Control and Energy Management in Device Drivers. Chenyang Lu

TinyOS. Wireless Sensor Networks

Data-flow Analysis for Interruptdriven Microcontroller Software

EVENT DRIVEN SENSOR SYSTEMS

AUTOBEST: A United AUTOSAR-OS And ARINC 653 Kernel. Alexander Züpke, Marc Bommert, Daniel Lohmann

Politecnico di Milano Advanced Network Technologies Laboratory. Internet of Things. TinyOS Programming and TOSSIM (and Cooja)

VORAGO VA108x0 I 2 C programming application note

AIM: To create a project for implement a wireless communication protocol on an embedded system- ZigBee.

Sensor Network Application Development ZIGBEE CONCEPTS 0

CS 425 / ECE 428 Distributed Systems Fall 2014

Peripheral State Persistence and Interrupt Management For Transiently Powered Systems

Presented by: Murad Kaplan

Self-Organization in Autonomous Sensor/Actuator Networks [SelfOrg]

Exam Ad Hoc and Sensor Networks HS 2007

Static Analysis of Embedded C Code

A wireless embedded sensor architecture for system-level optimization Jason Hill and David Culler {jhill,

Microcontroller basics

TinyOS Tutorial. Greg Hackmann CSE 521S Fall 2010

WSN Programming. Introduction. Olaf Landsiedel

Mobile and Ubiquitous Computing TinyOS application example. Niki Trigoni

Middleware for Wireless Sensor Networks: An Outlook

Wireless Sensor Networks

Embedded Systems Dr. Santanu Chaudhury Department of Electrical Engineering Indian Institution of Technology, IIT Delhi

SMD149 - Operating Systems

Process Scheduling Queues

Bluetooth low energy Protocol Stack

EFM32 Series 0: DMA (ARM PrimeCell µdma PL230)

AC OB S. Multi-threaded FW framework (OS) for embedded ARM systems Torsten Jaekel, June 2014

Introduction to TinyOS

Hardware Design of Wireless Sensors

EECE Hybrid and Embedded Systems: Computation

Hardware Support for a Wireless Sensor Network Virtual Machine

Chapter 13: I/O Systems. Operating System Concepts 9 th Edition

TinySec: A Link Layer Security Architecture for Wireless Sensor Networks. Presented by Paul Ruggieri

WSN Programming. Introduction. Olaf Landsiedel. Programming WSNs. ! What do we need to write software for WSNs?! Programming language

Developing deterministic networking technology for railway applications using TTEthernet software-based end systems

Overview The Microcontroller The Flex Board Expansion boards Multibus board Demo board How to: Compile demo Flash & Run Demos

Commercial Real-time Operating Systems An Introduction. Swaminathan Sivasubramanian Dependable Computing & Networking Laboratory

Process Description and Control. Chapter 3

ARDUINO MEGA INTRODUCTION

TOSSIM simulation of wireless sensor network serving as hardware platform for Hopfield neural net configured for max independent set

EVE2 BLE CAN Datasheet

Following are a few basic questions that cover the essentials of OS:

Process Description and Control

Process Description and Control

Operating Systems Design Fall 2010 Exam 1 Review. Paul Krzyzanowski

The Flooding Time Synchronization Protocol

Chapter 8: Virtual Memory. Operating System Concepts

Amarjeet Singh. January 30, 2012

Architecture or Parallel Computers CSC / ECE 506

TinyOS: An Operating System for Wireless Sensor Networks

Barrelfish Project ETH Zurich. Message Notifications

Notes based on prof. Morris's lecture on scheduling (6.824, fall'02).

Y-THREADS: SUPPORTING CONCURRENCY IN WIRELESS SENSOR NETWORKS

Voice Over Sensor Networks

SWE 760 Lecture 1: Introduction to Analysis & Design of Real-Time Embedded Systems

Final Exam Study Guide

Processes. OS Structure. OS Structure. Modes of Execution. Typical Functions of an OS Kernel. Non-Kernel OS. COMP755 Advanced Operating Systems

Chapter 9: Virtual Memory

Operating systems for embedded systems. Embedded Operating Systems

Concurrent Programming. Implementation Alternatives. Content. Real-Time Systems, Lecture 2. Historical Implementation Alternatives.

Transcription:

Self-Organization in Autonomous Sensor/Actuator Networks [SelfOrg] Dr.-Ing. Falko Dressler Computer Networks and Communication Systems Department of Computer Sciences University of Erlangen-Nürnberg http://www7.informatik.uni-erlangen.de/~dressler/ dressler@informatik.uni-erlangen.de [SelfOrg], SS 2005 2-7.1

Overview Self-Organization Basic methodologies of self-organization; comparison of central and hierarchical control, distributed systems, and autonomous behavior; examples of self-organization Mobile Sensor/Actuator Networks Ad hoc routing; reliable communication and congestion control; sensor assistance for mobile robots; applications Coordination of Autonomous Systems Coordination and synchronization; communication aspects; clustering Bio-inspired Mechanisms Swarm intelligence; artificial immune system; intra/inter cellular information exchange [SelfOrg], SS 2005 2-7.2

Case Study: Mica2 + TinyOS + Surge Hardware Mica2 / Mica2dot Sensor boards Programming environment (aka operating system) TinyOS nesc Sensor application Surge [SelfOrg], SS 2005 2-7.3

The MICA Architecture Atmel ATMEGA103 4 Mhz 8-bit CPU 128KB Instruction Memory 4KB RAM 4 Mbit flash (AT45DB041B) SPI interface 1-4 uj/bit r/w RFM TR1000 radio 50 kb/s ASK Focused hardware acceleration Network programming Rich Expansion connector i2c, SPI, GIO, 1-wire Analog compare + interrupts TinyOS tool chain DS2401 Unique ID Transmission Power Control sub microsecond RF synchronization primitive 51-Pin I/O Expansion Connector Digital I/O 8 Analog I/O 8 Programming Lines TR 1000 Radio Transceiver Atmega103 Microcontroller Hardware Accelerators SPI Bus Power Regulation MAX1678 (3V) 4Mbit External Flash Coprocessor 2xAA form factor [SelfOrg], SS 2005 2-7.4

Rich Sensor board Y Axis X Axis TEMP MAGNETOMETER PHOTO Mica PINS Gain Adjustment SOUNDER MICROPHONE Tone Intr Mic Signal ACCELEROMETER ADC Signals (ADC1-ADC6) On/Off Control I 2 C Bus Interrupt Microphone Sounder Magnetometer 1.25 in Temperature Sensor Light Sensor 2.25 in Accelerometer [SelfOrg], SS 2005 2-7.5

Mote Evolution [SelfOrg], SS 2005 2-7.6

Tiny OS Concepts Scheduler + Graph of Components constrained two-level scheduling model: threads + events Component: Commands, Event Handlers Frame (storage) Tasks (concurrency) Constrained Storage Model frame per component, shared stack, no heap Very lean multithreading Efficient Layering init Commands init Power(mode) TX_packet(buf) power(mode) send_msg (addr, type, data) Messaging Component internal thread Events Internal State TX_pack et_done msg_rec(type, data) msg_sen d_done) (success RX_pack et_done (buffer) ) [SelfOrg], SS 2005 2-7.7

Application = Graph of Components application Route map router sensor appln Active Messages packet bit byte Radio Packet Radio byte RFM Serial Packet UART Temp ADC photo clocks SW HW Example: ad hoc, multi-hop routing of photo sensor readings 3450 B code 226 B data Graph of cooperating state machines on shared stack [SelfOrg], SS 2005 2-7.8

Sensor network programming challenges Driven by interaction with environment Data collection and control, not general purpose computation Reactive, event-driven programming model Extremely limited resources Very low cost, size, and power consumption Typical embedded OSs consume hundreds of KB of memory Reliability for long-lived applications Apps run for months/years without human intervention Reduce run time errors and complexity Soft real-time requirements Few time-critical tasks (sensor acquisition and radio timing) Timing constraints through complete control over app and OS [SelfOrg], SS 2005 2-7.9

TinyOS Very small operating system for sensor networks Core OS requires 396 bytes of memory Component-oriented architecture Set of reusable system components: sensing, communication, timers, etc. No binary kernel - build app specific OS from components Concurrency based on tasks and events Task: deferred computation, runs to completion, no preemption Event: Invoked by module (upcall) or interrupt, may preempt tasks or other events Very low overhead, no threads Split-phase operations No blocking operations Long-latency ops (sensing, comm, etc.) are split phase Request to execute an operation returns immediately Event signals completion of operation [SelfOrg], SS 2005 2-7.10

TinyOS Execution Model Commands request action ack/nack at every boundary call cmd or post task Events notify occurrence HW intrupt at lowest level may signal events call cmds post tasks Tasks provide logical concurrency preempted by events Migration of HW/SW boundary bit byte packet application comp data processing message-event driven active message Radio Packet Radio byte RFM event-driven packet-pump crc event-driven byte-pump encode/decode event-driven bit-pump [SelfOrg], SS 2005 2-7.11

Programming TinyOS: nesc Dialect of C with support for components Components provide and require interfaces Create application by wiring together components using configurations Whole-program compilation and analysis nesc compiles entire application into a single C file Compiled to mote binary by back-end C compiler (e.g., gcc) Allows aggressive cross-component inlining Static race condition detection Important restrictions No function pointers (makes whole-program analysis difficult) No dynamic memory allocation No dynamic component instantiation/destruction These static requirements enable analysis and optimization [SelfOrg], SS 2005 2-7.12

Event-Driven Sensor Access Pattern command result_t StdControl.start() { return call Timer.start(TIMER_REPEAT, 200); SENSE event result_t Timer.fired() { return call sensor.getdata(); Timer Photo LED event result_t sensor.dataready(uint16_t data) { display(data) return SUCCESS; clock event handler initiates data collection sensor signals data ready event data event handler calls output command device sleeps or handles other activity while waiting conservative send/ack at component boundary [SelfOrg], SS 2005 2-7.13

TinyOS Commands and Events {... status = call CmdName(args)... event EvtName)(args) {... return status; command CmdName(args) {... return status; {... status = signal EvtName(args)... [SelfOrg], SS 2005 2-7.14

TinyOS Execution Contexts Tasks events commands Interrupts Hardware Events generated by interrupts preempt tasks Tasks do not preempt tasks Both essential process state transitions [SelfOrg], SS 2005 2-7.15

Tasks provide concurrency internal to a component longer running operations are preempted by events able to perform operations beyond event context may call commands may signal events not preempted by tasks {... post TskName();... task void TskName {... [SelfOrg], SS 2005 2-7.16

Typical Application Use of Tasks event driven data acquisition schedule task to do computational portion event result_t sensor.dataready(uint16_t data) { putdata(data); post processdata(); return SUCCESS; task void processdata() { int16_t i, sum=0; for (i=0; i maxdata; i++) sum += (rdata[i] 7); display(sum shiftdata); 128 Hz sampling rate simple FIR filter dynamic software tuning for centering the magnetometer signal (1208 bytes) digital control of analog, not DSP ADC (196 bytes) [SelfOrg], SS 2005 2-7.17

Task Scheduling Currently simple FIFO scheduler Bounded number of pending tasks When idle, shuts down node except clock Uses non-blocking task queue data structure Simple event-driven structure + control over complete application/system graph instead of complex task priorities and IPC [SelfOrg], SS 2005 2-7.18

TinyOS Active Messages Sending Declare buffer storage in a frame Request Transmission Name a handler Handle Completion signal Receiving Declare a handler Firing a handler automatic behaves like any other event Buffer management strict ownership exchange tx: done event => reuse rx: must rtn a buffer [SelfOrg], SS 2005 2-7.19

Sending a Message bool pending; struct TOS_Msg data; command result_t IntOutput.output(uint16_t value) { IntMsg *message = (IntMsg *)data.data; if (!pending) { pending = TRUE; message->val = value; message->src = TOS_LOCAL_ADDRESS; if (call Send.send(TOS_BCAST_ADDR, sizeof(intmsg), &data)) return SUCCESS; pending = FALSE; return FAIL; destination length Refuses to accept command if buffer is still full or network refuses to accept send command User component provide structured msg storage [SelfOrg], SS 2005 2-7.20

Send Done Event event result_t IntOutput.sendDone(TOS_MsgPtr msg, result_t success) { if (pending && msg == &data) { pending = FALSE; signal IntOutput.outputComplete(success); return SUCCESS; Send done event fans out to all potential senders Originator determined by match free buffer on success, retry or fail on failure Others use the event to schedule pending communication [SelfOrg], SS 2005 2-7.21

Receive Event event TOS_MsgPtr ReceiveIntMsg.receive(TOS_MsgPtr m) { IntMsg *message = (IntMsg *)m->data; call IntOutput.output(message->val); return m; Active message automatically dispatched to associated handler knows the format, no run-time parsing performs action on message event Must return free buffer to the system typically the incoming buffer if processing complete [SelfOrg], SS 2005 2-7.22

Maintaining Scheduling Agility Need logical concurrency at many levels of the graph While meeting hard timing constraints sample the radio in every bit window Retain event-driven structure throughout application Tasks extend processing outside event window All operations are non-blocking [SelfOrg], SS 2005 2-7.23

nesc Interfaces nesc interfaces are bidirectional Command: Function call from one component requesting service from another Event: Function call indicating completion of service by a component Grouping commands/events together makes inter-component protocols clear interface Timer { command result_t start(char type, uint32_t interval); command result_t stop(); event result_t fired(); interface SendMsg { command result_t send(tos_msg *msg, uint16_t length); event result_t senddone(tos_msg *msg, result_t success); [SelfOrg], SS 2005 2-7.24

nesc Components Two types of components Modules contain implementation code Configurations wire other components together An application is defined with a single top-level configuration module TimerM { provides { interface StdControl; interface Timer; uses interface Clock; implementation { command result_t Timer.start(char type, uint32_t interval) {... command result_t Timer.stop() {... event void Clock.tick() {... [SelfOrg], SS 2005 2-7.25

Configuration Example Allow aggregation of components into supercomponents configuration TimerC { provides { interface StdControl; interface Timer; implementation { components TimerM, HWClock; // Pass-through: Connect our "provides // to TimerM "provides" StdControl = TimerM.StdControl; Timer = TimerM.Timer; // Normal wiring: Connect "requires" to "provides" TimerM.Clock -> HWClock.Clock; [SelfOrg], SS 2005 2-7.26

Top-Level Configuration [SelfOrg], SS 2005 2-7.27

Concurrency Model Tasks used as deferred computation mechanism // Signaled by interrupt handler event void Receive.receiveMsg(TOS_Msg *msg) { if (recv_task_busy) { return; // Drop! recv_task_busy = TRUE; curmsg = msg; post recv_task(); task void recv_task() { // Process curmsg... recv_task_busy = FALSE; Commands and events cannot block Tasks run to completion, scheduled non-preemptively Scheduler may be FIFO, EDF, etc. [SelfOrg], SS 2005 2-7.28

Main Loop of a TinyOS Application [SelfOrg], SS 2005 2-7.29

Compilation of a TinyOS Application [SelfOrg], SS 2005 2-7.30

Evaluation TinyOS component census Core TinyOS: 401 components (235 modules, 166 configurations) Average of 74 components per app Modules between 7 and 1898 lines of code (avg. 134) Race condition analysis on TinyOS tree Original code: 156 potential races, 53 false positives Fixed by using atomic or moving code into tasks Race condition false positives: Shared variable access serialized by another variable Pointer-swapping (no alias analysis) [SelfOrg], SS 2005 2-7.31

Inlining and dead code elimination Inlining and dead code elimination saves both space and time [SelfOrg], SS 2005 2-7.32

TinyOS Kernel Efficiency and Simplicity Metrics [SelfOrg], SS 2005 2-7.33

Surge Application Surge is a java program for displaying multihop routing topology in sensor networks When working with multihop routing applications, Surge provides the following information to users: Detects the existence of all the motes in a wireless network. Displays mote information, including the mote identification number (ID), the number of messages sent from each mote, etc Displays the topology of network [SelfOrg], SS 2005 2-7.34

Surge Application: multi-hop data collection Periodically collect sensor readings and route to base Timer component fires event to read from ADC ADC completion event initiates communication Multihop routing using adaptive spanning tree Nodes route messages to parent in tree Parent selection based on link quality estimation Snoop on radio messages to find better parent [SelfOrg], SS 2005 2-7.35

Raw Data Packet [SelfOrg], SS 2005 2-7.36

TOS_Msg Data Packet [SelfOrg], SS 2005 2-7.37

Multihop Message [SelfOrg], SS 2005 2-7.38

Surge Message [SelfOrg], SS 2005 2-7.39