INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 1 Data Management in Sensor Networks Ellen Munthe-Kaas Jarle Søberg.

Slides:



Advertisements
Similar presentations
CSE 5392By Dr. Donggang Liu1 CSE 5392 Sensor Network Security Introduction to Sensor Networks.
Advertisements

Sensor Network Platforms and Tools
한국기술교육대학교 컴퓨터 공학 김홍연 TinyDB : An Acquisitional Query Processing System for Sensor Networks. - Samuel R. Madden, Michael J. Franklin, Joseph M. Hellerstein,
1 Sensor Network Databases Ref: Wireless sensor networks---An information processing approach Feng Zhao and Leonidas Guibas (chapter 6)
What is a Wireless Sensor Network (WSN)? An autonomous, ad hoc system consisting of a collective of networked sensor nodes designed to intercommunicate.
1 Introduction to Wireless Sensor Networks. 2 Learning Objectives Understand the basics of Wireless Sensor Networks (WSNs) –Applications –Constraints.
1 Supporting Aggregate Queries Over Ad-Hoc Wireless Sensor Networks Samuel Madden UC Berkeley With Robert Szewczyk, Michael Franklin, and David Culler.
Scaling Down Robert Grimm New York University. Scaling Down in One Slide  Target devices (roughly)  Small form factor  Battery operated  Wireless.
The Cougar Approach to In-Network Query Processing in Sensor Networks By Yong Yao and Johannes Gehrke Cornell University Presented by Penelope Brooks.
Aggregation in Sensor Networks NEST Weekly Meeting Sam Madden Rob Szewczyk 10/4/01.
A Survey of Wireless Sensor Network Data Collection Schemes by Brett Wilson.
Generic Sensor Platform for Networked Sensors Haywood Ho.
The Design of an Acquisitional Query Processor For Sensor Networks Samuel Madden, Michael J. Franklin, Joseph M. Hellerstein, and Wei Hong Presentation.
Data Management for Sensor Networks Zachary G. Ives University of Pennsylvania CIS 650 – Database & Information Systems April 4, 2005.
TAG: A TINY AGGREGATION SERVICE FOR AD-HOC SENSOR NETWORKS Presented by Akash Kapoor SAMUEL MADDEN, MICHAEL J. FRANKLIN, JOSEPH HELLERSTEIN, AND WEI HONG.
T AG : A TINY AGGREGATION SERVICE FOR AD - HOC SENSOR NETWORKS Samuel Madden, Michael J. Franklin, Joseph Hellerstein, and Wei Hong Presented by – Mahanth.
Introduction To Wireless Sensor Networks Wireless Sensor Networks A wireless sensor network (WSN) is a wireless network consisting of spatially distributed.
TAG: a Tiny Aggregation Service for Ad-Hoc Sensor Networks Paper By : Samuel Madden, Michael J. Franklin, Joseph Hellerstein, and Wei Hong Instructor :
The Design of an Acquisitional Query Processor For Sensor Networks Samuel Madden, Michael J. Franklin, Joseph M. Hellerstein, and Wei Hong.
TinyOS By Morgan Leider CS 411 with Mike Rowe with Mike Rowe.
Abstract Since 2002, much research has been done across the country in the area of micro-electric mechanical systems as a potential solution to the pandemic.
Microcontroller-Based Wireless Sensor Networks
Presented BY:- S.KOTESWARA RAO 09511A0528. INTRODUCTION Bluetooth is wireless high speed data transfer technology over a short range ( meters).
March 6th, 2008Andrew Ofstad ECE 256, Spring 2008 TAG: a Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden, Michael J. Franklin, Joseph.
Crowd Management System A presentation by Abhinav Golas Mohit Rajani Nilay Vaish Pulkit Gambhir.
1 Pradeep Kumar Gunda (Thanks to Jigar Doshi and Shivnath Babu for some slides) TAG: a Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden,
TAG: a Tiny Aggregation Service for Ad-Hoc Sensor Networks Authors: Samuel Madden, Michael Franklin, Joseph Hellerstein Presented by: Vikas Motwani CSE.
1 TAG: A Tiny Aggregation Service for Ad-Hoc Sensor Networks Samuel Madden UC Berkeley with Michael Franklin, Joseph Hellerstein, and Wei Hong December.
INT 598 Data Management for Sensor Networks Silvia Nittel Spatial Information Science & Engineering University of Maine Fall 2006.
Sensor Database System Sultan Alhazmi
The Design of an Acquisitional Query Processor for Sensor Networks CS851 Presentation 2005 Presented by: Gang Zhou University of Virginia.
CS542 Seminar – Sensor OS A Virtual Machine For Sensor Networks Oct. 28, 2009 Seok Kim Eugene Seo R. Muller, G. Alonso, and D. Kossmann.
Query Processing for Sensor Networks Yong Yao and Johannes Gehrke (Presentation: Anne Denton March 8, 2003)
Research Overview Sencun Zhu Asst. Prof. CSE/IST, PSU
College of Engineering Grid-based Coordinated Routing in Wireless Sensor Networks Uttara Sawant Major Advisor : Dr. Robert Akl Department of Computer Science.
REED: Robust, Efficient Filtering and Event Detection in Sensor Networks Daniel Abadi, Samuel Madden, Wolfgang Lindner MIT United States VLDB 2005.
1 REED: Robust, Efficient Filtering and Event Detection in Sensor Networks Daniel Abadi, Samuel Madden, Wolfgang Lindner MIT United States VLDB 2005.
ResTAG: Resilient Event Detection with TinyDB Angelika Herbold -Western Washington University Thierry Lamarre -ENSEIRB Systems Software Laboratory, OGI.
Fuzzy Data Collection in Sensor Networks Lee Cranford Marguerite Doman July 27, 2006.
Aggregation and Secure Aggregation. Learning Objectives Understand why we need aggregation in WSNs Understand aggregation protocols in WSNs Understand.
Overview of Wireless Networks: Cellular Mobile Ad hoc Sensor.
W. Hong & S. Madden – Implementation and Research Issues in Query Processing for Wireless Sensor Networks, ICDE 2004.
In-Network Query Processing on Heterogeneous Hardware Martin Lukac*†, Harkirat Singh*, Mark Yarvis*, Nithya Ramanathan*† *Intel.
Wireless Sensor Networks
REED : Robust, Efficient Filtering and Event Detection in Sensor Network Daniel J. Abadi, Samuel Madden, Wolfgang Lindner Proceedings of the 31st VLDB.
INF5100 Autumn 2008 © Ellen Munthe-Kaas and Jarle Søberg 1 Data Management in Sensor Networks Ellen Munthe-Kaas Jarle Søberg.
Sep Multiple Query Optimization for Wireless Sensor Networks Shili Xiang Hock Beng Lim Kian-Lee Tan (ICDE 2007) Presented by Shan Bai.
Building Wireless Efficient Sensor Networks with Low-Level Naming J. Heihmann, F.Silva, C. Intanagonwiwat, R.Govindan, D. Estrin, D. Ganesan Presentation.
KAIS T Location-Aided Flooding: An Energy-Efficient Data Dissemination Protocol for Wireless Sensor Networks Harshavardhan Sabbineni and Krishnendu Chakrabarty.
The Design of an Acquisitional Query Processor For Sensor Networks Samuel Madden, Michael J. Franklin, Joseph M. Hellerstein, and Wei Hong Presentation.
Wireless Sensor Network: A Promising Approach for Distributed Sensing Tasks.
Software Architecture of Sensors. Hardware - Sensor Nodes Sensing: sensor --a transducer that converts a physical, chemical, or biological parameter into.
Lecture 8: Wireless Sensor Networks By: Dr. Najla Al-Nabhan.
- Pritam Kumat - TE(2) 1.  Introduction  Architecture  Routing Techniques  Node Components  Hardware Specification  Application 2.
Wireless sensor networks: a survey
Created by :- prashant more prashant more. INTRODUCTION Bluetooth is wireless high speed data transfer technology over a short range ( meters).
TAG: a Tiny AGgregation service for ad-hoc sensor networks Authors: Samuel Madden, Michael J. Franklin, Joseph M. Hellerstein, Wei Hong Presenter: Mingwei.
Wireless Sensors Networks - Network Address Allocation Presented by: Assaf Goren Supervisor: Dr. Yehuda Ben-Shimol.
Medium Access Control. MAC layer covers three functional areas: reliable data delivery access control security.
Wireless Sensor Networks
Overview of Wireless Networks:
Ioana Apetroaei Ionuţ-Alexandru Oprea Bogdan-Eugen Proca
Introduction to Wireless Sensor Networks
Distributed database approach,
Introduction to Wireless Sensor Networks
The Design of an Acquisitional Query Processor For Sensor Networks
Distributing Queries Over Low Power Sensor Networks
REED : Robust, Efficient Filtering and Event Detection
Aggregation.
Connected Sensor Cover Problem
Presentation transcript:

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 1 Data Management in Sensor Networks Ellen Munthe-Kaas Jarle Søberg

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 2 Outline Sensor networks –Characteristics –Motes –Application domains –Data management TinyOS TinyDB

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 3 Sensor Networks Base station (gateway) Motes (sensors)

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 4 Sensor Network Characteristics Autonomous nodes –Small, low-cost, low-power, multifunctional –Sensing, data processing, and communicating components Sensor network is composed of large number of sensor nodes –Proximity to physical phenomena Deployed inside the phenomenon or very close to it Monitoring and collecting physical data No human interaction for weeks or months at a time –Long-term, low-power nature

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 5 Motes Spec smart dust; total size 5 mm 2 Mica2 mote with 2 AA batteries (provide power for one year’s use) Mica2DOT mote. Powered with button battery Mote: Short for remote. Refers to a wireless transceiver that is also a remote sensor

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 6 Mote Hardware Made up of four basic components –sensing unit usually two subunits: sensor and ADC –processing unit makes the sensor collaborate with the other nodes to carry out the assigned sensing tasks –transceiver unit connects the node to the network –power unit small, standard batteries

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 7 Motes in the DMMS Laboratory Mica2 Processor: MPR400CB based on Atmel ATmega128L Radio: 900 MHz multi-channel transceiver Memory: 4 kB Configuration EEPROM 128 kB Program Flash Memory 512 kB Measurement (Serial) Flash Power: 2 x AA OS: TinyOS v1.0 Weight: 18g (excluding batteries) Sensors: –Light –Temperature –Acoustic Actuators: –Sounder

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 8 Motes vs. Traditional Computing Embedded OS –Usually an image flashed to the device Lossy, ad hoc radio communication –E.g. wrt slow CPU Sensing hardware Severe power constraints

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 9 Application Domains Environmental Health Military Commercial

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 10 Environmental Applications Tracking the movements of birds, animals, insects Monitoring environmental conditions that affect crops and livestock Chemical/biological detection Biological, earth, and environmental monitoring in marine, soil, and atmospheric contexts Meteorological or geophysical research Pollution study, precision agriculture, irrigation Biocomplexity mapping of environment Flood detection, forest fire detection

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 11 Health Applications Integrated patient monitoring –Body sensor networks Telemonitoring of human physiological data Tracking and monitoring doctors and patients inside a hospital Tracking and monitoring patients and rescue personnel during rescue operations

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 12 Military Applications Monitoring friendly forces, equipment and ammunition Battlefield surveillance Reconnaissance of opposing forces and terrain Nuclear, biological and chemical (NBC) attack detection and reconnaissance

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 13 Commercial Applications Monitoring product quality Constructing smart office spaces Interactive toys Smart structures with sensor nodes embedded inside Machine diagnostics Interactive museums Managing inventory control Environmental control in office buildings Detecting and monitoring car thefts Vehicle tracking and detection Tracking goods with RFID

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 14 Application Examples Traditional monitoring apparatus. Earthquake monitoring in shake-test sites. Vehicle detection: sensors along a road, collect data about passing vehicles. Habitat Monitoring: Storm petrels on Great Duck Island, microclimates on James Reserve.

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 15 Managing Data Purpose of sensor network: Obtain real-world data –Extract and combine data from the network But: Programming sensor networks is hard! –Months of lifetime required from small batteries –Lossy, low-bandwidth, short range communication –Highly distributed environment –Application development –Application deployment administration

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 16 Data Management Systems for Sensor Networks DB sensor network

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 17 Data Management Systems for Sensor Networks Motivation: –Implement data access Sensor tasking Data processing Possibly support for data model and query language Goals: –Adaptive Network conditions Varying/unplanned stimuli –Energy efficient In-network processing Flexible tasking Duty cycling

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 18 Data Management System Challenges Routing Resource allocation Deployment Query language, query optimization

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 19 Outline Sensor networks TinyOS TinyDB

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 20 TinyOS Operating system for managing and accessing mote HW Characteristics: –Energy-efficient –Programming model: Components –Only one application running at a time –No process isolation or scheduling –No kernel –No protection domains –No memory manager –No multithreading Programming language: nesC

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 21 Outline Sensor networks TinyOS TinyDB –Overview –Data model –Query language –Architecture –Network administration –Aggregates (TAG: Tiny Aggregations)

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 22 TinyDB High level abstraction –Data centric programming –Interact with sensor network as a whole –Extensible framework Under the hood: –Intelligent query processing: query optimization, power efficient execution –Fault mitigation: automatically introduce redundancy, avoid problem areas SELECT nodeid, light FROM sensors WHERE light > 400 SAMPLE PERIOD 1s query, trigger data Appli- cation TinyDB sensor network

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 23 Feature Overview Declarative SQL-like query interface Metadata catalog management Multiple concurrent queries Network monitoring (via queries) In-network, distributed query processing Extensible framework for attributes, commands and aggregates In-network, persistent storage

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 24 Query Language Essentials Declarative queries –Simple, SQL-like queries –Users specify the data they want and the rate at which data should be refreshed –Using predicates, not specific addresses TinyDB collects data from motes in the environment, filters it, aggregates it, and routes it out to a PC TinyDB does this with power-efficient in-network processing algorithms

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 25 Outline Sensor networks TinyOS TinyDB –Overview –Data model –Query language –Architecture –Network administration –Aggregates (TAG: Tiny Aggregations)

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 26 Data Model Relational model Single table sensors –One column (attribute) per type of value that a device can produce (light, temperature,...) –One row (tuple) per node per instant in time –Physically partitioned across all nodes in the network –Tuples are materialized only at need and stored only for a short period or delivered directly to the network –Projections and transformations of tuples from sensors may be stored in materialization points

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 27 The sensors Table sensors(nodeid, temp, light) sensors(nodeid, light) sensors(nodeid, volume) acoustic sensor light sensor light and temperature sensor sensors(epoch, nodeid, ) volume, temp, light,... SELECT nodeid, light FROM sensors WHERE light > 400 SAMPLE PERIOD 1s

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 28 TinyDB Routing Tree TinyDB GUI TinyDB Client API PostgreSQL DBMS TinyDB query processor Mote side PC side 7 Sensor network

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 29 SELECT nodeid, light FROM sensors WHERE light > 400 SAMPLE PERIOD 1s sensors(epoch, nodeid, ), temp, lightvolume,... epochtimeStampnodeidvolumelighttemp null422null epochtimeStampnodeidvolumelighttemp null410null 2...2null460null sensors(nodeid, light) nodeidlight nodeidlight sensors(nodeid, temp, light) sensors(nodeid, volume) TinySQL Routing Example nodeidlight 3null nodeidlight 2422 nodeidlight

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 30 Outline Sensor networks TinyOS TinyDB –Overview –Data model –Query language –Architecture –Network administration –Aggregates (TAG: Tiny Aggregations)

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 31 TinySQL Example 1 Sample interval: Interval during which exactly one tuple of sensors is produced per node for the purpose of executing the query, and during which the query is executed once. The sampling itself does not take much time. Epoch: Period of time between the start of each sample interval. Numbered consecutively Data collection period: Period of time over which query is running. ”Report light and temperature readings once per second for 10 seconds.” SELECT nodeid, light, temp FROM sensors SAMPLE PERIOD 1 s FOR 10 s time sample interval data collection period epoch:

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 32 TinySQL Example 2 Materialization point: Stored table in the nodes. Cf. materialized views in traditional RDBMSs and windows in data stream management systems (DSMSs, will be explained in a later lecture). ”Store the latest eight light readings, doing one reading every 10 seconds (forever).” CREATE STORAGE POINT recentLight SIZE 8 AS (SELECT nodeid, light FROM sensors SAMPLE PERIOD 10 s)... later: DROP STORAGE POINT recentLight

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 33 TinySQL Example 3 Joins are allowed between two materialization points or between a materialization point and the sensors table. –New sensors tuples are joined with tuples of the materialization point on their time of arrival ”Count the number of recent light readings (from zero to eight samples in the past) that were brighter than the current reading, each current reading collected during a time span of ten seconds.” SELECT COUNT(*) FROM sensors AS s, recentLight AS rl WHERE rl.nodeid = s.nodeid AND s.light < rl.light SAMPLE PERIOD 10 s new reading nodeidlight nodeidlight sensors recentLight

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 34 TinySQL Example 4 Aggregation can be performed on grouped values as in ordinary SQL. Grouping and aggregation take place over the tuples collected during each sample interval. ”Find the rooms on floor 6 where the average volume is over some threshold (assuming each room can have multiple sensors). Do this every 30 seconds.” SELECT room, AVG(volume) FROM sensors WHERE floor = 6 GROUP BY room HAVING AVG(volume) > threshold SAMPLE PERIOD 30 s... later: STOP QUERY id

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 35 TinySQL Example 5 An event can be used for initiating data collection. –Generated by another query or by a lower-level part of the OS ”When a bird-detect event occurs, report the average light and temperature levels at sensors near the event’s location. Do this every 2 seconds for a period of 30 seconds (then go to sleep again).” ON EVENT bird-detect(loc): SELECT event.loc, AVG(light), AVG(temp) FROM sensors AS s WHERE dist(s.loc, event.loc) < 10 m SAMPLE PERIOD 2 s for 30 s

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 36 TinySQL Example 6 Generating an event from a query: ”Signal the event hot whenever the temperature goes above some threshold. Read the temperature every 10 seconds.” SELECT nodeid, temp FROM sensors WHERE temp > threshold OUTPUT ACTION SIGNAL hot(nodeid, temp) SAMPLE PERIOD 10 s

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 37 TinySQL Example 7 To make sure the network runs for a guaranteed period, users may request a specific query lifetime. ”Get the temperature, but space out the readings to make sure that the network will survive at least 30 days.” SELECT nodeid, temp FROM sensors LIFETIME 30 days

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 38 TinySQL Example 8 Network health queries are metaqueries over the network itself. ”Report all sensors whose current battery voltage is less than k.” SELECT nodeid, voltage FROM sensors WHERE voltage < k SAMPLE PERIOD 10 minutes

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 39 TinySQL Example 9 Actuation queries can be used to perform some physical action in response to a query. ”Turn on the fan if the temperature is rising above a certain level.” SELECT nodeid, temp FROM sensors WHERE temp > threshold OUTPUT ACTION power-on(nodeid) SAMPLE PERIOD 30 s

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 40 Outline Sensor networks TinyOS TinyDB –Overview –Data model –Query language –Architecture –Network administration –Aggregates (TAG: Tiny Aggregations)

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 41 Inside TinyDB TinyOS Schema Query Processor Multihop Network Filter light > 400 get (‘temp’) Agg avg(temp) Queries SELECT AVG(temp) WHERE light > 400 Results T: 1, AVG: 225 T: 2, AVG: 250 TablesSamples got(‘temp’) Name: temp Time to sample: 50 uS Cost to sample: 90 uJ Calibration Table: 3 Units: Deg. F Error: ± 5 Deg F Get f : getTempFunc() … getTempFunc() TinyDB ~10,000 Lines Embedded C Code ~5,000 Lines (PC-Side) Java ~3200 Bytes RAM (w/ 768 byte heap) ~58 kB compiled code (3x larger than 2 nd largest TinyOS Program)

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 42 Metadata Management Each node maintains a metadata catalog containing –local attributes name cost: power, sample time –events name signature cost: frequency estimate –user-defined functions and predicates Periodically copied to root for use by query optimizer Registered via static linking at compile time using nesC

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 43 Outline Sensor networks TinyOS TinyDB –Overview –Data model –Query language –Architecture –Network administration –Aggregates (TAG: Tiny Aggregations)

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 44 TinyDB Routing Tree TinyDB GUI TinyDB Client API PostgreSQL DBMS TinyDB query processor Mote side PC side 7 Sensor network

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 45 Routing A routing tree is established –Root is a gateway –Spanning tree –No multiple paths –Tree construction and maintenance Query fragments are disseminated down the routing tree –Query optimization performed centrally, outside the sensor network, using metadata obtained from the nodes –Semantic routing tree to avoid flooding

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 46 Routing Tree Creation 1.One mote is appointed the root (usually used as the interface/gateway of the network) 2.The root broadcasts a message asking motes to organize into a routing tree 3.Any mote without an assigned level that hears this message assign its level as the received+1 and chooses the sender as its parent through which it will route messages to the root 4.Motes re-broadcast the routing message, inserting their own IDs and levels... and so on

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 47 Communication Scheduling Data processed up the routing tree Per node per epoch: Sleep; data sampling; receiving; processing; transmitting –Sleep period defined based on number of children Awakening just in time to receive results –Sampling –Receiving –Processing: Filtering, partial aggregate –Network transmission Adaptation to network contention and power consumption Expensive (sending 1 bit takes approx 800 instructions)

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 48 Communication Scheduling A mote upon receiving a request to perform a query: –awakens –synchronizes its clock –chooses the sender of the msg as its parent –forwards the query, setting the delivery interval for children to be slightly before the time its parent expects to see the partial state tuple

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 49 The Epoch Long enough to allow all nodes to report Epoch length = Tree depth * (Sample interval + receive time + send timeSets a lower bound to the epoch) –Limits the maximum sample interval of the network The sample interval is increased by pipelining the communication schedule

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 50 Outline Sensor networks TinyOS TinyDB –Overview –Data model –Query language –Architecture –Network administration –Aggregates (TAG: Tiny Aggregations)

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 51 Aggregates: Centralized Approach Server-based approach: All sensor readings are sent to the base station, which then computes the aggregates Example: SELECT COUNT(*) FROM sensors How many transmissions?

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 52 Aggregates: Centralized Approach

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 53 Aggregates: Distributed Approach In TinyDB aggregates are computed in- network whenever possible. –Lower number of transmissions –Lower latency –Lower power consumption Example: SELECT COUNT(*) FROM sensors How may transmissions?

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 54 Aggregates: Distributed Approach

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 55 Implementation of agg Each aggregation agg is implemented via a partial state tuple and three functions: –the partial state tuple (partial state record in the paper) at each node holds an intermediate aggregate value –i – initializer: Specifies how to instantiate a partial state tuple for a single sensor value –f – merging function: Specifies how to compute a combined intermediate aggregate from two intermediate aggregates –e – evaluator: Takes a partial state tuple and computes the actual value of the aggregate Example: avg –partial state tuple where s is sum and c count –i(x) = for a sensor value x –f(, ) = –e( ) = s/c

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 56 Taxonomy of TAG We classify aggregates according to four properties: –Duplicate sensitivity –Tolerance to losses –Monotonicity –State requirements Yield a general set of optimizations that can be automatically applied Can extend the original five aggregates

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 57 Duplicate Sensitivity duplicate insensitive aggregates are unaffected by duplicate readings from a single device –max, min, count distinct duplicate sensitive aggregates will change when a duplicate reading is reported –count, sum, average, median,...

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 58 Loss-Tolerance exemplary aggregates return one or more representative values from the set of all values –behave unpredictably in the face of loss –max, min, median,... summary aggregates compute some property over all values –the aggregate applied to a subset can be treated as a robust approximation of the true aggregate value –count, sum, average, count distinct,...

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 59 Monotonicity Monotonicity: If a  b, then f(a)  f(b) Monotonic aggregates: For two partial state tuples s1 and s2 combined via a function f,  s1,s2, e(f(s1,s2))  max(e(s1),e(s2)) or  s1,s2, e(f(s1,s2))  min(e(s1),e(s2)) Important when determining whether some predicates (such as HAVING ) can be applied in-network, before the final value of the aggregate is known –Early predicate evaluation saves messages by reducing the distance that partial state tuples must flow up the aggregation tree.

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 60 State Requirements Distributive aggregates Algebraic aggregates Holistic aggregates Unique aggregates Content-sensitive aggregates

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 61 State Requirements: Distributive aggregates The partial state is the aggregate for the partition of data over which data are computed The size of the partial state tuples is the same as the size of the final aggregate –max, min, count, sum

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 62 Properties and Optimizations PropertyExamplesAffects Duplicate sensitivityMin: dup. insensitive Avg: dup. sensitive Routing redundancy Loss-toleranceMax: exemplary Count: summary Effect of loss MonotonicityCount: monotonic Avg: non-monotonic Snooping, hypothesis testing Partial stateMedian: unbounded Max: 1 tuple Effectiveness of TAG

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 63 State Requirements: Algebraic aggregates The partial state tuples are not themselves aggregates for the partitions, but are of constant size –Average (consists of two values) s1, c1s2, c2 (s1+s2)/(c1+c2)

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 64 State Requirements: Holistic aggregates The partial state tuples are propotional in size to the set of data in the partition No useful partial aggregation can be done, and all the data must be brought together to be aggregated by the evaluator –median

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 65 State Requirements: Unique aggregates Similar to holistic aggregates, except that the amount of state that must be propagated is proportional to the number of distinct values in the partition –count distinct

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 66 State Requirements: Content-sensitive aggregates The partial state tuples are proportional in size to some (perhaps statistical) property of the data values in the partition

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 67 Beyond TinyDB: LifeUnderYourFeet 10 motes in the soil of an urban forest environment –MicaZ motes –Slanted grid, approx. 2m apart –A small stream runs through the middle of the grid; depth depends on recent rain events –Collecting air and soil temperature and soil moisture data Sampling and data collection –NOT TinyDB! ”Sample-and-collect schemes can loose up to 50% of collected measurements” –Sample every minute –Store on on-board flash 23 kB/day 512 kB flash means flash is overwritten after 22 days –Gather results once a week or fortnight Wireless basestation connected to PC is travelled to the perimeter of the deployment site to collect measures –Simple sliding window ARQ protocol

INF5100 Autumn 2007 © Ellen Munthe-Kaas and Jarle Søberg 68 Literature Samuel R. Madden, Michael J. Franklin, Joseph M. Hellerstein, Wei Hong: TinyDB: An Acquisitional Query Processing System for Sensor Networks, ACM Transactions on Database Systems (TODS), Volume 30, Issue 1, (Available through the ACM Digital Library; cf. Some additional reading: –Samuel R. Madden, Michael J. Franklin, Joseph M. Hellerstein, Wei Hong: TAG: a Tiny Aggregation Service for Ad-Hoc Sensor Networks OSDI, 2002