Dynamic Macroprogramming of Wireless Sensor Networks with Mobile Agents (1) AITAmI’07 = Artificial Intelligence Techniques for Ambient Intelligence (workshop @ IJCAI'07, Hyderabad) (2) Ambiance: A Mobile Agent Platform for End-User Programmable Ambient Systems, in J.C. Augusto & D. Shapiro, Eds, Advances in Ambient Intelligence, vol. 164, IOS Press, 2007
Reza RazaviUniversity of Luxembourg Kirill Mechitov, Gul AghaUniversity of Illinois at Urbana-Champaign Jean-François Perrot Université Pierre et Marie Curie, Paris
Bits of History - 1 : Desirable ends • Software with two levels of users • "normal" users • "expert" users who modify the system • Examples • Banks (Teller clerk / Financial expert) • Metrology systems (Measuring Operator / Defining expert) • Videostore • End-user programming for the expert • in the sense of Bonnie Nardi
Bits of History - 2 : Available means • Adaptive Object-Model (Ralph Johnson & al 1997) • (Smalltalk) Objects and meta-objects • The Type-Object Pattern • Meta-objects are terminal objects (not classes) • Manolescu's Micro-Workflow (2000) • Reza Razavi's thesis (2001) • Meta-objects should be classes • Dart improves Micro-Workflow
Words of Advice... • Thou shalt reuse ! • Funding available from Luxembourg for Ambient Intelligence • Reusing Dart in the context of Wireless Sensor Networks
Transatlantic meeting Thanks to Jean-Pierre !
Background Photo: http://pinker.wjh.harvard.edu Typical Applications Query: detect an animal Query: photograph speeding vehicles Query: chart traffic patterns
1. A Wireless Sensor Network...thousands of low-cost sensor nodes...[WSNA2007]makes up an infrastructure 2. Queries from End-Users over this infrastructure(the network is seen as a data provider)e.g. Liz' & Pablo's queries • diverse • unpredictable 3. Wanted : an execution mecanism for queries.
A scenario from Microsoft Research • The ambient infrastructure, installed in a parking garage, comprises break beam sensors and security camera nodes. • Two ordinary end-users, namely Liz and Pablo, who work independently, desire to use the ambient system for their own purposes. • Liz is a site manager of the garage building and is interested in collecting vehicle arrival time data. • Pablo is a security officer in the building who wants to issue tickets to speeding drivers.
Service Repository Business Ontology Steps Prototype of a Web Portal for Query writing http://indus.cs.uiuc.edu:8080/seaside/ambiance
Vehicle Tracking uQuery Server Dart, Seaside, Squeak TCP/IP HTTP FSTC, UL,Luxembourg HTTP WSN ActorNet UIUC, Urbana-Champaign, IL., USA Firefox SAP Research, Palo Alto, CA., USA Explorer LIP6, Paris, France Typical Deployment
uQuery Server Serves a dual purpose : elaborating the request executing it
Entities and relationships Histogram Entry Mobile Object Pulse collection collection Vehicle Histogram Entry Collection Pulse Pair Histogram Example Domain : Vehicle Tracking Service Repository Estimate Motion For a Period Do Classify Vehicle Average Pulse Pairs Detect Beam Event Sort Edges
Knowledge level Web Server Query Processor Optimized code Query graph Operational level Execution Engine Text stream Messaging Service Sensors Mobile agents Output Overview of our Approach
Operational level The MICA2 hardware & the TinyOS lightweight OS The Mica2 has a 8 MHz 8-bit ATmega 128L CPU with • 4 KB of SRAM, • 128 KB of program flash memory • and 512 KB of serial flash. The 4 KB SRAM space is shared by the stack, heap, and all TinyOS components' static variables. Limited memory heavily constrains applications requiring several coordination services. Application code, large constant tables and logged data are loaded in the flash memory units. Long-running procedures are explicitly executed as tasks, which are scheduled in series and run to completion. Since only interrupts can preempt tasks or lower-priority interrupt handlers, processes must be segmented into sequences of tasks if they are to run concurrently.
Operational level ActorNet • Interpreter • Provides a uniform computing environment regardless of H/W, O.S. differences. • Mica2, PC,… • Mobility • Avoid data collection • Efficient way of sampling a sensor network • Easily cope with changing requirements on the fly Gul Agha YoungMin Kwon Kirill Mechitov Rajeesh Kumar
Operational level : Break Beam Detector Example Destination sensor ID (for migration) Meta-actor ID (for communication) ( (lambda (migrate) ; actor behavior (seq (migrate 200 111) (par (extmsg 111 (migrate 100 ; detectBeamEvent() primitive (#20) ; no arguments (nil) (prim20 nil) ))) )) ; migrate subroutine (lambda (adrs val) (callcc (lambda (cc) (send (list adrs cc (list quote val))))) ) ) Primitive-specific behavior (for application logic)
Operational level : Primitive DetectBeamEvent() while (read_beam_sensor() > threshold) yield processor pulse_start = time() (read_beam_sensor()samples the photo (light intensity) sensor 10 times a second, returning a 10-bit value indicating light intensity level. “breaking the beam” reduces light intensity below the threshold) while (sensor output <= threshold) yield processor pulse_end = time() return list(11, sensor_id, pulse_start, pulse_end – pulse_start)
Actors and Meta-Actors • Actor: • A thread at the operational level • Actually executed as a mobile agent • Meta-actor: • A thread at the meta-level • Controls the generation of code and execution of the actor • Based on the meta-data contained in the query representation
1 2 3 13 Histogram Entry Collection Histogram For a Period of <2 weeks> Do <T1> Plot Histogram Main 4 5 12 Vehicle Histogram Entry Do <T2> Create Histogram Entry T1: Compute Histogram Entry 6 9 10 11 Pulse Pair 3 Mobile Object Vehicle Average Pulse Pairs Estimate Motion Classify Vehicle 8 8 Pulse Pair 1 Pulse Pair 2 Sort Edges Sort Edges 7 7 7 Pulse 1 Pulse 2 Pulse 3 Detect Beam Event Detect Beam Event Detect Beam Event T2: Identify Vehicle Liz’s query Liz's query • Concurrent uQuery execution at the knowledge level • Comprises both local and remote interpretation (on ActorNet)
1 uQuery Meta-Actor 2 6 5 Histogram Entry Collection Histogram Control Meta-Actor Task Meta-Actor Step Meta-Actor Main 3 16 15 Vehicle Histogram Entry Do <T2> Create Histogram Entry T1: Compute Histogram Entry 4 9 8 7 Pulse Pair 3 Mobile Object Vehicle Average Pulse Pairs Estimate Motion Classify Vehicle 10 11 Pulse Pair 1 Pulse Pair 2 Sort Edges Sort Edges 12 13 14 Pulse 1 Pulse 2 Pulse 3 Remote Step Meta-Actor Detect Beam Event Detect Beam Event Detect Beam Event T2: Identify Vehicle Liz’s query Meta-Actors For a Period of <2 weeks> Do <T1> Plot Histogram Behavior, Task and Stepimplement getMetaActorTypeto specify their corresponding Meta-Actor type
Meta-actor id (1) Registration Ack (2) Acknowledgement Actor (in text form) (3) Deployment (4) Wakeup & reception Output object (5) Unregistration Close connection Protocol for Interacting with WSN Knowledge level Operational level Actor Deployment Interface Meta Actor multithreaded server providing socket connections for concurrently deploying and executing actors Messaging Interface Marshalling/Unmarshaling
Knowledge level Actor Launching Platform Parallel Deployment on ActorNet Internet Operational level Meta-Actor Actor Deployment Service Meta-Actor Messaging Service PC Platform Meta-Actor PC Platform
1 2 3 13 Histogram Entry Collection Histogram For a Period of <2 weeks> Do <T1> Plot Histogram Main 4 5 12 Vehicle Histogram Entry Do <T2> Create Histogram Entry T1: Compute Histogram Entry 6 Remote StepMA (DBE) 9 10 11 Pulse Pair 3 Mobile Object Vehicle Remote StepMA (DBE) Remote StepMA (DBE) Average Pulse Pairs Estimate Motion Classify Vehicle StepMA (SE) 8 8 StepMA (SE) Pulse Pair 1 Pulse Pair 2 Sort Edges Sort Edges 7 7 7 Pulse 1 Pulse 2 Pulse 3 Detect Beam Event Detect Beam Event Detect Beam Event T2: Identify Vehicle Liz’s query Execution uQuery Engine uQueryMA TaskMA (main) StepMA (For) IterativeMA (?) TaskMA (T1) StepMA (Do) TaskMA (T2) StepMA (APP) StepMA (EM) StepMA (CV) StepMA (CHE) StepMA (PH) time