CrimeSPOT: Language Support for Programming Interactions among Wireless Sensor Network Nodes
Upcoming SlideShare
Loading in...5

CrimeSPOT: Language Support for Programming Interactions among Wireless Sensor Network Nodes



Presentation at UCAmI2011.

Presentation at UCAmI2011.



Total Views
Views on SlideShare
Embed Views



4 Embeds 161 85 73 2 1



Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

CrimeSPOT: Language Support for Programming Interactions among Wireless Sensor Network Nodes CrimeSPOT: Language Support for Programming Interactions among Wireless Sensor Network Nodes Presentation Transcript

  • Coen De Roover Christophe Scholliers Wouter AmerijckxSoftware Languages Lab, Brussels Theo D’Hondt Wolfgang De MeuterCrimeSPOT: Language Support forProgramming Interactions amongWireless Sensor Network Nodes
  • Context... active WSN applications event handlers enabled by event-driven middleware composed cannot be task nodes with sensing & reacting routes events over a decentralized event bus invokes event handler of individual nodes dispatching, storing, matching specific to WSN applications error-prone and lead to ad-hoc solutions are events carry sensor readings code duplication expiration, subsumption specific to active WSN applications reactions might no longer be warranted compensation
  • Motivating Example... problems associated with event-based programming Tent C Tent B Tent A Component: subscribed to single event TemperatureSensor Component: HumiditySensor Component: receiveEvent(Event e) { online HeatingController // invoke application logic online // publish new event humidityReading temperatureReading online } adjustHeating difficult to compose event handlers Decentralized Event Bus online adjustHeating humidityReading subscribed to multiple events temperatureReading dispatch over received events Component: store received events ComfortLevelMonitor relate new and stored events through matching
  • Motivating Example... problems inherent to active WSN applications Tent C Tent B Tent A Component: compensate reactions Component: TemperatureSensor HumiditySensor Component: if no longer warranted HeatingController online online temperatureReading online humidityReading adjustHeating events carry sensor readings Decentralized Event Bus online readings expire at different rates humidityReading adjustHeating readings subsume previous readings temperatureReading application-specific! Component: ComfortLevelMonitor e.g., a new reading subsumes older from same tent
  • CrimeSPOT in a Nutshell... a domain-specific language for programming activeWSN applications on top of event-based middleware minimize accidental complexity so developers can focus on essential complexity node-centric perspective CrimeSPOT specify interactions declaratively through rules network-centric perspective specify which rules govern which nodes reuse rules within and among WSN apps tailored towards active WSN applications readings: polling intervals, expiration, subsumption reactions: tracked so that they can be compensated
  • The CrimeSPOT runtime... architectural overview Node-specific Application Logic CrimeSPOT runtime inference engine Inference Layer Fact Inference Rule evaluates rules against facts Base Engine Base Reification Layer reification engine Reification Configuration Engine Base reifies events as facts Infrastructure Layer Middleware Bridge Middleware Bridge middleware bridge Event-based Middleware WSN Node
  • Problem: composability of event handlers... overcome through interaction rules fact in fact base: FUNCTOR(ATTRIBUTES)@[METADATA] requestForTemperature()@[from(MAC=1234:1234:1234:1234), factExpires(Seconds=600)] rules in rule base: HEAD ← BODY temperatureReading(Celcius=?c)@[to(MAC=?mac)] ← requestForTemperature()@[from(MAC=?mac)], ?c is this.getTemperature() humidityReading(Percent=?p)@[to(MAC=*),factExpires(Seconds=600)] ← ?p is this.getHumidity()@[renewEvery(Seconds = 600)]
  • Problem: events readings in WSN apps... overcome through configurable reification engine control effect of event on fact base e.g., a new humidity reading subsumes older from same tent incoming humidityReading(Percent=?new)@[from(MAC=?mac)] subsumes humidityReading(Percent=?old)@[from(MAC=?othermac)] provided online(Tent=?tent)@[from(MAC=?mac)], online(Tent=?tent)@[from(MAC=?othermac)]
  • Problem: unwarranted reactions in active WSN apps... overcome by distributed causality tracking which conclusions no longer hold when a fact is removed from the fact base? this.adjustHeater ← adjustHeating(Level=?h) class HeatingController private CSAction adjustHeater = new CSAction() { public void activated(CSVariableBindings bindings) { //adjust heating } public void deactivate(CSVariableBindings bindings) { //reset heating } }; }
  • Problem: no view of application as a whole... overcome through quantified code blocks control which code governs which node e.g., tent-related code shared by all nodes *{ online(Tent=?tnt)@[to(MAC=*),factExpires(Seconds=3600)] ← ?tnt is this.getTentBasedOnGPSReading()@[renewEvery(Seconds=3600)]. } *.java { private CSValue getTentBasedOnGPSReading() { return ... } }
  • Problem: reusing code within and among WSN apps... overcome through macro definition and applicationComfortLevelMonitor { subsumesOlderFromSameTent(humidityReading,Percent). subsumesOlderFromSameTent(temperatureReading,Celsius).} * { defmacro subsumesOlderFromSameTent($reading,$type): incoming $reading($type =?new)@[from(MAC=?mac)] subsumes $reading($type =?old)@[from(MAC=?othermac)] provided online(Tent=?tent)@[from(MAC=?mac)], online(Tent=?tent)@[from(MAC=?othermac)] }
  • Motivating Example Revisited... lines of CrimeSPOT code for the entire WSN Application +-55
  • Motivating Example Revisited... TemperatureSensor, HumiditySensor, HeatingController22. HeatingController  {23.        incoming  adjustHeating(Level=?new)  subsumes  adjustHeating(Level=?old).24.            25.        this.adjustHeater26.            <-­‐  adjustHeating(Level=?h).27. }28.  29.  {30.    private  CSAction  adjustHeater  =  new  CSAction()  {31.          public  void  activated(CSVariableBindings  bindings)  {  //adjust  heating  }32.          public  void  deactivate(CSVariableBindings  bindings)  {  //reset  heating  }33.    };    34. } 4. TemperatureSensor  { 5.        temperatureReading(Celsius=?temp)@[to(MAC=*), 6.                                                                              factExpires($readingInterval)]   7.            <-­‐  ?temp  is  this.getTemperature()@[renewEvery($readingInterval)]. 8.  } 9.   10.  { 11.        private  CSValue  getTemperature()  {  return  ...  } 12.  } 1. TemperatureSensor,  HumiditySensor,  HeatingController  { 2.        publishPresenceEvery($onlineInterval). 3. }
  • Evaluation... using CrimeSPOT on top of LooCI on SunSPOT motes +-55 lines of code for motivating example LooCI event-based middleware: component deployment, wiring event routing, service discovery CrimeSPOT: event dispatching, storage, matching expiration, subsumption, causality, exceptions validated expressiveness using several representative WSN applications temperature monitoring, fire detection, flood monitoring, range coverage very concise implementations overhead ∆ROM: +460kB ∆RAM: 3kB / fact, 30kB / worst-case rule with 6 conditions latency: 80ms (fact assertion), 140ms (rule activation assertion) reasonable price to pay for software engineering benefits
  • Conclusions... and future workdomain-specific language for programming active WSN appsminimizes accidental complexity so developer can focus on essential complexity node-centric: declarative rules specify interactions network-centric: which rules govern which components domain-specific: specify handling of events that carry sensor readings specify compensations for reactionsfuture work offer developers fine-grained control over causality tracking, rule activation precedence, .. support n-hop neighborhoods, have a fact change at each hop analyze node interactions w.r.t. network and memory usage explicit in CrimeSPOT code: expirations, intervals