Context-Oriented Adaptation in
Cyber-Physical Systems
Mikhail Afanasov*, Luca Mottola*† and Carlo Ghezzi*
*Politecnico di Milano (Italy), †SICS Swedish ICT
CPS Platforms
Problem
• CPSs are intimately tied to the real world
– Multiple environment dimensions at hand
– Continuously changing environment
• The software must adapt
• Missing design and
programming support
Example: Wildlife Tracking
Problem
module ReportLogs{
uses interface Collection;
uses interface DataStore;
}
implementation {
int base_station_reachable = 0;
event msg_t Beacon.receive(msg_t msg) {
if (!acceleromenter_detects_activity())
return;
if (call Battery.energy() <= THRESHOLD)
return;
base_station_reachable = 1;
call GPS.stop()
call BaseStationReset.stop();
call BaseStationReset.startOneShot(TIMEOUT);
}
event void BaseStationReset.fired() {
base_station_reachable = 0;
}
event void ReportPeriod.fired() {
switch (base_station_reachable){
case 0:
call DataStore.deposit(msg);
case 1:
call Collection.send(msg);}
}
}
Solution
• Context
• Context-Oriented Programming (COP)
• Language-independent design concepts
• Programming support
Solution
context Unreachable {
uses interface DataStore;
} implementation {
layered command void report(msg_t msg){
call DataStore.deposit(msg);}
}
context group BaseStationG {
layered command void report(msg_t msg);
} implementation {
contexts Reachable,
Unreachable is default,
MyErrorC is error;
components Routing, Logging;
Reachable.Collection -> Routing;
Unreachable.DataStore -> Logging;
}
context Reachable {
uses interface Collection;
} implementation {
layered command void report(msg_t msg){
call Collection.send(msg);}
}
Functionality are
decoupled;
implementations are
individually simpler
Context-oriented Programming
• Layered functions change the behavior depending
on the context
Context-oriented Programming
Java
Python
Erlang
Lisp
Objective-C
• Layered functions change the behavior depending
on the context
Design Concepts
• Context represents a single environmental
situation
• Context group as collection of environmental
situations sharing the same characteristics
Context group
Context Context
Patterns: Behavior control
Provides a context-
dependent functionality
send(Msg* msg)
Grevecom
https://github.com/muxanasov/Grevecom
Grevecom: Model Verification
Editor
Source-code
Translator
Binary
Model
Model-checker
Verification: Initial Model
• Simple transition: S0={…, …, …, i, …} -> S1={…, …, …, j, …}
• Dependency: S0={…, n, … , i, …} -> S1={…, n, … , j, …}
Grevecom: Source-Code Generation
Editor
Source-code
Translator
Binary
Model
Model-checker
ConesC
• Context-Oriented extension of nesC
• Enable layered functions (commands) in nesC
• Redefine component and configuration
Core features:
• Define context group
• Layered function
• Implementation variations in contexts
https://github.com/muxanasov/ConesC
Evaluation: Coupling
W. Stevens et al. Classics in software engineering. Chapter Structured Design. 1979.
Strongest Weakest
Evaluation: Complexity
Evaluation: Run-time Overhead
0
5
10
15
20
25
30
Wildlife tracking Adaptive stack Smart-home
MCUcycles
Context transition overhead
Function call overhead
MCU Overhead
Memory Overhead
0
0.5
1
1.5
2
2.5
3
Wildlife tracking Adaptive stack Smart-home
%
Binary overhead
RAM overhead
Turning an LED on is
8 MCU cycles Max 2.5%!
Conclusions and Ongoing Work
• Context as a CPS programming concept:
– Language independent design
– Programming support: ConesC, IDE, Model-checker
• Key results:
– Easier to maintain and to understand
– Verification against environment evolutions
– Negligible performance overhead
• Current work:
– Extending on micro & nano aerial drones
Other Activities @POLIMI
• Programming Systems for Coordinating Drones
• Example:
– L. Mottola et al. “Team-level
programming of drone sensor
networks”, in ACM SENSYS 2014
– Real-deployment for aerial
photogrammetry in
archaeological sites
(Aquileia, Italy)
– Currently being extended to
indoor scenarios for tiny devices
“Domus
dei putti
danzanti”
youtu.be/PPDGO-jc0It
Other Activities @POLIMI
• Integration and
remote control
– Mission-level
service-oriented
interfaces (REST)
– Remote-control service
oriented interfaces (CoAP)
• Flight control loops
– Reactive programming techniques
– Testing and verification
Questions?
0
5
10
15
20
25
30
Wildlife tracking Adaptive stack Smart-home
MCUcycles
Context transition overhead
Function call overhead

More Related Content

