SlideShare uma empresa Scribd logo
1 de 15
Baixar para ler offline
Coen De Roover                     Christophe Scholliers
                                     Wouter Amerijckx
Software Languages Lab, Brussels          Theo D’Hondt
                                   Wolfgang De Meuter




CrimeSPOT: Language Support for
Programming Interactions among
Wireless 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 active
WSN 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 application



ComfortLevelMonitor {
  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, HeatingController
22.   HeatingController	
  {
23.   	
  	
  	
  	
  incoming	
  adjustHeating(Level=?new)	
  subsumes	
  adjustHeating(Level=?old).
24.   	
   	
   	
   	
   	
   	
  
25.   	
  	
  	
  	
  this.adjustHeater
26.   	
  	
  	
  	
  	
  	
  <-­‐	
  adjustHeating(Level=?h).
27.   }
28.   	
  
29.   HeatingController.java	
  {
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.   	
  TemperatureSensor.java	
  {
                   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 work
domain-specific language for programming active WSN apps
minimizes 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 reactions

future 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

Mais conteúdo relacionado

Mais de Coen De Roover

A Recommender System for Refining Ekeko/X Transformation
A Recommender System for Refining Ekeko/X TransformationA Recommender System for Refining Ekeko/X Transformation
A Recommender System for Refining Ekeko/X TransformationCoen De Roover
 
A recommender system for generalizing and refining code templates
A recommender system for generalizing and refining code templatesA recommender system for generalizing and refining code templates
A recommender system for generalizing and refining code templatesCoen De Roover
 
Applicative Logic Meta-Programming as the foundation for Template-based Progr...
Applicative Logic Meta-Programming as the foundation for Template-based Progr...Applicative Logic Meta-Programming as the foundation for Template-based Progr...
Applicative Logic Meta-Programming as the foundation for Template-based Progr...Coen De Roover
 
A logic foundation for template-based program transformation in Eclipse
A logic foundation for template-based program transformation in EclipseA logic foundation for template-based program transformation in Eclipse
A logic foundation for template-based program transformation in EclipseCoen De Roover
 
The Cha-Q Meta-Model: A Comprehensive, Change-Centric Software Representation
The Cha-Q Meta-Model: A Comprehensive, Change-Centric Software RepresentationThe Cha-Q Meta-Model: A Comprehensive, Change-Centric Software Representation
The Cha-Q Meta-Model: A Comprehensive, Change-Centric Software RepresentationCoen De Roover
 
Detecting aspect-specific code smells using Ekeko for AspectJ
Detecting aspect-specific code smells using Ekeko for AspectJDetecting aspect-specific code smells using Ekeko for AspectJ
Detecting aspect-specific code smells using Ekeko for AspectJCoen De Roover
 
UbiLab@SOFT: A tale of ubiquitous bears, flyswatters 
and punching bags in ed...
UbiLab@SOFT: A tale of ubiquitous bears, flyswatters 
and punching bags in ed...UbiLab@SOFT: A tale of ubiquitous bears, flyswatters 
and punching bags in ed...
UbiLab@SOFT: A tale of ubiquitous bears, flyswatters 
and punching bags in ed...Coen De Roover
 
Logic-based program transformation in symbiosis with Eclipse
Logic-based program transformation in symbiosis with EclipseLogic-based program transformation in symbiosis with Eclipse
Logic-based program transformation in symbiosis with EclipseCoen De Roover
 

Mais de Coen De Roover (8)

A Recommender System for Refining Ekeko/X Transformation
A Recommender System for Refining Ekeko/X TransformationA Recommender System for Refining Ekeko/X Transformation
A Recommender System for Refining Ekeko/X Transformation
 
A recommender system for generalizing and refining code templates
A recommender system for generalizing and refining code templatesA recommender system for generalizing and refining code templates
A recommender system for generalizing and refining code templates
 
Applicative Logic Meta-Programming as the foundation for Template-based Progr...
Applicative Logic Meta-Programming as the foundation for Template-based Progr...Applicative Logic Meta-Programming as the foundation for Template-based Progr...
Applicative Logic Meta-Programming as the foundation for Template-based Progr...
 
A logic foundation for template-based program transformation in Eclipse
A logic foundation for template-based program transformation in EclipseA logic foundation for template-based program transformation in Eclipse
A logic foundation for template-based program transformation in Eclipse
 
The Cha-Q Meta-Model: A Comprehensive, Change-Centric Software Representation
The Cha-Q Meta-Model: A Comprehensive, Change-Centric Software RepresentationThe Cha-Q Meta-Model: A Comprehensive, Change-Centric Software Representation
The Cha-Q Meta-Model: A Comprehensive, Change-Centric Software Representation
 
Detecting aspect-specific code smells using Ekeko for AspectJ
Detecting aspect-specific code smells using Ekeko for AspectJDetecting aspect-specific code smells using Ekeko for AspectJ
Detecting aspect-specific code smells using Ekeko for AspectJ
 
UbiLab@SOFT: A tale of ubiquitous bears, flyswatters 
and punching bags in ed...
UbiLab@SOFT: A tale of ubiquitous bears, flyswatters 
and punching bags in ed...UbiLab@SOFT: A tale of ubiquitous bears, flyswatters 
and punching bags in ed...
UbiLab@SOFT: A tale of ubiquitous bears, flyswatters 
and punching bags in ed...
 
Logic-based program transformation in symbiosis with Eclipse
Logic-based program transformation in symbiosis with EclipseLogic-based program transformation in symbiosis with Eclipse
Logic-based program transformation in symbiosis with Eclipse
 

Último

Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 

Último (20)

Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 

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

  • 1. Coen De Roover Christophe Scholliers Wouter Amerijckx Software Languages Lab, Brussels Theo D’Hondt Wolfgang De Meuter CrimeSPOT: Language Support for Programming Interactions among Wireless Sensor Network Nodes
  • 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. 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. 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. CrimeSPOT in a Nutshell ... a domain-specific language for programming active WSN 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. 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. 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. 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. 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. 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. Problem: reusing code within and among WSN apps ... overcome through macro definition and application ComfortLevelMonitor { 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. Motivating Example Revisited ... lines of CrimeSPOT code for the entire WSN Application +-55
  • 13. Motivating Example Revisited ... TemperatureSensor, HumiditySensor, HeatingController 22. HeatingController  { 23.        incoming  adjustHeating(Level=?new)  subsumes  adjustHeating(Level=?old). 24.             25.        this.adjustHeater 26.            <-­‐  adjustHeating(Level=?h). 27. } 28.   29. HeatingController.java  { 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.  TemperatureSensor.java  { 11.        private  CSValue  getTemperature()  {  return  ...  } 12.  } 1. TemperatureSensor,  HumiditySensor,  HeatingController  { 2.        publishPresenceEvery($onlineInterval). 3. }
  • 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. Conclusions ... and future work domain-specific language for programming active WSN apps minimizes 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 reactions future 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