Вы находитесь на странице: 1из 3

Reza Razavi (PI)

University of Luxembourg
Åmbiance Project
Autonomous Systems Group reza.razavi@uni.lu Laboratoire d’Informatique de Paris 6 – CNRS
University of Luxembourg
Université Pierre et Marie Curie

Jean-Francois Perrot
Kirill Mechitov, Sameer Sundresh and Gul Agha
Université Pierre et Marie Curie
University of Illinois at Urbana-Champaign
Open Systems Lab jean-francois.perrot@lip6.fr
University of Illinois at {mechitov, sundresh, agha}@cs.uiuc.edu
Urbana-Champaign

Wireless Sensor Networks (WSNs) WSN Programming


Benefits: State of the Art
• Fine-grained sensing How can we program this system? • Programming tools focused on efficiency
• Easy deployment, no infrastructure required Query 1: determine
ambient temperature • Low-level, C-based programming language (nesC)
• Enable new class of applications uQuery Engine and wind conditions
• Lightweight, component-based OS (TinyOS)
• Supports real-time programming, sensing, concurrency
Query 2: Detect and
Challenges: locate deer moving • Applications are compiled together with the OS
through the region
• Resource constraints (memory, bandwidth, energy)
• Large-scale coordination Response to Query Macroprogramming WSNs
1: temp=65ºF
• Combine the problems of networking, signal wind: SE, 3mph event • Regiment, Semantic Streams, spreadsheet programming
processing, real-time and embedded computing • Do not meet requirements for uQuery Engines

Response to Query
Requirements for uQuery Engines 2: Deer at (10,35)
moving NW at 5mph
• Targeted at end-users, not programmers Adapted from: [Boulis, 2005]
• Dynamic: deploy and change behavior at run-time
• Support concurrency inherent to ambient systems Connecting together a large number of small computers with
• Multiplicity of end-users sensing and actuating capabilities, to collectively and cost-
effectively solve problems, based on real-time data.
Application Example: Break Beam Detector
We want to detect an object passing through a break beam sensor, on Note the following issues with the code below.
request: • Static:
• Wait for a request message from the user • Specification and linking of components at compile time
• Perform the requested action • All components are compiled into a single image deployed on the sensor
• Execute detectBeamEvent() primitive • Low-level:
• Keep checking the sensor until a change in status is detected • Programmer is responsible for managing: timing, communication,
• Send the result of detection back to the user Mica2-Dot and Telos motes
memory management, error handling
http://research.sun.com/ • No separation of concerns:
The user (programmer) is responsible for choosing the right OS and • OS and network programming elements are inextricably linked with
network components, and assembling them along with the specific business logic programming elements
application logic into an executable program.
// Communication: receive requests for execution and send results
/* Detect break beam event application (code excerpt) */ void sendPacket(uint8_t *buf, uint8_t n)
configuration Example {} __attribute__((C,spontaneous)) {
implementation { memcpy(msgbuf.data, buf, n);
// list of application components msglen = n;
components Main, ExampleM, LedsC, GenericComm, TimerC, if (call SendMsg.send(TOS_BCAST_ADDR, msglen, &msgbuf)
Photo, CC1000ControlM; == SUCCESS)
// statically link all components sendPending = 1;
Main.StdControl -> GenericComm; }
Main.StdControl -> TimerC; uint8_t isSendPending() __attribute__((C,spontaneous)) {
Main.StdControl -> Photo; return sendPending;
Main.StdControl -> ExampleM; }
ExampleM.SendMsg -> GenericComm.SendMsg[10]; event result_t SendMsg.sendDone(TOS_MsgPtr mp, result_t success) {
ExampleM.ReceiveMsg -> GenericComm.ReceiveMsg[10]; if (!success) call Timer.start(TIMER_ONE_SHOT, 200);
ExampleM.CC1000Control -> CC1000ControlM; else {
ExampleM.Timer -> TimerC.Timer[unique("Timer")]; call Leds.redToggle(); sendPending = 0;
ExampleM.Leds -> LedsC; }
ExampleM.PADC-> Photo; return SUCCESS;
} }
event TOS_MsgPtr ReceiveMsg.receive(TOS_MsgPtr mp) {
module ExampleM { TOS_Msg m;
/* … */ call Leds.greenToggle();
} if ((uint8_t)mp->data[0] == 20) {
implementation { m.data = deref(detectShadow());
TOS_Msg msgbuf; sendPacket((uint8_t *)m.data, strlen(m.data));
uint8_t msglen, sendPending; }
volatile uint8_t ioPending; return mp;
uint16_t ioData; }
event result_t Timer.fired() {
/* … */ return call SendMsg.send(TOS_BCAST_ADDR, msglen, &msgbuf);
}
// primitive function #20: detect beam event (using photo sensor)
uint16_t detectBeamEvent(); /* … */
// I/O: convert split phase non-blocking I/O to blocking I/O // Implementation of detectBeamEvent primitive
uint16_t IO(uint16_t a, uint16_t b) __attribute__((C,spontaneous)) { uint16_t detectBeamEvent() {
while (ioPending) yield(); int i;
if (a == 20) { call PADC.getData(); ioPending=1; } uint16_t data, avg = 0;
while (ioPending) yield(); ledSet(0);
return ioData; for (i = 0; i < 10; i++)
} avg += IO(2, 0);
async event result_t PADC.dataReady(uint16_t data) { avg /= 10;
ioPending=0; ioData=data; while ((data = IO(2, 0)) > avg - 15) yield();
return SUCCESS; ledSet(7);
} return list(2, newWord(20), newWord(data));
}
}
Ambiance: Adaptive Object Model-based
Platform for Macroprogramming Sensor Networks