PDF
Federated HPC Clouds applied to Radiation Therapy
PDF
Low Energy Task Scheduling based on Work Stealing
PPTX
C-SAW: A Framework for Graph Sampling and Random Walk on GPUs
PDF
Towards Exascale Simulations for Regional-Scale Earthquake Hazard and Risk
PDF
Parallelization Strategies for Implementing Nbody Codes on Multicore Architec...
PPTX
Artificial Neural Networks for Storm Surge Prediction in North Carolina
PDF
Create a Thermal Camera With Python On a Raspberry Pi
PDF
The world is the computer and the programmer is you
Federated HPC Clouds applied to Radiation Therapy
Low Energy Task Scheduling based on Work Stealing
C-SAW: A Framework for Graph Sampling and Random Walk on GPUs
Towards Exascale Simulations for Regional-Scale Earthquake Hazard and Risk
Parallelization Strategies for Implementing Nbody Codes on Multicore Architec...
Artificial Neural Networks for Storm Surge Prediction in North Carolina
Create a Thermal Camera With Python On a Raspberry Pi
The world is the computer and the programmer is you

What's hot (20)

PDF
Pysense: wireless sensor computing in Python?
PDF
resume-XinyuSui
PDF
Automatic Features Generation And Model Training On Spark: A Bayesian Approach
ODP
EGU 2012 ESSI: The FOSS GIS Workbench on the GFZ Load Sharing Facility compu...
PPTX
Brief Overview of a Parallel Nbody Code
PPTX
A Highly Parallel Semi-Dataflow FPGA Architecture for Large-Scale N-Body Simu...
PDF
Updates on the Fake Object Pipeline for HSC Survey
PPTX
20161025 OpenStack at CERN Barcelona
PDF
AES encryption on modern consumer architectures
PPT
3 2--power-aware-cloud
PDF
HPC in the Cloud
PDF
cloud_futures_2.0_Papazachos
PDF
State of the art time-series analysis with deep learning by Javier Ordóñez at...
PDF
Acceleration of the Longwave Rapid Radiative Transfer Module using GPGPU
PDF
Programming Existing Quantum Computers
PDF
Reading: "Pi in the sky: Calculating a record-breaking 31.4 trillion digits o...
PDF
Progress_report_KUSP2016_Ngo-Sy-Toan
PDF
cnsm2011_slide
PPT
Centrifuge Demonstration Project
PPTX
Storm: a distributed ,fault tolerant ,real time computation
Pysense: wireless sensor computing in Python?
resume-XinyuSui
Automatic Features Generation And Model Training On Spark: A Bayesian Approach
EGU 2012 ESSI: The FOSS GIS Workbench on the GFZ Load Sharing Facility compu...
Brief Overview of a Parallel Nbody Code
A Highly Parallel Semi-Dataflow FPGA Architecture for Large-Scale N-Body Simu...
Updates on the Fake Object Pipeline for HSC Survey
20161025 OpenStack at CERN Barcelona
AES encryption on modern consumer architectures
3 2--power-aware-cloud
HPC in the Cloud
cloud_futures_2.0_Papazachos
State of the art time-series analysis with deep learning by Javier Ordóñez at...
Acceleration of the Longwave Rapid Radiative Transfer Module using GPGPU
Programming Existing Quantum Computers
Reading: "Pi in the sky: Calculating a record-breaking 31.4 trillion digits o...
Progress_report_KUSP2016_Ngo-Sy-Toan
cnsm2011_slide
Centrifuge Demonstration Project
Storm: a distributed ,fault tolerant ,real time computation
Ad

Similar to Afanasov14flynet slides (20)

