SlideShare ist ein Scribd-Unternehmen logo
1 von 15
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Jeffrey Haguewood
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialJoão Esperancinha
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFMichael Gough
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...amber724300
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...BookNet Canada
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Accelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with PlatformlessAccelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with PlatformlessWSO2
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 

Kürzlich hochgeladen (20)

Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorial
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDF
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Accelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with PlatformlessAccelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with Platformless
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 

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