Standard AOM Architecture


AOM is a meta-data interpreter Meta-data interpreter Open Issues with AOMs
Read access

Meta-data corresponds to data that specifies the • Have not been applied to WSNs
Programs’:
OO Language Object meta-data repository
Adaptive • Lack of standard techniques for
Domain entity types service
• Object-model (Structure and Behavior) Rules • WSN dynamic code generation
Properties provision
• Windows, Menus, Configuration Panel, … Programmer Agent Associations • Supporting concurrency
Events
• Saved as configuration data • Supporting separation of high-level control
Write access from the execution
Expert Beam Event
Detector • Run-time optimization

Extended AOM Architecture for Macroprogramming WSNs

Knowledge level Step


Step Fetch Operational level
• Comprises: Load • Comprises a set of mobile agents
Code
• Conceptual ontology • The agents:
• Behavioral ontology Knowledge level • Are defined dynamically
• Framework for specifying queries as a composition Adapt
Adapt • Execute concurrently
of services through mediation of concepts • within the WSN, and
Adaptation cycle
• Assumptions: • on a single node
• Completeness of the service ontology Active object • Based on a formal model of
• Acknowledgeability of the users in the domain Intercession computation
Passive object
covered by the ontologies Introspection • In order to be verifiable
• Low-level data, such as the sensor id, may be • Actors
provided by users (in the process of being relaxed)
Operational level
• Keeps track of static and dynamic metadata.

Dynamically-composed
uQuery (ambient service)

Query Interpretation and Execution

Dart: Query Representation Framework Query Representation Example

Structure of queries 1

2
Behavior
0..* -dependents • Finite directed acyclic graph 3 13

Behavior 1 Process Conscious Product Context • Recursive Histogram Entry Collection

For a Period of <2 weeks> Do <T1>


Histogram

Plot Histogram
1 1
* 1 0..1 -holds • Steps may hierarchically point to tasks
-content Main Task
-organization 0..*
Task Step • Reflective 4

1..1 * 1..1
0..* 0..* • Same set of concepts reused to extend the system 5

Vehicle
12

Histogram Entry
Structure
Procedure Do <T2> Create Histogram Entry Step
1 0..1
-holds 0..1 Conceptual Ontology 0..* -computation method

Grid List
0..1
Ontology Concept 1..1
-contributes Construct 0..*
Semantics of queries 6
T1: Compute Histogram Entry

-type
0..1 -instantiates • Parallel evaluation of contributions 9 10 11

Primitive
1..1
Control Structure
• Limited to their dependencies Pulse Pair 3 Mobile Object Vehicle
Concept
Average Pulse Pairs Estimate Motion Classify Vehicle
0..* 0..* Contract

Result Argument
-spec
ActorNet Primitive • Different execution semantics Construct
8 8