PPTX
Programmable Exascale Supercomputer
PDF
AIST Super Green Cloud: lessons learned from the operation and the performanc...
PPT
Embedded Intro India05
PPTX
Exascale Capabl
PDF
The CAOS framework: democratize the acceleration of compute intensive applica...
PDF
Monitoring Cassandra at Scale (Jason Cacciatore, Netflix) | C* Summit 2016
PDF
Mathematics and development of fast TLS handshakes
PDF
Exploring the Performance Impact of Virtualization on an HPC Cloud
PPT
IS-ENES COMP Superscalar tutorial
PDF
Direct Code Execution - LinuxCon Japan 2014
PDF
Netflix at-disney-09-26-2014
PDF
Intelligent Monitoring
PDF
Static Energy Prediction in Software: A Worst-Case Scenario Approach
PDF
Nesc tutorial
PDF
High Performance & High Throughput Computing - EUDAT Summer School (Giuseppe ...
PDF
Natural Language Processing with CNTK and Apache Spark with Ali Zaidi
PPTX
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...
PDF
Direct Code Execution @ CoNEXT 2013
PDF
NVIDIA HPC ソフトウエア斜め読み
PPT
Overview Of Parallel Development - Ericnel
Programmable Exascale Supercomputer
AIST Super Green Cloud: lessons learned from the operation and the performanc...
Embedded Intro India05
Exascale Capabl
The CAOS framework: democratize the acceleration of compute intensive applica...
Monitoring Cassandra at Scale (Jason Cacciatore, Netflix) | C* Summit 2016
Mathematics and development of fast TLS handshakes
Exploring the Performance Impact of Virtualization on an HPC Cloud
IS-ENES COMP Superscalar tutorial
Direct Code Execution - LinuxCon Japan 2014
Netflix at-disney-09-26-2014
Intelligent Monitoring
Static Energy Prediction in Software: A Worst-Case Scenario Approach
Nesc tutorial
High Performance & High Throughput Computing - EUDAT Summer School (Giuseppe ...
Natural Language Processing with CNTK and Apache Spark with Ali Zaidi
Exploring the Final Frontier of Data Center Orchestration: Network Elements -...
Direct Code Execution @ CoNEXT 2013
NVIDIA HPC ソフトウエア斜め読み
Overview Of Parallel Development - Ericnel
Ad

Recently uploaded (20)

PPTX
Kompem Part Untuk MK Komunikasi Pembangunan 5.pptx
PDF
Presentation on cloud computing and ppt..
PDF
Unnecessary information is required for the
PDF
6.-propertise of noble gases, uses and isolation in noble gases
PDF
COLEAD A2F approach and Theory of Change
PPTX
2025-08-17 Joseph 03 (shared slides).pptx
PPTX
FINAL TEST 3C_OCTAVIA RAMADHANI SANTOSO-1.pptx
PPTX
power point presentation ofDracena species.pptx
PPTX
Unit 8#Concept of teaching and learning.pptx
PPTX
NORMAN_RESEARCH_PRESENTATION.in education
PDF
_Nature and dynamics of communities and community development .pdf
PDF
Public speaking for kids in India - LearnifyU
PPTX
3RD-Q 2022_EMPLOYEE RELATION - Copy.pptx
PDF
Yusen Logistics Group Sustainability Report 2024.pdf
PDF
MODULE 3 BASIC SECURITY DUTIES AND ROLES.pdf
PPT
Lessons from Presentation Zen_ how to craft your story visually
PPTX
Literatura en Star Wars (Legends y Canon)
DOC
EVC毕业证学历认证,北密歇根大学毕业证留学硕士毕业证
PPTX
Phylogeny and disease transmission of Dipteran Fly (ppt).pptx
PPTX
Research Process - Research Methods course
Kompem Part Untuk MK Komunikasi Pembangunan 5.pptx
Presentation on cloud computing and ppt..
Unnecessary information is required for the
6.-propertise of noble gases, uses and isolation in noble gases
COLEAD A2F approach and Theory of Change
2025-08-17 Joseph 03 (shared slides).pptx
FINAL TEST 3C_OCTAVIA RAMADHANI SANTOSO-1.pptx
power point presentation ofDracena species.pptx
Unit 8#Concept of teaching and learning.pptx
NORMAN_RESEARCH_PRESENTATION.in education
_Nature and dynamics of communities and community development .pdf
Public speaking for kids in India - LearnifyU
3RD-Q 2022_EMPLOYEE RELATION - Copy.pptx
Yusen Logistics Group Sustainability Report 2024.pdf
MODULE 3 BASIC SECURITY DUTIES AND ROLES.pdf
Lessons from Presentation Zen_ how to craft your story visually
Literatura en Star Wars (Legends y Canon)
EVC毕业证学历认证,北密歇根大学毕业证留学硕士毕业证
Phylogeny and disease transmission of Dipteran Fly (ppt).pptx
Research Process - Research Methods course

Afanasov14flynet slides

Editor's Notes

  • #3: Mobile or not, battery level
  • #4: Mobile or not, battery level
  • #5: Atteched to collars of animals, what makes them mobile as drones. They are buttery operated as well, and, with respect to drones, situations are changed even fastly then in this example.
  • #6: nesC is component-based language, endeed, but there are too much dimentions, changing independently and the functionaluty is relies on these dimentions
  • #9: Enable it on the r-c platforms, limited multythreading and no memory protection… as in high langs
  • #11: We claim that our design concepts inspired by COP can significantly simplify the software developing process for WSN. It is worth noticing, that these concepts are language independent and can be implemented in any of them.
  • #20: Layered function call
  • #22: The team-level programming model provides a middle ground between programming individual devices and swarm programming, enabling the specification of coordinated actions based on global states (unlike swarm programming), but still without resorting to individual addressing (like when programming individual devices)
  • #23: We built abstractions and prototypes allowing the integration of aerail drones into larger processes, also using graphical interfaces. The picture shows an example of a composition of individual processing blocks that instruct the drone to take pictures in a given area and then post-process the pictures looking for a certain pattern as well as uploading them on Flickr.