Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

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


Published on

Presentation at UCAmI2011.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

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

  1. 1. Coen De Roover Christophe Scholliers Wouter AmerijckxSoftware Languages Lab, Brussels Theo D’Hondt Wolfgang De MeuterCrimeSPOT: Language Support forProgramming Interactions amongWireless Sensor Network Nodes
  2. 2. 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
  3. 3. 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
  4. 4. 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
  5. 5. 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
  6. 6. 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
  7. 7. 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)]
  8. 8. 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)]
  9. 9. 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 } }; }
  10. 10. 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 ... } }
  11. 11. 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)] }
  12. 12. Motivating Example Revisited... lines of CrimeSPOT code for the entire WSN Application +-55
  13. 13. 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. }
  14. 14. 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
  15. 15. 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