-requires 0..*
-policy 0..1
* 1
• Same set of concepts reused to extend the system Pulse Pair 1 Pulse Pair 2
-produces 0..1

Behavioral Ontology
Execution Strategy Association • Late Sort Edges Sort Edges

Generalization
Contributes
Signature Aggregation • value binding
1..1 1 *
7 7 7
Relation
• method binding Pulse 1 Pulse 2 Pulse 3

Detect Beam Event Detect Beam Event Detect Beam Event

The Core Design of Dart: A Reusable and Extendible T2: Identify Vehicle

(Global) Behavior Representation Framework Liz’s query

Liz’s Query: compute histogram of vehicle


arrival times for a period of two weeks
Source: [Whitehouse, Liu, Zhao 2006]
Collaborators:
Christoph Dony
Noury Bouraqadi Université Montpellier-II
Computer Science Research Team. LIRMM, France
Ecole des Mines de Douai Ralph Johnson,
Software Architecture
Group
University of Illinois at
Urbana-Champaign
BioMedical Informatics Vincent Ginot
ERCIM Working Group Mobidyc Project
Alain Cardon
French National Institute for Agricultural Research
Université Pierre et Marie Curie

ActorNet: Implementation of the Operational Level Primitive Processing Algorithm

At the operational level, queries are executed by ActorNet


2
• A system of mobile, concurrently executing agents called actors Actor id

• Actor code is dynamically generated by the meta-level


• ActorNet language is extended with new keywords and services providing the
means to link the meta-level and the operational level of the Ambiance platform 1
Meta Actor Actor in text form Actor Deployment Interface

Wakeup + multithreaded server providing socket


reception connections for concurrently deploying and
executing actors

3 Output object

Registration + sleep

Actor id Messaging Interface

ActorNet platforms are deployed on sensor nodes or PCs


• Provide resource management, scheduling, communication, migration, sensing
and actuation, etc., for actors. ActorNet Agent code for a call to the Detect Beam Primitive
( (lambda (migrate)
; actor behavior
(seq
; migrate to destination (node 200, meta-actor id 111)
(migrate 200 111)
Break Beam Detector Example
; migrate to source (node 100) and report result
For the break beam detector, the meta-level will generate the code for an (par (extmsg 111 (migrate 100
; perform application logic:
actor of the Detect Beam step. ; detectBeamEvent() primitive (#20)
• An ActorNet agent template is provided by the execution strategy ; which takes no arguments (nil)
(prim 20 nil)
• The Detect Beam meta-actor computes and fills in: )))
• the destination sensor id (for migration) ))

• meta-actor id (for communication) ; migrate subroutine


• the primitive to be executed (for application-specific functionality) (lambda (adrs val)
(callcc (lambda (cc)
• the arguments to the primitive (for control) (send (list adrs cc (list quote val)))))
)
)

How does Ambiance satisfy the requirements of uQuery Engines?


The Ambiance platform supports:
• Using a WSN to serve concurrent users By extending the AOM model to mobile agent Separation of business logic primitives from
computing
the core of the mobile agent system,
• Dynamic, end-user-driven service specification Query 1: determine
facilitates addition of new domain-specific
ambient temperature
• Complex queries, comprising sensing and actuation and wind conditions
primitives
While meeting WSN constraints:
Query 2: Detect and
• Embedded, concurrent, distributed computing locate deer moving Hooks are provided for quality attributes,
through the region
• On highly resource-limited hardware components such as:
Response to Query
• Work with a dynamic set of sensing resources 1: temp=65ºF
• Security: automated supervision for security
wind: SE, 3mph event checks
The two-level approach to architecting • Auditability: who has been involved in what
uQuery Engines allows separating: • Non-repudiability: who has initiated which
• query representation and reasoning concerns, Response to Query action
2: Deer at (10,35)
from moving NW at 5mph
Adapted from: [Boulis, 2005]
• those of their effective execution on divers Reusability and extendibility of:
runtime platforms • The Ambiance Platform
• through model-to-code transformation. • Its query representation framework
Using a mobile agent system as the query
execution environment provides:
• dynamicity and concurrency of
macroprogramming, while enabling Web-based uQuery Engine User Interface
• load balancing and other optimizations Uses: Seaside framework (http://www.seaside.st/)
required by the WSN environment and Squeak (http://www.squeak.org/)

Вам также может понравиться