Programming Abstractions in Wireless Sensor Networks Professor Jack Stankovic Department of Computer Science University of Virginia.

Slides:



Advertisements
Similar presentations
How to use TinyOS Jason Hill Rob Szewczyk Alec Woo David Culler An event based execution environment for Networked Sensors.
Advertisements

System Integration and Performance
NesC Prepared for the Multimedia Networks Group University of Virginia.
1 Lab 3 Objectives  Case study: “Hello world” program on motes  Write you first program on mote.
1 Message Oriented Middleware and Hierarchical Routing Protocols Smita Singhaniya Sowmya Marianallur Dhanasekaran Madan Puthige.
Sensor Network Platforms and Tools
Overview: Chapter 7  Sensor node platforms must contend with many issues  Energy consumption  Sensing environment  Networking  Real-time constraints.
Contiki A Lightweight and Flexible Operating System for Tiny Networked Sensors Presented by: Jeremy Schiff.
Accurate Emulation of Wireless Sensor Networks Hejun Wu Joint work with Qiong Luo, Pei Zheng*, Bingsheng He, and Lionel M. Ni Department of Computer Science.
Network Reprogramming & Programming Abstractions.
7/13/2007AIIT Summer Course - D#1 Wireless Embedded Systems and Networking Lab Day 5: Part 1: TinyOS Programming on Open Source Distribution Jaein Jeong.
Tiny OS Optimistic Lightweight Interrupt Handler Simon Yau Alan Shieh CS252, CS262A, Fall The.
Integrated  -Wireless Communication Platform Jason Hill.
1 TinyOS Mohammad Rahimi CSCI599-Spring Motivation  The new class of distributed tiny devices  The new generation of software.
TinyOS Software Engineering Sensor Networks for the Masses.
2008EECS Embedded Network Programming nesC, TinyOS, Networking, Microcontrollers Jonathan Hui University of California, Berkeley.
Sensor Node Architecture Issues Stefan Dulman
Mehmet Can Vuran, Instructor University of Nebraska-Lincoln Acknowledgement: Overheads adapted from those provided by the authors of the textbook.
Philip Levis UC Berkeley 6/17/20021 Maté: A Tiny Virtual Machine Viral Programs with a Certain Cosmopolitan Charm.
1.3 Executing Programs. How is Computer Code Transformed into an Executable? Interpreters Compilers Hybrid systems.
1 Energy Efficient Communication in Wireless Sensor Networks Yingyue Xu 8/14/2015.
Sensor Coordination using Role- based Programming Steven Cheung NSF NeTS NOSS Informational Meeting October 18, 2005.
1 Software Development Infrastructure for Sensor Networks  Operating systems ( TinyOS )  Resource (device) management  Basic primitives  Protocols.
TinyOS Tutorial Jianping Wang (merge several tutorials found online)
A System Architecture for Networked Sensors Jason Hill, Robert Szewczyk, Alec Woo, Seth Hollar, David Culler, Kris Pister
Programming in nesC (and TOSSIM)
By: R Jayampathi Sampath
April 15, 2005TinyOS: A Component Based OSPage 1 of 27 TinyOS A Component-Based Operating System for Networked Embedded Systems Tom Bush Graduate College.
TinyOS By Morgan Leider CS 411 with Mike Rowe with Mike Rowe.
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment.
NEST 1 NEST System Working Group Meeting #1 Jack Stankovic University of Virginia September 2001 Boeing Huntington Beach, CA.
Mate: A Tiny Virtual Machine for Sensor Networks Philip Levis and David Culler Presented by: Damon Jo.
Korea Advanced Institute of Science and Technology Active Sensor Networks(Mate) (Published by Philip Levis, David Gay, and David Culler in NSDI 2005) 11/11/09.
EnviroTrack: Towards an Environmental Computing Paradigm for Distributed Sensor Networks – Abdelzaher Tarek,etc An Entity Maintenance and Connection Service.
IntroductionRelated work 2 Contents Publish/Subscribe middleware Conclusion and Future works.
Mate: A Tiny Virtual Machine for Sensor Networks Phil Levis and David Culler Presented by Andrew Chien CSE 291 Chien April 22, 2003 (slides courtesy, Phil.
한국기술교육대학교 컴퓨터 공학 김홍연 Habitat Monitoring with Sensor Networks DKE.
Dhanshree Nimje Smita Khartad
System Architecture Directions for Networked Sensors Jason Hill, Robert Szewczyk, Alec Woo, Seth Hollar, David Culler, Kris Pister Presented by Yang Zhao.
Lab 3 Introduction to TinyOS and nesC How to debug programs at PC Examples –Blink Timer –Blink –Hellow World Reference: 1.x/doc/tutorial/lesson1.html.
Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai.
HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 TinyOS & NesC.
Part 2 TinyOS and nesC Programming Selected slides from:
REED: Robust, Efficient Filtering and Event Detection in Sensor Networks Daniel Abadi, Samuel Madden, Wolfgang Lindner MIT United States VLDB 2005.
Energy conservation in Wireless Sensor Networks Sagnik Bhattacharya, Tarek Abdelzaher University of Virginia, Department of Computer Science School of.
System Architecture Directions for Networked Sensors Jason Hill, Robert Szewczyk, Alec Woo, Seth Hollar, David Culler, Kris Pister Presenter: James.
Xiong Junjie Node-level debugging based on finite state machine in wireless sensor networks.
WSN Software Platforms - concepts Vinod Kulathumani Lecture uses some slides from tutorials prepared by authors of these platforms.
Internet of Things. IoT Novel paradigm – Rapidly gaining ground in the wireless scenario Basic idea – Pervasive presence around us a variety of things.
Lab 3, Part 2 Selected slides from: Wireless Sensor Networks Hardware/Software Tiny OS & NesC Programming borrowed from Turgay Korkmaz.
SensorWare: Distributed Services for Sensor Networks Rockwell Science Center and UCLA.
TinyOS Sandeep Gupta. Operating System (OS) What is an OS? Main functions  Process management  Memory management  Resource management Traditional OSs.
In-Network Query Processing on Heterogeneous Hardware Martin Lukac*†, Harkirat Singh*, Mark Yarvis*, Nithya Ramanathan*† *Intel.
System Architecture Directions for Networked Sensors.
Based on slides from Andreas Larsson Table from CY Chong, SP Kumar, BA Hamilton - Proceedings of the IEEE, 2003.
Operating Systems: Summary INF1060: Introduction to Operating Systems and Data Communication.
Blink Blink.nc configuration Blink { } implementation { components Main, BlinkM, SingleTimer, LedsC; Main.StdControl -> BlinkM.StdControl; Main.StdControl.
1 Device Controller I/O units typically consist of A mechanical component: the device itself An electronic component: the device controller or adapter.
Building Wireless Efficient Sensor Networks with Low-Level Naming J. Heihmann, F.Silva, C. Intanagonwiwat, R.Govindan, D. Estrin, D. Ganesan Presentation.
Why does it need? [USN] ( 주 ) 한백전자 Background Wireless Sensor Network (WSN)  Relationship between Sensor and WSN Individual sensors are very limited.
Software Architecture of Sensors. Hardware - Sensor Nodes Sensing: sensor --a transducer that converts a physical, chemical, or biological parameter into.
TinyOS Sandeep Gupta. TinyOS basics TinyOS is  Single tasking OS  Interrupt driven Written using a Component based language A set of components put.
TinyOS and nesC. Outline ● Wireless sensor networks and TinyOS ● Networked embedded system C (nesC) – Components – Interfaces – Concurrency model – Tool.
Introduction to Operating Systems Concepts
Simulation of Distributed Application and Protocols using TOSSIM
An Introduction to nesC
Chapter 2: Operating-System Structures
Introduction to Operating Systems
Chapter 2: Operating-System Structures
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment. Phone:
Presentation transcript:

Programming Abstractions in Wireless Sensor Networks Professor Jack Stankovic Department of Computer Science University of Virginia

Importance Raise the level of abstraction Move out of the domain of HW and embedded systems programmer Amplify the applications addressed – programmed by domain experts More reliable One of the most important areas of research to make WSN widely used

Context System Development Environment Analysis/Tools Use of System SQL/Queries Actual Programming

Programming Models Environmental (domain specific, tracking, monitoring, …) –EnviroSuite Data/Database Centric - Queries –SQL, TinyBD, Cougar –Statistical and range queries Middleware APIs and Services –Group Management, Token machine language (Regiment), Milan (QoS based), Agilla –Support for other models Components Database Event Agent

Programming Models Components –nesC Virtual Machines –Mate Functional Macro-programming –Regiment (regions, streams) (Mobile) Scripts –SensorWare Extend TCL interpreter with support for commands such as query, send, wait, replicate, … Provides execution environment for Scripts Events –Publish/subscribe –DSWare, SNEDL, Impala

Programming Models Model Driven Swarm computing Java Linux

Program What? Low level protocols (MAC, routing, …) Middleware services Application Use of system –Queries Blurs

Sensor/Actuator/Communication Heterogeneous Homogeneous Resource management, team formation, networking, aggregation, … Severe constraints power, memory, bandwidth, cpu, cost,...

Reliability Make an unreliable platform reliable!! HW (motes) are/will be very reliable Environment/wireless communication will not be reliable

Abstractions Program as a whole – not individual nodes Hide details (which ones, expose what) –Single node decisions –Asynchrony –Race conditions –False alarms –Retries –Physical details (e.g., location, sensor characteristics, …) –Faults –Scale –Storage locations

Other Questions How to disseminate programs –Flooding, viral programs, gossip protocols Efficient on small, embedded, real-time devices Long-lived systems –Disseminate again –Disseminate pieces of executable

Environmental Paradigm Current Paradigms –Single node abstractions –Explicit interactions between nodes –Read sensor data; fuse data; move data –Set actuators Environmental Paradigm –Reflect the physical world directly –Virtual world of entities (fire, people, vehicles, pesticide, velocity, location, areas, …)

EnviroSuite Way to think –Events – measurable environmental activities –Events mapped to programming objects –Computation is attached to these objects Report location, compute velocity, … Library provides protocols for sensor data processing, object maintenance, inter-object coordination, aggregation mechanisms, etc.

EnviroSuite

event-object VEHICLE { object_creation_condition = ferrous object && background sound object_resolution = 6; // minimal distance between // two events object_function = report.Location; object_function = report.Speed; } ferrous object && background sound This statement is supported by drivers in a library:

Level of Knowledge Required Ferrous object –Which signal processing module? –What parameter specifications need to be made? –We are programming in an application that interacts with the environment – how divorced from that fact can the programmer be?

Routing Protocol - SPEED USES VELOCITY Expose Velocity

Radio Irregularity DOI = Degree of Irregularity DOI = 0.05 DOI = 0.2 Do Not Expose

Data/Database Centric Query Processing Architectures (SQL-based) –Process the queries –Route the queries –Retrieve information efficiently (in time and with low energy costs) Storage Architectures –How/where to store collected data from sensors –In-network storage At local node Data centric – name the data and hash to a location Multi-resolution (hierarchies)

Example of Query Retrieve, every 30 seconds, the rainfall level if it is greater than 50 mm SELECT R.Sensor.getRainfallLevel() FROM RFSensors R WHERE R.Sensor.getRainfallLevel() > 50 AND $every(30); Many other extensions to query capability including statistical and range based queries

Content Dissemination - Caching Information source (Aperiodic updates) Data replicas (Placement?) Receivers (Refresh Rate, Accuracy) Goal: Find the optimal communication path to send sensory data from a monitored source to multiple (mobile) sinks such that energy usage is minimized.

Middleware APIs Group Management –Create –Terminate –Merge –Join/Leave –Assign function Track target Classify target Map temperature region –Consensus

Group Management IR Camera

Group Management IR Camera

Examples: Tracking and Map Regions Base Station

Group Management - API –Create_Group(name,function,criterion,atleast,acc uracy) - implicit and explicit –Destroy_Group(name) –Join() –Leave() –Merge() –Move_COG() –Expand() -- to gain sensing confidence –Shrink() -- to save power –Commit(grp_ID) - to synchronize group re- configurations

Other Services Naming Directory Location Monitor Configure …

Question How general/specific should a middleware service be? Function of severity of resource constraints Severe Careful interoperability Exactly what is needed and no more! Excess Capacity More general services Useable by many

Functional Macro- Programming (Regiment) Apply function to data from a stream Aggregate samples from a stream Filter stream Define/Disseminate Events from a area (region) Area Base Station Abstract Regions Streams

Regiment (cont.) Set frequency Fidelity Contour finding Combine regions Anchors (leaders for a region) Functional Language

Regiment Abstractions –Streams, Spaces, Events, Anchors (leader for a region), When (time) –Regions – group of nodes with some relationship to each other Like the function for a group in previous middleware slides Ex. – all nodes within k radio hops of node N Ex. – all nodes whose proximity sensor records a hit

Token Machine Language (TML) Kind of middleware to support Regiment PL Regiment –Compiler transforms a macro-program written in functional style into an efficient nodal program based on a token machine –Token machine is an intermediate language (target) for Regiment

TML NODE Token Handlers – Atomic Tasks Token from Network Name of Token Handler Data Generate Tokens

Components - nesC Underlying execution model (TinyOS) –Tasks and Events –Split phase operation Modules –Component Specification – Interfaces –Component Implementation Configurations –Wiring Diagrams

Tasks and Events Tasks –Deferred computation –Non-preemptable by other tasks –Scheduled FCFS from task queue Events –Execution of an interrupt handler –Runs to completion –Can preempt tasks and can be preempted by other events

Application Example RFM Radio byte i2c Temp photo Messaging Layer clocks bit byte packet Radio Packet Routing Layer sensing application application HW SW ADC messaging routing UART Packet UART byte

Components - nesC The nesC model: –Interfaces: uses provides –Components: modules configurations Application:= graph of components Component A Component B Component D Component C Application configuration Component E Component F EnviroTrack on top of nesC

Interfaces Examples of interfaces: interface StdControl { command result_t init (); command result_t start (); command result_t stop (); } 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 (uint16_t addr, uint8_t len, TOS_MsgPtr p); event result_t sendDone (); } interface ReceiveMsg { event TOS_MsgPtr receive (TOS_MsgPtr m); } StdControl.ncTimer.nc ReceiveMsg.ncSendMsg.nc

Modules Implements a component’s specification with C code: module MyCompM { provides interface X; provides interface Y; uses interface Z; } implementation { …// C code } MyCompM.nc

Modules Posting Tasks: module BlinkM {… } implementation {… task void processing () { if(state) call Leds.redOn(); else call Leds.redOff(); } event result_t Timer.fired () { state = !state; post processing(); return SUCCESS; }… } BlinkM.nc

Configuration Example Blink application Wiring Example configuration BlinkC { } implementation { components Main, BlinkM, ClockC, LedsC; Main.StdControl->BlinkM.StdControl; BlinkM.Clock->ClockC; BlinkM.Leds->LedsC; } ClockCLedsC Main BlinkC BlinkM BlinkC.nc

Future? Different component models? nesC components are “low level” with a fair amount of syntax Envirosuite, Mate, etc. do build on top of nesC

Mate – Virtual Machine TinyOS Mate VM (interprets) 24 Instruction Programs Each instruction executes as task (slow) Code capsules

Code Capsules One capsule = 24 instructions Fits into single TOS packet –Energy efficient Atomic reception Code Capsule –Type and version information –Types: send, receive, timer, subroutine Larger programs – use several capsules

Value Re-programmability –Re-task a network Parameter adjustment Self-replication –One of the special instructions on the VM is forward (which supports a viral-like infection of the entire network) Incremental addition of new nodes

Propagation Example

Node Enters the Network

Instruction Set One byte per instruction Three classes: basic, s-type, x-type basic: arithmatic, halting, LED operation s-type: messaging system x-type: pushc, blez  8 instructions reserved for users to define Instruction polymorphism Example: add(data, message, sensing)

User Defined Instructions TinyOS Mate VM (interprets) 24 Instruction Programs Code capsules Instructions Understood by Mate User defined Sound alarm - Write to flash

Mate Architecture Stack based architecture Operand stack Return address stack Three events/execution contexts: Clock timer Message reception Message send

Code Example(1) Display Counter to LED

Code Example(2) Sense and Send

TinyOS Sense and Send event result_t Timer.fired() { if (state == IDLE && call Photo.sense()) {state = SENSE;} return SUCCESS; } event result_t Photo.dataReady(uint16_t data) { if (state == SENSE) { packet->reading = data; if (call SendMsg.send(packet, sizeof(DataBuf)) { state = SENDING; } else {state = IDLE;} } return SUCCESS; } event result_t SendMsg.sendDone(TOS_MsgPtr msg) { if (state == SENDING) {state = IDLE;} return SUCCESS; }

Component Breakdown 7286 bytes code, 603 bytes RAM

Questions What should a programmer see? –New language –New middleware –Services –Components –Abstracts models –All the above – None of the above

Questions What would have made your life easier in doing the programming assignments? What makes it easier to get the system to work? –Debugging tools Initially (in programming environment) On real platform

Ideas Move code to node – executes on middleware, VM, interpreter Domain specific (good or bad?) Regions/Streams Expose/Hide? –Performance –Physical systems Disseminate

Summary Very active area –It must be Solutions can have large impact –Applications programmers rather than system experts Standard? –Analogy to real-time computing and programming languages? WSN-Java?

Final Question Will there be GP WSNs (and how might that affect the programming abstractions)?